Presentation on theme: "Adam Miles. Transport Tycoon Deluxe (TTD): Written by Chris Sawyer for Microprose in 1994. Written almost entirely in Assembly language. Designed."— Presentation transcript:
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.
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.
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.
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
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).
World Chunking Frustum Culling Hardware Instancing
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.
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.
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…
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…
Windows Z-Order Dragging Focus Resizing Visibility Hierarchy Controls Label Button Textbox Radio button Checkbox List box View Window Scrollbar Title Bar TT3D implements:
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.
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.
List is almost endless… Railways, Ships, Aircraft Towns Terrain generation Save Games Multiplayer – LAN / Internet AI / Computer players Lighting Artwork Etc…