Documentation

GardenTrains developer's technical documentation, writen by Quintus Hegie for computer geeks. With this documentation you'll be able to develop new levels and create new game objects (locomotives and/or wagons). If you're a web developer and you have a question about 3D progamming and/or BabylonJs, please contact me on HTML5GameDevs. If you're a game player instead of a developer, then you can find the manual here.

Please note: The game specific soure code is protected with legal copyright! The code may be changed at any time without any notification, rendering any custom additions maybe no longer compatible with the latest version.

3D Engine

Scene Optimization

The player generally has a good camera view over the whole level. Therefore most meshes are visible and need to be rendered most of the time. This creates a challenge for keeping a constant and high framerate. That is why I use some specific scene optimization techniques for this train game.

Level of Detail (LOD)

A level mainly consists of a terrain or playing ground, that is visible in full or in large part. Next in line of frequently visible meshes are the train tracks. The train tracks may be observed from very close by (when camera is set to train drivers view mode) as well as from a large distance (when camera is set to level map view). A technique to speed up rendering when using various distances to view the same mesh is to apply Level of Detail (LOD).

Levels of Detail on a Rail: left the full mesh (rendered when viewed from close-by), right the simplified mesh (rendered when viewed from a distance)

Game Objects

Hierarchy

Locomotives

A locomotive is equiped with a motorblock and is controllable by a player.

Locomotive Game Object: accessors of attached objects

Wagons

A wagon is not motorized and needs to be pushed/pulled by a locomotive.

Wagon Game Object: accessors of attached objects

Trainline system

The tracks within the game are laid out within the trainline system. Each segment within the TrainLineSystem is called a TrainLine.