Game Development Community

Maps: 1 vs many

by Tim Doty · in Torque Game Builder · 03/13/2005 (8:10 am) · 4 replies

To learn T2D, torque script, et all I'm working on a (somewhat) simpler game than my main project. This is a top-down car combat game. The map I'm using for testing is moderate in size (50x50 tiles), but a friend of mine asked me to make a map of our home town and in the tile scale this will end up as something like 1000x1000 tiles.

My first thought was to keep maps at 50x50 and just use a bunch of them, loading them as necessary. Basically, keep nine loaded all the time: the current one plus each adjacent map. This way the camera won't see edges, but memory is conserved.

The thing is I've noticed the load time for initing T2D is quite noticable on my system. It takes maybe five seconds and that is with 2x 2.0GHz AthlonMP. Is the pause loading the map? Or is it just general initing?

I know I can find out through trial and error, but I'm trying to save my rather limited dev time to fun stuff (adding weaponry and damage).

So my question boils down to two things: should I be concerned about memory consumption of a 1000x1000 tile map (I'm wanting this to run on as wide a range of hardware as possible)? Should the time to load a 50x50 map be relatively insignificant when all tiles are already loaded?

I appreciate any and all input (even if its telling me to just try it). I had an audience last night even though I had broken movement and was in the process of fixing it -- T2D is a *lot* of fun.

#1
03/13/2005 (9:12 am)
@Tim: There was a problem with the tile-editor (not T2D) that caused large maps to load slow. I have now fixed the problem and you can happily load a 1000x1000 in fractions of a second.

Here's my post from the other thread to explain...

I just got around to addressing this potential bug and after creating/saving/loading very large tile-layers, I found that there wasn't a problem at all when driving the tests from scripts. What I did find is that there is a problem with the tile-editor itself, not T2D. For any layer being edited, the tile-editor creates a guide-layer (checkered layer) underneath the layer, which is fine. The problem occurs with the way it implements the checkered pattern itself. It essentially uses script to place alternate blended static tiles, in the case of a 1000x1000 setup, it iterates a million tiles in script which can take a considerable time. It also recreates the guide-layer when selecting different layers so the general performance of the tile-editor become unmanagable.

I'll look at an alternate method of showing a nice grid in the editor.

You can confirm this problem by removing the script-code that forms the checkered guide-layer. You'll find this in the tileeditor Mod, "editorScreen.cs" (approx line 1339). Comment-out the following code:-
// Populate with tiles.
for ( %x = 0; %x < %tileCountX; %x++ )
	for ( %y = %x % 2; %y < %tileCountY; %y+=2 )
		%guideLayer.setStaticTile( %x SPC %y, tileEditorCursorImageMap );

The tile-layers now have an option in the engine that turns on a grid showing the outlines of the tiles. This is instantaneous and can be useful for a number of situations outside of the editor.

There are also file-stream changes that we want to do for all the objects, including this one that will greatly reduce the overhead and bulk of the files but this was always going to be part of our new unified file-format, something we're working on now.

Expect some of this stuff in the next update.

- Melv.
#2
03/13/2005 (9:39 am)
@Melv: Thanks for the prompt answer! You're guys involvement in support really makes the product. I take it from what you are saying I can just design a 1000x1000 map and it will work fine in the tile editor in the future, but would work fine as a map in a game right now?

And that map loading period should be very fast so the delay I'm seeing on startup is probably other initing, not map loading?

Tim Doty
(who hasn't had this much fun programming in a couple of years)
#3
03/13/2005 (9:52 am)
Absolutely.

Be aware that if you fill-up such a map it could take a moderate amount of memory as you're talking about 1 million tiles. Shouldn't be too much of a problem though.

Somehow 1000 seems like a nice round number but you'd obviously want to have what your game requires and if it has to be 1000x1000 then so be it, T2D will serve you well in this respect.

- Melv.
#4
03/13/2005 (10:29 am)
Well, the map scale dictates the size. I may yet set it up as a dynamically loaded maps of smaller size. The 1000x1000 is an estimate. I got a map of my home town and gridded it out. It's taller than it is wide, but the I think it came out to something like 20 maps wide by 24 maps tall if the maps are 50 tiles in each dimension. At 15 feet per tile that's 15000x18000 feet, more or less. Good thing this is a small town and not a city.

The working map is just 750x750 feet (50x50 tiles) and it does just fine for driving around and having fun ;^)