Chicalm Uncovered - How it is Programmed

The goal of the Chicalm game was to write a fun interactive game that simulates the behavior of real dogs. The challenge was to write a game that is easy to play while still being realistic. Here I will show you how fuzzy logic [1] is used together with a bit of simple dog knowledge to simulate the behavior of a real dog.

To make the game easy to use, I chose a selected number of calming signals. I decided to allow the Chihuahua to lie down, sit, play, turn its head, and walk. I hope that this number of signals is easy to control while giving the user quite some power over the dog. For ease of use, you can either control the Chihuahua by mouse or by keyboard.

The code for the big dog deals with whether to eat the Chihuahua or not. To do that the code just keeps track of the big dog's aggression level. At a fixed interval the aggression level gets increased and the calming level is subtracted from it. If the aggression level gets too high, the big dog eats the Chihuahua.

To calculate the calming level, fuzzy logic is used. Dogs interpret calming signals differently depending on the distance they are from the calming subject. When they are at a short distance they react well to the turning of the head, while at large distances lying down seems to work best. At medium distance, getting into play position and sitting work best. The Chicalm game uses the following graph to determine the calming level.




When dogs get aggressive they don't think as clearly. If a dog is aggressive, it is better to lie down even at a small distance. The aggressive dog needs a stronger signal. To get this into the game, the aggression level of the big dog is added to the distance before determining the calming level.

The last signal the big dog can react to is walking away. Among dogs it is extremely rude to walk away before having been properly sniffed. (Almost every time our Gina growls at another dog, it is because the owner of the other dog is pulling on the leash and forcing the dog to walk on.) For every step the Chihuahua takes the big dog follows and its aggression is increased. The Chihuahua has no chance to dodge past. Of course once the big dog has finished sniffing he no longer cares about the Chihuahua. Now the Chihuahua can safely run to the other side of the screen.


I hope that this discussion helps you understand the Chicalm game and when meeting both real and animated dogs.




[1]Fuzzy logic is a logic that allows many different values between true and false. Chicalm makes use of this by not just checking if the Chihuahua is calming or not as it would be done in traditional logic, but by allowing it to calm at many different levels depending upon the distance, and the aggression level of the other dog.