
Example of large city map using tiles for ground
Features:
* Large scalable map (adding more ground will not slow down the engine)
* Car with loose suspension
* Model loading
* Camera tracking
* Moving water
* Fake shadows/shading
* The buildings height and textures are randomized at startup
Features lacking
* There is a bug in the heightmap z lookup function, which causes the car to glitch near the boundary of the map
Download
gmroadtile.zip
The zip files is about 9mb large, due to some pretty heavy textures.
How does it work?
The map is drawn in the normal Room editor in Game Maker, using tiles and objects. Since GM tiles tend to be quite large if you need resolution I use two sets of tiles. The small tiles are thumbnails (16x16 or 32x32) and these are read and converted to 3d graphics by the engine when starting the demo. Another benefit of this is its possible to do some heightmapping, as shown in the demo. The map is 2000x2000 large, however tiles must be places on even 16 or 32 pixel boundaries as the scanner looks for tiles there. When rendering everything is scaled up 16 times for accuracy. This is how the apparently huge map is achieved. The tiles indices are put into a 2D grid which is 125x125. When rendering the nearest region around the camera is iterated over, and any tiles in that region are drawn using d3d. The fake shadowing on the road is done by scanning for objects near the tile, and darkening the colors of the 3d triangle. Any tiles that end up behind the camera are ignored for extra speed. If you want a free camera or top down view you might want to disable that optimization.
The frame rate may be a little slow on your system. This is due to the car model which is pretty heavy. For a real game a more economic car model would have be chosen.
Also note that only a small portion of the room is filled in this example, you could easily fill the whole room and there should be no or little slow down (unless you really put a lot of objects in there). If you want a huge amount of objects you might want to extend the tile grid idea above to do the same thing with objects.
Most of the models and textures come from Sketchup 3d warehouse. I wrote my own Sketchup model converter (actually from .obj to .mdl). I do not know the copyright status of using models and textures from Sketchup in productions, please refer to their license agreement for more info. The buildings are pretty much simple blocks.
This may be used freely by anyone, but if it is used in any production a mention of 'JMike' would be nice.
Hope this is useful for someone!
Update 20080920
* Texture widths are now fixed to 2^x
* Collision response on by default
--JMike
Edited by JMike, 20 September 2008 - 08:56 AM.











