Thesis Rests with Its Author
Total Page:16
File Type:pdf, Size:1020Kb
University of Bath PHD A modular physics methodology for games Schanda, Florian Award date: 2012 Awarding institution: University of Bath Link to publication Alternative formats If you require this document in an alternative format, please contact: [email protected] General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain • You may freely distribute the URL identifying the publication in the public portal ? Take down policy If you believe that this document breaches copyright please contact us providing details, and we will remove access to the work immediately and investigate your claim. Download date: 26. Sep. 2021 A Modular Physics Methodology for Games submitted by Florian Schanda for the degree of Ph.D. of the University of Bath Department of Computer Science 2012 COPYRIGHT Attention is drawn to the fact that copyright of this thesis rests with its author. A copy of this thesis has been supplied on condition that anyone who consults it is understood to recognise that its copyright rests with the author and they must not copy it or use material from it except as permitted by law or with the consent of the author. This thesis may be made available for consultation within the University Library and may be photocopied or lent to other libraries for the purposes of consultation. Signature of Author.................................. ....................................... Florian Schanda Summary Currently, games with rich environments allowing a wide range of possible interactions and supporting a large number of physical simulations make use of a large number of scripts and bespoke physical simulations, adapted to fit the needs of the game. This thesis proposes a methodology that can be used to tie together various different physical simulations, both off-the-shelf and bespoke, such as rigid body physics, electrical and magnetic simulations to give something greater than the sum of the individual parts. We present a notation for designing the overall physical simulation and a means for the different parts to interact. Experiments using an implementation of the methodology containing electricity, rigid body simulation, magnetics (including electro-magnetics), buoyancy and sound show that it is pos- sible to model everyday objects such an electric motor or a doorbell. These object work ‘as expected’, without the need for special scripts and new, originally unexpected, interactions are possible without further modification of the experiment setup. Acknowledgements • First, and foremost, for many reasons, my supervisor Phil Willis. He had unending patience and never did give up on me, even if I was really, really late. He also patiently listened to all my crazy ideas and helped me distill something useful out of them, he always had a positive thought, helpful insight or an encouraging word ready when it was needed. Thank you Phil. • My examiners, Steven Pettifer (external) and Joanna Bryson (internal) for an interesting, intense and productive viva voce. • My proof-readers: Lucy Perry (all), my father Friedrich Schanda (all), Dalia Khader (parts) and of course Phil Willis (all). • I would like to thank Eamonn O’Neill and Angela Cobban. You may have forgotten what you did, but I did not. • My comrades in arms, Martin Brain1 and Jessica Jones. Without their support, nagging and distraction (with random side-projects) in the later years of this project I would have gone insane and this work would not have concluded. • My mother Ursula “A¨ıda” Schanda and my father for their write-up stories that made me feel a lot better for not doing as much work as I should (apparently scrubbing leaves of a rubber plant is more entertaining than writing up a PhD) and offering a lot of support. • Dalia Khader for being a good friend, great help with tutoring and for an entertaining motivational bet on who will finish writing up first, which I lost by more than a year. (Addendum: a lot more than a year now.) • Two of my undergraduate lecturers which significantly shaped and influenced my under- standing of computer science: John Fitch and James Davenport. • Praxis for giving me 10 out of 15 days taken as holiday in order to finish writing up for free and then a 3 months sabbatical. In particular I would like to thank Anna Mascetti for suggesting and organising the free 10 days for me - thank you; it was appreciated! • Carina Murman who helped a lot with tutoring and the occasional lecturing and general sanity as I could rant to somebody sympathetic about the absence of mixing taps in the UK. • Comrades Carl, Jan and Hagen with whom I shared a house with in the second and third year of this project. • Comrades Cat and Emma for being awesome friends. Thanks - many a good rant was had. 1Who just lost the game. • Comrade Doug for running a pretty epic SR campaign. Also you were the first person I knew of roughly my age finishing a PhD; proving that it could be done. • Richard Stallman for pointing out the evils of proprietary software and for creating the GPL. Please never stop what you are doing. • Debian GNU/Linux, the GNU Project and the Linux Kernel. Everything produced and used in this project was based on free software. • Comrade Martin for destroying the word “Furthermore” for me. • Comrade computers florian, and later axiom, for hosting the repository of my work. In particular florian that survived being short-circuited with a 5p coin. Despite the magic smoke escaping, you continued to work to this day. You were with me since 2001. • Joanna Bryson for providing me with my first free laptop, on the condition that I ac- knowledge her in my thesis. So there ;) (Back then it was not known that you were my internal examiner.) 3 Contents 1 Introduction 9 1.1 Motivation ...................................... 9 1.2 Documentoverview................................ 10 2 Physical simulations and games 12 2.1 OverviewofGameTypes ............................. 12 2.2 Introduction to physical simulation in games . .......... 13 2.3 Rigidbodysimulationingames. ..... 15 2.3.1 2Drigidbodysimulationengines . 16 2.3.2 3Drigidbodysimulationengines . 16 2.3.3 Dedicatedcollisiondetection . ..... 17 2.4 Notablecommercialphysicsengines . ....... 17 2.5 Unifiedphysicsengines. 18 2.6 Other interesting physical simulations . .......... 18 2.6.1 Sound ..................................... 18 2.6.2 Electricity................................... 20 2.6.3 Computationalfluiddynamics . 21 2.7 Dynamicworlds................................... 23 2.7.1 Levelofdetail................................. 24 2.8 Otherrelatedworkandconcepts . ..... 25 2.8.1 VirtualManufacturingatBath . 25 2.8.2 PhysicsSandbox ............................... 25 2.8.3 Pipelines ................................... 26 2.8.4 PresenceandEngagement . 26 2.8.5 Notation.................................... 26 2.9 Conclusion ...................................... 26 2.10Addendum ...................................... 27 3 Goals, assumptions and constraints 28 3.1 Anexamplescenario ............................... 28 3.2 Goalsofthemethodology . 29 4 3.3 Assumptionsforthemethodology. ...... 29 3.3.1 Number of solutions and script complexity. ....... 29 3.3.2 Differentworldbuilding . 30 3.3.3 Noconflictingassumptions . 31 3.4 Challengesanddesirableproperties . ......... 31 3.4.1 Staticworlds ................................. 31 3.4.2 Predictabilityandconsistency. ...... 32 3.4.3 Identifyingspecialcases . 32 3.5 Constraints ..................................... 32 3.6 Summary ....................................... 33 4 The methodology: concept and design 34 4.1 Outline ........................................ 34 4.1.1 Splittingupdynamics . 35 4.1.2 Re-factoring of the electricity simulation . .......... 36 4.2 Thefourcomponents............................... 37 4.2.1 Part1: properties(datastore) . 37 4.2.2 Part2: resolvers(simulation) . ..... 38 4.2.3 Part 3: derived property sets (re-factoring and abstraction) ....... 39 4.2.4 Part4: interactions(glue) . 41 4.3 Concludingremarks ............................... 42 5 The methodology: definition 43 5.1 Introduction.................................... 43 5.2 MainLoop ...................................... 43 5.3 Layer1:properties ............................... 44 5.4 Layer2:resolvers................................ 45 5.4.1 Relatedconcepts ............................... 47 5.5 Layer3: derivedpropertysets. ...... 47 5.6 Layer4:interactions ............................. 49 5.7 Additionalnotes ................................. 49 5.7.1 Schedulingandparallelism . 50 5.7.2 Orderdependencewithinresolvers . ..... 51 5.7.3 Ausefulshortcut............................... 53 5.8 Concludingremarks ............................... 54 6 The methodology: implementation, experiments and results 55 6.1 Introduction.................................... 56 6.2 ArchitectureOverview . 56 6.2.1 Implementation language and build system . ...... 56 6.2.2 Architecture ................................. 57 6.2.3 Designpatterns................................ 57 5 6.2.4 Userinterface................................. 59 6.2.5 Orderofimplementation. 60