Programming Documentation
Total Page:16
File Type:pdf, Size:1020Kb
Flying Samurai { Programming documentation Jan Beneˇs,Osk´arElek, Marek Hanes, J´anZahornadsk´y June 3, 2010 \We make war that we may live in peace." | Aristotle Contents 1 Introduction 1 2 About the project 2 2.1 Team..................................................2 2.2 Externists . .3 2.3 Review of specification . .5 2.4 Hardware requirements . .6 2.5 Comparison with similar software . .6 2.6 Timeline . .7 2.7 Future of the project . .8 2.8 Known bugs . .9 2.9 Some statistics . 10 3 Building the project 11 3.1 Setting up the environment . 11 3.2 Building from sources . 11 4 Programming documentation 12 4.1 Architecture . 13 4.2 Multi-threading model . 15 4.2.1 Threads and their purpose . 15 4.2.2 Synchronization . 15 4.2.3 Messages and heartbeat . 16 4.2.4 Reader and Writer . 16 4.2.5 Structures . 17 4.2.6 Swap and swap chain . 18 4.2.7 Messages in detail . 19 4.3 Menu ................................................. 21 4.3.1 Concepts . 21 4.3.2 Implementation . 21 4.3.3 Handlers and actions . 21 4.4 Game logic . 23 4.4.1 Logical entities . 23 4.4.2 Mission . 24 4.4.3 Career . 26 4.5 Graphics . 27 4.5.1 Scene graph . 28 4.5.2 Airplane meshes . 29 4.5.3 Terrain . 33 4.5.4 Static terrain geometry . 36 4.5.5 HUD and debugging graphics . 38 4.5.6 Special effects . 39 4.5.7 Camera . 40 4.5.8 GUID . 40 4.6 Physics . 41 4.6.1 Introduction . 41 4.6.2 Model overview . 41 4.6.3 Model parameters . 42 4.6.4 Core formulae . 46 4.6.5 Input processing . 48 4.6.6 Visualization . 48 4.6.7 Damage model . 49 4.6.8 Collision reaction . 51 4.7 AI ................................................... 53 4.7.1 Overview . 53 4.7.2 Environment knowledge . 54 4.7.3 Agent states . 56 4.7.4 Agent role . 57 4.7.5 Decision making . 59 4.7.6 Inverse motion . 60 4.8 Input . 62 4.8.1 Abstraction layer . 62 4.9 Sound . 64 4.9.1 Requirements . 64 4.9.2 Resources and usage . 64 4.9.3 Integration . 64 4.9.4 Interface . 64 4.10 Miscellaneous . 65 4.10.1 Consoles . 65 4.10.2 SettingsFile . 65 4.10.3 Command line parameters . 66 4.10.4 Helper code . 66 4.10.5 Code sharing foundation . 66 4.10.6 Multi-platform support . 67 5 Conclusions 68 6 Acknowledgements 69 7 References 70 A Startup 72 B Game parameters definition file ("entities file”) 73 B.1 MOD ................................................. 73 B.2 Period . 73 B.3 Map.................................................. 74 B.4 Front.................................................. 74 B.5 Nations, Sides . 75 B.6 Airfields, Squadrons . 75 B.7 Airplanes . 76 B.8 Pilots . 76 B.9 Ranks . 77 B.10 Awards . 77 B.11 News . 77 B.12 Physics, Gun . 78 B.13 AIParams, NeuralParams . 78 C Media directory 80 D Terrain preparation workflow 81 D.1 Terrain elevation maps . 81 D.2 Splatting maps . 82 D.3 Forest and city data . 84 E Adding new models into the game 86 F Modelling.