Unit 71: Object Oriented design for computer games
Concepts and principles
simplified understanding
simplified understanding make it easier to learn and understand the code to identify it easy for example with blueprints you can locate the functions easier to make it more understandable to code objects also you can organise your code to make it easier to locate to fix or remove.
re usability
re usability refers to using the same object multiple times, with many characters you can input the same code to make them do the same function for example when your making ai for your game you can use the same code in all enemy's.
maintenance
maintenance is the ability to change or edit the code if an error has occurred or to a just the length of code for less lines for example you can maintenance you code for a object to make it simpler or better.
efficiency
efficiency is how well the code works for the object the more efficient the better if you have code that is not that efficient then it will not be that good.
real-world modelling
collaboration and sharing
some objects can run together using the same parent but can have there own unique code aswell they share the code to get the same out come as the other object for example you could have your ai linked to the same parent to run the same.
communication
many objects use communication meaning colisions and resonses some objects communicate /interact with other objects using weapons or some sort of projectile which can leave bullet holes comence ragdoll or brake the glass however some interact by picking up a object or getting itno a vehical
quality assurance
this is looking through all your code and checking to make sure your code works well and maintains a certain outcome to make sure everything fits the games design until you finish you games production
Game objects: sprites; characters; weapons; rooms; walls; scenery; instances; rewards, eg
bonuses, power-ups
sprites
sprites are objects that are implemented into two dimensional as a graphic character, weapon or scenery sprites are the visual side of the object that would be placed into the scene also sprites can be used for you ui to. you can animate sprites using code and make them do all sorts of things.
characters
are the main object in the game weather is ai or the player in most games a caracter is human but in some are not humans most characters have a name animations and coding that is unique to others but some can be the same for example with zombie characters some will have the same code and colision as other but some would be similar.
weapons
weapons are what the character uses to attack another character. they will have animations and will all have unique code. weapons can range from many things like guns knifes bats even a frying pan anything you attack a character with is a weapon. any weapon thats shoots a projectile will have similar code to others beause they may have different damage or more ammunition. some weapons have colissions with walls and are able to shoot through walls or leave marks.
Object properties: colour; size; speed; movement; sounds; health; lives
object properties consist of colour size speed movement ect but these are all programmed differently you can use colour on your character weapons or your ui its a way of brightening up you game and show emotion between objects. objects will have different sizes characters will often be the same but sometimes they can be bigger than others depending on the design of the game. the speed of a object shows what they are sometimes a object can be quite slow in movement but have a really fast attack.
sounds
sounds can be used to set mood and atmosphere in a game the can be used in the enviroment wepons characters basically everything can make a sound in a game. sounds can be basic or they can be quite good also alot of games tend to have quite a bit of music in there games.
health and lives
health and lives are used in games that have action and adventure to show strength or to show how many times you can die the health and lives can be shown in the players ui so they can see how many lives or how much health you have but not every game has this feature games like forza Motorsports dosnt have health or lives but the cars can suffer damage.
Actions and events: mouse and keyboard events; create; destroy; collision; timers; scoring
actions and events are the main part of code. events is the start and the actions follow. the mouse events can be used to set the camera or to fire a weapon. keyboard events can be used to interact with objects or move around also can be used to change weapons or change settings. create events can be use to spawn / draw a object into the world of your game in which could be a projectile or spawning zombies.the destroy event can be used to remove a object from your world like destroying the projectile ones it collides with something. collision is used in nearly the hole game as you need collision to make effects and sow damage also collision is needed to allow you player to walk through buildings and for a projectile to kill a enemy.
timers
timers are used in alot of code to begin a event in a game by counting down or up this is good for creating delays. timers are used in many game for different reasons they are used to trigger events like explosions in game make timers can be made two ways 1 being the drag and drop method and the other being gml code.
score
score is used in alot of games to keep total of points for a player or a team score can be interpreted in many ways and is often shown in games ui so they can see it whilst playing. score in most games is used as a kill counter but in racing style games it can be used as drift points in a race.
Inheritance
parent and child
in codeing parent is used as a base for multipul objects to make them run the same this can be used to create many ai like zombies. the child is the object that is linked to the parent to use the same code to have the childs function the same. this can be used for zombies.
overriding events
overriding events can be used to change game mode for example this can be used to switch game mode from first person to third person.