Search This Blog

COBbling rampage

 [Originally written September 6 2020]

Emboldened by my success with the lemons, I’ve expanded my to-do list:

  • Fix the coconuts. Playing with the shells shouldn’t cause pain, and I’ve noticed that creatures don’t seem to be able to eat the pieces.
  • Fix the medicinal herbs. They don’t seem to go invisible when used up, thus causing the same kind of confusion about pushing not always working as the standard food. Also, I find it incredibly annoying that I’m not able to simply pick sprigs and carry them where I need them. That was the one thing the Playstation game did right!
  • Fix the beelacanth. First of all, the plant contains small amounts of glycotoxin. In a herb. What were the developers thinking?! Secondly, the seed has unpredictable effects. Third, I want to bring its behavior into line with the updated medicinal herbs.
  • Make a cheese vendor. Both to give me a source of cheese and to put my COBbling skills to the test.

I decided to start with the herbs. This went much faster than the lemons, and I’ve realized that the structure of CAOS reminds me quite a bit of Fortran, but slightly less irritating to work with. Of course, I wouldn’t consider myself fluent in Fortran, but I have some experience with reading it at least, which may have given me a head start in understanding CAOS as well. This isn’t to say today’s efforts went without a hitch. Indeed, it proved once again why it’s a good idea to work in a VM with backed up creatures, as I had to reinstate the world twice – in one case after I managed to accidentally delete the hand! 

But eventually world-breaking bugs gave way to oddly-placed objects, and once these were ironed out (turned out I’d forgotten to reset the target of the script to the owner after changing it and was pulling coordinates from the hand instead of the plants), I had a functional herb update pack! The herbs now become invisible when they’ve lost their usable sprig, so creatures aren’t tempted to keep pushing them. As an added bonus, clicking on the herb will pull the sprig off and drop it on the ground nearby – essentially, I’ve made the herbs double as vendors for their sprigs.

Download the Updated Herbs

My plan initially was to take on the beelacanth next. The beelacanth is considerably more complicated than the standard herbs, and behaves quite differently. I’ve got a pretty good grasp on most of its behavior from annotating its code, and after some observation and testing courtesy of Bob (who had some nasty run-ins with the bees), I’ve concluded that it is perhaps too complex. I don’t mean for my level of skill (although that seems to be true right now too), I mean it’s confusing for the creatures. 

For instance, pushing a herb eats the sprig directly (and with my updates, hides the plant). With the beelacanth, pushing it eats the whole plant, except when there’s a fruit. In that case, the fruit pops off and the creature is left confused as to why he couldn’t eat the plant. There also appears to be a case for creatures pollinating plants by pulling them – but no other herb has a pull script. And there also seems to be code that can make the plant jettison its own seeds, based on a counter… but for one thing, the interaction of this counter with the timer means that if my calculations are correct, it would take several hours for this code to fire, and the counter doesn’t get reset! Similarly, the seeds can “go bad” after a while and cause different effects, but the creatures can’t distinguish a good seed from a bad one. 

It’s all very impressive in theory and I don’t downplay its importance in paving the way for complex ecosystems in later games, but it just does not work well in the context of Creatures 1.

But I was having some issues updating the beelacanth, so I decided to move on to the coconut. I have searched on the internet for a fix for this, or even an explanation, and I can find nothing – but I have never seen a creature successfully eat a coconut. After looking through the code, I found, and fixed, the issue… and it turned out to be a oneliner. This is the “pick it up” script for the coconut piece, and the second line marks it as active. The problem? “Active” means creatures can’t use it again (which includes pushing it) until it goes inactive. I removed this line, and also changed a couple lines so that pushing the whole coconut slightly relieves boredom (in line with other toys, which the coconut is classified as) and no longer causes pain, and soon Betty was happily knocking down, cracking open, and eating coconuts.

Download the Updated Coconut

The beelacanth isn’t that important to me right now, since it’s an optional item that I don’t usually include in my worlds. What is important to me is cheese! I feel confident making my own COB from scratch now, even if just a simple, immobile vendor – a cheese plate that sits in the kitchen. If pushed by the hand, it would generate a piece of cheese. It would be tempting to do the same when pushed by a creature, but I want to be consistent with other vendors, of which there are officially four:

  • Beehives – feeds honey directly when pushed (or is it pulled? If the latter, I will have to fix it…).
  • Carrot vendor – feeds carrot directly when pushed.
  • Hootch still – doesn’t do anything when pushed by anyone, and should probably be made invisible.
  • Shee Seed Launcher – the odd one out, as it has a function but it doesn’t feed directly (I’ll have to fix this when I get around to finishing the beelacanth edits).

Therefore, the cheese plate should also feed directly. Besides, it’s easier to teach a creature that vendors produce food if they get fed from pushing it. Pushing the vendor and then the food is a bit of a leap of logic I don’t think creatures can make.

Step one was the artwork. This part was easy thanks to the C1 Photoshop palette and my existing pixel art skills. Importing it into a sprite was a bit of a struggle but once I had it saved in the correct bit depth and the correct size (apparently the dimensions need to be multiples of 4), that was done. Step two was choosing an ID. Nothing was listed on the wiki for 2 8 10, so that’s what I’m going with. Step three was coding. This object has only three scripts (the third is not shown; it’s just script 17 copied directly from the cheese item included in the game). The effect when eaten is also copied directly from cheese.

The coding wasn’t completely bug-free – being used to real programming I put an “endif” in there, which CAOS did not like. But surprisingly, that was the only hiccup. Once that was fixed, I had a functional cheese plate, and Bob was helping himself to as much cheese as he wanted!

2 comments:

  1. The herb update sets ATTR to 64 instead of 68 after the plant regrows, meaning that creatures can only eat the herb once!

    ReplyDelete
    Replies
    1. Good catch! I've corrected the mistake and uploaded a new version of the file.

      Delete