Game Stuff: New Hud and Angry Gimp usage

I swapped out the health numbers and ammo numbers for the game. Still frame looks alright now but personally I think the ammo count size needs more work. Also the whole thing is sliding off the screen which makes me think I need to recreate the whole UI widget from scratch. The biggest accomplishment here is getting the hex pattern for that health bar. For my 2d art I primarily use GIMP (https://www.gimp.org/) and gimp is usually good about having a pathway to do whatever you need. I would say around 80% of the time you can google “how to blah in GIMP” and you have 20+ years of history to rely on to get some kind of idea on how to do things. For that last 20% the solution is usually involves ripping an image from somewhere else to use as a stencil or as a basis for a built-in filter. In this case it was the latter. Gimp has filters for making a square checkerboard and diamonds but nothing for hex’s except for a “mozaic” filter. Which looks fine on paper but if you’re messing with the alpha you need very exact lines and the mozaic filter makes a pattern that includes a simulated light which annoyingly blurs the edges. However, the edges aren’t blurred by a gradient color (which can be easily fixed) but is blurred by adding a gradient to the alpha.

From here it looks fine.
Zoomed in is where troubled can be seen.

I tried everything to get rid of these edges but failed miserably: edge detection, thresholding, median blurs, contrast and color selection all seemed to maintain the gradient off the edge lines. I eventually gave up and used the suggestion from “chaz_prinz” here: https://www.reddit.com/r/GIMP/comments/rg5wt4/creating_a_borderless_hexagon_gridpattern/ and ripped a hex pattern from the internet to generate a black/white image which I was able to use for the pattern.
I ended up with a pretty nice pattern here:

Which I threw into a filled green rectangle to get the health bar above (plus some trimming/filling around the edges). I think the result is quite nice and fits the whole old-er school vibe that I’m going for. I might make it red just to fit the obvious ascetics from every other game in existence but I figure I’d fix up the ammo up first.

Lean With it

Added Leaning to the game and did some work on the reactions to different kinds of physical materials.

Gun still clips a bunch but it’s better than it was. The leaning needs more work but I figure to do that properly would require some kind of timer setup which I really don’t want to do at the moment (will add further layers to my not amazing blueprints).

Progress?

Been doing more with the game and got to the point where levels are starting to feel like levels and my “assetImports” folder is blowing up.

More work still needed but I’m starting to get a warehouse vibe that I think I’m going to roll with until it gets stale.

I pretty much gave up on the hit reactions for now. If I come back to that I think I’ll need to make a human-style character, then look through some unreal tutorials before I can move back to the bot.

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.