Weekly Update - Combat Decisions

Work on creature AI and the Behavior Editor continues to march along. Hostile creatures are attacking the player now, but I have some decision to make as to what style of player control is the best fit for Antilia and its server.

AI Behavior Editor Improvements

Work on the AI Behavior Editor is nearing completion, at least for the features I need in the near future. Over the past couple weeks the editor has transitioned into a functioning tool I am beginning to design real content with. Some of the notable improvements made in the past few weeks include a better display of parameter values and a map that makes it easier to navigate around the behavior tree.

I should also mention that recently on some weeks I have needed to work late or have otherwise been too short on time to write up a full post like this one. It takes time to gather images and thoughts together for these posts, and when I don't have that time I still post a "Quick Weekly Update" directly to Discord. (The invite link to our Discord group is in the footer of the antilia-game.com website.)

The navigation map in the top right makes it much easier to navigate around a large, complex behavior.

Parameter inputs now display fixed values if nothing links to them, making it easier to read the flow of the logic without inspecting individual nodes.

There are only a few more features I need to wrap up to call the editor complete at this time, including:

  • Embedded Behavior Nodes - This will allow AI behaviors to link to other AI behaviors as sort of "sub routines", and make complex behaviors easier to manage. This is partially implemented, but needs a few finishing touches.
  • Copy and Paste - Being able to copy and paste behavior nodes would improve usability.
  • Roles and Permissions - The behavior editor has too much potential for misuse right now, so it needs to be restricted to a "game master" role. I know a few of you wanted to play with the editor, and we can work out some rules and guidelines for that in the future.

New AI Behavior Nodes

I've added numerous AI behavior nodes and functions over the past few weeks, and with each node and function I add new possibilities open up. I've set up every character NPC currently in the game with it's own behavior, so changing what any particular NPC doing is just a few keystrokes away.

Some of the new behavior nodes include "Follow", "Wander", "Melee Attack Target", and I'm casually bringing the older behaviors for Fishing and Grilling up-to-date as "get more out of each compile" tasks I mentioned in a previous post.

With a Follow node and an instance-id (typically the character's name) NPCs can follow one another around!

The Wander node injects a little liveliness when creatures don't have anything else they need to do. By providing a center position or instance the creature will walk around an object without wandering off far.

Creatures Attack... the Server!

Last week's "quick update" post on Discord was made late in the evening about 20 minutes after getting the iichii to attack the player, but unless you looked closely for the floating red damage indicators it was hard to tell what was happening. This week I added attack sounds and animation to that, however I need to back up a little and re-implement that in a better way. There isn't anything in place currently to sync the animation, sound, and damage indicator, and the result is pretty terrible.

The Iichii and Swamp Jidou will approach and attack Taipii now (and will fight each other), but I don't have a system in place to synchronize when sounds should play or damage indicators should appear. It looks almost OK in this capture, but it's pretty bad in-game.

To remedy this I've started working on a Skill system that will provide control over animations, sounds, particle, and other effects to play out at the appropriate time on the client.

Going from a dozen NPCs that were mostly fishing to testing now with hundreds or thousands of creatures on the server hasn't been without some lessons and surprises. The past few weeks it has often felt like the iichii were attacking the server more than the player's character. Some of the uglier lessons involved all creatures performing too many expensive operations on "frame 1", poor caching of values that are expensive to calculate, excessive use of the 'broadcast' function, and "don't set up all 2000 creatures to randomly follow one of the other 2000 creatures". As I find each of these "bad scenarios" I've been adding code to limit or prevent the worst of the cases.

Antilia's Combat Style

As I work through the AI behaviors I'm becoming more familiar with the strengths and weaknesses of the server simulation. The core of the "Simulation Server" was written shortly after the Antilia MMO, and an "MMO mentality" still lingers in the current server.

On a technical note: I'd say the server's strength right now is its use of multiple threads to simulate a good number of game objects. A weakness that comes with that is a slower response time - creatures are a bit slow to notice and respond when a new hostile creature approaches them. The way objects are divided up across server threads they can't immediately access or interact with one another, they have to rely on messages which take at least "1 frame" (time) to move across threads. Requests for new paths and other "expensive" data are queued up in a "first come, first served" basis that can become backlogged if a lot of requests are made in a short time. On the upside, nothing is blocked by pathfinding and similar services besides the creatures waiting for their data to be calculated. Pathfinding is done its own cpu thread while objects and creatures continue to update.

Here are the thread usage statistics on my dev PC with 1,100 Jidou running a "nest and gather food" behavior while 1,500 iichii are wandering around or attacking swamp Jidou. With 2,500 creatures the Isle of Kasau is clearly too crowded. I'm estimating that a more ideal creature count for the island will be around 600.

All this leads to some decisions I'll need to make soon regarding Antilia's combat style. Technically, the best fit architecture-wise for Anitlia's server would still be MMO-style combat - where the player enters "auto attack mode" and then has the option to move the character around and launch special attacks. But... I don't think anyone really wants that. My plan as I continue forward is to get NPCs engaging in combat against one another as a necessary base mechanic, and then add some action-RPG style combat mechanics on the client side and try to find a balance.

That's all for this week - thanks for reading!