Clean Ups

Messing with particle effects today. Above is the result of setting muzzle flash brightness WAAAY to high.

Once I played around with settings I got a good feel for things:

In addition I worked bullet holes so they look a little less “clean”. I still want to get some random going on there but honestly they’re good enough, especially when zoomed out really far.

I’ve also done some work on the physics body of the patrol bot. Now when they die they don’t fly into a million pieces. This stages some of the work needed to make proper impact hit points, however I’ll probably need to scale back the number of collision boxes used on the mesh.

Build #1 (v0.0.0)

Still using the fake name “BlackLace” I sprinted over the weekend and made a first build of the game.

Features:

  • Survival game mode
  • Two weapons!
  • Some horribly mixed audio
  • A settings button that doesn’t work!
  • NO WAY TO QUIT AFTER CLICKING START FORCING THE USER TO ALT+F4!!!

Yeah it’s very early but I got paranoid after seeing my GPU memory jump up to 14.9 gb so I wanted to try to send builds to people with less powerful graphics cards (I got a 4090 with 24gb of vram which is overkill for the mat textures I’m using everywhere so I’m not sure where the 14.9 came from…) UPDATE: It wasnt taking 14.9gb it was only taking 3gb

In addition I added in a bunch of quality of life UI elements in spaghetti blueprints that I will definitely forget next week

One of the most aggravating things about unreal is the half way gameplay framework. The GameMode is a weird half way point between arbiter and useless interface that you need to re-implement. Putting things in the game mode is the “Right” way to do things that are dictating the flow of the game but is isn’t needed. For example, in this case I have the game mode handling spawning of patrol bots and the transition from spectator to player in the game. However, something the gamemode failed to do is to 1.) Have a running list of all pawns (you need to make that yourself) 2.) Transition the player back to spectator upon being killed. I have the player pawn spawning and calling the “possess” function on the baseline controller which is crazy silly (I can probably fix that with ordering but still…).

Here’s some gameplay from the exported build.

(I wont use the snipping tool to record videos anymore…)

Big annoyances:

1.) When you shoot a wall it looks like snow (Need to spend more time making some 2d assets)
2.) Enemies collide with corpses (Not sure how that’s happening…)
3.) Reloading/weapon switching isn’t great (I really dont want to make reload animations but I think I need to now)
4.) The pistol I guess i have doing no damage? (Variable value change.)
5.) Enemies get stale fast. (I have a plan for this)
6.) I don’t turn off footsteps after the player dies so they keep going (Have an idea of whats happening here)
7.) The guns poke through the wall (I’ll probably make the gun model turn up or just make holder animations)
8.) Hud looks terrible

Minor nit picks:
1.) The AR Muzzle flash doesn’t stick to the gun always (Seems to be a niagra mesh renderer problem?)
2.) Some of the sounds are bad (I can spend more time here)
3.) Some of the grouping of Enemies (I think that will be fixed with the corpse collision part)
4.) No crouching (Just need to setup a input action)
5.) No hit reactions from the bots (i think I can fix this with a proper physics asset made)
6.) No fired shells

Things that will test my patience:
1.) I need to make a computer settings menu…
2.) I need to compensate for different resolutions
3.) I need to make a proper physics asset for the patrol bot

Oh also I made some junk to fill in the levels with:

Last one I had from an older project but I put new materials on it.

Less Project More Game

Today I decided I needed to start making this an actual “game” rather than just focusing on the asset side of things. To start I made a simple arena:

Essentially a bunch of walk-able pathways and two towers in the center. The goal was to essentially stress out the AI by putting a bunch of stuff in the way. This succeeded and I had to re-write a bunch of the AI tasks (luckily not the base ai tree too much).

Now the ai flow is:

1.) Check if it needs to reload
2.) Start fighting
3.) If it has ammo, try to move to a “strafeTarget” (i.e. a tactically relevant position) , if it doesn’t have one or can’t move to said target just generally move towards the target.
4.) Wait a few seconds to let some bulletsfly(firing timing happens in the patrol bot logic, not the ai logic)
5.) If you have ammo find a new tactically relevant position to stand in

In addition I have the AI and the patrol bots doing line traces from either the intended target position to the character to see if it can hit the shots it’s aiming for, or if it needs to move.

The big struggle today was setting up the AI settings for unreal, which in general are a real pain. I’m worried I made it basically unplayable on cheaper PC’s but I’ll need to get a build together for testers before I start optimizing. The way unreal’s AI works (and I think uniity is pretty similar) is by setting up a grid of points, then using an “navigation agent” to handle how pathfinding works. This navigation agent is a primitive object (I assume a cube but I’m not 100% sure) that is placed along projected paths to check if it’s possible to move to the target location. If unreal/unity Didn’t have this concept you’d hit a bunch of issues with the AI trying to navigate it’s body through a bunch of pinhole sized paths. So to handle cornering a bit better I started messing with the AI agent size: (Nav agent height near the bottom)

However, I quickly found out that A.) You need to change it int he “navigation Mesh” settings:

also, AND that if you don’t have dynamic re-generation on Unreal just starts saying that the nav mesh needs to be rebuild (and I wasn’t sure how to do that…). So I had to check the “FORCE REBUILD” guy and set the “runtime generation” to dynamic.

This biggest hit here will be performance but again I’d rather rush a build, have it run like crap then optimize as needed.

The bots are doing most of the main things that I think baseline quality AI does:
1.)Don’t shoot at you if it doesn’t see you
2.)Don’t get stuck on corners
3.)Play an animation when turning

The three things it still needs:
1.) Coordination between bots
2.) Less bumping into other bots.
3.) Some form of IK

But In my opinion those things are secondary at the moment. The next thing I want to jump on is a basic health + hud+weapon system so there’s a “game” part of this.

Also this needs to be fixed, but I’ll probably write up a whole thing about how Unreal’s deferred rendering kinda sucks for First person view models (even though the originally “Unreal” games were all first person shooters….)

Three Laws? Pfff…

THE GLORIOUS ROBOT ARMY HAS BEEN CREATED

Working on these guys made me pull in all of the knowledge of unreal and blender I’ve learned over the years. I’ll break it down into hurdles that I had to overcome.

1.) Retargeting skeletons

All of these models have their own skeletons, and each animation that you import has its own skeleton assignment. For the life of me I had no idea how to swap animations that I imported from version 1 of a model to version 2 (i.e. all of the skeleton bones had the same names). I went down a dark path of ik rigging just to realize I should’ve just right clicked a single animation.

…nuts…I had to re-import the assault rifle because I removed the stock for the bot and I made a new animation for the bot:


2.) Making the bots reload.

Again so the goal was to make the bots throw a physical object into the air so that the player would have the opportunity to shoot it. This is a crazy concept that requires a lot of tweaking to get right. The idea here is that I mark a point on the back of the bot as a “throw point” where I spawn a mag.

Then Unreal has a system called “Animation Notifies” which lets me communicate from an animation asset through an animation blueprint back to the controlled pawn.

You can see there are two here: “release Mag” which is the bot dropping a mag and “Spawn Mag” which creates and throws the new mag.

These are then tied to triggers within the animation blueprint to call back to the pawn.

Honestly not a great system but its apparently how unreal wants us to handle these things. Ideally you would have a nicer hierarchy of ownership but making what I would consider “Good” software left the room once I decided to go with blueprints.

3.) Unreal’s AI is helpful and horrible at the same time.

The tree I showed yesterday was very simplistic relative to this. When looking at this the first reaction is “oh yeah that makes sense” then “wait why would you do it this way” then finally “I don’t understand what this picture is”. So quick explanation: start at the root node, go down to the sequence node which triggers the nodes below it from left to right. The green box uptop is called a “service” and essentially is a while(true) loop that triggers while the sequence is executing. The blue boxes are if checks that happen before executing each node, for example “doIHaveAmmo” is used twice here and checks if the bot has ammo before executing. In the event that these blueboxes return false the entire sequence is canceled and you go back to the first node in the sequence(which in this case is the reload node).

4.) Niagra confuses me and I might get back into HLSL to avoid it

I made the muzzle flashes but I still kinda hate how they look. I started trying to make some 2d stuff but that ended up not really working:

The idea there was to try to make a ribbon that had a sinewave of width that would be lower frequency and a radial sinewave that would give bumps on the side. That didn’t really work however.

Then I got creative with making a mesh in blender and importing it in as the firecloud that comes out the front of the gun.

I stuck with that 2nd iteration and it seems like its better than the ribbon but I still want some more cloud-ness to it.

When firing (as seen above) it kinda looks like an orb just kinda spawned in front of your barrel. Most other games try to do this with 2d sprites however I’m a big fan of 3d sprite muzzle flashes like those from the tf2 announcement trailer:

Image taken from : https://gamebanana.com/mods/198837

I might just add some more spikes onto the current model and call it quits on that front.

Now next up for work is probably the environment, I have a bunch of reference images of place I thought were cool in boston and the surrounding area I’m going to try to generate some textures using them as inspiration. I then eventually have to do audio but I’m really dreading looking back into unreal’s dsp system. It’s very intense (and I literally do hardware based DSP in my day job).

AI (Not that kind)

I got a bunch of the animations for the enemy (now I’m calling a “patrol bot”) together to handle it’s movement.Then while I was on a role I threw in some basic AI. Essentially what the robot does is:

  • Looks for player (not implemented)
  • Runs towards the player
  • Starts shooting
  • Moves around to random points in a circle around the player (Within 20 deg of where it currently is, assuming the player is the center of this movement circle) That white ball is a quick representation of where the robot chose to move next.

Nothing to crazy here, the bigger issue (like most of unreal) is knowing what won’t back you into a corner and force you to undo everything you’ve made. Here I have two custom tasks and one custom decorator. The “PatrolBotShoot” task was originally executing a fire function but I flipped the bot to a simple “if Has target then shoot every 1 seconds” mechanism to allow for firing at any moment. The “PatrolBotStrafe” Selects a random point around the player and keeps the patrol bot focused on the player as it moves around. The “PatrolBotKeepFacingTarget” decorator does exactly what it sounds like.

The animations are still the hardest part of all of game dev in my opinion:

The sequence below took five individually made animations (The strafing still looks too timid to me) and pushed the limits of my patience when dealing with imports to unreal (unreal seems to have weird issues if you import ONLY the animations from a .glx file).

In other news I also started reworking the muzzle flash for weapons but I’m still working the kinks out.

My goal here (if I didn’t say it before) is to swap in the rifle on the back of the robot for different weapons, then I dont have to do any more work on animations and I can just focus on environment art (which I’m sorely lacking experience for) and gameplay.

Enemy #1

Woo! Got some animations in game, I made the mistake of thinking that Unreal engine control rigs were actually something useful for what I’m doing. Once I found that out I just gritted my teeth and did the whole animation process in blender and transferred it over into unreal.

These animations will definitely need to be remade at some point but I’ll punt on that until I think I have a level of robot shooting going on.

Rigging Woes…

I tried being clever and pretty much wasted 6 hours….

I spent a bunch of time rigging up this model, a large portion of the time was spent undoing the dumb modifiers I put on the legs. Specifically I used array modifiers and mirror modifiers to generate the legs after making the first one.

Using this technique ensures that when you finally go to export you need to manually re-assign origins somewhere on the model which is something you really need to keep track of when rigging properly.

This all went good but I decided to put the bones 90 degrees offset because I thought it would make it nicer to manipulate. Which I would say is true if I was going to manually manipulate the bones. However, I tried getting smart and moving into unreal engine control rigs: https://dev.epicgames.com/documentation/en-us/unreal-engine/control-rig-in-unreal-engine

Which in theory should let me animate in unreal, which would save me an export/debug step which I normally have to do from blender. However I kept hitting weird issues with setting up controls and having unreal auto-recognize things… Then I noticed the issue once I tried testing the physics asset:

So that isn’t good. Essentially unreal makes a set of simple geometric shapes that it glues onto your model when you import to try to get a good collision box setup. In this case me twisting the bones make the system give up and just surrounded the body with a capsule and legs with one big box:

So I attempted to fix this (which looked good)

…But then I hit the next problem…

What’s going on here is that there’s a parenting loop going on. Looking back at the original model I put the bones 90 degrees offset from the mesh (again because I think I’m smarter than how everyone does stuff).

With the bones offset from the mesh I had to apply the physics geometries to the mesh itself rather than the bone. So then unreal was trying to modify the position of the mesh, but the bone had no constraints to the physics so it tried putting the mesh back, then the physics manipulated the mesh, then the bone manipulated the mesh, then the physics manipulated the mesh, then the bone manipulated the mesh….So that comes out with the result you see above which is everything kind of giving up. The fix here is to re-orient the bones so I can attach the physics geometries to the bone….I basically wasted my morning setting myself up for failure. However this is the first complex mechanical mesh I’ve ever done so it’s still a learning experience in my head.

Abelton has a weird sampler…

Well it’s still simpler but the “slide” mode of the sampler where essentially each segment of the sample gets broken up into chunks that correspond with midi notes. Pretty sick if you’re looking for the linkin park effect from numb.

Pretty cool, I tried playing bass over this and I cant take the damn sound its making. I gotta feeling the fx board that was on the high knob is bad somehow and I need to replace it with just a capacitor somwhere else ala

https://www.premierguitar.com/diy/mod-garage/wire-a-passive-treble-and-bass-circuit

Bot Attempt 2

Remade the robot for the game. This one has some more real world inspiration and is quadruped which I think should make some of the animations easier (easier in concept not really execution).

There’s still some work I might do on the front (there’s that blank space) but I might just stick with this one to rush it in game.

In my head this is a converted cargo type robot, and I wanna keep the same idea where a new magazine shoots out of the back and the robot has to catch it. I keep having this idea that the player should be able to identify this and can shoot the magazine before it gets to the rifle.

…I know…i know…I know