Extra Work - VR Mecha Game
This is the beginning of something I'm definitely going to continue with. I got the idea for this in the middle of the Negotiated project, so I just had to get it out of my system. Once I was happy with the little demo I made, I got back to the project (what little that mattered, really). However, I made this. I'm proud of this. So I'll show what I did.
If you saw my Negotiated Project, you may have seen a mecha design. Well, that's what started this all! The very first thing I did was create a very simple model version of this mech, which I could use temporarily. You can see the resulting mesh below.
Now that I had a mesh, I needed animations. Simply put, I needed a slide left, back, forward, right, idle and death animation. With a bit of work (and learning) in 3DS Max, I managed to get what you see below. Usable animations, yay!
Now... I'm going to skip ahead a bit, simply because I didn't really document as much of this, and I don't have access to the project at the time of writing this. About a week later, I had a playable, functional level with an enemy AI that works and tries to kill you. Pretty big jump, right? Well, it was a big learning bump.
If you saw my Negotiated Project, you may have seen a mecha design. Well, that's what started this all! The very first thing I did was create a very simple model version of this mech, which I could use temporarily. You can see the resulting mesh below.
Now that I had a mesh, I needed animations. Simply put, I needed a slide left, back, forward, right, idle and death animation. With a bit of work (and learning) in 3DS Max, I managed to get what you see below. Usable animations, yay!
Now... I'm going to skip ahead a bit, simply because I didn't really document as much of this, and I don't have access to the project at the time of writing this. About a week later, I had a playable, functional level with an enemy AI that works and tries to kill you. Pretty big jump, right? Well, it was a big learning bump.
The first thing you'd notice is that the Mech's animations are blending together. this is known as a 'blendspace' and is used commonly in Unreal Engine to blend animations dynamically and save a lot of time for the animators. This blendspace was taking the velocity direction of the character (relative to the direction the model), and using that to determine animations to blend.
After that, you'll notice that one of the arms of the model is pointing towards the enemy when in range. This is what is known as Inverse Kinematics (IK), and is usually used to change the position of the foot so it doesn't clip through things like stairs when characters interact with them. In this case, I used IK on the arm to dynamically point at the enemy target - in fact, it was pointing ahead of the target. Using the distance from the player to the target, and the speed/direction of where the target is going, I was able to create a vector in which the target would be in the time it takes the bullet to reach it. This is what a lot of 'auto aiming' systems in games use for projectiles, and is effectively 'leading' the aim of the gun ahead of the enemy to make the gun hit it in time.
Now, for the AI - this I spent the most time on, as it took a lot to get things working. The idea of the AI is simple: when it sees the player, it begins moving towards it until it's a certain distance away. If it loses sight of the player, it will move to where the player was last spotted until they have found the player again. If they don't, the AI returns to where it was spawned. When the AI has spotted the player and is in range, it begins strafing around the player and shooting. This makes it harder to aim at the enemy, as if it was standing there, it would be rather easy to hit. Adding a healthbar to the enemy makes what you have in the gif!
Oh, and just as a side note, the explosion is a simple particle effect I created that spawns at random 'sockets' in the skeletal animation of the mesh. The sockets were named 1-10, so I could just pick a random integer between that range and turn it into a name, and then that would place the particle effect at the position of the socket selected. This makes every explosion unique! I thought it was a pretty neat way of doing things.
Oh, and to show off one more thing, I also made a system that lets me switch weapons when launching the level. This will let me set up the 'weapon selection' menu in the future for when I try and turn this into a full game. Take a peek below!
That's what I've made for the project so far - I will be continuing this over the summer holiday, so hopefully this will become a full game someday! You may even see it on the Steam Store.



Comments
Post a Comment