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.

Coding > Drawmap Routine really good??

#145380 - anox - Wed Nov 14, 2007 5:47 pm

Hey folks,

I am a Java and Perl Programmer with some C/C++ experience wanting to dig deeper into C/C++ by coding some GBA or DS apps.
Actually, I am looking foward to code a small game!

Jep and now to my question:
I was looking into some example code when I noticed a somehow "common" way of mapping..

Creating tiles and mapping them into huge arrays. These arrays then get iterated and show the implemented tiles.

1) Is this a good and adviced mapping procedure?

2) How about moving the map when the character moves? Do I then move every tile in the array one step?

Thanks for your help and excuse me if this is a obvious thing...
I mean I just looked at a map array which was over one page long having about 500 tiles. Ok, make the tiles bigger then you will have a smaller array but please tell me your thoughts on this.

-anoX

#145390 - tepples - Wed Nov 14, 2007 8:33 pm

anox wrote:
I was looking into some example code when I noticed a somehow "common" way of mapping..

Creating tiles and mapping them into huge arrays. These arrays then get iterated and show the implemented tiles.

1) Is this a good and adviced mapping procedure?

Google "metatiles" to learn more about it.


Quote:
2) How about moving the map when the character moves? Do I then move every tile in the array one step?

Most of the time, you take advantage of the fact that the hardware map's display wraps around from one edge of the map to the other. You draw only the row or column of tiles that is about to scroll onto the screen.

Quote:
Thanks for your help and excuse me if this is a obvious thing...
I mean I just looked at a map array which was over one page long having about 500 tiles. Ok, make the tiles bigger then you will have a smaller array but please tell me your thoughts on this.

If manually coding tile maps is getting out of hand, you might want to try your hand at writing a map editor in Swing.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.