#3313 - Mani - Sat Feb 22, 2003 5:57 pm
Does anyone know of a FAQ or sample of how to accomplish those huge maps that most gba-platform games use?
Most games use maps that are bigger than the available "map-memory".
I know how to use the background layers but there must be some kind of dynamic loading of the maps and tiles, right?
Hope I was clear enough, my english is not too good.
_________________
---
#3315 - Daikath - Sat Feb 22, 2003 6:08 pm
Uhm.. I dont know to code this but I am planning to make a game wich only has the area a little bit bigger then what is on screen in RAM but if a player walks up it checks what more it needs for that part of the world it is in, along with some extra tiles.
To explain it more carefully, if a player walks up the tile map deletes the lowest row and shifts every other row one row down and gets a new row at the top.
_________________
?There are no stupid questions but there are a LOT of inquisitive idiots.?
#3319 - jenswa - Sat Feb 22, 2003 8:16 pm
Well,
that's the way to do it,
check http://www.gbajunkie.co.uk for a tutorial about
tilemaps.
It helped me out fine,
only i don't use big maps, so i can't help any further.
_________________
It seems this wasn't lost after all.
#3322 - blindfold - Sat Feb 22, 2003 8:42 pm
to make bigger maps than those 32x32 or 64x64 just do the following:
1. make a simple map 32x32 - remember to make wrapping on
2. when you scroll right, just scroll screen until a scroll value reaches modulo 8 (8, 16, 32 etc... just use %8)
3. when you reach scroll value %8 you have to copy a new strip on the right of the screen (at 32th column)
4. and so on
remember to use a %32 to keep values at 0....31 tile!
do the same for all directions
oh, and you should meet problems when you scroll in both directions, remember to wrap around also a strip to avoid it...
thats all, if you meet problems, just try an example from a visual ham (there is a level scroll demo), or an example from Emapper (a tile editor... but they have an GBA example of a scroll level engine source), although all examples are a two sides scrolling.
#3325 - ampz - Sat Feb 22, 2003 8:55 pm
Yep, that's the way to do it. It's really simple.
However, I'd recommend using &7, &15, &31 instead of %8, %16, %32 It's alot faster. (Since the ARM7 does not feature hardware division).
#3333 - mbcook - Sun Feb 23, 2003 12:02 am
ampz wrote: |
Yep, that's the way to do it. It's really simple.
However, I'd recommend using &7, &15, &31 instead of %8, %16, %32 It's alot faster. (Since the ARM7 does not feature hardware division). |
That's really odd. It may not have hardware division, but it does have shift/rotate, right? No computer should be slow when dividing integers by factors of 2, you just shift the value, and the compilier should be smart enough to do this for you. Odd.
_________________
--Michael
#3335 - Mani - Sun Feb 23, 2003 1:38 am
blindfold wrote: |
to make bigger maps than those 32x32 or 64x64 just do the following:
1. make a simple map 32x32 - remember to make wrapping on
2. when you scroll right, just scroll screen until a scroll value reaches modulo 8 (8, 16, 32 etc... just use %8)
3. when you reach scroll value %8 you have to copy a new strip on the right of the screen (at 32th column)
4. and so on
remember to use a %32 to keep values at 0....31 tile!
do the same for all directions
oh, and you should meet problems when you scroll in both directions, remember to wrap around also a strip to avoid it...
thats all, if you meet problems, just try an example from a visual ham (there is a level scroll demo), or an example from Emapper (a tile editor... but they have an GBA example of a scroll level engine source), although all examples are a two sides scrolling. |
Thanks alot mister! (The sample that comes with Emapper did the trick :-))
_________________
---
#3341 - ampz - Sun Feb 23, 2003 3:37 am
mbcook wrote: |
ampz wrote: | Yep, that's the way to do it. It's really simple.
However, I'd recommend using &7, &15, &31 instead of %8, %16, %32 It's alot faster. (Since the ARM7 does not feature hardware division). |
That's really odd. It may not have hardware division, but it does have shift/rotate, right? No computer should be slow when dividing integers by factors of 2, you just shift the value, and the compilier should be smart enough to do this for you. Odd. |
Yes, some compilers are smart enough to substitute divisions by factors of two with shift operations. But not all of them, I'am not sure GCC is smart enough to do it.
And, in this case it's a modulo operation. It can be substituted by a shift and a substraction, or by a single AND operation. Not all compilers are smart enough to do theese kinds of substitutions. To be on the safe side, I always make the substitutions myself.
#3365 - blindfold - Sun Feb 23, 2003 5:26 pm
oh, yeah, it's true, you can use a &31 instead of %32 (and so on..), just like shifting instead of division