GameTools mklevel

From Wikiid
Revision as of 20:37, 23 October 2007 by SteveBaker (Talk | contribs) (New page: The '''mklevel''' tool builds a complete (but very generic) level from a standard set of terrain tiles. The tiles are required to be in the '''models/autotiles''' directory and they must ...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The mklevel tool builds a complete (but very generic) level from a standard set of terrain tiles. The tiles are required to be in the models/autotiles directory and they must be named in the exact way that the mktiles tool does it.

The input to the tool is (currently) two image files - provided on the command line:

 cd /u/lol
 /u/games/make_level/src/mklevel images/heights.png images/features.png

The output is the file 'level.xml' in the current directory. That level file is suitable for input to the tile editor or for inclusion into ultimate.xml.

The Heights Image

The 'heights' image and the 'features' image must be the exact same resolution - one pixel in the map represents the height or feature content of one corner of a terrain tile (actually, the corner shared between four tiles - unless we are at the edge of the map). So if the image is (say) 100x100 pixels then the resulting terrain map will only be 99x99 terrain tiles. Since each tile is 20m across, that produces almost 2km x 2km of terrain. Fortunately, the terrain representation (both on disk and inside the game) is quite efficient - so there is little penalty in generating very large areas of terrain - other than that your players may get lost inside it!

The 'heights' image should be monochrome. The mapping should be such that bright pixels are high and dark pixels are low and every 16 grey levels equals one terrain "height step" (which is currently set to 2.5m in the mktile tool). Since the terrain tile corner heights are limited to 0, 2.5, 5 and 7.5m, the steepest the terrain can slope is 7.5m across each pixel - so the images you create need to be somewhat fuzzy. If you paint a height map that is beyond the limits of what the system can build, it will do it's best to stay as close to what you ask as possible - but it doesn't guarantee to do exactly what you ask. If (for example) you put a black pixel next to a white pixel, that would demand 16 height steps over a difference of one terrain tile - since that's impossible, you'll find that the generated terrain will start sloping up about four pixels away from where you asked it to change heights.

The Features Image

The 'features' image should be a colour image. It should contain predominantly black pixels (meaning generic terrain). Currently, the only thing you can store here is information about water. Pixels painted in maximum blue (0,0,255) will be made from river tiles. However, since we have no automatically generated waterfall tiles, mklevel assumes that all water must be at zero height - even if the 'heights' map says otherwise. This means that the heights data for pixels adjacent to the blue pixels should never be more than 3 height steps above zero. You can paint them higher than that - but the terrain will be squashed downwards until there is enough slope to reach water level where the rivers are. In other words, water takes precedence over height if there is any argument between the two!

Remember that one pixel represents the corner between four terrain tiles - so a single blue dot on the 'features' map would produce four terrain tiles - each with water in one corner. A straight line of blue pixels produces a narrow 20m channel that straddles two tiles in width. Consequently, if you were to make a 'diagonal' connection between two blue pixels, you'd get a tile with water in two corners and land in the other two. With our current tile generator, there will be a very narrow waterway between the two blue pixels - so diagonal connections imply water flowing between the two blue dots. However, this will be VERY narrow in some versions of the tile - so you maybe want to avoid doing that. For a waterway wide enough to take the seaplane down it, you'll need at least a two pixel wide river painted into the 'features' map.

Other feature types will eventually be supported by different coloured pixels in the feature map.

Wikiid Pages relating to gameTools (edit)
gameTools - Main page
gameTools - Support Tools :
plb_to_ac3d, mklevel, mktile, mktree, tiled, autogen_java, mk3dgallery
gameTools - File Formats :
title_screen.rgb, ultimate.xml, material.xml, decoration.xml, physics.xml
tiled.xml, tiled_autotiles.xml, Level files, Tile naming scheme, PLB files
gameTools - Source Code :
Game functions: gameCamera, gameClock, gameChecksum/gameHashTable, gameHTTP,
gameIsect, gameJoystick, gameParticleManager, gameScreen/gameMouse,
gameSky, gameStarter, gameStrokeFont, gameUtils
Material database: MatList/MatEntry
Tile map handling: TileObject/MapFlag/MapEntry/Map
Java Interfacing: JavaLink
Image file loading: liImage/liImageFactory
3D Model file loading: loadPLB, PLB exporter
Physics: Sabot, Bullet, gameTools - Use with Blender, PLB exporter
Object management: Object

Wikiid Pages relating to Lemur of Lima (edit)
Lemur of Lima - Main page
Lemur of Lima - Controls
Lemur of Lima - Levels :
List of Levels, Level design, Screen shots, Models
Lemur of Lima - Java Plugins :
Java plugin API, Event handling, Flags, GameInterface API , Alphabetical Index
Lemur of Lima - Source Code Documentation :
Initialisation, Main Loop, gameTools