Thousand tiles based maps - "How to" using SGDK?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
masteries
Very interested
Posts: 53
Joined: Thu Jul 30, 2020 3:33 pm

Thousand tiles based maps - "How to" using SGDK?

Post by masteries » Sat Jul 17, 2021 5:02 pm

Greetings,

I am trying to port my recently released Metal Slug port for Atari STE, to Sega Genesis/Megadrive

https://youtu.be/gyRBcTnn-5M

Its the first mission...

But the map is very detailed to load 4096 tiles into limited VRAM of this console.

Obviously a way to store, such example, 512 tiles, and dinamically modify these 512 tiles is needed to succesfully display the map on the screen for a Megadrive system.

I was thinking on a way, via C coding, of load the first 512 tiles, and when the map advances one column... check if the new column tiles are already present on the 512 loaded tiles, if not -> search for a free place on the 512 tile list and load the new one.

As well, each "discarded" column at left is being checked, if its tiles are not already present anymore on the screen, in order to mark these no more used tiles as free in order to be loaded when new columns at right demands.


Obviously, this is intended only for horizontal scroller, but it is a really complex tile dynamic loading code, but useful due to it is restricted to a maximum number of tiles on the VRAM.


Complexity can be crazy when 8 way scrolling is take into account,



Is there already a set of functions implemented in SGDK in order to effectively use thousand tiles based tilemaps?

Without require many hard to code very long functions?

Can be the BMP load functions useful due to these have the ability to specify VRAM tile starting?
Are these functions performance effective?



Atari Game Tools (Atari ST/STE) and Scorpion Engine (Conmodore A500 - A1200) have these capabilities already present, you can use these massive tile number based maps. And I am searching for similar functionalities such dinamically loading of VRAM tiles for Genesis/Megadrive


Thanks in advance,

If you can provide code samples, these will be more than welcome!

---------------------------------------------------

Edit: Probably this question needs to be moved to SGDK sub-forum

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Thousand tiles based maps - "How to" using SGDK?

Post by Stef » Sun Jul 18, 2021 8:14 pm

Unfortunately there is no such tools proposed by default in SGDK.
The MAP resource doesn't support "tile streaming". I already though about adding this feature but it would be really complex as it would need to handle free scrolling at same time (i don't imagine to limit to only vertical or horizontal scroll).
A "naive" way to handle that is to do it the same way it's done in Sonic 3D: have virtual tilemap of 4096 tiles and *always* handle internal map with unique tile for each position, so for each new column / row you need to stream tiles data. As the scroll speed is slow in MS game that should be possible. The downside of that is that tile data cannot be compressed and you will spent a large part of your DMA bandwidth with that.

Post Reply