# Lecture 4 - System Dynamics ### SET09121 - Games Engineering
Babis Koniaris
School of Computing. Edinburgh Napier University --- # Recommended Reading Game Design Workshop. 4th Edition. Tracy Fullerton (2019). - Read Chapter 5 on System Dynamics. - Digital copies are available in the library. ![GameDesignWorkshopBook](assets/images/gdw_book.jpg) --- # What is a System? - An example of a system is an engine. - Real, or a software one, like what we are going to build in the module. - An engine is a system with a particular objective. - That objective is to power some form of manual action. - We can apply our formal elements when thinking about systems. ![image](assets/images/engine.jpg) --- # Games as Systems - When we consider games as systems, we focus on **objects** that interact with each other according to their **properties**, **behaviors**, **relationships**. --- # Objects - Objects are the basic elements of a system. Consider the objects you define in object-oriented development. - For example: an engine, steering wheel, and wheels interact together to allow a car to operate. - The complexity of the underlying system is hidden behind an interface. For a car, this is the steering wheels and pedals. - Objects are defined by their properties, behaviors, and relationships with each other. - In games the most basic of object is usually called an Entity, Actor, or Game Object. - Almost everything in a game is an object. - For example: players, opponents, environment. --- # What Objects Are Here? ![image](assets/images/mario.jpg) --- # Spelunky - Spelunky is one of the best (?) examples of inheritance in games - Olmec, a boss, inherits from a push block - The ghost can be killed because of inheritance! - More info: https://www.rockpapershotgun.com/2016/03/04/making-of-spelunky/ --- # Properties - Properties are the attributes of the objects in a system. - From an OO point of view, properties are values stored in the object. - Some properties might change over the course of a game while others remain constant. - In checkers, the color of a piece remain constant. - The position of a piece might change at every turn. - More properties make the game more complex. - More complex does not always mean better. - Some common properties include: - Position. - Appearance. - A flag (bool) to indicate whether the object is alive. --- # What Properties are Here? ![image](assets/images/dragon_age.jpg) --- # Behaviours - Behaviours are the actions that an object undertakes. - From an OO point of view, behaviours are implemented as methods of an object. - Many of the behaviours are interlinked with the state of the object. - An engine requires fuel to be turned on. - Adding more behaviors to a game makes it harder to predict. - Depending on the kind of game you want to create, this might be desirable or not. --- # Behaviours (cont.) - Behaviours (==actions) "happen" during the update step. - For example, when B is pressed the player should jump. - Player's actions are normally based on the controls (Procedures from Formal Elements). - Computer controlled actions are normally supplied via some form of Artificial Intelligence (System procedures, objectives, rules). - The physical objects are normally controlled by the physics system. --- # What Behaviours are Here? ![image](assets/images/minecraft.jpg) --- # What Behaviours are Here? ![image](assets/images/pacman.gif) --- # Behaviours in PacMan. - There are three major behaviours: - Chase / Scatter / Frightened - Each ghost has it's own chase behaviour - Blinky always goes for you - Pinky tries to get in front of you - Inky targets a space based on Blinky and your position - Clyde retreats when getting too close to the player. - Behaviours change based on game state. --- # More about PacMan https://dev.to/code2bits/pac-man-patterns--ghost-movement-strategy-pattern-1k1a
--- # Relationships - To turn a set of objects into a system, we need relationships between them. - The steering wheel of a car is connected to the wheels. - The position of chess pieces on the board determines how pieces can interact with each other. - The position of Tetris pieces determine if lines are cleared, and where falling pieces stop. - Some relationships between objects can be changed by the player. - Chess pieces can be moved to a different location. - Some relationships can be based on the current state. - If a character is wanted then guards will chase them on sight. --- # What Relationships are Here? ![image](assets/images/cities_skylines.jpg) --- # System Dynamics - A system is more than the objects that make it up. - Dynamic relationships cause unforeseen interactions and Conflict. - Small changes in object properties can have a dramatic effect. - To understand a game it is necessary to observe the dynamics of the system during play. --- # De-constructing Games --- # De-constructing Tic-Tac-Toe - Tic-Tac-Toe (noughts and crosses) is a simple game. - **Objects:** the nine squares. - **Properties:** symbol within the square (`O`, `X`, or empty). - **Behaviours:** place a symbol inside a square. - **Relationships:** location of squares on the board. --- # Tic-Tac-Toe Game States ![image](assets/images/tic-tac-toe.jpg) --- # De-constructing Chess - Chess is a significantly more complex and strategic game than Tic-Tac-Toe. - **Objects**: board, pieces. - **Properties**: colour, rank, and location of a piece. - **Behaviours**: move a piece. - **Relationships**: location of pieces relative to other pieces. --- # De-constructing Chess - Why is chess so much more interesting than tic-tac-toe? - Simple but different behavior for different pieces. - Much larger range of possibilities. - Much more complex relationship between the pieces. --- # Example Systems --- # Economies - In-game economies are often simplified compared to the real-world. - **Bartering Economy**: Exchange goods for other goods. - **Market Economy**: Have a currency which can be used to buy any good. - Some economies even have inflation (MMOs) as a result of how the economy is designed. --- # Emergent Systems - Emergent systems exhibit behavior not explicitly programmed. The behavior emerges from the rules placed on the objects. - Birds flocking is such a behavior. - Very relevant to game AI. - Nature is full of such systems. - Examples include: Game of Life, Spore, The Sims. ![image](https://66.media.tumblr.com/303da0502e45b38484e73b174b3db9db/tumblr_nhte1rMwH01teec4eo2_500.gif) ![image](https://media.indiedb.com/images/articles/1/182/181609/flock4.gif) --- # System Interaction - What information is provided to the player about the system? - Hiding information encourages guessing, bluffing, deceiving. - What can the player control? - This has a huge impact on the top-level experience of the game. - What feedback occurs within the system? - Positive (reinforcing) feedback forces a system towards one extreme. (Morrowind potions) - Negative (balancing) feedback forces a system towards equilibrium. (Oblivion level scaling) --- # Tuning of Game Systems - Make sure the system is internally complete. - A loophole might allow a player to unintentionally skip a conflict. - It might not be possible to resolve a conflict. - Make sure the game is fair and balanced. - Avoid dominant strategies (a strategy that is always the best irrespective of the game state) or overpowered items. - Make sure it is fun and challenging. - Requires playtesting. --- # Summary --- # Summary - From this lecture you should understand: - **Objects:** the parts that make up a system. - **Properties:** the values that define the objects of the system. - **Behaviours:** what functions does an object perform in a system. - **Relationships:** how do the objects interact with each other. - You should use these principles to try and de-construct games that you are familiar with.