Homebrew Using an background atlas for a NDS homebrew

Project68K

Well-Known Member
OP
Newcomer
Joined
Nov 12, 2020
Messages
67
Trophies
0
Age
23
XP
650
Country
United States
I've recently had an idea on how to implement a lot of backgrounds for a NDS homebrew. I thought about having some sort of background atlas. Similar to a sprite atlas, it would be a atlas ( a large 2048 x 2048 background) that contains all the static, non-moving 256 x 192 backgrounds that the game will use. Everything else will be a transparent color. Doing this, we do not need to load in every single background.

In game, to change backgrounds, we can simply scroll to a certain position in a large background, which will show the next smaller background in it?

Is this a good idea in terms of performance, and has anyone else done this?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Seems like a solution, and not a good one, in search of a problem.

Assuming you are not trying to change fast enough to effect some kind of video background then swapping out background images as appropriate is fairly trivial.

Further to that 2048 x 2048 is not something the hardware natively supports in any mode ( http://problemkaputt.de/gbatek.htm#dsvideobgmodescontrol , 3d not doing much more if you were thinking about abusing that to map a texture to a flat surface) and when you do get up there in resolutions it rather restricts your other options, not to mention even without that it would mean you kill off a bunch of memory to things that don't get used all the time. This is also to say nothing of people doing tiled backgrounds instead and tile maps to make things smaller that way.

People do use larger images than the native resolution in backgrounds, however it is usually an animation trick to create some kind of scrolling effect (adjust things to make it horizontally and/or vertically tileable as it were and you can do a nice movement effect and rest to create an infinite scroll) or one of my favourite examples a moving stars background in Tetris Worlds on the GBA (a large static image of stars is found, they whizz around it in almost a figure 8/infinity pattern and it looks like your favourite old school Windows screensavers).
 

Project68K

Well-Known Member
OP
Newcomer
Joined
Nov 12, 2020
Messages
67
Trophies
0
Age
23
XP
650
Country
United States
Seems like a solution, and not a good one, in search of a problem.

Assuming you are not trying to change fast enough to effect some kind of video background then swapping out background images as appropriate is fairly trivial.

Further to that 2048 x 2048 is not something the hardware natively supports in any mode ( http://problemkaputt.de/gbatek.htm#dsvideobgmodescontrol , 3d not doing much more if you were thinking about abusing that to map a texture to a flat surface) and when you do get up there in resolutions it rather restricts your other options, not to mention even without that it would mean you kill off a bunch of memory to things that don't get used all the time. This is also to say nothing of people doing tiled backgrounds instead and tile maps to make things smaller that way.

People do use larger images than the native resolution in backgrounds, however it is usually an animation trick to create some kind of scrolling effect (adjust things to make it horizontally and/or vertically tileable as it were and you can do a nice movement effect and rest to create an infinite scroll) or one of my favourite examples a moving stars background in Tetris Worlds on the GBA (a large static image of stars is found, they whizz around it in almost a figure 8/infinity pattern and it looks like your favourite old school Windows screensavers).

Thanks for the response. I get your point about it not being a viable solution. I mainly wanted to do this mainly so I wouldn't have tons of background images laying around when it could be put on one single large atlas.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
You could still put it in one giant file and slice it up (fetch bytes blah through blah, possibly even calculated if you want to go that way) or an archive and play with pointers. Might make it hard for your end users to swap out files if they wanted to do that but if that is not a thing you anticipate then play it as you will.

Assuming you don't care to pack it all into the binary/nitrofs with ndstool (if it is going to get large there are reasons not to, even without it making file level changes annoying) I should note later versions of devkitpro also encouraged people to use a directory which in turn could house homebrew in its own subdirectory rather than scattering things and their own (often generically named thus conflicting with others if you wanted multiple pieces of homebrew) around on the root of the flash cart if that is a concern. To say nothing of argv if you wanted to roll that way.
 

mrparrot2

Well-Known Member
Member
Joined
Nov 29, 2021
Messages
106
Trophies
0
Age
29
Location
SP, Brazil
XP
562
Country
Brazil
Blt a new image into a 256x192 background can be done quite fast. My homebrew C&C game does that every frame and it is not, by far, one of the most time consuming operations in the game and it can maintain a 20~30 FPS all the time. If you don't need to do this on every frame I would advise you NOT to use this large background trick to save VRAM.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: So negative