Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Does the old SNES RPG game load all map at once?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Triad_prague   Members   -  Reputation: 140

Like
0Likes
Like

Posted 05 December 2011 - 06:04 PM

Hi, sorry if I post in the wrong place, please move it as you see fit :).

Recently I played several good-oldie SNES RPG game, and I wonder do SNES RPG games load all map data at the beginning of the game? because I move from map to map and never noticed a 'glitch' or a pause during the transition (unlike nowadays games which will show 'now loading...' screen).

So how did they do it back then? I thought I read somewhere that SNES console is a bit limited in memory and processing power....thanks btw for reading my questions
:D

Cheers,

Triad Prague
the hardest part is the beginning...

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31938

Like
2Likes
Like

Posted 05 December 2011 - 06:09 PM

The SNES only had 128KiB of RAM, but game cartridges could store up to about 6 MiB of ROM.
In these old cartridge-based consoles, the ROM was accessible at usable speeds (you didn't have to load data from disk into RAM to use it, like we do these days) and was directly addressed by the system, allowing you to treat RAM and ROM data the same way from code --
e.g. pointers from 0x000000 to 0x020000 might be mapped to the RAM chip, while pointers from 0x020000 to 0x620000 might be mapped to the ROM chip.

Also, cartridges could contain extra hardware -- for example, the later 3D games like Starfox actually contained a primitive "GPU" (clocked at 0.02 GHz!!) inside the cartridge!

#3 SimonForsman   Crossbones+   -  Reputation: 6323

Like
1Likes
Like

Posted 05 December 2011 - 06:24 PM

Hi, sorry if I post in the wrong place, please move it as you see fit :).

Recently I played several good-oldie SNES RPG game, and I wonder do SNES RPG games load all map data at the beginning of the game? because I move from map to map and never noticed a 'glitch' or a pause during the transition (unlike nowadays games which will show 'now loading...' screen).

So how did they do it back then? I thought I read somewhere that SNES console is a bit limited in memory and processing power....thanks btw for reading my questions
:D

Cheers,

Triad Prague


Its not that easy to say really, but it doesn't really matter either, back then a map could consist of a few hundred bytes of tile IDs which you could load from ROM in no time at all, today games are loading 10-20MB(or more) of level data from a much slower HDD instead. You can eliminate loadtimes in many modern games by using a PCIe ramdrive to store the game on, (Those are insanely fast), unfortunatly they cost quite a bit of money still.
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#4 Triad_prague   Members   -  Reputation: 140

Like
1Likes
Like

Posted 06 December 2011 - 01:41 AM

whoa, thank you guys for the fast response!

BTW I'm trying to get the same effect with my framework here, thing is....I only load map on demand (when the player collides with a trigger, and that trigger call change_map() ). How am I going to do that? I can pre-load all maps but that might consume enormous amount of memory. So if you got any ideas, please share here....thanks!! :D
the hardest part is the beginning...

#5 SimonForsman   Crossbones+   -  Reputation: 6323

Like
1Likes
Like

Posted 06 December 2011 - 03:26 AM

whoa, thank you guys for the fast response!

BTW I'm trying to get the same effect with my framework here, thing is....I only load map on demand (when the player collides with a trigger, and that trigger call change_map() ). How am I going to do that? I can pre-load all maps but that might consume enormous amount of memory. So if you got any ideas, please share here....thanks!! :D


If you got your maps in a grid (as many old console RPGs did) you can load all surrounding maps in a background thread,

Thus if you got zones like this:
01,02,03,04,05
06,07,08,09,10
11,12,13,14,15
16,17,18,19,20
21,22,23,24,25

and the player is in zone 12 you also load 11, 07, 17 and 13, (if he can exit diagonally you have to load those aswell) in a background thread.

If the player then moves into zone 07 you toss out zone 17,11 and 13 and load 02,06 and 08 instead, This means you always have the maps the player can reasonably enter in memory before they are needed and thus you get no load times at a fairly reasonable memory cost.

In your case since you have triggers what you should do is:

1) at game start you need a loading screen anyway, load the zone the player is in and then let him start playing.
2) Check all map change triggers in the current zone and load the zones they lead to in a background thread.

If the player hits a mapchange trigger you check if the map is loaded, if it is you simply change map immediatly, do step 2 to start loading the new zones you need and toss out the ones you no longer need.

This way you should only need a loading screen if for some reason the player is able to move through zones faster than you can load them.
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#6 Hodgman   Moderators   -  Reputation: 31938

Like
4Likes
Like

Posted 06 December 2011 - 03:57 AM

If you got your maps in a grid (as many old console RPGs did) you can load all surrounding maps in a background thread,

This is a good idea -- most games have some kind of "background loading" mechanism.

You can do this without threads -- the operating-system will have a way to open files in an asynchronous manner,
e.g. on Windows you can use something like this to start a background load of a file:
struct LoadItem
{
	OVERLAPPED overlapped;
	void* buffer;
	DWORD size;
};

VOID WINAPI OnComplete(DWORD errorCode, DWORD numberOfBytesTransfered, OVERLAPPED* overlapped)
{
	overlapped->hEvent = 0;//when a file is finished loading, we let the user know by setting hEvent to NULL
}

void PollBackgroundLoads() { SleepEx(0, TRUE); }//if a background load has finished, this will call OnComplete

LoadItem* LoadFile( const char* path )
{	//get a handle to the file
	HANDLE file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
	if(file == INVALID_HANDLE_VALUE)
		return 0;
	LoadItem* item = (LoadItem*)malloc(sizeof(LoadItem));
	DWORD fileSize = 0, fileSizeHi = 0;
	fileSize = GetFileSize(file, &fileSizeHi);//measure the file before loading it
	if( fileSize == INVALID_FILE_SIZE )
	{
		DWORD error = GetLastError(); void* errText = 0;
		DWORD errLength = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, 0, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&errText, 0, 0);
		printf("%s\n", (char*)errText);
		LocalFree(errText);  free(item);
		return 0;
	}
	item->size = fileSize;
	item->buffer = malloc(fileSize);//make a buffer to store the file in
	item->overlapped.Pointer = 0;
	item->overlapped.Internal = item->overlapped.InternalHigh = 0;
	item->overlapped.hEvent = (HANDLE)path;//set any non-NULL value
	BOOL ret = ReadFileEx(file, item->buffer, fileSize, &item->overlapped, &OnComplete);//kick off a background load
	if( !ret )
	{
		DWORD error = GetLastError(); void* errText = 0;
		DWORD errLength = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, 0, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&errText, 0, 0);
		printf("%s\n", (char*)errText);
		LocalFree(errText);  free(item->buffer); free(item);
		return 0;
	}
	return item;
}
Once you've started a background load, you can check on it from time to time to see when it's finished. e.g. in a quickly thrown together game-loop, if you wanted to switch to a new level by loading it in the background first:
void Test()
{
	LoadItem* file = NULL;
	MyLevel* level = new MyLevel(...);
	while( true )
	{
		if( !file && level->wantToLoadNewLevel )//we're not loading a file & the game wants to load a new level
		{
			file = LoadFile( "C:/text.txt" );//start the background load
			if( !file )
			{
				printf( "load failed\n" );
				return;
			}
		}
	PollBackgroundLoads();
		if( file && !file->overlapped.hEvent ) // we've started loading a file & it's finished loading
		{
			delete level;//change levels to the one in the file
			level = new MyLevel(file->buffer, file->size);
			free( file->buffer );//free up the buffers used by the loading process
			free( file );
			file = 0;
		}
		level->Update();
	}
}


#7 Hodgman   Moderators   -  Reputation: 31938

Like
0Likes
Like

Posted 07 December 2011 - 05:33 PM

Oops, I forgot to put the call to SleepEx in the above code originally. Fixed

#8 Vortez   Crossbones+   -  Reputation: 2704

Like
0Likes
Like

Posted 08 December 2011 - 12:02 AM

As another one posted, i think the best approach is too store tiles textures by index, instead of loading all the bitmap in ram, as a single but big texture which require a lot of memory (a siimple 2000x2000 texture require 2000x2000x3 = 12Mo of memory in 24-bit colors). For example:

0011200
0122200
2010220

Each byte(or characters in this case) represent a different tile texture, the 0's might be water, then 1 grass ect... that way it dosen't consume much memory at all. Then you could even store them in .txt files and build a simple editor to load/make them later.

#9 stormwarestudios   Members   -  Reputation: 215

Like
0Likes
Like

Posted 08 December 2011 - 09:07 AM

Read up on the following two articles:

Tile Based Games FAQ

Tile Graphics


These were pretty much the bread-and-butter for developing tile-based RPGs on limited-hardware systems, but are still relevant today to achieve optimized tile map rendering and traversal systems for your game.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS