Hey guys, I’m currently working on a game influence by ‘Hidden & Dangerous’.
H&D is a RTS/FPS, but allows you to go in to a top view and plan out your players commands. You control 4 soldiers. The game is pretty hard as your players die very quickly and once they are dead, that’s it, you loose them for the rest of the game. Before you start a campaign, you get to choose you soldiers and equipment. I want to keep these elements.
I still want the players to die quickly so that you do actually have to use good tactics and be careful instead of just run and gun. Just like in the H&D series. If you just run and gun, you’ll die straight away.
So that’s kind of what I’m going for. If you’ve played H&D then you’ll know.
Stuff done so far:
- Character switching. In-game and in the map overview
- Friendly AI controller that takes over soldier when player switches to another character
- Switching between the game and map overview/planner
- Using the anim starter pack for basic animations and control
- Command system which allows the player to stack commands for each friendly soldier. Such as move to, go crouch, go walk etc. Friendly AI will go through each of it’s commands one after the other and move on the next one when the current one is complete
- When player switches out from friendly soldier to another one, AI will take back over and continue executing any commands
I’ve started writing out some of the stuff I’m aiming to implement. This list is not exhaustive though!
Game is broken down in to several campaigns. Each campaign has an x amount of specific missions.
Player must be able to choose what soldiers he is going to take on campaign
soliders must have stats
stats can be improved over time
soldiers will be made unavailable if they die
stats: Strength, Awareness distance, acuracy, run speed
Player can choose weapons/gadgets and ammo to take to last campaign.
Before a campain specific mission, player can give each soldier there own loadout up to their max weight
Player can choose from weaponry recovered from previous missions on that campaign
Each soldier can carry varying weights of item
Player can only pick one primary and one secondary
Player can then pick gadgets
Player can give certain amount of ammo for the campain (Weighted)
Mission win triggers:
Capture and return character
Move to waypoint
Fire at will
Plant placable gadget
Throw throwable gadget gadget
So this game is certainly more challenging to make than I had hoped for, but I’m pressing on. I restarted with a c++ project. Trying to do it in BP only was getting very messy, very quickly.
I’ve created the soldier selection screen, where you can choose from a database of available soldiers who have different stats. Upon starting the game, the soldiers you selected will be spawned and their stats filled.
Made a start on the weapon systems too.
I need to keep learning more and more about AI/Behavior trees/Blackboards etc before I go back to the friendly commands system.
Video below showing soldier selection screen functionality.
I’ve also made a start on the friendly AI. You are now able to go in to the planning map view and mark out waypoints for each soldier.
Finally, I have got my head around how I’m going to implement the command system.
I’m going to have ‘command volumes’. Each character will have an array of command volumes. Not only will these volumes have a location, which covers move-to type commands, but they will have enum options to set when the player gets to that volume. Such as telling the character to crouch/go prone etc. Select a weapon or whatever. The character can then just check the options and then destroy the command volume. The behavior tree can then find the position of the next command volume and send the character there.
One other benefit is, even if I don’t want the player to go anywhere, but still have a command, such as select a weapon, it can just spawn it where it is, carry out the command and then move on to the next.
With this core part figured out, I’m actually going to do a 3rd iteration of the game. I want to change the player switching. I want a live spectator pawn setup. So the game is live and the player can issue commands in real time, but also able to slow or stop time in the game. All the while, allowing the player to posses the selected character and take over it’s AI.
Here is a demo of the command issuing. I need to transfer the behavior tree tasks over to c++ but I’ve got a good foundation!
A pretty heft chunk of work done. You can now issue basic move commands to each character. You can also control any character.
I’ve added a widget for the commands so you can see what commands you have give. What character that command is assigned too.
You can also delete commands.
I’ve been learning a lot about using EQS.
I’m going to use it so the player and enemy AI can automatically find cover if they need to, or they simply aren’t doing anything.
I’ll also start work on some slightly more complicated commands. Such as ‘select weapon’, ‘enter vehicle’ etc.
Exported UE4 mannequin. Re-rigged in Blender. I’ve made a start on a custom set of animations.
So I have been grinding away working on the animations. I’m an animation noob, so they are a bit goofy. I can fine tune them later though. I’ve got a lot to add though. I need to do all the sideways/backwards animations and then make a start on the firing animations etc.
This is a proper drag, but it’ll pay off in the long run having the animations I want, instead of being stuck with the animations pack.
So I’ve set up AI perception for the friendly AI.
Friendly AI will now respond to enemies when it detects them, and then continue with its remaining commands.
Please excuse the rubbish animations. I’ll refine the animations/speed as I go.
First character modeled. Swapped out the UE4 mannequin.
I have been working on the data driven inventory system. I have one end done. When the game starts, the players are given their chosen weapons. Now I need to make the actual selection screen.
Here’s a photo for the mean time anyway
Not mush to show visually for this post.
I’ve been busy moving the inventory system over to C++.
I’ve also been tackling some hurdles with the AI sight. I didn’t get on well with the AI perception. So I’ve coded AI sight from scratch.
Perception can be used later on for other reactions such as hearing etc.
I originally just a ray cast from the players eyes, to the enemy characters. This was working if they were both stood up, but caused issues if they were crouched or prone behind cover. So the AI now shoots a ray to the actor origin as before, but if that fails, it cast’s a ray to the other actors head. This seems to be working pretty flawless. The caveat being that they wont see if only the legs are showing under cover, but I can live with that. Even then, the way I have structured the sight function, it would be easy to add this in. The sight function does all the filtering at the start then only line traces if for example, the enemy is within a certain distance. If the first line trace fails, it tries the line trace to head. It would just be a case of doing that again to a lower point of the enemy body. Like I say though, I’m not fussed about that really.
Getting the location for the head location was actually easy in the end. At first, I was trying to think of some crazy mathematical solution for an adjusted location from the actor location. In the end, sockets came to my rescue again. Just put a socket on the enemy skeleton in the head, just cast a ray to the socket location. Easy
So I’ve been grinding away at the AI targeting system.
I wanted all weapons to actually fire in their own direction. Using aim offset, the AI can now/have to actually aim their weapon to get hits on enemy.
With the AI stood up and firing at an enemy without cover is easy. What has been a real pain, is if the AI is prone, firing at a target that is behind cover. I still need to make some minor tweaks but it’s nearly there.
The friendly AI is coming along nicely. Friendly AI will carry out user given commands. He will go in to alert mode if he sees an enemy. He will try to attack enemy. If he looses sight, he will go to that location. After a cool down period, he will go back to following his list of commands.
I was actually surprised when I did a quick test. I sent one of my AI in to a different part of the map where I placed a few enemies. He continued to take out all the enemies and continued with his commands. It was really interesting to see him responding and moving around and attacking by him self. I guess that’s a good sign that the AI is coming along!!
I will upload a new video soon. I want to sort out the animations first. Now that I have the AI going in to alert mode and attacking, I need to start adding in firing animations. I’ve started adding in iron sight animations. Now I need to go over and make sure he is going between iron sight/ hip animations correctly.
Finally, a video to show! Freindly AI now responds to and attacks enemies. They will stay alerted for a second or two and then move on.
After grinding away at the AI, I decided to do something a bit more of the art side of things.
Made a start on the sten gun. I still have some work to do with the textures, but it looks pretty good at the moment.
Final asset. Now migrated to the main game. As I already have the base weapon system in place, I’ve gone ahead and added this to my weapons data table and now the characters can use this weapon in game.
So I’ve restarted the project from scratch. Again.
Trying to manually code all the AI was getting a bit out of hand.
This new project fully utilises AI perception/Behavior trees. The behavior is now state based. This makes things a lot easier and clearer. It also makes it easy for AI to remember what they were doing before. So for example, they can be carrying out a command, get in to combat on the way, then they can ‘remember’ if they were waiting, following a command or following another character etc.
Going all in the AI systems, it’s only taken a few hours to get close to the logic I had previous. Much more cleaner and less buggy! The speed is also helped by the fact that I’ve put it all together in BP. Once I’m done, I’ll go through each of the BT tasks and start transferring them to C++. Mind you, all the tasks being event driven, there isn’t a massive pressure to transfer them to C++.
Made a start blocking out the first map. Its aimed to be the ‘training’ map. So just a short mission. The characters spawn at the bottom there. They must infiltrate the base, steal an enemy vehicle and escape to the mountains. The base is mainly a vehicle depot, with reserve troops. Expect minimal resistance with inexperienced soldiers.