The Dungeon Survival Project continues to progress….
Along with various smaller fixes and tweaks which I don’t remember well enough to go over in detail, this is what I’ve put into the game since the last post on the blog here.
- Two-handed pickup animation and code setup for the player (to throw barrels)
- Creating a “flee” state for the AI, so that rats that have been attacking run away faster than the normal walk speed
- Setting up flee mode so that cowardly/non-aggressive rats will skitter away when the player nears
- Rats will also jump when Move Tos have failed. This is the same jump code I use to make the rat launch forward at the player when attacking. It works surprisingly well at getting the rats to unstick when they’ve become caught on the navmesh.
- Throwing or dropping heavy objects on the rats will kill them (this is just a “side effect/emergent gameplay” of the other code I implemented – and illustrates just a little more of my approach to bringing roguelike-esque gameplay into 3D).
- Rotation and location offset system for pickup actors – this is so that a designer (me) can position a given item relative to the player’s hand in a more pleasing way.
Offsets also mirror correctly to the opposite hand.
- Created two hand pickup animation (not hooked up, though two-hand pickup gameplay functions).
- Created more pleasing rat-death-pose with separate static mesh, to avoid the corruption issue I mentioned previously that was apparently caused by importing the skeletal mesh as a static (it ended up having the wrong number of collision volumes, would fail an assert and crash).
As a side effect of the if-stuck-then-jump portion of the AI, the cowardly rats get startled and jump into the air before fleeing.
An amusing issue has cropped up with the flee state: due to the rat speed being 4x normal walking speed (to give them the appearance of rapidly running off), they also cause massive impact forces.
When the rats hit a barrel or other physics obstacle while moving, they send it flying at breakneck speed.
I witnessed one rat commit rat suicide while I was testing by fleeing away from me head first into a barrel, which rocketed up into one of the walls and then smashed the rat and killed it instantly.
Of course I’ll be tweaking that down, which was needed to reduce the amount of force the rats push the player with anyway.
Now that cowardly rats work, and can flee, I’m going to re-enable the randomization of rat behavior (cowardice and aggression).
Hooking up the rat death animation, putting in some blood effects etc. is the next on my list. After that comes the hunger/starvation/eating portion of the AI.
Unfortunately, despite talking about the player’s kick attack a bunch, I realized I don’t actually have a kick animation like I thought, so that is going on the back burner. I may implement a simple animation that just lerps the leg out into a static pose, but it will look bad.
Finally, I also realized what I need to set in MotionBuilder in order to actually have it save the rotations of bones in a keyframe. That one had me frustrated for a quite a while.
Things are slowly becoming more fun. Tossing rat corpses around, or chucking a barrel onto an attacking rat, are really fun.