Breaking Down the C1 Computer

I’ve been poking and prodding at this post for a while and I wanted to make sure that this analysis of the code is as complete as possible. However, I’m still unsure about parts of the code. Here’s what I know so far!

Also, a small announcement. I’m going to be away towards the end of the week and all weekend. Don’t expect many updates while I’m away! I’ll be happy to respond to any comments I receive while I’m gone. Have a great week, everyone!

Something that always bothered me about the first of the Creatures games was that there was no built-in way to teach Creatures how to express emotions. I know there are tools like the Encyclopaedia Nornica and the Super Speech Toy to help alleviate this and I use them both, but I always thought it would be better to have another computer placed elsewhere that taught creatures feelings like there is in Creatures 2.

I had no idea how to start tackling this sort of problem though since I had no way to pull the scripts from the game to 1) learn how the computer works or 2) start making a new computer based off of that one. That is, until I found this amazing tool at Shee’s Lost Knowledge. It’s a Creatures 1 Scriptorium Extractor. It pulls out all of the existing cobs’ scripts and organizes them by class numbers. I was able to pick out which file was the computers thanks to this handy, dandy C1 class numbers list.

I’m not yet ready to start working on additional computers just yet so for now, let’s just see how this works. I’ll be using and Gameware’s Creatures CAOS Guide as references. My comments will be preceeded with a double slash ( //comment ).

bbd: edit 0 
    //Prevents word editing
stim shou 60 8 128 0 0 0 0 0 0 0 0 0
    //Sig, inp, int, feat, chem0, chem0, chem1, chem1 amnt... chem4 amnt
    //Significance – How important this is to the related neuron
    //Input – Which neuron to trigger (255 if none)
    //Intensity – Amount to nudge neuron
    //Features – Determines of features (I'm not sure what this means)
stim from 40 255 0 0 34 50 43 50 0 0 0 0
    //as above

This top section prepares the agent by making it so that words can’t be edited and injecting creatures with the appropriate chemicals.

doif from ne pntr 
    //perform the following if not activated by pointer
	addv obv0 1
        // add 1 to obv0
	doif obv0 gt 13
        // if obv0 is greater than 13 then...
	setv obv0 0
            // set obv0 to 1
        // when a creature activates this it moves on to the next word
    // if it's activated by the pointer
    // this section determines where the pointer pressed (3 buttons)
	targ pntr
        // targets the pointer
	setv var0 posl
        // setv var0 to the pointer's posl coordinate
	targ ownr
        // target self (?)
	subv var0 posl
        // subtract posl coordinate from var0
        // this helps find the relative position of the pointer from PC

This section above begins a handful of checks. Here, at the top, it checks to see whether the pointer activated the agent or whether it was a creature.

If it was activated by a creature then the script will add 1 to obv0. obv0 is the variable that the game uses to determine which word the computer will play. If that value becomes higher than 13, the script sets the value to 0 which goes back to the beginning of the word list.

If the pointer activated the agent, the script needs to determine which button the pointer pressed.

// The following section selects which word to choose from the list (0-13)
	doif var0 ge 25
        // if it's 25 greater or equal to var0 then...
        // This is the "repeat" button. No value changes here.
        doif var0 gt 45
            // if it's 45 greater than var0 then...
            // This is the far right >> button.
		addv obv0 1 
                    //add 1 to obv0
                    //go to next word in the list
			doif obv0 gt 13 
                    //if obv0 is greater than 13 then...
				setv obv0 0 
                        // set obv0 to 0
                        // start the word list over
		    doif obv0 eq 0
                    // if obv0 is 0
		    setv obv0 13
                        // set obv0 to 13
			subv obv0 1
                    // subtract 1 from obv0
                    // go back one word

Once the script has the coordinates for the pointer, it then needs to determine which button was pressed and then change the value of obv0.

The first button is the “repeat” button. Since the word doesn’t need to change, no values are changed.

The third button is the “next” button. If this button is pressed, the script adds 1 to the obv0 variable. As above, if this value goes over 13, it goes back to the beginning of the list.

The second button is the “previous” button. If this is pressed, it subtracts 1 from the obv0 variable. If this value goes below 0, it goes back to the last word in the list by setting the value to 13.

part 2
anim [ 0 1 2 R ]

part 1
base 57
    // frame 57 is the base for this animation
anim [ 0 1 2 3 ]
    // waits til the animation is over
setv var0 obv0
    // sets var0 to obv0 (the word number from above)
    // this helps determine what animation to use next
mulv var0 4
    // multiply var0 by 4
addv var0 1
    // add 1 to var0

part 1
base var0
    // as above, with var0 instead of 57
anim [ 0 1 2 3 R ]
bbd: show 1  
    // shows the current word; taken from obv0 by default
snde word
    // plays a sound
wait 10      
    // wait 10 ticks
bbd: emit 0  
    // speaks the word so creatures can hear, 0 means it will be "read"
setv actv 0
wait 30

part 1
pose 0
wait 50
bbd: show 0
    // shows no word

part 1
base 61
anim [ 0 1 2 3 R ]

part 2
pose 0

Finally, once the word to play is determined, the game can finally play the appropriate animations and teach the creature the appropriate word. My knowledge is still pretty shaky when it comes to how “part” is used, so any help I can get would be wonderful.

I’m also still not sure how to edit the existing computer so if any of you knows how to do this, please let me know! I’ll be happy to walk you through the process so you can see how it’s done.

I hope to have something more complete done next time. If there are any other scripts you’d like me to try to break down I’ll be happy to do that, too. I could also break them down into small or larger parts if you prefer.

That’s all for now! Happy developing!

5 thoughts on “Breaking Down the C1 Computer

  1. Haha, this is taking me forever to understand because I always put the comment before, not after the code. Funny how that works. I think there is some more information on the bit record of features on Muppetboy’s Geatville, in the brain section. Great walkthrough, it’s interesting to see how the original objects were made.

    1. Yeah, sorry about that! When I was learning to code I was taught to comment on the same line so I guess I do the next line out of habit. It’s sort of funny because my petz LNZ codes have the comment on the line before.

      Good to know! I’ll have to review his info and update this post when I get some time.

      Thanks for pointing that out!

Leave a Reply

Your email address will not be published. Required fields are marked *