top of page

Skillshot: Unity, Dashes & Enemy AI

A lot has happened in the 5 months since my last post. Firstly, I have taken on a QA role at Rocksteady studios. This is a full time role so leaves little room for me to work on side-project such as this. Another contributing factor to this lengthy hiatus was that I made the decision to swap this project from UE5 to Unity, meaning I basically had to throw everything in the bin and start again from scratch. I could have made posts about the rebuilding process, but design-wise this would have just resulted in me repeating everything I said when building the game the first time in UE. Instead, I decided to hold off until I had added something to the Unity version which was not featured in the original. As you can guess by the title, that something is enemy AI (mostly).


Why swap to Unity?

Although UE provides a useful template for creating FPS by having the basic movement and shooting done for you, this also comes with restrictions. If you are going to use that template as a base, it comes with lots of things baked into it which I didn't want or need, especially in regard to movement and animations. This added unnecessary complexity to the systems, making it more challenging than it needed to be to implement my own mechanics. To resolve this, I tried striping away a lot of the things I didn't need from the template but since everything in UE is so interconnected, this actually proved to be a lot of work as it caused various knock-on issues. At the end of the day, it felt like I was having to fight against the engine to make the game I wanted, rather than using it as a tool. Unity has no such issues, I can create everything I want, from scratch, without needing to work around any in-built systems. The swap also allows me to use C# rather than blueprint, offering a greater level of control over exactly how each of my systems function, which is really helpful for a precise, e-sports-ish game like this.


Dashes

An early addition I made to the project when rebuilding it in Unity was an energy system. Under the new system, the player has a resource called energy which can be spent of various movement abilities. For now, I have only added a multi-jump, and a horizontal dash, but I plan to add various other moves over time. This system allow more player freedom than just having a double jump and a conventional dash with a cooldown. If the player wants to jump 3 times they can, if they want to jump-dash forward-jump, they can do that to, if they want to dash left - dash back off a ledge - then do an aerial jump, they can do that to.


Enemy AI

The most notable addition I have made is that I now have a basic enemy who will aim and fire the player when they are in their field of view. As this game is basically a demo of my ability to create cool weapons, a movement system and the "score for style" game mode, I decided it was not necessary to have the enemies behave just like players, I'm not trying to get myself an AI programming job here. As such, going forward I will be creating a singleplayer FPS level rather than a mock-multiplayer match. This frees me up to create enemies that behave in simpler ways, allowing me to focus on the player. This enemy I have created wields the same sniper weapon as the player which works in exactly the same way, except they act as a turret, rotating but not moving. Also to avoid the enemy having perfect accuracy, they dont always shoot directly at the player, instead a random value (currently between 1 and -1) is added to the X, Y and Z of the player's location, giving the enemy a chance to miss.


Below is a video of the game in its current state. Now dont get too caught up on the visuals, I'm aware its a step down from the UE version, but everything is of course placeholder.






Comments


bottom of page