Design Patterns in Game Development
Kalliokoski, Eleonoora (2023)
Kalliokoski, Eleonoora
2023
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-2023121337106
https://urn.fi/URN:NBN:fi:amk-2023121337106
Tiivistelmä
Tutkielma keskittyy ohjelmistojen suunnittelumallien käyttöön pelinkehityksessä sekä käytännön että teorian kautta. Pääasiallinen tavoite on tarjota esimerkkejä suunnittelumallien käytöstä pelinkehitysprosessissa sekä analysoida tekijöitä, jotka voivat vaikuttaa niiden käyttöön projektissa.
Tutkielman teoreettinen tausta keskittyy suunnittelumalleja ja niiden käytännön sovellusta koskeviin lähteisiin. Näistä lähteistä osa on erityisesti pelialaan liittyviä. Sen sijaan, että kaikki suunnittelumallit esiteltäisiin yksityiskohtaisesti, tutkielma tiivistää useimmat perusmallit lyhyesti ja tarjoaa yksityiskohtaisempia kuvauksia pienemmästä määrästä malleja, jotka ovat erityisen tärkeitä pohdinnalle.
Käytännön esimerkkien luomiseksi tutkielmaan sisältyi myös pieni peliprototyyppi. Prototyyppi toteutettiin Unity-pelimoottorissa käyttäen C#-ohjelmointikieltä. Prototyypin yleinen rakenne on selvitetty osana tutkielmaa. Projektin laajuus on tarkoituksellisen pieni, ja pääasiallinen tarkoitus prototyypin luomiselle oli luoda lyhyt mutta pelattava peli, kun taas tutkielman pääpaino on teoreettisella taustalla ja pohdinnalla.
Lukuunottamatta äänitiedostoja, jotka hankittiin erikseen asianmukaisilla lisensseillä, peliprojekti toteutettiin kokonaisuudessaan tutkielman piirissä. Tähän kuuluvat perusideointi ja konsepti, pelin ja pulmien suunnittelu, ohjelmointi ja perusgrafiikka. Prototyypin kehitys tapahtui samanaikaisesti teoreettisen tutkimuksen kanssa.
Lopullinen prototyyppi on nk. “pakopeli”, jossa pelaajan tulee ratkoa ongelmia ja käyttää esineitä pelin sisällä avatakseen oven ja voittaakseen pelin. Prototyyppinä peli on lyhyt, ja siihen sisältyy vain muutama pulma. Pelaajan vuorovaikutus tapahtuu hiirellä, ja pelin sisällä suunnistaminen näytöllä olevilla painikkeilla. Pelaaja voi myös kerätä esineitä pelin sisällä ja käyttää niitä muihin pelin elementteihin.
Kuvauksen jälkeen prototyyppi analysoidaan koodin ja rakenteen tasoilla, osoittaen sekä suunnittelumalleja jotka esiintyvät pelissä, että vaihtoehtoisia ratkaisuja jotka olisi voitu sisällyttää siihen. Lisäksi pohdinta koski pelimoottorin vaikutusta käytettyihin malleihin ja yleisesti olio-ohjelmointiin.
Pohdintaosiossa tuodaan esille lisää suunnittelumalleja. Etenkin pohditaan sitä, miten pelin laajuus ja teema saattavat vaikuttaa suunnittelumallien valintaan ja hyödyllisyyteen.
Tutkielman lopputulos on, että vaikka suunnittelumallit voivat olla hyödyllisiä pelinkehityksessä, niiden valintaan ja käyttöön liittyy useita tekijöitä. Lisäksi todettiin, että prototyypin koko rajoittaa siihen sisällytettävien mallien määrää ja tyyppiä, ja laajempi projekti olisi sallinut useampien mallien näyttämisen käytännössä. This thesis studies the use of software design patterns in game development through both a practical and theoretical lens. The main goal was to provide examples of design patterns as used in game development as well as analyse some factors that may affect their suitability to a given project.
The theoretical background of the thesis focuses on different sources on software design patterns and their practical implementations, with some sources concerning game development in particular. Rather than go in depth with all established design patterns, the thesis briefly summarizes most basic patterns and provides more thorough descriptions and examples of a smaller number of patterns that are especially relevant to the discussion.
To provide some practical examples, the thesis work included the development of a small game prototype. This prototype was developed on the Unity game engine using C#. The general structure of the prototype is described as part of the thesis. The scope was kept deliberately small, with the goal of producing a short but playable game experience with the main focus of the thesis being on the theoretical background and discussion.
With the exception of audio elements, which were acquired as pre-made assets, the game project was developed entirely within the context of this thesis. This included the basic concept and ideation, level and puzzle design, programming, and basic graphics. The development of the prototype was done concurrently with the background research.
The finished prototype game is in the “escape room” genre, where the player must solve puzzles and use items to open a final exit and win the game. As a prototype, the game is short, consisting of only two item puzzles and two lock puzzles. Player interactions are done with a mouse, and navigation from one screen to the next happens via on-screen buttons. The player is also able to pick up items within the game space and use them on game objects.
The prototype is then analysed on a structural and code level, identifying design patterns where they appear as well as patterns that could have been included without changing the premise or scope of the game. Some consideration was also given to the game engine and the ways it facilitates the inclusion of design patterns and the use of object oriented programming in general.
In the discussion section more patterns are brought into consideration, particularly in the context of game scope and genre and how these may affect the choice and usefulness of design patterns.
The final conclusion is that while design patterns can be useful in the development of games, there are several factors that affect the choice and usage. It was also concluded that the small scope of the prototype limits the extent to which it can include different patterns, and a larger project could showcase more patterns within the context of a single game.
Tutkielman teoreettinen tausta keskittyy suunnittelumalleja ja niiden käytännön sovellusta koskeviin lähteisiin. Näistä lähteistä osa on erityisesti pelialaan liittyviä. Sen sijaan, että kaikki suunnittelumallit esiteltäisiin yksityiskohtaisesti, tutkielma tiivistää useimmat perusmallit lyhyesti ja tarjoaa yksityiskohtaisempia kuvauksia pienemmästä määrästä malleja, jotka ovat erityisen tärkeitä pohdinnalle.
Käytännön esimerkkien luomiseksi tutkielmaan sisältyi myös pieni peliprototyyppi. Prototyyppi toteutettiin Unity-pelimoottorissa käyttäen C#-ohjelmointikieltä. Prototyypin yleinen rakenne on selvitetty osana tutkielmaa. Projektin laajuus on tarkoituksellisen pieni, ja pääasiallinen tarkoitus prototyypin luomiselle oli luoda lyhyt mutta pelattava peli, kun taas tutkielman pääpaino on teoreettisella taustalla ja pohdinnalla.
Lukuunottamatta äänitiedostoja, jotka hankittiin erikseen asianmukaisilla lisensseillä, peliprojekti toteutettiin kokonaisuudessaan tutkielman piirissä. Tähän kuuluvat perusideointi ja konsepti, pelin ja pulmien suunnittelu, ohjelmointi ja perusgrafiikka. Prototyypin kehitys tapahtui samanaikaisesti teoreettisen tutkimuksen kanssa.
Lopullinen prototyyppi on nk. “pakopeli”, jossa pelaajan tulee ratkoa ongelmia ja käyttää esineitä pelin sisällä avatakseen oven ja voittaakseen pelin. Prototyyppinä peli on lyhyt, ja siihen sisältyy vain muutama pulma. Pelaajan vuorovaikutus tapahtuu hiirellä, ja pelin sisällä suunnistaminen näytöllä olevilla painikkeilla. Pelaaja voi myös kerätä esineitä pelin sisällä ja käyttää niitä muihin pelin elementteihin.
Kuvauksen jälkeen prototyyppi analysoidaan koodin ja rakenteen tasoilla, osoittaen sekä suunnittelumalleja jotka esiintyvät pelissä, että vaihtoehtoisia ratkaisuja jotka olisi voitu sisällyttää siihen. Lisäksi pohdinta koski pelimoottorin vaikutusta käytettyihin malleihin ja yleisesti olio-ohjelmointiin.
Pohdintaosiossa tuodaan esille lisää suunnittelumalleja. Etenkin pohditaan sitä, miten pelin laajuus ja teema saattavat vaikuttaa suunnittelumallien valintaan ja hyödyllisyyteen.
Tutkielman lopputulos on, että vaikka suunnittelumallit voivat olla hyödyllisiä pelinkehityksessä, niiden valintaan ja käyttöön liittyy useita tekijöitä. Lisäksi todettiin, että prototyypin koko rajoittaa siihen sisällytettävien mallien määrää ja tyyppiä, ja laajempi projekti olisi sallinut useampien mallien näyttämisen käytännössä.
The theoretical background of the thesis focuses on different sources on software design patterns and their practical implementations, with some sources concerning game development in particular. Rather than go in depth with all established design patterns, the thesis briefly summarizes most basic patterns and provides more thorough descriptions and examples of a smaller number of patterns that are especially relevant to the discussion.
To provide some practical examples, the thesis work included the development of a small game prototype. This prototype was developed on the Unity game engine using C#. The general structure of the prototype is described as part of the thesis. The scope was kept deliberately small, with the goal of producing a short but playable game experience with the main focus of the thesis being on the theoretical background and discussion.
With the exception of audio elements, which were acquired as pre-made assets, the game project was developed entirely within the context of this thesis. This included the basic concept and ideation, level and puzzle design, programming, and basic graphics. The development of the prototype was done concurrently with the background research.
The finished prototype game is in the “escape room” genre, where the player must solve puzzles and use items to open a final exit and win the game. As a prototype, the game is short, consisting of only two item puzzles and two lock puzzles. Player interactions are done with a mouse, and navigation from one screen to the next happens via on-screen buttons. The player is also able to pick up items within the game space and use them on game objects.
The prototype is then analysed on a structural and code level, identifying design patterns where they appear as well as patterns that could have been included without changing the premise or scope of the game. Some consideration was also given to the game engine and the ways it facilitates the inclusion of design patterns and the use of object oriented programming in general.
In the discussion section more patterns are brought into consideration, particularly in the context of game scope and genre and how these may affect the choice and usefulness of design patterns.
The final conclusion is that while design patterns can be useful in the development of games, there are several factors that affect the choice and usage. It was also concluded that the small scope of the prototype limits the extent to which it can include different patterns, and a larger project could showcase more patterns within the context of a single game.