Categories
Uncategorised

GD2 Blog: Week 10

Game Jam

As of the 6th of December, we started a game jam that’d last for a week. Grouping with 5 other people, we managed to work on a game under the theme of implementing 10 seconds into our game.

We spent our first couple of hours planning what our game was going to be, and we settled on the idea of 10 second escape rooms, however instead of having to complete one room in 10 seconds, there was a monster getting closer to the player every 10 seconds.

We thought of different possible styles for the game and its mechanics, and settled on doing a horror themed game with fixed camera angles coupled with a retro looking style (See Figure 1).

Figure 1

Upon further planning, we decided on what mechanics we’d want for an escape room style game – most of which ended up being simple puzzle ones such as pressure plates, moving crates and switches.

With these in mind, I sketched out the first 6 levels introducing each mechanic one by one until mixing them together by the last couple of rooms – this will be done without any tutorial and will instead be done with a more simpler style of level design (See Figure 2).

“Introduce new elements in isolation”

“Show players instead of telling them”

“Teach through repetition”

Abhishek Iyer, 2020

We’ll be doing this as to keep our game as simple as possible for the gamejam, due to its fast paced nature we will need to teach the player as fast as possible rather than to hold them back by explaining with tutorials.

Figure 2

Once started on the game, I worked on the level design and mechanics – the player mechanics and controls were handled by a different member of the team.

Figure 3 shows the final product of the game, which features a fully working UI system that shows the player their current room location as well as the monster’s, included is also a flashlight which shows its current charge.

I’ll be going into how I created the structure of the first 6 puzzles in the game. The following puzzle in this starter room is to stack the crate on the pressure plate, which is wired to a locked door.

Figure 3

Following the stacking mechanic introduced earlier, the player is given a puzzle where they must form a bridge by stacking crates next to eachother to get to the other side of a gap.

Figure 4

The next puzzle introduces a new mechanic, which is a switch. The player simply walks up to this to open up a locked door similar to the pressure plate but it doesn’t require a crate.

Figure 5

The next puzzle combines the mechanics of the last couple of puzzles, where the player needs to stack a crate to get across a gap into a room with a switch, this then unlocks the door the player can carry the previous crate through to place on a pressure plate.

Figure 6

The next puzzle is similar to the last one, but is in a dark area the player has to navigate, this is where the flashlight mechanic comes in to help the player see in the dark.

Figure 7

The next puzzle level introduces elevators, this level starts off with a crate already on a pressure plate which immediately calls down an elevator to the player’s view. The player uses this to take the crate off the pressure plate which then reverses the elevator to go up and onto the platform.

Figure 8

Detailing further about how the 10 second mechanic works, every room you succeed in passing rewards the player an extra 10 seconds that carries over. This means the player will be rewarded with more time the faster they solve a level.

However after each 10 seconds that pass, the monster will also go forwards by 1 room – this is depicted in-game by a screenshake and UI warning that the monster is approaching closer. If the monster is behind the player by one room, then they will start to appear in the current room the player is in before catching up and sending them to a gameover state.

This should emit a feeling of pressure and panic into the player, which I feel conveys the horror part of the game quite well, as it seems that the monster is actively hunting the player.

Figure 9

For our game, I feel as if we managed to achieve our goal for what we set out to do and made a fun puzzle game in the end whilst utilizing the game jam’s 10 second theme. I am quite proud of how everything turned out in the end, especially as this was one of the first games I worked on within a group.

Bibliography

Lowenthal, M., 2020. How Video Games Introduce Their Mechanics. [online] Pausebutton.substack.com. Available at: https://pausebutton.substack.com/p/how-video-games-introduce-their-mechanics [Accessed 13 December 2021].

Categories
Uncategorised

GD2 Blog: Week 9

Unreal Physics

As of November the 29th, I looked towards experimenting with physics in the Unreal Engine and made a Hovercraft using Blueprints.

Unreal uses Chaos Physics, which is smaller and faster compared to other commonly used physics engines such as PhysX. It is included in Unreal Engine 4.26 by default.

“Chaos Physics is a Beta feature that is the light-weight physics simulation solution used in Fortnite, and it includes the following major features:
RBAN (Rigid Body Animation Nodes)
Destruction
Cloth
Ragdoll
Vehicles”

docs.unrealengine, 2021

We’ll be looking into Impulses and Forces, which are physics interactions within the Unreal Engine.

Impulses are applied instantly, and can give a fixed amount of speed. These could be used for an immediate style of force like a ricochet, or speed power up.

These can be accumulated each tick and applied together so multiple calls to the function will increase together.

Figure 1, docs.unrealengine

Forces change velocity proportionate to the time the force is applied for, which can be used for things that build up over time such as a gravity or air resistance.

Like Impulses, Forces can also be accumulated each tick and applied together with multiple calls to the function.

f
Figure 2

Using Blueprints, I created a pawn of an elongated cube with simulated physics enabled to it. Attached to it are several scene components which determine the hover distance, spring and damping coefficients.

Figure 3

The Hovercraft’s scene components contain several variables, one for getting the reference of the parent vehicle and the hover distance and coefficients mentioned earlier.

There is also a Hover Delta variable which contains the elongation / compression of the spring, the Previous Hover Delta is used to calculate the speed of elongation / compression for the damper.

Figure 4

The hovercraft’s components use a line trace to detect its distance from the ground to the hovercraft itself, we then get its out hit and return value result.

yep
Figure 5

This is what the Hovercraft’s line traces look in-game, also shown is the hovercraft currently hovering using the blueprints in the next paragraphs.

Figure 6

To make sure the components make the player hover, we get the output of the line trace’s distance and subtract it with the hover distance to set the Hover Delta.

The next step is to set a cast to the parent vehicle’s primitive component and add a force to it – afterwards we then set the hover delta to our previous hover delta variable.

Underneath are calculations to use the previous hover delta with our damping coefficient, which is then added by our sprint coefficient. This is then multiplied by the get up vector and put towards the force we’re adding to the hovercraft.

Figure 7

To control our hovercraft, we use variables for the forward force and the turn torque. These values tend to be very large in quantity due to Unreal using CM as its base unit.

The event tick simply constantly applies the current force to push or turn the hovercraft forward or turn sideways.

Figure 8

In-game, the hovercraft is able to be controlled as well as climb over objects.

Figure 9

I think that this was a fun way to experiment with the possibilities of physics in Unreal, blueprints tend to be very effective and fast when putting together prototypes or tests. What I could possibly do next is to try and redo the task but in C++ instead, as I already have a prototype to base it off of.

Bibliography

Docs.unrealengine.com. 2021. Physics. [online] Available at: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Physics/ [Accessed 13 December 2021].

Docs.unrealengine.com. 2021. Chaos Physics. [online] Available at: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Physics/ChaosPhysics/ [Accessed 13 December 2021].

Docs.unrealengine.com. 2021. Add Impulse. [online] Available at: <https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Pawn/Components/CharacterMovement/AddImpulse/> [Accessed 13 December 2021].

Docs.unrealengine.com. 2021. Add Force. [online] Available at: https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Pawn/Components/CharacterMovement/AddForce/ [Accessed 13 December 2021].

Categories
Uncategorised

GD2 Blog: Week 8

Unreal AI

As of November 22nd, I looked at some of the AI systems within Unreal. This includes the use of the Blackboard, AI controller and Behaviour Tree to make a simple NPC that patrols randomly and chases the player once it sees them.

Before starting, I created a new blank character that started off as a blank capsule. Looking around in the properties of the new character I set it a new skeletal mesh and reused the same animation class as the third person character (See Figure 1).

Figure 1

To start, I created a Blackboard blueprint which would contain all the variables that would be used within the Behaviour Tree later on.

The Blackboard contains several user defined Keys that hold information used by the Behavior Tree to make decisions.

docs.unrealengine, 2021

The Blackboard contained an Object reference key to the Actor itself, a boolean activated line of sight and a vector based patrol location which would hold a randomized set of coordinates for the AI to walk towards (See Figure 2).

Figure 2

Next up was to set the Behaviour Tree, this would contain a queue of instructions for our AI to follow in a certain order depending on their condition.

Behavior Trees assets in Unreal Engine 4 (UE4) can be used to create artificial intelligence (AI) for non-player characters in your projects.

docs.unrealengine, 2021

Here is the behaviour tree, it first checks if it has a line of sight on the player and initiates a chase sequence using Tasks. If the player is not within their sights then they initiate a patrol sequence (See Figure 3).

Figure 3

For the NPC, there will be different types of movement speeds initiated by the blueprint depending on whether they are chasing or patrolling. I created a function which simply gets the NPC’s walk speed and changes their max walking speed to the new one (See Figure 4).

Figure 4

This is then used within the Tasks of the Behaviour Tree, for instance once the chase sequence is initiated, a cast is done towards the NPC where it targets their character movement and sets it as the new chase speed.

Figure 5

For the patrol movement, it gets the actor location and finds a random point within a certain radius to set as their next patrol location. It also changes the player’s speed to a patrol one which is more slower than the chasing speed (See Figure 6).

Figure 6

Next up we have an AI controller to set our NPC to, this can help observe the game world using features such as perception to look for players. In our case, we will be using the perception of the NPC to activate a chase sequence if it currently sees the player.

The job of the AIController is to observe the world around it and make decisions and react accordingly without explicit input from a human player.

docs.unrealengine, 2021

To set up our AI’s perception, we will be using an AI Sight config where we can set their sight radius and what they’re able to detect (See Figure 7).

Figure 7

Once set up, we can have an event that activates once the AI sees our player (At this point, the player has been given a tag to help the AI identify them)

Once triggered, our event will enable the blackboard keys that make the AI to chase the player. In it is also included a timer, so if the AI loses sight of the player for a certain amount of time then these keys will be disabled and make the AI stop chasing them (See Figure 8).

Figure 8

I managed to get this working in-game, Figure 9 shows the AI patrolling if they don’t have sight of the player.

Figure 9

Once seen, their chase sequence is activated. They will pursue the player until they lose sight of them for a certain amount of time as shown on Figure 10.

Figure 10

I feel as if AI is interesting to work with in Unreal, although I have briefly touched upon it using C++ which is what I might need to study more on. However I feel confident in using blueprints to set up simple AI quickly, which may be handy for prototyping in general.

Bibliography

Docs.unrealengine.com. 2021. AIController. [online] Available at: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Framework/Controller/AIController/ [Accessed 29 November 2021].

Docs.unrealengine.com. 2021. Behavior Trees. [online] Available at: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/ArtificialIntelligence/BehaviorTrees/ [Accessed 29 November 2021].

Categories
Uncategorised

GD2 Blog: Week 7

Hyper Casual Game: Part 1

As of the 15th of November, I’ve decided to work more on my Hyper Casual Game for the Unit. In this blog I’ll be going over what game I’m trying to make, and what I hope to achieve with it.

The idea for my Hyper Casual Game is to make a simple top-down game that requires the player to avoid rolling boulders that would bounce off of walls (See Figure 1), this game would feature a very simple control scheme in-which you just need to move the player.

Figure 1

Hyper Casual games are typically easy to play, and feature minimalistic user interfaces. As most of the games consist to be small they can be quickly downloaded without needing any instructions, and thus gather a wider audience of players.

“A hyper-casual game is a mobile video game which is easy-to-play, and usually free-to-play; they also feature very minimalistic user interfaces.”

wikipedia.org, 2021

Here is the progress of what I’ve made so far, there are only three objects that make the game; the player, the boulder and the walls. The player simply moves about using WASD, and the is a spherical boulder uses the walls to bounce off of and change direction.

Figure 2

In the boulder, are several overlap events where it detects if it’s hit the player or the walls. If it calls a function that hits the player then it uses a pointer to set the player’s collision to false and their death boolean to true.

If it touches a wall, it updates its direction variable to make it face a different direction. So far it only subtracts it’s current angle by 111 degrees which is currently a placeholder, to make the ball properly bounce off the wall would require some possible trigonometry.

Figure 3

What I could try to do to get some more realistic bouncing is by trying to calculate the angle of reflection from the angle of incidence once the ball hits the wall (See Figure 4).

Angle of incidence is equal to the angle of reflection
Figure 4 (oreilly.com, 2021)

How this could be done in Unreal is that I could simply get the current angle of the direction the ball is going in and to bounce it off in the opposite direction by multiplying it with a negative value to get the angle of reflection.

Hopefully I am able to improve upon this function when I next work on the project to get a more realistic feel for the boulder to bounce off of the walls.

So far I feel as if the project has gone well at least, as I’ve got the game functioning at a prototype level. The gameplay just needs more refining before I can move onto the details and possibly adding in more content.

Bibliography

En.wikipedia.org. 2021. Hyper-casual game – Wikipedia. [online] Available at: https://en.wikipedia.org/wiki/Hyper-casual_game#:~:text=A%20hyper%2Dcasual%20game%20is,feature%20very%20minimalistic%20user%20interfaces.&text=Usually%20featuring%20infinite%20looped%20mechanics,leading%20to%20their%20addictive%20nature. [Accessed 23 November 2021].

O’Reilly Online Learning. 2021. HTML5 Canvas, 2nd Edition. [online] Available at: https://www.oreilly.com/library/view/html5-canvas-2nd/9781449335847/ch05s02.html [Accessed 23 November 2021].

Categories
Uncategorised

GD2 Blog: Week 6

Particles

As of the 9th of November, I looked into adding onto my previous project with effects such as particles. This was done using one of Unreal’s VFX systems known as “Niagara”.

For my project, I just wanted to create a simple particle effect that came out of the weapon once the player fired it. Within the gun’s blueprint I attached a Niagara particle system that would play on the end of the gun (See Figure 1).

Figure 1

Before, alongside an emitter I set up a particle system. This is a container that has multiple emitters into one combined effect which I am able to modify how they act in-game – for instance I can make them go a certain direction or speed.

You can also view how it will play out within the timeline panel.

“In the Niagara System Editor, you can modify or overwrite anything in the emitters or modules that are in the system. The Timeline panel in the System Editor shows which emitters are contained in the system, and can be used to manage those emitters.”

docs.unrealengine, 2021

As shown in Figure 2, I am editing the emitter I made within the particle system.

Figure 2

Within my character’s code, I check to see if the player is shooting and then use a for loop to check for any currently active weapons that are guns. This then activates the weapon’s “Effects” function (See Figure 3).

Figure 3

This function enables a boolean which will then activate our particle system within the weapon’s blueprints.

Figure 4

Using an event tick, the game constantly checks to see if the gun is firing and then plays the effect alongside with a sound (See Figure 5).

Figure 5

Here is what the particles look like in-game once the player fires (See Figure 6).

Figure 6

This was a fairly simple task, but I enjoyed learning a different system within Unreal. It was interesting to check out the particle system and how it could be utilized within our games.

Bibliography

Docs.unrealengine.com. 2021. Niagara Overview. [online] Available at: [Accessed 16 November 2021].

Categories
Uncategorised

GD2 Blog: Week 5

Unreal and C++

As of the 2nd of November, we studied using Sockets in Unreal. For this lesson we used one of the default templates to demonstrate what sockets can do, I chose the third person template as I can use that to make a character walk over items and pick them up.

Sockets can be applied to certain bones on models which can allow for other meshes to attach themselves onto them, for example you may want to attach an item to a hand.

“Sockets can then be translated, rotated, and scaled relative to the bone. Static Meshes and/or Skeletal Meshes can also be previewed attached to sockets.”

docs.unrealengine, 2021

The first thing I did within my project was go onto the third person character’s model, and set up sockets in their right hand for two different types of weapons (See Figure 1).

Figure 1

After that, I created a pickupable item similar to previous sessions, this was simply named as “Weapon”.

However this time it has a USkeletalMeshComponent, which enables it to attach to the sockets on the player (See Figure 2).

Figure 2

Next up was to create a function within the Weapon’s cpp file pointing to the third person character, this function is activated by an overlap beginning.

Within the function, if the weapon is overlapping with the character then it will get one of the sockets from the character’s mesh, and then attach our weapon to it

The weapon that’s being picked up will also be set to one of the player’s equipped slots (See Figure 3).

Figure 3

These weapons can also be stored onto the character, within the character’s header file there are several class variables for the potentially picked up items.

Included are also functions that set the player’s current weapon and their equipped ones – these will then be able to be switched between eachother via a player input (See Figure 4).

Figure 4

Once this function is called by the weapon overlap, it will set one of the player’s EquippedWeapon variables to it. First it checks to see if the weapons actually contain variables before setting them (See Figure 5).

Figure 5

As each weapon contains a variable, it is important to know which ones are enabled. This function makes sure the current equipped weapon plays the correct animation for our player, which I have done by using booleans (See Figure 6).

Figure 6

Using an animation blueprint, I have added some new animation states to the player which can be triggered depending on their variables.

In example, the transition between the Idle/Run state to the Gun one is dependent on whether the “Has Gun?” boolean is active or not.

Figure 7

Here are the animations for the player changing depending on which weapon is currently on the right hand socket (See Figure 8).

Figure 8

The player is also able to shoot the gun, which triggers a unique shooting animation until they stop holding left click. This was simply done using the bind actions with the player inputs.

Figure 9
Figure 10

I feel as if this was a fairly tough task, however I feel like I do have a better idea of how to use sockets and how actors can work together using pointers and variables. This may be interesting to experiment with more in later sessions.

Bibliography

Docs.unrealengine.com. 2021. SkeletalMeshSockets. [online] Available at: https://docs.unrealengine.com/4.27/en-US/WorkingWithContent/Types/SkeletalMeshes/Sockets/ [Accessed 16 November 2021].

Categories
Uncategorised

GD2 Blog: Week 4

Unreal and C++

As of the 25th of October, we started a new project where we experimented more with using cameras and a different style of control for our third person character.

To set up our camera so it spawns and follows, we create it within in our character’s default values (Figure 1).

Figure 1

To make sure the camera follows our player, we use a “SpringArmComponent” which our following camera will be attached to.

We can set how long the length is, which is the distance of how far away it is from the player, we can also enable camera lag which makes the following feel smoother.

Basically what this does is help the camera remain at a certain distance from the player but also not phase through other objects.

The SpringArmComponent tries to maintain its children at a fixed distance from the parent, but will retract the children if there is a collision, and spring back when there is no collision.

docs.unrealengine (2021)

This can be useful as to not get the camera stuck behind geometry that could possible obstruct the player’s view and thus hinder gameplay.

We also added some animations by using more animation blueprints and an animation instance C++ class.

In our header file, we include some variables such as our character’s movement speed and a reference to their pawn (See Figure 2).

Figure 2

In our CPP file, we set the pawn value to our character. If the pawn hasn’t been set, then it will try to return a pointer to the owner of the animation instance within the NativeInitializeAnimation void.

In the next void where we update our animation properties where we get a speed variable from our current pawn.

The next line we create a variable called LateralSpeed which only takes the speed from the pawn’s X and Y movements and leaves the Z axis out, we then get the magnitude of the speed in the next line by returning the size of our LateralSpeed.

Figure 3

In our animation blueprint, we then connect our variable to our IdletoRun state, so that we can base which animation plays off of the speed of the player.

0 would set the animation to an idle state, more than 0 sets it into a moving state where it is walking. If the speed is greater than a certain amount then a running animation will play instead.

Figure 4

Bibliography

Docs.unrealengine.com. 2021. Camera Components. [online] Available at: https://docs.unrealengine.com/4.27/en-US/Basics/Components/Camera/ [Accessed 4 November 2021].

Categories
Uncategorised

GD2 Blog: Week 3

Unreal and C++

As of the 18th of October, we continued from our previous Unreal Project to add some pickups to our game that would affect and change the player. The following pickups would change the player’s speed, scale and also health.

To do this, I created a base Pickup actor that would then be the parent to multiple different other pickups that’d override the original code of the parent.

To make sure the pickup works, we use a begin overlap function within the code which detects whether the pickup overlaps the player.

“Event called when something starts to overlaps this component, for example a player walking into a trigger. For events when objects have a blocking collision, for example a player hitting a wall, see ‘Hit’ events.”

docs.unrealengine.com (2021)

In the code of the pickup contains an OnOverlapBegin function where the effects of the pickup take place, this then casts it to our character so we are allowed to change their variables with a pointer.

Also included in its tick function is also some code that enables it to rotate on the spot – this makes it stand out to the player.

Figure 1

Once the pickup was done, it was now time to create some children based off of it. The first one I did was a health pickup, which would simply add 50 onto the player’s health variable and then destroy the pickup.

Also included is UE_LogTemp, which sends a warning to the Output log which is what we’ll be using to test if the function works properly.

Figure 2

Below shows before the player overlaps with the pickup, so far they are down to 50 health as shown by the widget.

Figure 3

Once walked over, we get confirmation of the overlap from our UE_LogTemp from before.

Figure 4

Once collected, the pickup disappears and 50 is added onto the player’s health.

Figure 5

Here is the code to one of the other pickups, this one scales the player on overlap by enabling a boolean from the character’s code that enables a certain function within it.

Figure 6

The pickup has a different shape to the health pickup to help further distinct it, on overlap the player immediately scales upward.

Figure 7

The next pickup is a speed one, this simply increases the speed of the player. Unlike the other pickups it has text above it to further define what it is.

Figure 8

Like the others, it simply changes one of the player’s variables. In this one it sets the player’s speed from 0.3 to just 1.

Figure 9

After managing to create some simple pickups, I feel as if I’ve gotten a better handle on using pointers with casting in Unreal.

Bibliography

Docs.unrealengine.com. 2021. On Component Begin Overlap. [online] Available at: https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Collision/OnComponentBeginOverlap/ [Accessed 25 October 2021].

Categories
Uncategorised

GD2 Blog: Week 2

Unreal and C++

As of the 11th of October, we started to work on importing models and animations into Unreal, and making them function in-game. For this we created a PlayerController class that would be using inputs to move.

Additionally, I’ve also used an Animation Blueprint to make the animations function through movement.

First off, we had to set the input mappings within the project settings. For walking movements, we use the Axis Mappings which are continuously held down by the player (See Figure 1).

“The inputs mapped in AxisMappings are continuously polled, even if they are just reporting that their input value is currently zero.”

Docs.unrealengine.com (2021)

We will also bind some keys to these, there are also some scales assigned which is essentially what scales the value of the current input – for instance walking backwards would have a negative scale as shown.

Figure 1 (Self Collection)

In the header file of our character, we declare two void functions that will allow us to move our character.

Figure 2 (Self Collection)

In our CPP file, we use a pointer within the SetupPlayerInputComponent void to point to the inputs we created in project settings and apply them to our character’s movement voids from the header file.

Once set up, we create movement by using FVectors and then multiply the value going into the movement with the player’s speed variable.

Also using FRotators we can set our player to be facing where they are currently moving, ff the value going into the speed is greater than 0, then our player will be facing forwards.

However if it is less than 0, it will be assumed that they are going backwards and thus will be flipped

Figure 3 (Self Collection)

After importing the player’s model and animations into the game, I used an animation blueprint to make sure the player’s idle and movement animations blend and work together properly using EventGraphs and AnimGraphs

“AnimGraph to drive State Machines, BlendSpaces or other nodes; enabling blending between multiple Animation Sequences or poses that can fire off notifications to other systems, and enabling dynamic animation-driven effects.”

Docs.unrealengine.com (2021)

Using the EventGraph, I was able to create several variables that would be set by casting the character’s current rotation and velocity as seen in Figure 4.

Figure 4 (Self Collection)

Afterwards, I would create an AnimGraph that used these values to determine which animation played depending on the player’s speed.

As you can see an idle animation turns into a walk one if the current speed is greater than 0, but walking at a speed greater or equal to 10 would start the player’s walk cycle (See Figure 5).

Figure 5 (Self Collection)

Within the Player character’s code, I also created a function that would constantly scale them up and down within the header file. These variables are also going to be editable within the blueprint using UPROPERTY macros.

Figure 6 (Self Collection)

Within the header file, I also declared one more void function where the character scaling will be taking place.

Figure 7 (Self Collection)

In the CPP file, I created a function for the scale that would detect whether a boolean was enabled and how high a player’s current scale was.

If the player’s scale is higher than the set MaxScale, then scaleUp will be set to false, otherwise if the value is lower than the MinScale then scaleUp will be enabled.

Figure 8 (Self Collection)

Every tick, the character will check whether the scaleUp boolean is true or false, if it is true then the character will keep scaling up.

However if it is false, then they will simply scale down.

Figure 9 (Self Collection)

In-game, the character is now able to scale up and down constantly using CharacterScale. I feel as if this lesson was a good way to introduce us into creating our own functions, as well as further understanding how to create a Player Controlled character that can move.

Bibliography

Docs.unrealengine.com. 2021. Input. [online] Available at: https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Input/ [Accessed 20 October 2021].

Docs.unrealengine.com. 2021. Animation Blueprints. [online] Available at: https://docs.unrealengine.com/4.27/en-US/AnimatingObjects/SkeletalMeshAnimation/AnimBlueprints/ [Accessed 20 October 2021].

Categories
Uncategorised

GD2 Blog: Week 1

Unreal and C++

As of the 4th of October, we covered using C++ and Unreal within our first lesson.

First, we covered the Unreal Engine Class Hierarchy as shown in Figure 1. This covers the different classes such as; Actors, Pawns, Characters, PlayerControllers and Game Modes.

“Selecting a Parent Class allows you to inherit properties from the Parent to use in the Blueprint you are creating.”

Docs.unrealengine.com (2021)

These are also used with C++ as well as Blueprint. These are considered the parent classes for which we will be writing our code under.

Figure 1 (Docs.unrealengine.com.)

We also made use of the UE4’s macros, which allow C++ and Blueprints to communicate with each other.

An example of one of these macros would be UPROPERTY, which is a macro you can add on the line before a class member variable.

Figure 2 (Self Collection)

What this helps enable us to do is that we are able to quickly tweak these variables in-engine using a Blueprint version of our created class using property specifiers such as EditAnywhere and BlueprintReadWrite in the brackets.

“The UPROPERTY() macro is used to expose variables to the Unreal Engine editor and to include the property in the Unreal Engine memory management system.”

Romero Blueprints (2020)

We are also able to categorize them so that they show up within the Blueprint’s properties.

Figure 3 (Self Collection)

I managed to make several different characters that would be inherit values from their parents.

For this I created a character assigned as “Animal”, and then following that created a character that inherited from this class called “Dog” which had some variables from the Animal class but also some of its own.

Figure 4 (Self Collection)

Using a UFUNCTION, I was also able to call a function that would set one of the dog’s variables to true by calling it in the default values of the class.

Also within the dog’s default values is attained from the Animal class, which is “Legs”.

Figure 5 (Self Collection)

What we learned for the first lesson was a good start to Unreal, creating simple classes and getting used to working with both Microsoft Visual Studio and Unreal.

Bibliography

Docs.unrealengine.com. 2021. Class Hierarchy. [online] Available at: https://docs.unrealengine.com/4.27/en-US/API/ClassHierarchy/ [Accessed 19 October 2021].

Docs.unrealengine.com. 2021. Blueprint Class. [online] Available at: https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Types/ClassBlueprint/ [Accessed 20 October 2021].

Docs.unrealengine.com. 2021. C++ Class Wizard. [online] Available at: https://docs.unrealengine.com/4.26/en-US/ProductionPipelines/DevelopmentSetup/ManagingGameCode/CppClassWizard/ [Accessed 20 October 2021].

Romero, M., 2020. The UPROPERTY() macro. [online] Romeroblueprints.blogspot.com. Available at: https://romeroblueprints.blogspot.com/2020/10/the-uproperty-macro.html [Accessed 20 October 2021].