Tuesday 6 March 2018

Year 2 - Unit 71: Object Oriented design for computer games - Task 1


Unit 71: Object Orientated design for computer games - Task 1

Screenshots of how I created the gml
  •           How is it used
  •       Compared to this year
Attack, health bar, move
How is oo design used
More examples plus detail
How do we move in gamemaker vs unreal
3 examples
Paragraph of making a game in unreal vs gamemaker

Opinion paragraph at end

Example 1 - How to attack:

Code to create the ammo
Code to make the ammo move 
Code to make the enemy die if it
is hit by the ammo
Code to destroy the ammo if it
misses
In GameMaker to code a character to attack it's pretty simple as all you need to do is group a certain keyboard key to the creation of another object, this specific code is added to the object that releases the ammo as it were (the playable character in this case). Now once I press the space bar it just creates the ammo so I needed to make it move straight up towards the enemies that you are shooting at. From a pop up menu you can choose which way it moves and at what speed, this part of the coding will be within the ammo's events. After that is done we need to make it so that the enemy either disappears or loses health when it is hit by the ammo, this part would be located within the enemies events and actions and would be classed as collision detection.  However, I also needed to code it so that when the ammo missed the enemy it would destroy the ammo rather than letting them all gather. This small bit of coding is located within the ammo's events.


Attack Animation: https://youtu.be/GQlqwFiIiu0
In Unreal to make a character attack something its much of a longer process as you not only need to animate the action but also make it so that the action (for melee attacks) does damage to the enemy. Although I haven't included this in my game just yet I do plan to and this is how I will do it in this specific game engine.
Attack Damage: https://youtu.be/LjDsPr4ujDE
All of the coding for the attack animation will be found within the animation blueprints, Unreal has many animations that you can use so this part of the coding shouldn't be too difficult. Using a collision based overlap system we can code the character and the enemies so that when the melee weapon overlaps the enemy it does some damage. To make this accurate you will need to tell the engine the points in which it would actually overlap. (Shown at around the 2 minute mark of the video linked to the left). To make so that you only do damage to the enemy when you swing the weapon you will need to make sure that the weapons variable is used when swung to check if it actually is in contact/overlapping with the enemy.


Example 2 - How to create a working health bar:

Having the characters health full
Drawing the health bar
In GameMaker to create a health bar that is actually functioning we first need to make sure that the enemy/characters health starts on full, this will need to be in an invisible object's code and will start as soon as the game itself does. The second part of the health bar creation is to actually draw the health bar under the character. In the enemies code when it gets hit its life will reduce.


Creating the Healthbar
Health bar coding
In Unreal the creation of the health bar comes before the actual coding of the decrease or increase of the health. This piece of code basically just states when or not the character should regenerate  health or lose it. This code is found within the third person character under a health bar function.


Example 3 - Moving the Characters:

Move right
Move left
In GameMaker to make the character move you assign a movement to a certain key on the keyboard. Once that is set you can then change the speed to however high or low you wish just like when I did it for the ammo going towards the enemies.



In Unreal to program the character to do simple movements you don't actually have to do anything because it already programmed for you inside of the characters movement input. This makes it a lot easier to get straight into the other aspects. However, if you wish to do so you could go deeper into the specifics as it can be edited.



Conclusion:

In conclusion I feel as though there are so many differences between these two engines that I love them both for their own separate reasons. The reasons I love GameMaker are many, the first being how easy it is to code as a beginner and how you can expand from doing a more visual programming skill to an actual language whilst still using the same engine. I also love how simplistic it is and how you can create the sprites within the engine. But on the other hand I like Unreal for its endless possibilities of the graphics and how you can model such a complex and detailed model and use it within a game. Also the programming is slightly more complex than GameMaker's which is harder to get to grips with but gives you so many more possibilities of what you can do now and in the future of the game you create.



Screenshots used in higher quality are located within this folder:
https://drive.google.com/open?id=1C-bb9A6uXc8Czb2MtYJ1FnHMPyeiIgen







No comments:

Post a Comment