A C1 CAOS Lesson for Everyone

The Wonderful World of C1 CAOS CodingI shied away from Creatures CAOS for a long time, because it does require some time to learn and understand. By no means do I consider myself an expert, yet I’m pretty happy with how my knowledge is coming along! That’s always what I encourage everyone to do with Creatures: Find something new, know that you won’t be a master overnight, and have fun learning along the way! I often ran away, like this terrible graphic shows, but now I want to just introduce the concept of CAOS in Creatures 1. We’re going to start with a very simple script, which shouldn’t scare anyone away! Enjoy, and please feel free to ask questions! And never be afraid to offer a different opinion or correct me: I’m not always right!

First, what is CAOS? It is explained in detail at the Creatures Wiki, but simply think of it as a programming language. Although all of the Creatures games use it, it differs from game to game. I’m currently only looking at Creatures 1 CAOS, so keep this in mind if you plan on examining Creatures 2 or Creatures 3 and Docking Station! Every object in C1 has at least one script behind it, and this simply defines what it does. If we didn’t have scripts, objects wouldn’t do anything, and Albia would be one boring place. CAOS can be complex, but let’s take it one step at a time!

Finding Ways to See the Existing Creatures 1 ScriptsThere are a couple of resources and programs I recommend for understanding C1 CAOS. First, download the Official Creatures CAOS Guide. It’s long, yet using the search feature to find specific commands works wonders and makes it seem a lot less intimidating! Another important resource is the List of Script Numbers. The values correspond to all different types of actions. Don’t worry about this list, though! Most objects only use a couple of these scripts, and this is simply a tool to understand some of the values in CAOS. The most important part of learning CAOS is to understand the scripts of a working object. This can be a COB, or an object already existing in Creatures 1 (like a carrot or spinning top). I use CrEd32 to extract the scripts from a COB file. As for existing objects, Amaikokonut kindly let me know about a feature in BoBCoB, called AutoScript. This works nicely, yet it can only extract the scripts for one object at a time… And it takes a long, long time.

As if by magic, a solution to extracting all of the C1 scripts was released today at The Shee’s Lost Knowledge! I have little else to say except: Try it out! In just under a minute, the program extracted 189 scripts from a brand new world in Creatures 1. It is simply amazing, and a perfect way to start looking at CAOS! Again, don’t worry about the fact that there are so many scripts. Take a simple object with just a few scripts, and it isn’t too terrible trying to understand what it all means. We’re going to be looking at the basic carrot, and it should become clear about what the problems are with it. Although I’m going to release an update myself very soon, please don’t think that means that you’re not allowed to make your own fix for the carrot! It might just be the perfect way to start understanding CAOS. Let’s jump in!

Annotating the Carrot’s Activate 1 Script (2 6 3 1)

I know this is the right script because it corresponds with the class number for the carrot (2 6 3), and is for the activate 1 script (script number 1). Need more help understanding this? Ask away: I’m happy to explain more!

CAOS Code Explanation
scrp 2 6 3 1 Some programs begin with this line, while others name the file by it. This simply creates a new script for 2 6 3 (carrot) for script number 1 (activate 1, or push). Everything included here will happen when a Creature pushes, or eats, a carrot.
doif pose gt 4 If the carrot’s pose is greater than 4, the following commands should be executed. You may need to use a program to open the sprite file for the carrot (pars.spr) to understand this better. However, poses for 5 and 6 are for the full grown carrot, while poses 0-4 are for seedlings. Hence, only full grown carrots will continue on with this set of doif (pronounced “do if”) instructions.
stim writ from 10 255 0 0 35 100 34 70 57 100 0 0 This looks long and crazy, but don’t rush off just yet! The first part, stim writ from means that a stimulus will be emitted onto the Creature who is pushing (eating) the carrot. The portion 10 255 0 0 is a little beyond the scope of this first lesson, but these values define the significance, sensory lobe neuron, intensity, and features. We’ll leave those for another time! 35 100 is in the format of the chemical number, followed by the amount of it. Simply put, this means 100 units of hunger decrease (chemical 35). 34 70 means 70 units of NFP decrease (chemical 34), while 57 100 means 100 units of starch (chemical 57). The final 0 0 means that a fourth chemical is not used with the carrot. We can understand this to be the set of chemicals that a Norn or Grendel gets from eating a carrot.
snde chwp Back to an easy one! If the object is on the screen, this line states that the sound file chwp.wav will play. We all probably know that sound!
pose 0 Here lies the part of the script that confuses Creatures to no end. This means that the carrot will now return to pose 0, which is a seedling. At this point, it was already eaten and we would have heard the chewing sound. The problem? The Norn or Grendel is still holding the carrot! Setting the pose like this is a useful piece of CAOS coding, but this is a surefire way to confuse everyone here. I’ll be explaining how I’ll fix this line in a later update: It’s a bit long, but not too bad!
endi A short piece of code comes with a short explanation: It marks the end of the current doif statement. Always pair this with a set of doif instructions!
endm Surprise: This terminates the current script! It’s another requirement, that is like a “The End” in the coding language for each script.

Breaking Down the Script Even More

What does it all mean? When a Norn or Grendel pushes a full grown carrot, he or she receives 100 hunger decrease, 70 NFP decrease, and 100 starch. A chewing sound can be heard to indicate that the carrot has been eaten, and then said carrot turns into a tiny seedling. And that’s it! There are still several other scripts to go through, yet this one defines what happens at the most crucial moment: Mealtime! Check back soon to learn more C1 carrot CAOS!


Add a Comment

Feel free to join the discussion! E-mail addresses are not published, and required fields are marked.

« Previous Post | Next Post »