Game Engine for Loc Game Engine for Location-Based Services Based
Total Page:16
File Type:pdf, Size:1020Kb
FACULDADEDE ENGENHARIADA UNIVERSIDADEDO PORTO GameEngineforLocation -Based Services TiagoPintoFernandes MasterinInformaticsandComputingE ngineering Supervisor: AntónioCoelho(AuxiliarProfessor) June2010 Game Engine for Location Based Services – Tiago Fernandes – MIEIC / FEUP – 2009/2010 ©TiagoPintoFernandes,2010 2 Game Engine for Location Based Services – Tiago Fernandes – MIEIC / FEUP – 2009/2010 GameEngineforLocationBasedServices TiagoFernandes MasterinInformaticsAndComputingEngineering AprovadoemprovaspúblicaspeloJúri: Presidente:NomedoPresidente(Título) VogalExterno:NomedoArguente(Título) Orientador:NomedoOrientador(Título) ____________________________________________________ 3 Game Engine for Location Based Services – Tiago Fernandes – MIEIC / FEUP – 2009/2010 30deJunhode2010 Resumo O objectivo do presente projecto consiste em introduzir uma nova dimensão ao conceito de motor de jogo, através da implementação do conceito de Location-Based Services numa Frameworkdecriaçãodejogos.Hojeemdia,existe umgrandenúmerodemotoresdejogo, comerciaisougratuitos,disponíveisnomercado.Porém,poucoscontemplamapossibilidadede tirar partido das capacidades e conceitos relativos aos serviços de localização geográfica existentes. Os que procuram utilizar estes conceitos, normalmente estão muito longe do que habitualmenteéconsideradoummotordejogo,devidoaofactodenãoconseguiremfornecer umabasedeprogramaçãoestávelouumaplataformadedesenvolvimentoflexívelparaacriação dejogos,tendousualmenteporbaseplataformasWebnasquaisosutilizadoresdevemactualizar oseuestadosemprequejogamumdestesjogos. Assim,omotordejogo Punkman ,descritonestadissertação,procuraapresentarumanovae inovadoraformadeabordarestaproblemáticaefornecerumaplataformaestáveleexpansível paraodesenvolvimentodejogosquepossamutilizarascapacidadesdosserviçosdebaseados em localização. O principal objectivo deste projecto consiste então em apresentar uma arquitecturaquesejacapazdesuportarummotordejogoquepossaserutilizadoemdiferentes plataformas de hardware e software, que seja expansível e capaz de utilizar a informação geográficaedeposicionamentoexistente,taiscomomapasoupontosdeinteresse,nacriaçãode jogos. Porém, alguma parte da implementação é ainda descrita, assim como alguns algoritmos e comparações com outras implementações. Todos os pontos de expansão do motor foram testadoseimplementadospelomenosumavez,demodoagarantirqueomotoréexpansívele simplesdeutilizar.Opresentedocumentoapresentaosdetalhesdestasimplementações. 4 Game Engine for Location Based Services – Tiago Fernandes – MIEIC / FEUP – 2009/2010 30th,June2010 Abstract Theobjectiveofthepresentprojectistogiveanewdimensiontotheconceptofgameengine, byintroducinglocation-awarenesstoagamecreationframework.Nowadays,thereareagreat number of game engines available in the market, both commercial and non-commercial. However,fewarethosethatcontemplateandtakeadvantageoftheconceptoflocation-based services.Thosewhouseitcanbarelybeconsideredrealgameengines,duetothefactthatthey donotusuallyprovideastableprogrammingordevelopingplatformforthecreationofgames. Rather,theyconsistmoreofweb-basedplatformsinwhichtheusersmustupdatetheirstatus andnotnecessarilybasedonspecifichardwareplatforms. The PunkMan engine, explained in this thesis, attempts to present a new and innovative approachtothisthemeandprovideastableandexpansibleplatformforthedevelopmentof gamesthatmayusethecapabilitiesoflocation-basedservices.Themaingoalofthisthesisisto presentasuitablearchitectureforthegameenginethatcanbeusedindifferenthardwareand softwareplatforms,isextensibleandisableofusingthegeographiclocation,andunderlying geographical information present, such as maps, points of interest, etc. to create games. However, the actual implementation of some concepts is also described, as well as the algorithmsusedandsomebenchmarkingcomparisons.Alloftheengineexpansionpointswere testedandatleastoneconcreteimplementationwascreatedinordertoverifythattheengineis expansibleandeasytouse.Thecurrentdocumentpresentsthedetailsontheseimplementations. 5 Game Engine for Location Based Services – Tiago Fernandes – MIEIC / FEUP – 2009/2010 Acknowledgments Inthefirstplace,Iwouldliketopresentmythanks to prof. António Coelho for the supportduringthepresentprojectandforthehelpgivenwhentheworkandtimetodevelopthis thesiswasinseriousrisk.Iowemyveryspecialthankstoprof.A.AugustodeSousaandprof. Fernando Nunes Ferreira for guiding me all of these years and for all the support and for introducingmetothisamazingworldofComputerGraphicsandImagery.Also,Iwanttothank tomyparentswhohavealwaysgivenmeeverythingIneeded(andmore)toreachthispointand havealwaysbeenpresentwhenIneeded.Finally,butnotleastimportant,Iwanttopresentmy very special thanks to Mariana Teixeira, to whom this work is dedicated, for basically everything,butespeciallyforbeingbymysideineveryoccasionandhelpingmetofaceallof theproblemsthatappearedalongthislongway. TiagoFernandes 6 Game Engine for Location Based Services – Tiago Fernandes – MIEIC / FEUP – 2009/2010 Contents 1.Introduction .................................................................................................. 12 1.1 Motivation .......................................................................................... 13 1.2 Problemstatement ................................................................................. 13 1.3 Objectives .......................................................................................... 14 1.4Expectedresults ......................................................................................... 15 1.5Documentstructure ..................................................................................... 15 2Stateoftheart ................................................................................................ 17 2.1Historyofvideo-games ................................................................................. 17 2.2Evolutionofhardware .................................................................................. 20 2.3Psychologyofgaming .................................................................................. 26 2.4Anoverviewofgameengines .......................................................................... 31 2.5LocationBasedServices ................................................................................ 37 2.6MobileGaming .......................................................................................... 40 2.7LocationBasedGaming ................................................................................ 44 3.AgameengineforLBS ..................................................................................... 47 3.1Enginerequirements .................................................................................... 47 3.2Methodologyandenginephilosophy .................................................................. 50 3.3Architecture ............................................................................................. 52 4.CoreComponentsLayer .................................................................................... 62 4.1.DataStructures ......................................................................................... 62 4.1.1.Integertypes ....................................................................................... 63 4.1.2.Floatingvsfixedpointarithmetics ............................................................... 63 4.1.3.Strings .............................................................................................. 65 4.1.4.Arrays .............................................................................................. 65 4.1.5.HashMaps ......................................................................................... 67 4.1.6.MathLibrary ....................................................................................... 68 4.1.7.Pseudo-ReflectionSystem ........................................................................ 69 4.1.8.Serializationsystem ............................................................................... 71 7 Game Engine for Location Based Services – Tiago Fernandes – MIEIC / FEUP – 2009/2010 4.1.9.GraphLibrary ...................................................................................... 73 4.2.EventSystem ........................................................................................... 74 4.3.FileSystemAccess ..................................................................................... 75 4.4.Networking ............................................................................................. 76 4.5.ThreadManagement ................................................................................... 77 4.6.Otherfeatures ........................................................................................... 79 5.TheRendererLayer ......................................................................................... 80 5.1.WindowManagers ..................................................................................... 81 5.2.Renderers ............................................................................................... 82 5.3.2Dsystem ............................................................................................... 85 5.4.Transformations ........................................................................................ 86 5.5.Animations .............................................................................................. 88 5.6.Geometry ..............................................................................................