Cooldown upgrade
I had an upgrade that sped up the movement cooldown by 25%. This is a quantitative change, not a qualitative one. I think that makes for a lame upgrade. Now I'm experimenting with a new upgrade: add 1 to your max HP. This is also a quantitative change, but it's significant enough that it changes the game. Of course it has to be quite expensive.
AI
I've been optimizing and bug-fixing the AI. I've been having trouble with the triangle rasterizer. I want it to distribute points evenly across all surfaces, but sometimes it doesn't do that.
Actually fixing the problem sounded like too much work, so I first deployed some mitigation measures. The biggest issue was the following scenario:
- AI bot tries to pathfind from point A to point B
- AI system tries to find the navigation graph node closest to point A
- The nav graph is missing nodes near point A, so it turns out the closest node is actually on the other side of a wall
- AI system happily calculates a path from that node
- AI bot gets stuck trying to get to the other side of the wall
I "solved" this by also storing a normal for every node. In the scenario above, the system will now ignore the bad node since it's facing the wrong way.
This duct-tape patch still wasn't enough, so I also went and actually fixed the rasterizer. It now works on all but the very thinnest of triangles. I think I'm okay with it.
Even with a perfect nav graph, the AI can still get stuck due to the low sample rate. I put in more mitigation measures:
- Normally the bot tries to crawl toward the next nav node before shooting toward it. I made it stop if any further movement would obscure the next node behind an obstacle.
- If the bot can't see the next node, it might be a bit off from the node it's currently supposed to be at. I made it crawl toward it in this case.
- If all else fails, the bot goes into "panic" mode after a few seconds, swinging the camera around and shooting to the first suitable target location.
I did a lot of work on the behavior trees as well. They keep falling into loops, where behavior X gets triggered, executes successfully, but for whatever reason doesn't actually do anything to change the situation, and so it gets triggered again the next time around.
The bot actually has three loops, two of which run in parallel at any given time. This is another place where repetition can creep in, because the two parallel loops can preempt each other in certain situations. You're running behavior A, behavior B interrupts it, but as soon as it's done, behavior A starts up again. If the two behaviors are at odds (going different directions for example), the loop will repeat forever.
Right now each behavior has a hard-coded priority index, but I think I might need to alter it randomly, or decrease it every time the behavior runs, in order to avoid situations like this.
Goodbye teleporters, hello rocket pods
Teleporters were just not fun. Plain and simple.
Also, getting caught in an enemy sensor field was not scary enough. The enemy gets points for it, and they might be able to track you down better, but they might not even be looking for you at that moment. You end up with "alarm fatigue", walking around constantly being tracked without worrying about it.
So I trashed the teleporters and replaced them with single-use rocket pods. Each rocket is dirt cheap and takes 1 second to spawn. I'm expecting people to build arrays of these things.
Here's a gif. Ignore the cramped UI, it's a lot less crowded in 1080p.
Right now the rockets just head straight for the target without regard for the environment, but I'll probably have to put some simple obstacle avoidance in.