Blog Archive

Monday 20 February 2017

Unit 71: Object-Orientated Design for Computer Games

Concepts and Principles

Simplified Understanding - When using blueprints and other coding methods, all the different parts can get very confusing to read and to understand. By making sure to make all the code as simple as possible to understand, it makes the whole process of creating a game much simpler. One way of simplifying someones understanding of the code used is to leave a comment on the coding method showing what that code represents, so that if something goes wrong with that aspect of the game, it is much simpler to find that piece of code and then edit it to make it work.


Re-usability - Using Object-Orientated design means that you are able to take assets and then re-use them in different parts of the game, or in different projects all together. For example, once you have created a door you can take the behaviour and state of this object and then use it in different places in the game, even re-using the behaviour of the object and transferring onto different objects, such as opening a chest instead of a door.

Maintenance - As with any creation, there will likely be some problems with the blueprints or coding the first few times that the project is used. It is important to be able to fix these problems both before the game is released, and also to be able to fix any problems that come to light when the game released. A lot of the time, there will be bugs and glitches that will have been missed by the testing time, therefore the game will continuously need to be maintained by fixing the problems in the code, and updating it in order to make the game run better and without any problems.

Efficiency - Game development is now such a time restricted industry, with fans always wanting the new game as fast as possible for the developers to release it, and for it to also be at a high standard when it is released. Being able to work efficiently is the key to getting games out on time, which is why when possible, it is useful to re-use assets that are very similar to each other, such as doors and windows, instead of recreating everything individually, which would take much longer to do, and wouldn't be an efficient use of time considering that it would be much quicker and easier to take other assets and then tweak their state or behaviour slightly so that they match the new role that they need to play. Furthermore, by having a good team in place to test the game well in order to find and iron out all of the bugs and issues in the game helps to save time in the long run as there would have to be much less maintenance when the game is released, and the developers can focus on improving the game as a whole, such as balancing certain characters in team based games such as Overwatch, instead of being stuck fixing bugs that are ruining the game.

Real-world modelling - When creating a game, unless it specifically isn't meant to work with certain physical interactions, should usually have aspects that are modelled from the real world. Things such as doors and windows are all going to work in generally the same way in which they work in the real world. With doors, they are generally going to open when you interact with them, by pushing them open, or by using a handle. With things like sliding doors, they will open when the player stands in front of a sensor that will then trigger the door being opened for the player. In the example below, if the player stands in the boxed area, which is the sensor for the door, the statue will slide back and reveal a secret area for the player to explore. Another aspect of real-world modelling is that of when the player is walking around, you want to world to feel real and immersive for them, so making sure that any of the objects have the correct collision is important, as you wouldn't want players to be able to walk through things like walls or chairs, unless that was specifically a mechanic for the game, as you that isn't something that you would be able to do in real life.


Collaboration and sharing - A lot of the time there will be more than one person working on a game, which means that working together is important to get everything done in a good time. For example, members of the artistic team, such as the concept artists and the 3D modellers and animators will create these models, and then they will be passed onto the programmers who will input the behaviour of the created object, and then this object will be passed onto the developers who will add it to the game. It is important that all of the teams are collaborating together in order to help the workflow and help to speed up the process, as the programmers can't really get started until they know what they have to programming from the creative team.

Quality assurance - Whenever a game is created, it is important for it to be continuously tested throughout all the stages of it's development, in order to find all of the bugs and glitches before the game is released, so that the game can have a successful launch and not be ruined by complaints of bugs and glitches that might put people off buying the game. The QA team is in charge of testing the game extensively to find these bugs and report them so that the programmers can fix them before release. An example of a game that had a lot of bugs at release was Assassin's Creed Unity, which was so buggy and broken on release that Ubisoft had to offer a free game to any of those who purchased the season pass as compensation for releasing such a broken game, which shows that they clearly didn't test the game sufficiently enough before release, or that the QA team didn't do a great job in finding these bugs.

Game Objects

Sprites - Sprites are 2D bitmaps that are a form of pixel art. They were generally used in older video games due to that fact that they weren't as graphically intensive on the weaker consoles that were around, although they do see use today in massive successful 2D games such as Terraria and Shovel Knight.

Characters -
These are the ones in the game that display some sort of personality and are generally the objects within the game that can hold the most importance within the game, especially in games with a lot of emphasis on story and narrative. They are generally the ones in the game in which the players will have the strongest reaction to seeing, both negatively and positively. The person that the player controls is their character, and in a lot of games now they are fully customisable in order to make them feel unique to the player that has created them. There are also non-playable character, or NPCs which generally make up the rest of the characters within the game, with these being the other characters that you interact with in the g
ame, such as quest givers or companions for the player. These characters have their own personalities and mannerism in order to differentiate them from everyone else and make them unique. This can help players to form an attachment with these characters, which can help with story purposes as it gives the player something to care about within the game, and can be a good motivator for the player if something were to happen to a character that they like.


Weapons - Weapons in video games are incredibly varied, with a lot of that variety firstly being based on the genre of game, and even then weapons can come in all different shapes and sizes, from futuristic weaponry to swords and bow and arrows. In any game in which the player has to deal with enemies, there is almost certainly going to be some kind of weapon available. FPS games have guns as their primary weapons, alongside secondary equipment such as explosives and knifes. If the game is based on a historical event, such as CoD: World at War then a lot of the weapons were based off of the same weapons used at that time, which helps to add to the games authenticity. In games such as Bloodborne, the majority of the weapons have their own distinct animations and are able to change forms into different states, which changes the animations of the weapon to something different. This allows the players to change up their play style mid-fight so they can get an advantage over their opponent. The game allows includes ranged weapons that allow players to parry their opponents strikes by shooting them in the middle of their attack, which again affects how different weapons will affect a games play style as some players will decide not to use this mechanics, whereas others will use this mechanic as the main way to defeat enemies. In games such as this weapons have a massive impact on the game as they directly affect the way the game is played and they allow different players to have their own unique experience of the game, whereas in games such as the CoD campaigns you are generally just given a weapon to use per level and are very much directed into when you should use a different weapon so many players will have a very similar experience when playing.

Rooms - Rooms are basically where everything happen in the game, and in Gamemaker they are generally the levels of the game. A game needs at least one room to function, although in general games will need many more in order to be a game of decent size and content. When creating a room in Gamemaker, there are many different factors that need to be considered when creating the room, such as the size of the room, the objects that are going to be placed within the game and the general design and layout for these object. The background of the room can also be changed to fit the scene and atmosphere that you are trying to create. It is also important for rooms to be able to transition between each other so the player can progress through the game. This is generally done by having an object that the player can collide with, such as a door, or an end goal such as the flag at the end of a Mario level that will then  move the player on to the next level.

Walls - 
These are the objects that help to create buildings and other rooms by giving areas boundaries that the player cannot pass through. They can help to lead players through the level by limiting the places in which they can travel, forcing them to traverse the level in the way the designer intended. This also stop players entering areas that they shouldn't be in, using invisible walls in order to stop the player in outside areas without having to add huge walls that may impact the scenery of the level and make it look worse.

Scenery - 
The scenery is objects that have been placed within the room that help to create and set the scene within the room. This can be done using different objects in order to create a scene, or by using sculpting tools in order to change the landscape or the room in order to create hills etc.

Instances - These are created from objects, with variables that are pre-determined. They are copies of objects that have been created and can be placed inside rooms, where you can choose where they are placed, along with changing their variables among other factors.


Rewards -  
These are generally given out to players when they have done something in the game, generally in a positive manner. In a game such as Hearthstone the player will get rewards whenever they complete their daily quests, usually in the form of gold or a card pack. This gold can then be used to purchase things in the game such as arena runs or more card packs  to increase their collection. Furthermore, Hearthstone also gives out rewards depending on how well you finish in ranked play, with better rewards for players who finish higher in the rankings. All of this helps to incentivise players to come back and play the game and get rewarded for doing so, which helps the game continue to grow expand with more players continuing to play daily in order to get their rewards.

Object Properties

Colour - This is the colour of the object in the game, which can be used to differentiate between two similar enemies of different strength, of in some cases to signify that the enemy that you are fighting is getting stronger. Different colours on objects also help to signify weak points on an enemy, or whether you are doing any damage to an enemy, or whether you as the player are taking damage, such as a health bar changing colour from green to red when you or the enemy has taken a lot of damage. For another example, in the Legend of Zelda: Ocarina of Time, when you damage enemies they flash red to indicate that you are doing damage to them, which is useful as a confirmation that you are doing the right thing.

Size - This is the physical size of the object in the game. In terms of characters and enemies, the generally rule is that the bigger the size of the enemy, the stronger the enemy will be to defeat. Enemies can also grow in size in order to indicate them getting stronger as the fight goes on. This can be shown in the Ornstein and Smough fight in Dark Souls. The fight starts by fighting both of the bosses at the same time, but when you manage to deplete the health bar of one of them, in this case Smough, the other boss will absorb his power and grow in size, as well as regaining all of the health that he had lost in the fight phase of the boss fight. This helps to both progress the fight into another phase, and also helps to show the player that this enemy is now stronger than it used to be.


Speed - How fast an object is moving within the game. In games such as racing games, different objects are going to have very different speeds, depending on what car you are driving and how powerful they are compared to others in the game. In Mario Kart you can collect items that can increase your speed or decrease the speed of the other races in order to give yourself an edge in the race at that moment, especially when you are further behind. In a lot of games such as RPGs there are usually a lot of ways in which the player can increase the speed in which they travel through the world, usually increasing in effectiveness the more the game has been played. Generally the player with start off by only being able to walk with a limited use of sprint, before acquiring some kind of vehicle, such as a horse in Skyrim in order to move faster. In certain games like Warioware: Smooth Moves for the Wii, speed is also an indication of how difficult the game will be, where the player will have to get through a few levels, and then the game will speed up in order to increase the difficulty.


Movement - 
This is how the player or other characters move around within the game. It some stealth games enemies will have a set path that they will patrol unless an outside event triggers a change in their behaviour, such as seeing the player. Other enemies will not move until the player comes into their line of sight, and then they will activate and move towards the player.

Sounds - In terms of background music, this is used to help add to the atmosphere of the game, and to help keep the player interested in player, as a silent game would quickly lose a players attention. It also helps to keep the player immersed in the atmosphere, especially if the music is relevant to the situation the player is in. Leading on from that point, music is also used in order to signify to the player that something is happening that they should be paying attention to, such as the fact that they have just entered a fight, which is helpful if you aren't sure where the enemies are as it lets you know that you should be on your guard in this area. In horror games in particular it also helps to build tension for the player and helps to increase the fear levels that they are feeling. Sound effects also play a large part in video games as they help to reinforce whether the player has done something right or wrong by playing upbeat sounds for doing something good like completing a level or winning a fight, or sad and depressing sounds for things such as death or some kind of failure. A famous example of positive sound effects in video games is the tune that plays in Final Fantasy games when you win a battle, which a lot of people know just because of how catchy and upbeat it is, which helps show the player that they are doing the right thing.

Health - Health is generally considered to be the amount of damage you as a player can take, or how much damage an enemy can take before they die in the game. In game, health can be represented in many different ways, the most popular being a health bar on the screen somewhere, although this can also include different variations such as hearts from the Legend of Zelda series. Some games don't have any kind of representation of health, instead relying on visual cues on screen to inform the player how much damage they have taken, such as the screen slowly getting more red as the player takes more damage, which is popular in the Call of Duty series.



Lives - Another representation of how long you have to live with a game, lives represent how many times you can die before you have to restart the level, or in some cases the whole game. Lives are a massive part of the Mario franchise, with players being able to collect extra lives in the levels that they play through, and every time they die in a level they lose a life and restart from a checkpoint. If at any point the player loses all of their lives they receive a gameover  and are returned to the hub world where they can try again from the beginning of that level.

Actions and Events

Mouse and keyboard events -
These are events that are triggered by inputting a command using a mouse and/or a keyboard in order to activate these events. Using the mouse, this could be done by clicking one of the buttons such as the left mouse button in order to select something in order to find out more information about the object. The player could also hold the button down and drag the mouse in order to drag and move objects around. In terms of keyboard events, in gaming generally the keyboard is used for movement and general actions, whereas the mouse is used to control the camera, and in shooters, to fire the weapons. Most games use the WASD keys in order to control the player, and then have varying controls for the other actions that the player can perform. In a MOBA such as Smite the player uses WASD to move, and the mouse to aim and fire. They then can select which abilities they would like to use using numbers 1-4 in order to select a specific ability, and then use the mouse to aim and fire that ability. This means that the player has to know which ability is mapped to which button in order to use the ability that they want to use, which is why it's important to have simple controls for games such as this in which the game easily corresponds to the key mappings or players are going to get more confused when playing the game.

Create -
This is the event in which objects are made within the game. In a game such as Space Invaders when the player presses the shoot button, the game will create a bullet at the position at which your ship was when you pressed the button which will then move towards the enemies that are moving down the screen. Another example would be after a certain time duration the game may create more enemies for the player to deal with, perhaps shortening the time period each time in order to make the game harder.

Destroy -
 This is the event in which objects are removed from the game. Taking Space Invaders as the example again, when the bullet that you shoot collides with one of the alien spaceships, that hit will destroy the ship, along with the bullet so that the bullet doesn't continue moving through and destroys aliens behind the ship that was hit.

Collision -
This is what stops the player from passing straight through objects, such as tables and chairs when they are moving around. This stops players from passing through walls and getting to areas that they shouldn't be in , along with making the game feel more realistic and helps make the game more immersive. In some games, when you collide with an object with enough force, it will break into smaller pieces, such as in Nioh where you can break boxes and lights when you hit them, and they will smash and break.

Timers -
These are events that work by when being triggered to start some kind of time based mechanic, such as a timer, countdown or a stopwatch. Timed events are used in all sorts of ways, such as in racing games where when the race starts the game starts a stopwatch that tracks the players time for each lap and then the whole race as a whole. This is especially important in time trial style races where the player has to complete a race or a lap in a certain time in order to succeed and get a reward. Another example would be during the first mission of Mass Effect 1 where you have to disarm 3 bombs before the timer reaches 0 and the bomb explodes, resulting in a game over and having to restart from a previous save. Once you deactivate all the bombs the timer disappears and the player doesn't have to worry about a time limit anymore as the trigger for ending the timer has been activated.

Scoring -
Scoring systems within games are generally the best way to make a game competitive, both between multiple players but also for single player games as well in which the player can compete against themselves in order to improve and get better. In games such as FIFA or Rocket League the scoring system is pretty simple where every time one team scores a goal they get a point, and the team with the most points wins the game. For single player games the scoring system could be I
n the form of a high score in which the player will try to beat in order for them to become better and give them something to aim at. In games such as Call of Duty you can get points for more different things within the game, the most obvious one being when you get a kill on an enemy player. However, you can also get points for capturing objectives such as in the domination game mode. Games such as Overwatch keep track of many different scores that players compete over in order to have the highest score in that category at the end of that match, such as amount of healing done or amount of damage done to the other team. Being top of these scoring categories gives players rewards such as extra experience at the end of the game, which gives players a reason to try and be the best in these areas, which helps to add to the competitiveness of the game through scoring systems.

Inheritance - In object-orientated design, inheritance is when one object is based on either another object, called prototypal inheritance, or another class, which is class-based inheritance. This allows this new object to take on the properties of the existing object, which can then be modified to undertake different behaviour, or modified in some way whilst keeping the same behaviour of the object in which it inherited from.

Parent - The parent in inheritance is the object that is used for the basis of the inheritance. This can also be called a superclass or base class.

Child - The child in inheritance is the object or class that inherits the properties and behaviour from the parent. This can also be called a subclass or derived class. The child will be the one in which behaviour will be modified to perform different actions to the parent in order to allow for these new objects to perform a slightly different role in the game. For example, in Dark Souls 1 there are multiple types of skeleton enemies, in which the different variants will all be children of the one parent enemy, and then modified and edited so they behave slightly differently, and also look
different to the original.

Overriding events - These are the events that the child will override in order to do something different to the parent, such as one the parent being able to walk off of ledges, where as the child can only stay on the ledges.

Inherited Behaviours and Properties - 
These are the events that the child will gain from the parent that don't include anything extra that will be added to child from other sources, it is just the code that carries over from the parent.


No comments:

Post a Comment