So, I'm currently using the Jelpi demo program to make a new game, and I was wondering:
Is there anyway to have multiple small maps?
What I'm using right now is going to be where there's technically one map, but it's separated into chunks.
However, I'm not confident about that.
I am going to put the game on the site Soon-ish.
The short answer is yes, you can. The easy way to do this is to just imagine the map like a giant image you can crop and rearrange at will.
map cel_x cel_y sx sy cel_w cel_h
This draws a portion of the map to the screen, specifically, it only draws the region (cel_x, cel_y)->(cel_x+cel_w-1,cel_y+cel_h-1) of the map to the screen specified by sx, sy. You basically get 128 screens worth of map that you can rearrange as you choose (64 if you don't want to give up half your tiles)
Only 32 screens, alas.
Ah, but! The map sheet is writable memory in its own right, which means that you can come up with a scheme to paint a given map onto a chunk of that map area at runtime and thus have potentially much larger total map space in your game.
Requires some way of procedurally generating or otherwise compressing and storing map data in some form other than literally pre-rendered 16*16 screen-sized chunks of map data, but there's a lot of ways to do that. By one means or another, you construct a level behind the scene during gameplay, and draw that to some of the map memory, and then just paint the appropriate screens or so worth of that with map() during the game loop and the screen-drawing code never even has to know there's dynamic shenanigans going on behind the scenes.
I do a very trivial version of this with Ennuigi; the initial map data is an 8*2 array of pre-drawn Marioesque levels, and each time there's a screen transition I copy one of them at random to the top left screen's worth of map memory, which the game then just consistently paints during the game loop. But! I also wrote a "degrade" function that gets called before the swap, on the randomly selected map chunk, that goes through and replaces some of the pristine map tiles with crumbled/rotted/damaged versions of same, so each time a player returns to the same scene in the Mushroom Kingdom everything looks a little more run-down.
[Please log in to post a comment]