Casanova: a language for game development

DSpace/Manakin Repository

Show simple item record

dc.contributor.advisor Bugliesi, Michele
dc.contributor.advisor Spronck, Pieter
dc.contributor.author Maggiore, Giuseppe <1985> it_IT
dc.date.accessioned 2013-07-26T09:12:28Z
dc.date.available 2013-07-26T09:12:28Z
dc.date.issued 2013-04-19
dc.identifier.uri http://hdl.handle.net/10579/3046
dc.description.abstract In this work we present Casanova, a programming language. Its novelty lies in the fact that it was designed with an exclusive focus on making games. The goal of Casanova is to change the landscape of game development, by show-ing how programming languages, and not game engines and game development sys-tems, are the real frontier to explore in order to make game development truly easier. In this work we do not just show Casanova. We also present an extensive eval-uation of our own experience in using the current implementation of Casanova in order to build games and simulations. We conclude that Casanova is not just capable of making games, but that it also makes it easier to create games and to avoid bugs and common pitfalls. it_IT
dc.description.abstract In questo lavoro presentiamo Casanova, un linguaggio di programmazione. La novità sta nel fatto che è stato progettato con un focus esclusivo sul realizzare videogiochi. L'obiettivo di Casanova è quello di cambiare lo sviluppo di giochi, mostrando come linguaggi di programmazione, e non motori di gioco e sistemi di sviluppo del gioco siano la vera frontiera da esplorare al fine di rendere più facile lo sviluppo di giochi. In questo lavoro non ci limitiamo a mostrare Casanova. Presentiamo anche una valutazione approfondita della nostra esperienza nell'utilizzo dell'implementazione corrente di Casanova per costruire giochi e simulazioni. Concludiamo che Casanova non è solo in grado di supportare la realizzazione di giochi, ma anche che rende più facile evitare errori e difficoltà comuni. it_IT
dc.language.iso eng it_IT
dc.publisher Università Ca' Foscari Venezia it
dc.rights © Giuseppe Maggiore, 2010 it_IT
dc.subject Game development it_IT
dc.subject Programming languages it_IT
dc.subject Functional programming it_IT
dc.subject Casanova <linguaggio di programmazione> it_IT
dc.title Casanova: a language for game development it_IT
dc.type Doctoral Thesis en
dc.degree.name Informatica it_IT
dc.degree.level Dottorato di ricerca it
dc.degree.grantor Scuola di dottorato in Scienze e tecnologie (SDST) it_IT
dc.description.academicyear 2013 it_IT
dc.description.cycle 25 it_IT
dc.degree.coordinator Focardi, Riccardo
dc.location.shelfmark D001256 it
dc.location Venezia, Archivio Università Ca' Foscari, Tesi Dottorato it
dc.rights.accessrights openAccess it_IT
dc.thesis.matricno 819050 it_IT
dc.format.pagenumber VIII, 200 p. it_IT
dc.subject.miur INF/01 INFORMATICA it_IT
dc.description.tableofcontent 1 Introduction 1 1.1 Games, board games, and video games . . . . . . . . . . . . . . . . . 1 1.2 The challenge of game development . . . . . . . . . . . . . . . . . . . 2 1.3 Problem statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 Research questions and process . . . . . . . . . . . . . . . . . . . . . 4 1.4.1 A new programming language . . . . . . . . . . . . . . . . . . 5 1.5 Structure of This Work . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 Requirements of a game 9 2.1 The game loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 State machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3 Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3 Available game development systems and languages 21 3.1 Systems vs languages . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.2 Systems for making games . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2.1 Relevant game systems . . . . . . . . . . . . . . . . . . . . . . 23 3.2.2 Our choice of systems . . . . . . . . . . . . . . . . . . . . . . . 24 3.2.3 Game Maker . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.3 Languages for making games . . . . . . . . . . . . . . . . . . . . . . . 28 3.3.1 Simula 67 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.3.2 Inform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.3.3 SGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 3.4 Motivating a new programming language . . . . . . . . . . . . . . . . 33 3.4.1 Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.4.2 Correctness . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.4.3 E ciency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.5 Creating new languages for making games . . . . . . . . . . . . . . . 37 4 Design of Casanova 39 4.1 The RSD pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.2 Motivation for a new language . . . . . . . . . . . . . . . . . . . . . . 40 4.3 Design Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.4 Informal design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 ii Contents 5 Syntax of Casanova 45 5.1 Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 5.2 Type System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.2.1 Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.2.2 Coroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6 Semantics of Casanova 51 6.1 Informal Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.1.1 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6.1.2 Correctness . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6.1.3 Bouncing Balls . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.2 Formal Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 6.2.1 Types Translation . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.2.2 Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 6.2.3 Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.2.4 Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 7 Implementation of Casanova 65 7.1 Rule Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 7.2 Generating the Update and Draw Functions . . . . . . . . . . . . . . 67 7.2.1 Naïve traversal . . . . . . . . . . . . . . . . . . . . . . . . . . 68 7.2.2 Traversal with CPS caching . . . . . . . . . . . . . . . . . . . 69 7.3 Scripts and coroutines . . . . . . . . . . . . . . . . . . . . . . . . . . 72 7.3.1 A DSL for Scripting . . . . . . . . . . . . . . . . . . . . . . . 76 7.3.2 Scripting in Games . . . . . . . . . . . . . . . . . . . . . . . . 79 8 Making games in Casanova 89 8.1 Game of Life . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 8.2 Making games with Casanova . . . . . . . . . . . . . . . . . . . . . . 94 8.3 Player avatar and shooting stu . . . . . . . . . . . . . . . . . . . . . 95 8.4 Game map and monsters with AI . . . . . . . . . . . . . . . . . . . . 98 8.5 Active map entities and selection-based input . . . . . . . . . . . . . 100 8.6 Recombining the samples . . . . . . . . . . . . . . . . . . . . . . . . . 102 8.7 Hand written optimizations . . . . . . . . . . . . . . . . . . . . . . . 103 9 Evaluation of Casanova 105 9.1 Supported Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 9.2 Features to Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 9.2.1 Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 9.3 Quantitative assessment . . . . . . . . . . . . . . . . . . . . . . . . . 110 9.3.1 Coroutines in games . . . . . . . . . . . . . . . . . . . . . . . 110 9.4 Casanova in education . . . . . . . . . . . . . . . . . . . . . . . . . . 111 9.4.1 High school students . . . . . . . . . . . . . . . . . . . . . . . 112 Contents iii 9.4.2 Master students . . . . . . . . . . . . . . . . . . . . . . . . . . 112 10 Discussion 115 10.1 Original research questions . . . . . . . . . . . . . . . . . . . . . . . . 115 10.2 Extension opportunities for Casanova . . . . . . . . . . . . . . . . . . 116 10.2.1 Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 10.2.2 Standard library . . . . . . . . . . . . . . . . . . . . . . . . . 117 10.2.3 IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 10.2.4 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 10.2.5 AI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 10.2.6 AAA games . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 10.3 Shortcomings of Casanova . . . . . . . . . . . . . . . . . . . . . . . . 119 10.3.1 Low-level optimizations . . . . . . . . . . . . . . . . . . . . . . 119 10.3.2 Imperative mindset shift . . . . . . . . . . . . . . . . . . . . . 120 10.3.3 Unusual syntax . . . . . . . . . . . . . . . . . . . . . . . . . . 120 10.3.4 Advanced rendering . . . . . . . . . . . . . . . . . . . . . . . . 120 10.3.5 Other languages . . . . . . . . . . . . . . . . . . . . . . . . . . 120 11 Conclusions 123 Bibliography 127 A Building a Menu System 139 B Networking in Casanova 143 B.1 Networking and games . . . . . . . . . . . . . . . . . . . . . . . . . . 143 B.2 Common solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 B.3 Networking in Casanova . . . . . . . . . . . . . . . . . . . . . . . . . 145 B.4 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 C A General-purpose AI for Casanova 149 C.1 Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 C.2 Agent stats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 C.3 Naïve GOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 C.4 Heuristic pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 C.5 Acting out plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 C.6 Layered GOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 C.7 Learning Expected Costs and Bene ts . . . . . . . . . . . . . . . . . 156 C.7.1 Learning Whole Plans . . . . . . . . . . . . . . . . . . . . . . 157 C.7.2 Learning and Layers . . . . . . . . . . . . . . . . . . . . . . . 158 C.7.3 Implicit Social Interactions . . . . . . . . . . . . . . . . . . . . 158 C.7.4 Explicit Social Interactions . . . . . . . . . . . . . . . . . . . . 159 C.8 Assessment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 C.9 Missing and implemented . . . . . . . . . . . . . . . . . . . . . . . . . 161 iv Contents D Casanova and Data-bases 163 D.1 The Game World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 D.2 Persistency, Saving Games and Multiplayer Games . . . . . . . . . . . . . . . . . . . . . . . . . . 165 E Casanova in Other Languages 167 E.1 Haskell and type classes . . . . . . . . . . . . . . . . . . . . . . . . . 167 E.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 E.1.2 Advanced uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 E.1.3 Casanova in Haskell, a sketch . . . . . . . . . . . . . . . . . . 169 E.2 C++ and partial template specialization . . . . . . . . . . . . . . . . 171 E.2.1 Casanova rules . . . . . . . . . . . . . . . . . . . . . . . . . . 172 E.2.2 Casanova scripts . . . . . . . . . . . . . . . . . . . . . . . . . 174 E.2.3 Asteroids game . . . . . . . . . . . . . . . . . . . . . . . . . . 176 E.2.4 Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 F A Brief Introduction to F# 181 F.1 let and fun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 F.2 Lists and sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 F.3 Basic type de nitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 F.4 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 F.5 Units of measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 G A Brief Introduction to Monads 189 Summary 197 About the author 199 it_IT
dc.degree.discipline Game development it_IT


Files in this item

This item appears in the following Collection(s)

Show simple item record