Rally Sport Racing Game: Codename Space Racer
Total Page:16
File Type:pdf, Size:1020Kb
Rally Sport Racing Game: CodeName Space Racer - An evaluation of techniques used when developing a marketable 3D game Sebastian Almlöf (Chalmers) Daniel Axelsson (GU) Ludvig Gjälby (Chalmers) Maria Lemón (GU) Markus Pettersson (Chalmers) Joakim Råman (Chalmers) Gustav Örnvall (Chalmers) Department of Computer Science and engineering CHALMERS UNIVERSITY OF TECHNOLOGY UNIVERSITY OF GOTHENBURG Gothenburg, Sweden 2012 Bachelor’s thesis no 2012:27 ABSTRACT In this thesis, various modern game programming and modeling techniques are presented, with a focus on algorithms for graphical effects. A few of those techniques have then been selected and implemented in a graphics-intensive racing game set in an open space environment. The game is developed from the ground up in C# with the XNA 4.0 framework. The performance of the implemented techniques has then been evaluated. For the graphics, implementations of deferred rendering, Phong-shading, environment maps, exponential shadow maps, screen-space ambient occlusion, lens flares, bloom, depth of field and motion blur have been included in the game. A physics engine has been developed from the ground up using a numerical implementation of Newtonian mechanics with Euler-forward integration and a multi-phase collision detection system using Sweep-and-prune and OBB-intersection algorithms. Network play allowing games over LAN or the Internet has been included with the help of the Lidgren-network-gen3 library. TABLE OF CONTENTS 1 Introduction .................................................................................................................................................. 1 1.1 Background.......................................................................................................................................... 1 1.2 Purpose ................................................................................................................................................ 1 1.3 Problem ................................................................................................................................................ 1 1.4 Limitations ........................................................................................................................................... 2 1.5 Programming language and framework ......................................................................................... 2 2 Method ........................................................................................................................................................... 3 2.1 Design ................................................................................................................................................... 3 2.2 Coding .................................................................................................................................................. 4 2.3 Testing .................................................................................................................................................. 4 2.4 Optimization ....................................................................................................................................... 5 3 Gameplay design .......................................................................................................................................... 6 3.1 Introduction ......................................................................................................................................... 6 3.2 Study of design choices ...................................................................................................................... 6 3.3 Racing in space .................................................................................................................................... 6 3.4 Player movement ................................................................................................................................ 7 3.5 Precision modifying ........................................................................................................................... 9 3.6 Tracks ................................................................................................................................................... 7 3.7 Multiplayer ........................................................................................................................................ 10 3.8 Discussion and Result ...................................................................................................................... 10 4 Graphics ....................................................................................................................................................... 13 4.1 The graphics pipeline ....................................................................................................................... 13 4.2 Gaussian blur .................................................................................................................................... 14 4.3 Culling ................................................................................................................................................ 15 4.4 Shading .............................................................................................................................................. 18 4.5 Multiple light sources....................................................................................................................... 21 4.6 Shadows ............................................................................................................................................. 26 4.7 Ambient Occlusion ........................................................................................................................... 33 4.8 Environment mapping ..................................................................................................................... 37 4.9 Motion blur ........................................................................................................................................ 43 4.10 Depth of field ..................................................................................................................................... 47 4.11 Glare ................................................................................................................................................... 51 4.12 Particle systems ................................................................................................................................. 54 4.13 Results of all the implemented graphical effects .......................................................................... 56 4.14 Discussion about all the implemented graphical effects ............................................................. 57 5 Modeling ..................................................................................................................................................... 58 5.1 Introduction ....................................................................................................................................... 58 5.2 Software ............................................................................................................................................. 58 5.3 Tools and features ............................................................................................................................. 59 5.4 Polygon count ................................................................................................................................... 60 5.5 Texture-mapping .............................................................................................................................. 61 5.6 Method: Our implementation ......................................................................................................... 62 5.7 Result .................................................................................................................................................. 62 5.8 Discussion .......................................................................................................................................... 62 6 Physics ......................................................................................................................................................... 63 6.1 Introduction ....................................................................................................................................... 63 6.2 Ordinary differential equations ...................................................................................................... 63 6.3 Newtonian mechanics ...................................................................................................................... 64 6.4 Collision detection ............................................................................................................................ 67 6.5 Collision response ............................................................................................................................. 68 6.6 Method: Our implementation ......................................................................................................... 69 6.7 Result .................................................................................................................................................. 70 6.8 Discussion .........................................................................................................................................