Breathing Life – Day 34

I’ve spent the whole afternoon working on nothing but AI. The work being done is on the way that the office “furniture” behaves. At the moment, the player is able to send the PC desks in the office haywire, so a nearby staff member will rush over to attend to them. After attending to them for a certain amount of time, they are considered “Fixed” and the staff person goes back to their patrol.

To do this, the following happens: The player finds a server rack, which is connected to two computers in the office. Clicking the server rack causes the rack to make the decision “Fire My Triggers!”, it finds the two computers it’s connected to, and tells them to consider making the decision “Attention Ornament!”. If all goes well, the computers make this decision, which causes a wave of sound to pour out of them for a certain radius. Anything hit by this radius will make the decision “Attend to Ornament!”. When one of the ornaments has captured someone’s attention, it goes into “Waiting for Cooldown!” decision. It will sit there until its captured staff member walks up to it. When they touch, they both enter “Cooling Down Ornament!” decision and a timer counts down while he works on it. Once the counter hits zero, the ornament decides to “Return to Idle Ornament”, and the staff member decides to “Consider next Patrol Path node”.

When in “Waiting for Cooldown!”, sometimes the staff member never makes it to the computer. He might get stuck or die on the way. While waiting for cooldown, the ornament’s “Impatience” raises slowly. If it hits a certain level, it will return to “Attention Ornament!” and capture the attention of someone else.

After lots of trials in an office with eight computers and only five staff members, every computer always got fixed eventually. The office is starting to really feel alive, watching staff members hurry around fixing problems and reacting intelligently.

Many Pixels – Day 33

Besides cleaning up a lot of functionality in the code, the last few days have mostly been spend on the design side of things so there’s not a whole lot to talk about at this point. I’ve spruced up the rendering routines to go along with all the new graphics I’ve been working on. Creatures now have a much better method of animating their deaths, and dropping lots of entities into the game with minor/major design differences (i.e. gender, clothing types, etc.) actually works in a┬ádemonstrable┬ámanner now.

The “Emote” popup over creatures heads now has different little icons that can appear in it for “?” and “!”. At the moment, the AI loop calls different ones based on what is happening to the entity.

In the meantime, no screeshot of the new graphics until they take a bit of leap in fidelity. Most of the prototype graphics have been dropped out now and a few of the alpha ones are in so far, but I’m still using prototype assets for the screenshots.

A User Interface – Day 30

A lot of work has been spent recently on the animation and graphics, which I can’t show right now, but I have just today finished the very basic framework for the user interface. It’s a fairly open design where you just declare basic things about a “Window” and what “Buttons” live on it, and the game loop will always check on mouse clicks to see if the user clicked inside a window, and if they did, it calls the function set for the button inside the window that they clicked on.

At the moment, there’s a window called “Asset” manager, upon which the buttons are renderings of all the controllable creatures the player can use. If you click on one of the “buttons”, the function for that button will cause the camera to zoom to that creature, and the player will take control of it. The way it’s designed should make it fairly easy to build a fast user interface which is quick to capture all the input needed to react.

I’ve also done some work on the internal font set, it has an interlaced look to it now which can be adjusted on a sliding scale. There’s also now the ability to click and drag out a square around creatures to take control of multiple ones at once.

Going on Patrol – Day 27

Entities can now be given lists of co-ordinates that make up “Patrol Paths”, which each location accompanied by a “Pause Time”. When a creature is walking around on patrol, they’ll go from node to node, pausing at each one for the amount of time specified. If something more interesting happens while they’re patrolling, they’ll go attend to it before returning to the next patrol node they have in their list.

To get this behaving right in as many situations as possible, I’ve had to work a lot on the main AI loop and the concept of “Interest” in a decision. Whenever a creature decides to do something, they also are given a level of “Interest” in that thing, which constantly goes down the longer they keep doing it until they get sick of it. Creating a balance between which decisions should override others, and what to do when there’s nothing of interest left to do has been a lengthy process, but it’s starting to take a nice shape now.

I’ve had to make a few improvements to the way Pathfinding works as well. Because Pathfinding is a very memory-intensive process, I only allow 15 creatures to use it at any one time. The problem with this was that if a creature attempted to pathfind to an impossible to reach location, they would take up one of the pathfinding slots forever. I’ve changed the rules a little bit so every creature gets five chances to take a single step using path-finding. If they can’t make a move, they release their pathfinding slot for someone else to use and decide that they’ve come as far as they can.