gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > How Different is DS development from GBA?

#173773 - brave_orakio - Fri Apr 30, 2010 4:24 am

I was going through no$cash GBA and DS specs and while I've known for a while that a lot of the registers, OAM, palette, BG are almost the same, there seems to be some hardware bugs that a DS developer needs to be aware of.

So how different is it? Also should one think of the ARM7 core as a dedicated soundchip or does nintendo allow its use for executing gamecode now? Not sure if the bugs that exist in ARM9 core are also "available" in the ARM7 core.
_________________
help me

#173775 - Ruben - Fri Apr 30, 2010 5:51 am

Well, on the GBA you have to handle all sound mixing, graphics processing, game code, etc. on the only CPU available for GBA. On the DS, though, You have the ARM7 dedicated to handling WiFi, sound, etc. while the ARM9 handles game code, graphics, etc.

The only downsides I see are about TCM [which is why I don't use it xP] reading old memory, etc. Apart from that, I don't see any downsides. However, you have to keep in mind the different LCD registers.

Quote:
Also should one think of the ARM7 core as a dedicated soundchip or does nintendo allow its use for executing gamecode now?

Well, the official dev kit doesn't even HAVE the means of writing ARM7 code and is therefore dedicated for sound, WiFi, etc. And AFAIK, the ARM7 side doesn't have any 'bugs' since it doesn't have caching, etc.

EDIT:
Oh yeah, and VRAM access is limited to the ARM9; writes from the ARM7 won't do a thing [other than possibly give errors on no$ ;D]

EDIT 2:
Well, sort of. You can assign 32KB of VRAM to the ARM7 but that's rare

#173784 - Miked0801 - Fri Apr 30, 2010 4:43 pm

Honestly, the 3D hardware is the biggest change. Once you get a handle on it, there is little reason to use the 2D modes anymore.

#173792 - Ruben - Sat May 01, 2010 6:20 am

Hm, yeah, that's another good thing I missed. Even if your game is purely 2D based, using the 3D graphics system will let you use many things that are not very feasible with the 2D modes.

#173834 - brave_orakio - Tue May 04, 2010 1:54 am

Looks like I have a lot of studying to do on the 3d hardware. One more question: is the 3 cycle penalty that bad when executing code from WRAM or any other memory other than TCM/Cache? Or is just some small annoyance form time to time?
_________________
help me

#173839 - Dwedit - Tue May 04, 2010 3:43 am

What's executed most of the time? Loops. What are caches really good at? Loops.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#173842 - brave_orakio - Tue May 04, 2010 7:42 am

heh. Point taken.

Is putting code in TCM/Cache the same as putting code in IWRAM for GBA? Oh, and is better to use ARM code or will THUMB code be alright because I read something about code execution but couldn't understand it for now.
_________________
help me

#173843 - Ruben - Tue May 04, 2010 8:03 am

Well, putting code in ITCM [instruction TCM] will mean that it will act cached regardless of other settings [as long as it's enabled xP] and this will usually result in a VERY big speed-up, so yeah about the same as IWRAM on the GBA.

Also, I personally use ARM for the ARM9 side and THUMB for the ARM7 side, but either can be used as the ARM9 will read 32-bits at once anyway, so it's better for ARM optimized code. But if you're looking for space/speed for small routines, THUMB is the way to go. As for the ARM7, it's a LOT like IWRAM on the GBA [no caching, 3 cycles load, 1 cycles for most arithmetic, etc], so you can use either THUMB or ARM, but I use THUMB to maintain space [since you only have 64-96KB of its RAM].

#173845 - brave_orakio - Tue May 04, 2010 10:16 am

Ah I see, so the concept is the same. Hmm yes I believe that's what I read about ARM and THUMB and couldn't understand. Thanks!

Anyway as a last question, Can you guys please tell me of some games that are fully 2d(or mostly 2d) that uses the 3d-engine? I want to see some examples and finding the games shouldn't be that hard either unlike GBA games!
_________________
help me

#173846 - Ruben - Tue May 04, 2010 10:32 am

Well, Final Fantasy IV uses the 3D engine for certain 2D scenes, Mario & Luigi: Partners in Time also uses the 3D engine a bit [and the whole game is 2D], Wario: Master of Disguise also uses the 3D engine heavily and it's mainly 2D. You just have to read up on how to load matrices/textures to VRAM and send commands.

#173849 - gauauu - Tue May 04, 2010 3:24 pm

Not exactly answering the question....Advance Wars dual strike is sort-of in 3d (I had trouble telling what was in 3d and what was just 2d)...and it looks WAY worse than the other pure 2d advance wars games. It made me sad.

#173859 - Miked0801 - Tue May 04, 2010 9:25 pm

Spider Man Web of Shadows I'm pretty sure was a full 3D game mode, but was a 2D side scrolling platformer.

#173862 - brave_orakio - Wed May 05, 2010 1:53 am

Quote:
You just have to read up on how to load matrices/textures to VRAM and send commands


Yeah I was reading lots yesterday. If I understood right, polygons are done using a 4x4 matrix. To do 2d, use the image as a texture on a quadrilateral polygon(I'm only gessing on this part). And I have no direct access to the polygon/vertices RAM, I have to use/send the commands and the 3d engine will sort things out from there.

Did I get those parts right? The last part is kinda similar to the Genesis/Megadrive video processor I think, if anyone is familiar with that.

edit: What about the castlevanias? Especially Order of Ecclesia. I seem to recall seeing things there that looked impossible with the 2d engine
_________________
help me

#173863 - coreyh2 - Wed May 05, 2010 6:58 am

?Library uses 3d to do 2d. Its open source although the license is a bit restrictive. It reads a little like GPL plus non-commercial. It comes with several nice examples. I haven't learned nds 3d so I didn't get much out of it.

http://brunni.palib.info/new/index.php?page=ndssoft_ulib?Library

I'm not sure if any homebrew games were ever made with it. Support forum is in french.

Its something to look at anyway.
_________________
Deadening 2

#173867 - Exophase - Wed May 05, 2010 3:26 pm

brave_orakio wrote:
edit: What about the castlevanias? Especially Order of Ecclesia. I seem to recall seeing things there that looked impossible with the 2d engine


All of the Castlevania games use the 3D engine entirely for the gameplay screen. Contra 4 uses the 3D engine for the top screen. Some games like MMZX Advent use the 3D engine just for sprites.

The 2D engines are not useless. You need to use it in some capacity on at least one of the screens (or have no display at all). A lot of games mix 2D and 3D to good effect - see NSMB, which gets a lot of detail out of its models by making most of the screen use the 2D engine. The number of quads you can draw in a frame is pretty limited, even for some kinds of 2D.

#173868 - Miked0801 - Wed May 05, 2010 4:10 pm

Yep, but A3I5/A5I3 modes for poly texturing along with all the other effects you get with 3D make it difficult to justify tiled maps. The 2D screen is fine for simple menus and HUD overlays, but given a chance, use 3D for most everything else.

#173871 - Exophase - Wed May 05, 2010 6:07 pm

If you do a 2D game that allows moving between both screens (say, like Yoshi's Island DS) you probably will want to use both 2D engines, if only for convenience. When using the same 8x8 tiles the 3D engine can't actually draw the same amount the 2D layers can. Contra 4 had graphics that were visually similar on top and bottom but tiled completely differently, which probably wasted a lot of memory.

I somewhat agree though - I feel like Nintendo would have been much better off scrapping the main screen 2D engine and using the die space to improve the 3D engine instead. DS is the only platform I've ever heard of that has full 2D and 3D engines, even Saturn needed to use VDP1 to draw sprites. If anything this way would ease some constraints for DS emulation.

#173877 - brave_orakio - Thu May 06, 2010 2:45 am

Thanks for the suggestion of microlibrary(don't know how to write the symbol micro lol) but I kind of like to start from scratch learning this stuff.

I like to avoid libraries cause most of the time they hide a lot of stuff that I want to know about. heh.

Anyway, how do you emulate tiled BG using the 3d engine I can only guess that much like sprites, you use your tiles as textures on the polygons?

edit: Whats up with the NDS tutorial on dev-scene.com? The 3d tutorials are down?
_________________
help me

#173904 - Miked0801 - Fri May 07, 2010 6:46 pm

The reason for the full 2D support was to ease the transition from 2D to 3D on the developers, plus they already had all the 2D hardware in place for GBA backwards compatibility - might as well use it :)

#173906 - gauauu - Fri May 07, 2010 7:28 pm

I also really enjoyed having the similar 2d hardware that makes it REALLY EASY to make a gba homebrew game, then quickly port it over (or simultaneously develop/release) to run natively on the DS, taking advantage of the 2nd screen, extra buttons, etc.

#173919 - relminator - Sat May 08, 2010 3:54 am

brave_orakio wrote:
Thanks for the suggestion of microlibrary(don't know how to write the symbol micro lol) but I kind of like to start from scratch learning this stuff.

I like to avoid libraries cause most of the time they hide a lot of stuff that I want to know about. heh.

Anyway, how do you emulate tiled BG using the 3d engine I can only guess that much like sprites, you use your tiles as textures on the polygons?

edit: Whats up with the NDS tutorial on dev-scene.com? The 3d tutorials are down?


Simple demo of 3d to 2d I made last night with source here:

http://rel.betterwebber.com/junk.php?id=103

Screen:
[Images not permitted - Click here to view it]

It's just a proof of concept thingy so it's not that complete but it shows you how to render 3d quads as sprites in a 1:1 ratio from worldspace to screen space.
_________________
http://rel.betterwebber.com

#173988 - brave_orakio - Tue May 11, 2010 3:16 am

Hey thanks! No problem if it's just proof of concept. It may be what I'm looking for to start out!

By the way 1:1 meaning if I have a 32x32 pixel sprite/tile, It shows up onscreen as a 32x32 quadrangle(square in this case)?
_________________
help me

#173991 - relminator - Tue May 11, 2010 4:08 am

brave_orakio wrote:
Hey thanks! No problem if it's just proof of concept. It may be what I'm looking for to start out!

By the way 1:1 meaning if I have a 32x32 pixel sprite/tile, It shows up onscreen as a 32x32 quadrangle(square in this case)?


Yes. in fact you can use the sprite blitters ala oam (ie. screen resolution of 256x192).

Here's a demo of a particle system to test how fast the 3d core is at rendering 2d quads.

http://rel.betterwebber.com/junk.php?id=104

That runs about 512 particles with no slowdowns at all.
_________________
http://rel.betterwebber.com

#174020 - brave_orakio - Thu May 13, 2010 4:18 am

I've been reading through tutorials and source code(NDS 3d specific tutorials are are hard to come by) and if I understood right, the only memory used for graphics(polygons, textures and palettes in particular) is the VRAM right?

The palette memory of 2d mode is just for 2d mode yes?

Also one I haven't found yet is about texture. In 2d mode, sprites and tiles are cut up into 8x8 pixels. Is this true for textures in the DS as well, or are textures formatted like a bitmap(One whole image) and then use x and y coordinates (as well as other values like S and T which is basically length and width)to determine the texture displayed by a polygon? From what I read, its the latter so sprite animation might be a little different when using 3d mode in that case. Can anyone confirm?

Another question is about tiled BG using the 3d mode. Isn't this expensive on resources(meaning copying 2d mode using in this case 8x8 quadrangle polygons each displaying an 8x8 tile and then filling the screen with such polygons) or is there a way to just use one big quadrangle then display multiple textures using a table?

Last, how would I go on about doing something like the WIN_OBJ of 2d mode in 3d?

Sorry for the wall of text!

EDIT:relminator I recently tried to compile your source code. Does it use any other library other than libnds? I'm getting "'glinit' was not declared in this scope" and glviewport, rand among others.
_________________
help me

#174024 - sverx - Thu May 13, 2010 8:56 am

VRAM banks A through D could be used for storing the textures, VRAM banks E, F and G could be used to store texture palettes, if needed.
There's of course other memory where polygons (vertex) are stored, but it is not directly accessible, you can just 'push' data into it through a FIFO, basically.

Textures can be of different formats: 'paletted', direct color, semi-transparent and even compressed, check here.

That's everything I know about 3D ;)

#174026 - Azenris - Thu May 13, 2010 3:17 pm

Just wanted to say relminator's source code compiled for me and i only have libnds
_________________
My Homebrew Games

#174031 - brave_orakio - Fri May 14, 2010 2:27 am

Must be the way I modified the makefile then.

I modifed this one only:
from
LIBDIR := $(LIBNDS)
to:
LIBDIR := /d/devkitpro/libnds/

Please tell me if I modified it incorrectly. I'm really not used to using libraries in makefiles since I only used standard c functions in my past project and not libgba or libnds. Oh, and if any of you have any ideas about my other questions please answer them too! :-)
_________________
help me

#174035 - relminator - Fri May 14, 2010 5:40 am

brave_orakio wrote:

The palette memory of 2d mode is just for 2d mode yes?


You can set a pal for each texture you use via gl or glu palette.

brave_orakio wrote:

Also one I haven't found yet is about texture. In 2d mode, sprites and tiles are cut up into 8x8 pixels. Is this true for textures in the DS as well, or are textures formatted like a bitmap( whole image) and then use x and y coordinates (as well as other values like S and T which is basically length and width)to determine the texture displayed by a polygon? From what I read, its the latter so sprite animation might be a little different when using 3d mode in that case. Can anyone confirm?


glTextures are linear. aka bitmap. They are not cut in 8x8 tiles. Actually I just made a 2d renderer using only gl calls and its fast and does not have a sprite limit of 128. The way you would render sprites via 3d core is IMHO a lot easier than oam.

brave_orakio wrote:

Another question is about tiled BG using the 3d mode. Isn't this expensive on resources(meaning copying 2d mode using in this case 8x8 quadrangle polygons each displaying an 8x8 tile and then filling the screen with such polygons) or is there a way to just use one big quadrangle then display multiple textures using a table?



Yeah, my example uses one texture image but uses texture offsets to blit different parts of a texture. oam gfx data would hold as much as texture data. I am also using 256 colors for my textures these days.

brave_orakio wrote:

EDIT:relminator I recently tried to compile your source code. Does it use any other library other than libnds? I'm getting "'glinit' was not declared in this scope" and glviewport, rand among others.

[/quote]

I only use libnds. I'll upload a better and faster example when I get home.
_________________
http://rel.betterwebber.com

#174079 - brave_orakio - Mon May 17, 2010 7:42 am

Stupid me! I didn't download the latest version hat's why I was getting those errors!

I can't seem to find the max allowable size of textures for NDS. I can't recall where I read this. Although texture parameters indicate 1024x1024(probably only for 2 color).

Some of the questions have been answered, thanks to all! But the last one hasn't yet! So how do we do something like WIN_OBJ in 3d mode?
_________________
help me

#174080 - relminator - Mon May 17, 2010 8:38 am

brave_orakio wrote:
Stupid me! I didn't download the latest version hat's why I was getting those errors!

I can't seem to find the max allowable size of textures for NDS. I can't recall where I read this. Although texture parameters indicate 1024x1024(probably only for 2 color).

Some of the questions have been answered, thanks to all! But the last one hasn't yet! So how do we do something like WIN_OBJ in 3d mode?


What's WIN_OBJ?
_________________
http://rel.betterwebber.com

#174081 - elwing - Mon May 17, 2010 8:45 am

he speaks about the 2d windowing effects...
specifically the one using a sprite outline...


edit: windowing

#174084 - relminator - Mon May 17, 2010 10:00 am

Well, doing windowing in ortho mode should be pretty straightforward and with the way the DS 3d core works, doing a resizable but non-texture scaled (ie no filtering) window should not be a problem. BTW, doing windows without filtering should be better looking that filtered windows.
_________________
http://rel.betterwebber.com

#174088 - elwing - Mon May 17, 2010 12:21 pm

relminator wrote:
Well, doing windowing in ortho mode should be pretty straightforward and with the way the DS 3d core works, doing a resizable but non-texture scaled (ie no filtering) window should not be a problem. BTW, doing windows without filtering should be better looking that filtered windows.


there's surelly an easy way to perform some basic window, but have you checked all what you can do using windows (specially tricks involving object windows or hblank DMA)? I doubt you can easily do all windowing on the 3d hardware easily... that said the effect you gain surely worth more than windowing and some special 2d effects...