Sunday, July 10, 2011

Commoner AI Project

Crimmor needs to feel like a big city. And that means not just buildings, but commoners, lots of commoners, behaving in natural ways. Definitely an AI challenge. What I've been doing is combining Uncle FB's npc control scripts with ones used by Lugaid of the Red Stripes in Danaan Unvanquished, and added in my own code.


The goal is to provide an advanced AI for those "unimportant nameless npc" groups that fill out game worlds, while keeping things simple for builders to implement by minimizing the need for things like local variables. This AI is not for any npc that you want to behave in a specific way. The builder places an npc with this AI in their heartbeat, and they will eventually behave depending on their creature tag using substring detection to catch "classes" such as commoner, merchant, noble, bard etc.

Day/Night schedules happen automatically depending on waypoints placed in the area by builder. The schedules have randomization built in, with the randomization controlled via script variables. Common actions such as farming, shopping etc are predefined for builders, so commoners that spawn and move towards waypoints indicating these behaviors will automatically adopt them. For example a builder can place a "farming" waypoint and any commoners who are directed to that area will automatically play farming type animations.

As this is a project for the benefit of the community, feel free to take, fix, and improve, as long as you contribute back so others can benefit.

Social Thread. 
http://dl.dropbox.com/u/3879894/ai_test.7z

Monday, July 4, 2011

Hacking trap code

I've located the default code that handles traps (in traps.zip go figure...). Now that I can access the trap code I can inject my own code into the trap process and package that up into the campaign. This allows me to do all kinds of fun things, like make non-conductive thieves tools to avoid electric damage and extra long tools so the rogue can work at a distance and avoid spike traps. This allows me to create a new category of item, thieves tools specialized for handling specific trap types. Since the tools still get used up it allows a one time "bypass" if the rogue has a set that matches the trap type. Tools that do not get used up versus traps are also now doable, so our rogues can now have a favorite set of tools instead of the disposables. This makes the thieves tool a much more significant item, both from a gameplay standpoint and from a role playing standpoint since you can now invest time in giving a set a story. ("You found the personal tool set of the Guildmaster!") Purposed tool sets are now also possible, such as a set that is +5, but only versus fire traps.

The other good thing about finding the trap code is that I can now use it in conjunction with the pickpocket system I have, so npcs will be able to trap their pockets to guard against thieves. Theoretically, the system could also be used to allow a pc to trap their own pockets for multiplayer or a PW, but I don't need that functionality for Crimmor.

I can't say I've done anything with the trap code yet. I've been working on another unrelated scripting project for Crimmor that's much more complicated but promises far greater results.