How to not to Model a Table

Look at this table! Seems good right? …Right?……RIGHT?

I can promise you this is not good, you see when you make 3d models you can’t just “Make” the models. You need to plan and thing it through, the big things are:
1.) Keep the model as many simple shapes as possible
2.) Avoid complex faces that are not quads (i.e. 4 sided 4 vertex where it’s possible to rotate the face to be a flat rectangle
3.) Don’t repeat work (aka if you’re making a table make the leg once and copy+paste it…)

Now let me show you how I violated ALL of these checks

Above is the model view but I’m showing you the faces and vertexes of the model. You can almost immediately see the violations here. Everything is one piece, the legs are obviously done individually, there’s a weird slide in the middle of the table which serves no aesthetic value and if you zoom in on the top of the legs…

A TRIANGLE! However if you take the same pic in wire-frame you can see something much worse.

The bit circled in yellow is a hidden and folded face!!!! A big no-no especially for game dev where you’re trying to minimize the number of faces rendered on screen at once. Now you may ask yourself “Will. It’s still a table why do we care” the problem comes in when you make UV Maps.

from https://lkinulas.github.io/development/unity/2016/05/06/uv-mapping.html

To the uninitiated a UV map is a 2d projection of the external facing surfaces of an object, for a cube if you unwrap it you’ll get a chunky plus sign shape(more about this here: https://lkinulas.github.io/development/unity/2016/05/06/uv-mapping.html , which I skimmed but it seems better than anything I could write). Usually the way that adding textures onto a 3d model works is that you attempt to make the UV map in blender, then you dump into substance painter or equivalent program where you can paint onto the model in 3d, then you can dump the files out as text images. For example here’s the UV map of a keypad I made last year

Which here each of the keys have a single UV map, so therefore they have a single image to represent the color (known as albedo majority of the time, atleast with blender and unreal which both use “Physically based rendering” see https://en.wikipedia.org/wiki/Physically_based_rendering)

The 3d model holds the decoder-ring (which is the UV map) to convert the image file to properly positioned colors on the 3d model. Now you make now ask “hey everything you made for this game is literally a flat color and there’s no detail to mis-align” which is true. However with modern game engines they literally take the UV map and use that information to calculate how it interacts with light. An improperly made UV map can cause 3d models to flicker in bright lights, make them dark when they should be light and vice-versa. In the worst cases it can cause them to disappear entirely! In addition when you start doing things like bullet holes or blood stains on world models, an improper UV map will make the decal that is put onto the model become very mis-aligned from the intended position (think a bullet is shot at a table, the bullet hole should be where the bullet hit).

So now back to the table. The main issue here is that blender is actually pretty awesome at automating the generation of UV maps…Assuming your model is a simple geometry object (i.e. sphere, cube, cone, torus, plane) and doesn’t have the triangles. So if we try to automate the export of the table:

To give context of what you’re looking at, the left hand side shows each face on the table face, each grey square directly corresponds to each face on the 3d model on the right. If I select and individual face:

It shows exactly where the face will appear on the output image. So if you go back to the first image you can see that if I tried to just blindly apply either lighting effects or an image to the uv map we start hitting issues. For instance if I put a light directly on this corner

What will most likely happen is that everything in between those two faces will be lit in addition to the two faces in question. What’s in the middle you ask?

Not the areas you would expect to be lit. There’s also other factors here that I could get away with by getting creative with materials (which determine the direct lighting parameters like luminosity, albedo etc) but that would be much more work than just restarting, making a tabletop model, making a leg model and making a crossbar model then just copy+pasting the whole thing again.

With all of this you may also still be asking:
1.) Why are you making a table
2.) How does this fit into a game?
3.) Why are you blogging and modeling on Saturday night?

Answers:
1.) I haven’t made a model in a few weeks and I wanted to get my feet wet again
2.) Idk, places have tables. Wooden tables. Nice tables. With cross bars.
3.) It’s cold. I feel like crap and shut up

Also I’m straight up dreading adding more animations to the robot, I need to add a knife stab animation, a grenade throw animation and some kind of heavy shot animation. Unreal is very very bad at handling an updated model with updated animations. The process involves re-exporting everything as another .fbx file, deleting redundant animations, deleting the new re-imported base model and re-assigning each animation’s skeleton to the original skeleton and hoping you remembered the export settings from 6 months ago. If your forgot the aforementioned export settings you need to turn a knob keep doing the same process until things look kinda right. I’m debating on buying maya just to avoid this situation but I’d love to avoid learning new things until I get this silly game on steam.

Editors note (1 day later): I realized I wrote this whole thing without explaining why I did a bunch of dumb stuff: I was getting back to modeling and I just ran with the feelings for an hour rather than thinking it through. So I made a bunch of critical early mistakes which makes the model very hard to use.

“We have several items for purchase!”

I made a store stand that I’ll put a bipedal robot behind to be a shop owner. It’s currently not scaled or setup right to work. I think I’m going to make the lightbulb it’s own object that way I can swap colors on the fly. Right now I kept them in because I wanted to see what they would look like on the wire there. On the counter is a cardboard tip box and a metal lock-box.

Behind the Counter is a metal bucket (filled with what? Idk) and a generator that I’ll probably break out into it’s own object also.

In addition I wanna put a decal on the sign up top to say something like “robot killing weapons”.

Also I need to copy +paste the table a few times to make a full stand kind of thing. The proportions are definitely off so when I pull it into unreal it will be flippin’ huge. But before I do any scaling I’ll need to finalize everything on the table and fix up the wires so they’re not as blocky. Flat shading is fine but I think I can keep that vibe but put some wood texture on it for the next go around.

Grenade and stealing music to make more music

I have a few cassettes of older music that I wanna sample and put into something in Abelton. Why use cassettes? They’re cheap as hell, this one was $4 from my local record store.

I also made this guy:

Simple enough, getting it in game went smoothly. I don’t think I want to make this a first person model I’ll probably just attach it onto the front of one of the bots to make a kamikaze bot that rushes the player.

I also spun up a quick “use” system, which is just a ray-trace off the front of the player’s camera to whatever is in front of them. Then I made a generic “usableObject” interface which receives use commands that anything can implement.

This will be the first usable thing:

Idk what it will do but my hope is to make quick chat logs when you press use, or even a buy menu.

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….)