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

SGDK only sub forum

Moderator: Stef

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:22 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!
Last edited by masteries on Sun Jul 18, 2021 8:41 am, edited 1 time in total.

cero
Very interested
Posts: 338
Joined: Mon Nov 30, 2015 1:55 pm

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

Post by cero » Sun Jul 18, 2021 5:49 am

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.

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

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

Post by masteries » Sun Jul 18, 2021 8:42 am

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 :(

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 » Mon Jul 19, 2021 8:31 am

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.

cero
Very interested
Posts: 338
Joined: Mon Nov 30, 2015 1:55 pm

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

Post by cero » Mon Jul 19, 2021 5:12 pm

Your reply went to the duplicate thread in another subforum.

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 » Mon Jul 19, 2021 7:51 pm

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)

pitcrawler
Newbie
Posts: 6
Joined: Mon Jul 24, 2017 8:24 pm

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

Post by pitcrawler » 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.

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

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

Post by masteries » Mon Aug 09, 2021 9:59 pm

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,

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

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

Post by Miquel » Mon Sep 20, 2021 9:59 pm

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.
HELP. Spanish TVs are brain washing people to be hostile to me.

Post Reply