arkcadeproject
arkcadeproject
Ark-cade
12 posts
Don't wanna be here? Send us removal request.
arkcadeproject · 2 years ago
Text
Player - Use button/Gadgets
In the game there is a button which is used for a multitude of different things such as interacting with buildings, upgrading structures etc.
Tumblr media
The general use action functions by being an event dispatcher which interacts with all objects within the map and only the object which is in range is selected which is determined in the object's blueprint.
The general use action is only triggered however, when the entry on the gadgets table is empty AKA when no gadget is selected.
Tumblr media
Gadgets work by referencing a datatable, which stores the name of the gadget, its use cost and the picture it uses for the HUD, by a specific index which is increased every time the gadget swap button is pressed and loops back to 0 once the index is too high and then setting a variable to the name of the row of the selected gadget. Then, as shown in the first picture, the name of the datatable is used to determine which function is used, all of which require parts to use.
Repair kit
Tumblr media
The repair kit is used to simply repair the current weapon the player is holding back to full durability if the weapon is at all damaged.
Turret
Tumblr media
Unlike the other gadgets, the cost of the turret increases by 15 for every turret on the map currently, once used it spawns a new turret at first level, therefore increasing the price of the next turret spawn though the price goes down if a turret is destroyed.
Grenade toss
Tumblr media
The grenade toss gadgets throws a short range grenade with an AOE high damage explosion which is very useful at clearing crowds.
Medkit
Tumblr media
Lastly the medkit gadget heals the player for half of their HP while useful for the early stage of the game it begins to lose its value later in the game when enemies get increased damage.
The idea to use a datatable for the gadgets was the first idea and it ended up working, therefore this didn't go through any changes and overall I'm happy with how it turned out.
0 notes
arkcadeproject · 2 years ago
Text
Player - Weapon Firing System
The Weapon Firing System (WFS) went through multiple unsuccessful iterations where holding down the fire key would not continue to fire, however this was solved by the current firing loop.
Tumblr media
The system operates using a simple loop which uses the "Firingbool" variable to control the loop. Whenever the fire button is pressed, the "pull trigger" event is fired causing the bool to be set to true and start the "firing" event loop. First, the weapon fires (see below) then a calculation is made depending on whether or not it is below 1, a different calculation is made. but both use a delay to determine when the next bullet will be fired. Afterwards it checks whether the bool is still true, if it is, the event fires again and the process repeats, otherwise the do once node is reset so that the loop can be started again after firing is stopped, which can be done by releasing the fire button which causes the bool to be set to false.
Weapon fire
The weapon fire system seems complex due to the fact that a check must be made on what weapon is being used, but in reality it does the same thing on both paths, simply with different variables.
Tumblr media
First, the current weapon variable is given as an input and used to check which slot is being used, after which it checks if the weapon has durability equal to or less than 0, if true, 2 parts are given to the player and the weapon slot is emptied, otherwise, the game checks what weapon is being used using the Slot variables, the correct weapon is fired using an event and lastly, durability is decreased to the correct slot and the attack sound is played.
Tumblr media
Weapon fire functions
The function for the sniper rifle and pistol are almost identical, the only difference being that the sniper uses a different projectile and the pistol uses a different scale for its bullet
Pistol
Tumblr media
Sniper
Tumblr media
The firerate for the fireloop is set to the firerate of what slot is being used, a projectile is spawned and the screen shakes.
For the shotgun, a little more happens, as it spawns multiple projectiles, it operates on a for loop which goes through 5 indexes where the index is used for the direction each bullet is fired in and the bullets are set on kill on hit which means that the projectile is destroyed when it makes contact with anything.
Shotgun
Tumblr media
The last function occurs when the player has no weapon, it works on the same basis, however, it spawns a melee projectile located at a scene in front of the player.
Baton
Tumblr media
The whole firing system and its functions always functioned in the same way with the exception of implementing the durability feature and hasn't been changed much.
Overall I'm completely satisfied with how the system works in game.
0 notes
arkcadeproject · 2 years ago
Text
Player - Weapon system
In this game the weapons operate by reading a multitude of variables stored inside the player.
Tumblr media
Every variable has a secondary version as the player is able to hold and swap between two weapons, as such, there are variables for the stats of the weapon in the first slot and variables for the stats of the weapon in the second slot.
Slot - determines what type of weapon is being held, eg. "pistol" would cause the pistol code to be used
SlotDur - determines the weapon's current durability. Weapons break once this reaches 0 or below
MaxDura - determines the weapon's maximum durability. Used for the purpose of fixing weapons
SlotDmg - determines the damage dealt by the weapon.
SlotFirerate - determines the delay between bullets fired.
SlotSV - determines the scrap value of the weapon AKA how many parts will be given to the player when the weapon breaks or is scrapped
SlotUC - determines the weapon's Upgrade Cost when used at the upgrade station
The last variable - current weapon - is a boolean which determines which weapon is currently being used, false being slot one, true being slot 2.
These variables are only for the weapons the player is holding and are changed whenever a weapon is picked up.
Originally, the plan was to store the weapons as actors, however this proved to be difficult and as such, the method of storing the weapons was changed to use a string instead. The durability and max durability were also added a bit further down in development when developing the upgrade station, when it was decided that another reason to use the station was required as it seemed underutilised.
0 notes
arkcadeproject · 2 years ago
Text
Enemies - Pointer
All enemy types come with a "pointer" when spawned which allows the player to keep track of what enemy is in which direction.
Tumblr media
The pointer works by having an in world widget that is constantly at the players position which rotates using a calculation towards the enemy that it is assigned to.
0 notes
arkcadeproject · 2 years ago
Text
Enemies - Enemy spawner
Blueprint can be viewed here
The centerpiece of the game used for both spawning the enemies and the wave system.
The spawner works by utilising a gate with frequent checks if the correct amount of enemies has been spawned. If the gate is open, every 0.5 seconds the spawner finds all of the "target point" actors and spawns a random enemy from an array in the location of one of the target points while also spawning the "pointer" actor responsible for pointing towards the spawned enemy. Next it checks what enemy has been spawned and sets theirs correct stats with a short calculation then increases the number of enemies spawned after which it checks if enough enemies have been spawned and stops spawning if true.
At the same time every tick the spawner checks if there are no enemies on the field and if so it also checks if enough enemies have been spawned. Once both of these conditions are fulfilled, it stops spawning enemies, resets the enemies spawned variable and calculates how many enemies should be spawned next wave. Lastly the spawner starts the countdown to the next wave, with a gate that causes the spawning to commence if opened that can be closed if the "SkipDownTime" event is triggered, in which case spawning starts immediately.
The spawner went through 2 major reiterations, the first being a change that made the spawner use a game instance instead of variables in order for multiple spawners to be able to work together and the second iteration abolishing the need to use multiple spawners by using target points to determine spawn locations and using an array to spawn multiple types of enemy using the same actor.
0 notes
arkcadeproject · 2 years ago
Text
Enemies - Ranged Enemy
The ranged enemy differs from the other two types in the way that it has a perimeter around it that will make it stop moving if a target is within it after which it will begin firing.
Tumblr media
Once there is no longer such an actor within the perimeter, the enemy is able to move again and stops firing, this way the enemy is always a distance away form its target unless the target gets close to it.
The ranged enemy is similar to the melee enemy in a way that its attack is based off of a 1.2 second timer. Whenever this attack is triggered, it fires off a line trace in order to see if something with the player owned tag is in front of it and whether or not it is in range.
Tumblr media
If both of those conditions are met, it spawns an enemy projectile which works by simply checking if whatever it hid has the player owned tag and dealing damage if it does.
Tumblr media
After spawning the projectile, it does a short calculation to properly set its damage and plays a firing sound effect.
Tumblr media
This enemy, like the other 2, did not go through any iterations except for the addition of sprites.
0 notes
arkcadeproject · 2 years ago
Text
Enemies - Bomber Enemy
Being based off of the melee enemy, the bomber enemy similarly didn't go through many changes except for the sprites it uses.
Unlike the melee enemy however, this enemy doesn't attack on a timer, instead it simply walks until the hitbox in front of it detects collision with a player owned actor and then fires the attack event.
Tumblr media
Upon attacking, the enemy first makes sure all of its sprites and widgets are properly aligned with the screen, after which it will shake the screen and flash an impact frame located in the player's HUD.
Tumblr media
After that, it plays a sound effect for the explosion and calculates then deals the correct damage to the player and spawns a crater actor to signify an explosion. Lastly, a short delay is made to make sure the animation attached to it finishes playing and the actor is destroyed.
Tumblr media
0 notes
arkcadeproject · 2 years ago
Text
Enemies - Melee Enemy
Being the simplest AI, the melee enemy did not go through any major changes except for the addition of the code that controls its sprites.
Tumblr media
When the enemy is created, a timer is set for them to attack every 1.2 seconds, a variable is set for the player character and all of the correct sprites are loaded.
The melee enemy has the simplest attack; every time the "attack" event is fired, it checks if there are any actors with the player owned tag in a collision box in front of it and if there are, a small calculation based off of the player score is made to determine the damage dealt to the actor.
Apart for that the enemy shares the general code with the others.
0 notes
arkcadeproject · 2 years ago
Text
Enemies - General similarities
All 3 enemies in the game work in a similar way, the only difference between them being how they attack, which means they have similar or identical code.
Movement
Tumblr media
Every tick, a couple things happen.
First, the widget responsible for displaying enemy health is updated to show the correct health. Next, the game checks if the enemy's HP has fallen below or to 0 in which it executes the death function (shown later), otherwise it executes the movement which is identical in all the enemies in the way that it simply moves towards the closest actor with the player owned tag, with the exception of the ranged enemy, which will stop moving once they get within a certain distance to the object. Third, it makes sure to flip the enemy sprite so that they face the direction of the object they're moving towards. Lastly, a check is made to see if the enemy is in motion by checking its velocity, which it then uses to determine whether to play the animation for moving or the animation for not moving.
The movement itself has never been altered, however the code for rotating and playing animations was added further down the line.
Death calculation
Upon death, all the enemies run the same death function which can be viewed here. The function works by selecting a random number between 0 and 100 to serve as a percentage which it uses to determine which item is spawned upon death, if any at all. When an item is spawned, the score multiplier variable is used to calculate the items stats by multiplying itself by the items base stats and then the enemy is destroyed, leaving behind only its dropped item. The five items that can be dropped are: parts, a pistol, a shotgun, a sniper rifle and a medkit, though only one can be dropped per enemy.
This is the only iteration of this function and it did not go through any changes during development.
Damage
The code for getting damaged is simple and thus did not go through any alterations
Tumblr media
Killstreak
The last function shared by all the enemies is the killstreak code, which simply runs a function of the same name in the player which simply adds one to a counter that resets every 5 seconds if it is not re-triggered and sets a high score where applicable.
Tumblr media Tumblr media
This also did not go through any changes.
0 notes
arkcadeproject · 2 years ago
Text
Spawning a projectile
Tumblr media
In order to spawn a projectile, we can create a custom action mapping (in this case bound to L.click) which fires the spawnactor node with the designated actor being the projectile. The projectile spawns using the player's rotation, while its location is determined by the forward vector, which determines which way the player is facing, multiplied by 100 to place it in front of the player, added to the world location of the player themselves, which causes the projectile to always spawn in front of the player
0 notes
arkcadeproject · 2 years ago
Text
Projectiles
In order to add a projectile, it requires a projectile movement component. The 3 key variables that must be set for every projectile are: Initial speed, max speed and gravity scale.
Tumblr media
Initial speed determines the projectile's speed when it spawns, max speed is the upper limit the projectile is able to reach in game. Should initial speed be higher then max speed, the projectile will decelerate until it reaches the max speed value. Gravity scale, determines how much the projectile is affected by gravity, where 0 means it is not affected, negative values make it go up, and positive values make it go down.
In order to generate hit events, the scene root component must make contact with another actor, however the component is nothing by default so it cannot generate hit events.
Tumblr media
To solve this, any mesh can be made into the root component so that it generates a hit event whenever the mesh is hit, instead of the root scene, which doesn't have collosion.
Tumblr media
0 notes
arkcadeproject · 2 years ago
Text
Inputs
By going into the project settings, custom inputs can be created. By creating a custom axis mapping, you can create custom input events that will be bound to specific sticks/buttons.
Tumblr media
Axis mappings refer to inputs that can go from -1 to 1, while action mappings refer to inputs with only and on/off state.
In order to add movement, the "add movement input" node can be used. By using the custom input events, the axis value can be used to determine scale value, which determines whether you're moving positively or negatively along the specified axis in the world direction vector.
Tumblr media
0 notes