Page 1 of 1

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

Posted: Sat Jul 17, 2021 5:22 pm
by masteries
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!

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

Posted: Sun Jul 18, 2021 5:49 am
by cero
Is there already a set of functions implemented in SGDK in order to effectively use thousand based tilemaps?

Without require many hard to code very long functions?
No. You will have to write your own.

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

Posted: Sun Jul 18, 2021 8:42 am
by masteries
cero wrote:
Sun Jul 18, 2021 5:49 am
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?
No. You will have to write your own.
Thanks for the concise answer,

The smile on my face banished :(

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

Posted: Mon Jul 19, 2021 8:31 am
by Stef
Hey,

I posted a reply but for some reasons it didn't arrived.
Well, to make it short indeed SGDK doesn't provide help for that, the MAP system doesn't support tile streaming (i already though about adding it but it would be rather complexe to handle that with multi-scrolling).
The "naive" way of doing that is to use the Sonic 3D approach : have a virtual map supporting a maximum of 4096 tiles but internally you use tilemap as a frame buffer (no duplicated tiles, an uniq tile id for each tile) and just stream tiles for each new column / new row of the fly. That limit the speed of the scroll speed as obviously you can't stream too many tiles per frame, also using that method you cannot compress your tiles data (well that might be possible but you won't achieving a good compression ratio anyway). For a MS style game the scrolling speed is not an issue as it's generally quite slow, you can even limit it to 4 px/frame max and so stream tiles on 2 frames.

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

Posted: Mon Jul 19, 2021 5:12 pm
by cero
Your reply went to the duplicate thread in another subforum.

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

Posted: Mon Jul 19, 2021 7:51 pm
by Stef
oh indeed thanks ! I should have moved the topic to the appropriate section, but now it has been replied here i guess we can just ignore the other topic (i don't have right to delete / move it)

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

Posted: Mon Aug 02, 2021 7:53 pm
by pitcrawler
I did this for a project of mine similar to how you described, although it took a long time and a few tricks to get it working at a decent speed. I might be able to put a code sample together some time.

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

Posted: Mon Aug 09, 2021 9:59 pm
by masteries
pitcrawler wrote:
Mon Aug 02, 2021 7:53 pm
I did this for a project of mine similar to how you described, although it took a long time and a few tricks to get it working at a decent speed. I might be able to put a code sample together some time.
Thanks for your comment,

I managed to write a horizontal only frame buffer based scroll, performance is good, but I am also interested on 8 way scrolling.

Probably your code can reveal useful tricks or techniques,

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

Posted: Mon Sep 20, 2021 9:59 pm
by Miquel
Perhaps you should think to build a separate tool which handles all this. So in you program when the character reaches certain line it knows exactly which tiles and meta-tiles to update.

Regarding 8 directions scrolling, having up/down scroll not necessarily means any tile update. In Megadrive you can have planes 256/512 pixels tall.