TACStrike: weeks of June 15th - 28th

Published on Monday, 29 June 2015 07:28
Written by snake5

Character editor was the subject of focus for these two weeks. Gameplay's not quite there yet but I am getting quite close, as you can see in the video (P.S. I'm aware of the "fire" coming out of the gun, it's expected to look strange at this point - it's just a placeholder):

Let's get into all the rest first, as character editor is a bigger topic.

 

Level design & editor improvements

Material lookup from texture names.

06-22--2321-mtlovr

This was necessary to apply normalmap to water, for example. It's not easy to see at the moment but there's going to be an environment map and scrolling there as well and it will look more watery soon enough.

 

Shooting

What was done to make the video possible was rather simple - had to fix aiming, add weapon particle system, retrieve gun barrel attachment matrix, add basic bullet filtering (whoever shot it shouldn't get hit by it) and reconfigure shooting (faster bullet, different trigger, origin and direction).

To get there, however, some effort was required to build the...

 

Character editor

Editing/generating metadata for character meshes with realtime preview.

06-20--1145-charedit4

Character data consists of 5 major parts: mesh, bones, attachments, layers and masks.

Mesh must be selected from the "Edit character" tab, all very simple so far.

Bones are where it gets a bit more exciting. Apart from joints, that aren't implemented yet, there are bodies - physical representation of bones, and hitboxes - raycast-friendly representation. A body can be a box, a sphere or a capsule, with size/position/rotation relative to the bone. A hitbox is about the same thing, just limited to the box. Both can be generated automatically. Joints will be an important part of the system when I get to ragdolls, and that leaves bodies unused for now as well.

06-18--0954-charedit2

Attachments are the next best thing. They define a transform (position+rotation) that is relative to some bone. This makes it easy to position anything relative to any bone of the character, and to retrieve that position by a name, thus making positioning portable across multiple characters. This is how I place weapon particle effects at the right spot - I get the attachment matrix by name and pass it to the particle system.

But there's a plot twist - currently the weapon is welded into the character mesh, how could I possibly do the same thing when I make it possible to swap weapons? The answer is once again very simple - weapons will be characters. While they contain no bones, their transforms will still be relative to them.

This also allows me to define weapon "rest position" (on back for larger weapons, on the side of any leg for a sidearm) and placement of hats that could fall off while fighting.

06-18--2339-charedit3

Now while attachments determine where things should be put, layers do the opposite - they can produce basic movement (movement and rotation) in response to basic input (a number). They can be used to turn a character's upper and lower parts separately, or to make its arms go closer when near a wall, or turn its head towards a target etc.

So basically layers will be used to implement basic and responsive pseudo-IK, without constraint resolution.

06-24--2327-charedit6

And finally there's masks. They're most simple - specifies named sets of weights for bones, to use for masking bones to animation players (letting them affect only the specified bones by the given amount). Just like layers, it helps for upper/lower body part separation, to allow blending partial animations on the character (reloading animations rarely need to move legs, for example).

06-25--0944-charedit7a

As I'm sure you know, many of these things can be easily done in code, however there's one issue - not all characters can have the same bone configuration. Even if the names can be matched (though as I found out - it's a bit of a pain to do so on Blender as bones lose their animation tracks and it takes time to restore them), transforms often can't. A slightly turned bone can make all the difference in the world, making weapons hover or appear to be sucked into something.

 

Since I can make enemies shoot bullets now, I would like to take the time to develop a fully animated character and work on the AI. If I can make all that work, the rest is not likely to cause much trouble.

Search

Latest images