Adam Miles. Transport Tycoon Deluxe (TTD): Written by Chris Sawyer for Microprose in 1994. Written...

24
Transport Tycoon 3D Adam Miles

Transcript of Adam Miles. Transport Tycoon Deluxe (TTD): Written by Chris Sawyer for Microprose in 1994. Written...

Transport Tycoon 3D

Adam Miles

What is “Transport Tycoon”?

Transport Tycoon Deluxe (TTD): Written by Chris Sawyer for Microprose in

1994. Written almost entirely in Assembly language. Designed for MSDOS, sprites, 8bit graphics,

MIDI. Earn money by transporting passengers and

cargo. Build road/rail networks, planes and ships. Compete against up to 7 AI players. World size fixed to 256 x 256 tiles.

Transport Tycoon Deluxe

Transport Tycoon Deluxe

OpenTTD

2D Clone of Transport Tycoon Deluxe.

OpenTTD: Disassembled TTD, rewritten in C. Uses original graphics files, legality in

question. Significant feature enhancements:

World size increased up to 2048 x 2048. “… an AI that is actually worthy of its name” LAN and Internet multiplayer. Customisable graphics.

Transport Tycoon 3D

3D Clone of Transport Tycoon Deluxe.

TT3D: Completely rewritten from scratch. Fully 3D game world. Written in C# and Managed DirectX 9.0c. Larger map sizes – 512 x 512. Industries and Road Network.

TT3D – 3D Engine

Managed DirectX 9.0c – C#

Terrain Tilemap

Any size - non powers of 2 width/length if desired. Chunked – draws only the terrain in your locality. Texturing and Highlighting. Landscaping – per vertex height variation. ‘Pickable’:

Tile Vertex Side of a tile

TT3D – 3D Engine

TT3D – 3D Engine

Textured Meshes Positionable Rotatable Scalable

‘Instanced’…

TT3D – 3D Engine: Instancing

What does Hardware Instancing do? Draws many copies of identical objects – 1 draw call

Why use instancing? ‘Small Batch’ problem in DirectX 9. Every draw call goes via the CPU. Lots of draw calls maxes out CPU – low frame rate. A single draw call for all identical objects is the solution. Memory savings when compared to Shader Instancing.

How does it work? Multiple streams of data when rendering. Stream 0 = Mesh Data (Vertices). Stream 1 = Position Data (Vector4 – x, y, z. w is unused). Stream 2 = Rotation Data (Vector4 – x, y, z. w is unused).

TT3D – 3D Engine: Instancing

TT3D – 3D Engine: Performance

World

Hardware Instancing

TT3D – Gameplay

What is implemented in TT3D? Road/Tunnel Construction Depot/Station Construction

Vehicle Construction Maintenance costs

Pathfinding Landscaping Industries

Cargo Delivery Earn Money

GUI – Fully fledged Window and Control system.

TT3D – Road Network

Grid-based system Half / Full Straight Road Corner T-Junction Crossroads

3D Bi-directional Graph ‘Nodes’ are located on corners and junctions. Vehicles given a path to follow: Node ->

Node. Kept in its most optimal state. Allows for one-way streets.

TT3D – Road Network: Pathfinding A* Pathfinding

Provides ‘shortest-path’ capability on the graph.

How does it work? Uses a cost + ‘best-case’ heuristic. List of potential routes, explore the best looking. When best-case for Route A becomes worse than

Route B, explore Route B. Repeat until such a time that:

Destination is found. All potential routes have been explored, no path at

all.

In-game demonstration/explanation later…

TT3D – Landscaping

Grid-based system Rules:

No vertex may be > 1 unit above/below a neighbour.

No vertex may descend below zero. Edge of the map must remain at zero.

Algorithm was recursive… Large pyramids resulted in stack overflow…

Redesigned without recursion. Can still get slow on very large pyramids.

Once again, demonstration/explanation later…

TT3D – Landscaping

Grid-based system

TT3D – Graphical User Interface (GUI)

Win

dows

•Z-Order•Dragging•Focus•Resizing•Visibility•Hierarchy

Co

ntrols

•Label•Button•Textbox•Radio button•Checkbox•List box•View Window•Scrollbar•Title Bar

TT3D implements:

TT3D – GUI: View Window

Provides functionality to view and render a “window” on another part of the world. Used on vehicle windows to follow them

around the world.

How does it work? Create a second camera. Render the world to a texture using the new

camera. Draw the texture to the screen Present the final image.

TT3D – Challenges

Terrain Performance

Rewritten from scratch ~ 5 times. 1 draw call per tile… 1 draw call for the entire terrain.

Beginning to near theoretical limit of the GPU.

Road Network Maintaining the graph optimally. 3 dimensions: Tunnels/Bridges.

TT3D – Future Work…

List is almost endless… Railways, Ships, Aircraft Towns Terrain generation Save Games Multiplayer – LAN / Internet AI / Computer players Lighting Artwork Etc…