Friday, May 18, 2012

Magic Words Room Edits

Alright, apologize for the rushed and sub-par quality of the video, but it should show you the basics of how to use this thing:


Commands are as follows:

DMap - Toggles the debug map on and off, allowing you to see room boundaries and know exactly what you're doing.

RType - Toggles the bit of text next to the hand that tells you the type of the room you're touching.

DoorR [boundary] - Sets the boundary of the room "door" to the right of the hand, between 0 (nothing passes through) and 100 (Everything passes through)

DoorD [boundary] - Sets the boundary of the room "door" underneath the hand, between 0 (nothing passes through) and 100 (Everything passes through)

Room Type [type] - Changes the type of the room the hand is in. You can either type the Room Type number from 0 to 10, or the name of the room type itself. Entering "Room Type Help" will bring up a list of room type numbers and names.

Find CA Links - Creates symbolic colored dots in rooms that have a CA link in them. These dots can be clicked to move to the room they are linked with. Creatures cannot see or use these dots-- they are purely for user information. Note that this command can take several seconds to several minutes to finish, depending on the size of the world.

Hide CA Links
- Hides the CA Link dots (does not affect the links themselves)

Make CA Link -  Use this command twice-- once in the first room you wish to CA link, and again in the second room to complete the link. If you start a link but do not complete it, the linking process will be canceled after several seconds. All links are created with a strength of 1 (max)

Break CA Link -  Use while the hand is hovering over a CA link dot. Destroys the CA link between the rooms corresponding to the dot. It is important to use this command to break links as other methods such as kill hots will remove the dot, but not actually break the link.

After my huge writeup on the importance of CAs, I couldn't not come up with a tool to make that whole process easier, and it follows in the spirit of the Garden Box and other such efforts I've been making to make the world as customizable as possible

Download the Magic Words: Room Edits. As always, requires the Magic Words Core to work. This hasn't had more than a few hours of bugtesting, so please let me know if you run into any problems. 

Thursday, May 17, 2012

CAs and You!

So what is CA?

CA stands for Cellular Automata. More often, they are called “smells”, although this is somewhat of a misnomer, since light, nutrients, and water are not exactly smells, but since the majority of CAs are smells, the name sticks anyway.

CAs, sadly, are not easily perceived by the player, and as a result, we often forget completely about them while developing or even just setting up a creature habitat. I’m writing this stuff up to help bring awareness to how CAs are used in the game, how creatures perceive them, and how important it is that we design our agents and metarooms with the proper flow of CAs in mind.

CAs are Room Values!

Look at the map of the room below:


Each of those little sections, those little boxes, is called a room. The lines that divide them are known as doors. Even though they don’t really look like rooms or doors as we know them, that is how they are referred to, so just keep that in mind as you read the rest of this article.

CAs are not little invisible agents that waft around the ship like bacteria. They are actually numerical values calculated and stored in each room. One room might have a CA 8 (fat) smell value of 0.65, and the room next to it might have a CA 8 value of 0.55. CA values range from 0 to 1.

If you want to know the value of a certain CA in a certain room, first make sure you can see you room map by entering “dmap 1” in the caos command line. Center the hand in the room you want to check and enter the following: “outv prop grap mopx mopy #” replacing the “#” with a number from 0 to 19, depending on the CA you are testing for. Hitting enter should return a decimal value for the CA.

In the screens below, I’ve created labels to monitor the CA value of protein in each room. I’ve removed all other sources of protein smell in the world, so the only agent producing the smell are the lemons in the top left. As you can see, the CA concentration is the strongest where the lemons are sitting, and gets to be less and less as the rooms get further away. Even down at the bottom of the workshop, the CA exists, meaning a creature can sense it and follow it.


CAOS Note: Lemons don’t smell like lemons just because they’re classified as fruit! To make an agent “smelly” you have to use the EMIT command in the creation script-- the same place in the script you set your ATTR, BHVR, and other agent settings. The EMIT command is structured as such: emit [CA number] [amount]. The amount ranges from 0 to 1, so you might use 0.05 to give your agent a mild scent, or 0.9 for a very strong smell. You can actually set EMIT to a number even higher than 1, but the increase is very minimal.

How Creatures Use CAs

The classic Creatures IQ Test is the most common example of how exactly creatures use CAs to find their way around.

Creature brains already know from the start that protein smell is linked to fruit-- this is defined when the world is created using the CACL command, it’s not something they need to learn. And most creatures are born with an instinct to find fruit when they are hungry for protein. Once a creature decides to go looking for fruit, a combination of brain and action scripts take over.

The brain starts by checking the room the creature is in, and the rooms around it. It then decides which room has the highest CA value. If that room is to the left or right, a creature will simply walk that direction, but if that direction is up or down, the creature will start to feel very “low down” or “high up”, which will trigger its instincts to push or pull lifts to get moving in the direction with the higher CA. Similarly, if the CA is higher in a room that the creature can’t access by walking, it will start feeling “trapped” and feel inclined to push doors.



So in short, for a creature to pass a classic IQ test, it needs to:

- Be hungry.
- Understand that food (or fruit or seeds) will satisfy its hunger.
- Decide that finding food is more important than pushing the training dummy, taking a nap, smashing the lift button repeatedly, running into walls, etc.
- Be able to detect smells
- Understand that pushing lifts will satisfy its “need to go up” drive
- Understand that pushing doors will satisfy its “need to exit/trapped” drive.
- Not have any pose or gait mutations that might prevent it from traveling properly.

Primarily, creatures use CAs to find food. Creatures will also follow them to find their way home. This is most commonly seen in pregnant norns, who will often feel homesick and try to make their way back to the heating pan or incubator, where the hidden “norn home” (CA 15) emitter is located. Ettins will also make use of this, following the CA to “ettin home” (CA 17) when they are carrying a gadget (which they might have sought out by following the CA for “gadget” (18). CAs play a few other roles here and there, for example “norn” (12) CA generally makes grendels angry.

How other agents use CAs

While creatures use CAs for navigation, there are some plants and animals that rely on CAs as well. CA 3 (moisture) and CA 4 (nutrients) are sometimes required for certain plants to grow. The seed might check the room that it lands in, and if the CA levels aren’t high enough, it will just rot away instead of sprouting. Moisture might be added by little raindrops that, upon hitting the ground, add a little CA 3 into the room they land in. CA 4 might be added by decaying food; essentially compost. Similarly, some critters might require certain light or heat levels to reproduce or for eggs to hatch.

But this is all very agent-specific-- many third-party plants and critters especially don’t rely on CAs in part because many third-party metarooms don’t use emitters. These days, having an agent that requires certain CAs to function tends to really cripple where it can be used.

Overall, CA requirements for agents can potentially add a lot of complexity and interest to the game, but it requires a lot of knowledge about exactly what the agents require. In a room of CA-requiring agents, you might want to be careful about planting too many flowers that require lots of nutrients, lest they deplete the soil and your fruit-bearing plants are unable to grow. You might have to worry about watering the soil regularly, or throwing apple cores over it. The more CA requirements an agent has, the more restrictions there are on where it can thrive.

Often, when it comes to customizing, it’s easier to just ignore CA requirements and script in a form of population control, limiting where your plants sprout by room-type instead of CAs, so your species will thrive whether or not a room has proper emitters. But if you want to include this sort of interesting complexity into your agents, it’s important to specify to players what CAs they need, so the player knows to provide them in one way or another, whether by placing them in a room with emitters, creating their own emitters, or using other CA-altering agents.

CAOS Notes: Creating emitters is very easy. The code goes something like this:

new: simp 1 1 [species] "blank" 0 0 0
emit [CA number] [amount]
mvto [x] [y]


That’s it. Let’s say I want to be really mean and make a protein smell emitter to confuse my creatures. I might enter “new: simp 1 1 12345 "blank" 0 0 0 emit 6 0.5 mvto mopx mopy”.

This would create an invisible agent where the hand was that constantly emitted protein/fruit smell. Creatures would come from all over looking for fruit, and find nothing, and get very confused. So I wouldn’t recommend using it for fruit smell, but you might use it to emit light or heat, whatever the agents in the room might require.

But let’s say you don’t want to create an agent that emits a CA forever-- let’s say you just want to give the room a one-time boost of a certain CA, like how fruit might give the soil a little bit of nutrients as it decays. For this, you would use the ALTR command:

ALTR [Room ID] [CA number] [amount]

The room ID will probably be the room that the agent is sitting, in which case you can use “room targ” or “room ownr” in place of the room ID. If you’re running this from the CAOS command line, you can just use “room pntr” to use the room the hand is hovering over.

Amount in this case goes from -1 to 1, depending on if you want to subtract or add some amount of CA from the room.

Now, one thing to note is that ALTR doesn’t work on “smell” CAs that creatures use for navigation; it only works on CAs 0-5. If you need to alter the other CA of a room, you can use PROP, a command with the same function of ALTR, but instead of adding or subtracting the number specified, it sets that CA level in that room to exactly the number specified.

How CAs Travel

Now, we know what causes a CA value to exist at all, but what affects how CAs travel from one room to another?

Just a moment ago, we mentioned that ALTR works on some CAs, but not others. It works on heat, water, light, and other CAs that do not represent smells. Actual smell-based CAs are called “navigable” CAs by the game, presumably meaning that they are CAs creatures can follow to find their way to food sources or other objects of desire.

The interesting thing is that while non-navigable CAs can travel freely in all directions, navigable CAs only travel to the left and right.

For the purposes of demonstration, I have removed CA links from this room. Note how the grendel smell will only travel from left to right, and ignore rooms above and below:


Why do navigable CAs work like this? Doesn't it make more sense that smells would travel through all rooms?  Well, to us, yes, but you have to remember that we're dealing with not-so-bright creatures.
Again, for purposes of demonstration, I have set the pink and white grazer to emit a non-navigable CA that can travel anywhere. But let's say that was a protein smell, and poor Disastrous Plantation wanted to get to it? She would feel a pretty painfully stabbing desire to go up once she reached the open air, and have no way to get there. Maybe she would travel a bit more to the left to take the lift there, but she would just walk off the edge of the cliff trying to get to the grazer, getting increasingly more confused.

So for the sake of the creatures, it is better that smells only naturally travel in the directions that creatures can walk, and the rest be controlled by CA links.

CA links are very critical part of navigation for creatures, but not all third party metarooms include them, meaning you need to set them up manually to ensure your creatures can thrive.

As an example, here we see that there is a bounty of food right above Herria. But since smell CAs do not pass vertically through rooms, without CA links, she'll never be able to smell the food right above her.

CAOS Notes: Setting up a CA link is actually very easy. The syntax is as follows:

LINK [room1] [room2] [perm]

Room1 and Room2  are the room numbers you want to link. Getting these numbers is easy-- using Shift+Ctrl+R will produce the number of the room the hand is currently in right next to the hand:
 As shown, the room numbers we want to link here are 839 and 855. The perm is easy-- for most CA links, it is set to 1, to let all CAs flow freely between the link. Setting it to 0.5 would only let about half the CA amounts through the link, and so on.

So once we enter our command, "LINK 839 855 1" ... Herria can suddenly smell something delicious above her, and does not hesitate even a second to take the lift up to where the fragrant food awaits! As you can see by the tags, the CA smell has spread out into the rooms below.

CA links are also used to connect different metarooms together by creating a link between the rooms that the doors are located in; this way the creatures can smell what's on the other side of the door.

CA links are not just useful for linking up metarooms though-- creating links between rooms where elevines reside will encourage creatures to use them as well. Just remember that you are creating a link between two rooms, not two agents, and if you move the elevine, you'll need to break the old link (by running the command again with the perm set to zero) and create a new one, if you want to avoid some very confused creatures wondering where that smell is coming from!

Room Types and CAs

There's one more important thing to know about CAs, and that's how room types affect them. Room types are not just to determine if plants should grow or if fish should swim-- each type of room treats each CA differently. Consider the chart below:



Gain determines how much of the CA is absorbed from emitters in the room, Loss is how much of the CA dissipates into nothingness, and Diffusion controls how much of the CA flows over into other rooms.

Here you can see that soil-type rooms are really the only ones that can hold onto nutrient CAs, and CA smells travel much more easily through hard surface areas than through soil.

The variations between room types are subtle, but one special type of room to note is "Ettin Home," which is very much like a standard walkway with one huge exception-- it doesn't carry absorb gadget smell from gadgets in the room. This strange mechanism basically ensures that once ettins bring gadgets home to add to their hoard, they don't smell them anymore, meaning they can still pick up the subtle smells of other gadgets further away on the ship and hunt them down.

These relationships between CAs and Room Types can be altered with the RATE command, but you want to be careful what you do, because changes in CA rates will affect your whole world. Perhaps the most common CA rate modification available is Moe's Heat in Water transfer, which changes the rates to allow...well, heat to travel through water.

Wow... well, that about wraps up what I've learned about CAs over the past several weeks! I hope this clears up a lot of questions and misunderstandings about CAs, and hopefully makes the world an easier place for norns to find their way around. If you have any questions or comments or corrections, feel free to leave them below! And stay tuned for the release of a few Magic Words commands that will make managing your world's CA links a lot easier, I hope!

Saturday, April 28, 2012

Room-Editing, Magically!

I was in the middle of this lovely book when suddenly this idea hit me: Hey, what about a magic words command to change the DOOR permeability between rooms? That would be pretty easy, right? Yes, yes it would; I will try it after I finish this chapter.

But I couldn't focus on the chapter because I just could not stop thinking about the room-editing possibilities that could come from a few simple lines of code. Gah. When inspiration hits, it's unmerciful.



So an hour later I had a couple of new commands to play with:

DMap, which toggles the map grid on and off, as well as a bit of text near the hand that displays the type of room it is hovering over.

DoorH [number], which sets the door boundary between the rooms touching the right and left side of the hand. This is a number between 0 and 100, with 0 meaning nothing can pass though (a solid wall) and 100 meaning everything can pass through.

DoorV [number], which does the same thing as DoorH, but changes the boundary between rooms touching the top and bottom of the hand.

Room Type [number], which changes the type of room the hand is hovering over. This is a number from 0 to 10, a list of room types is found here. I ended up kind of throwing this in at the last minute because I figured if you were going to make new floors, you might want to not be "air" type rooms. But you can use it for whatever-- to flood certain areas or turn them into dry land, make barren metal hallways into soil to support plant growth, etc.

As shown in the video, this pairs pretty nicely with the garden box decorations as you can use them to visually denote your new platforms/walls, but I don't think these magic words commands are going to be bundled with the garden box; I'll probably release them before that.

Wednesday, April 18, 2012

Hera: Not lab rats, honest!

I have to confess something. I'm guilty of turning even my nurturing worlds into testbeds for agents that I'm working on. Maybe it's just that I get restless simply nurturing, or maybe it's because I enjoy testing a little be more if I actually know the creatures I'm working with. Either way, I wanted to accomplish a few things today-- run Hera a little bit, and finish off some long-pending releases. Since I'm putting the majority of my efforts into Garden Box agents now, I wanted to get a few things people have been asking about out of the way before getting too deep into such a big project.

Unfortunately, testing and developing while running Hera doesn't leave me a whole lot of time to pay attention to what the creatures are doing, which in some cases is just as well, since I did want to just let them go feral for a while and see how they did. Well, right off the bat we had some closure to the circle this world started with. Lilac, inexplicably, passed away not long after I opened the world. Surprisingly her score had shot up again, and I had no idea she was even having any trouble until she dropped. The hoverdoc told me she was really hungry; I hate to think she may have starved, especially surrounded by food, but it seems to be the most reasonable guess. I was especially saddened by this because I had just finished scripting in a magic words command to artificially lower a creatures' score, and had planned to use it on her to at least give her a chance to pass on her genes to the future, but sadly, it was not to be.

This is the last photo I have of Amina, playing some strange version of nornish hide and seek with her new friends. She had gone gray and entered the old stage; still, I was surprised to see her go so quickly afterwards. The worst part is, I was so busy trying to get these marks to show up on the right plane that I didn't even notice she had died until her body had already returned to stardust. Thus the first generation of these Hera creatures is finally complete. Amina was certainly the best of the lot in terms of genetics, even though her score was slowly climbing upwards as she aged, she seemed to be quite happy all the while.

It was funny that Rishi was randomly allocated the egg mark during testing, since the the two deaths had certainly made room for more. Having wandered off on her own, she quickly became pregnant and laid an on the island, then returned to sit by the horn and eat coconuts until she too, slipped to permanent sleep. Like Amina, she hadn't even been old very long when she died, so I'm really not sure why it happened so quickly, other than the fact that she had let her score shoot quite high.

But the egg hatched, and life continued. I figured I would name this one Aura, considering one of the agents I was trying to finish off was similarly named. She was born alone, but surrounded by food. Holding the genetics of Kayla and Elm, I can only hope she has a good life ahead of her.

Lyra had only just reached youth age when she had a sudden stirring in her belly. What a strange welcome into adulthood! Though she had wandered towards the volcano, her confusion over the whole situation must have sent her trekking back to her mentor Kayla for some advice, and together they watched this strange miracle unfold.

If this world contained males, it wouldn't be difficult to name the baby "Mark". But that isn't the case, so I decided Marcie was a close enough match. Even though she offspring of Kayla and Elm, she sported a much different color at birth than her sister. Genetics can be so unpredictable at times!

By the time she reached the child stage, however, her color had shifted pretty dramatically, much more akin to the tint of her sister and genetic parent, Elm. But her other genetic parent, Kayla, may have not been happy about this, as she developed a sudden dislike for Marcie and began slapping at her for seemingly no good reason. The little nornling retreated over to Lyra for safety, while I gave Kayla a couple punishing slaps.


 Speaking of color-changes though, Shimmer is certainly less....shimmery than she was when she was born. Still hanging out in that basement, she was quickly chosen to carry the offpsring to fill that last open population slot. Meet Bubbles, offspring of Elm and Kindi, a fitting candidate to test the third magic words agent I'm trying to finish up today.


While you guys have probably seen my Auras video before and have no doubt seen the marks in use on Discover Albia, I'm not sure I've said much about the "air bubbles" command, which essentially attaches an air tank to a creature, allowing it to breathe underwater, or if the creature is gilled, breath on the surface. Since it's an agent that essentially keeps the creature's lungs full of air, it can also be useful for creatures that have genetic handicaps preventing them from getting air properly. I actually invented this little command shortly after CCSF when I wanted all my creatures to be able to play in the seas of Devil's Reef, not just the aquatic ones.

Bubbles, much like Marcie, started out that nice blue tint that faded a bit when she left the baby stage. Elm's genetics are certainly getting around, and I for one am not complaining!

After that whole having-a-baby fiasco was over, Lyra returned to the volcano, where for some reason there grows a prototype chilli peppers patch plant, stars spewing everywhere from her as I test the large stars aura. She must feel pretty special about now. I'm a bit worried though; I'm not sure if the C2inDS version of the volcano is so dangerous as the original C2 version, but I don't want her bone marrow to start melting.

Testing out the butterflies aura, I was surprised to find Shimmer napping out on this rock! I don't remember this being a walkable area in C2, but it does look like a nice place to sun oneself! And poor Shimmer needs it too, having spent nearly her whole life in that little basement playroom!

Well, luckily this venture was a success, and I think I have these agents tweaked to a suitable release state! Let me know if you find any problems with them; in the meantime, Download the Magic Words Marks, Auras, and Air Bubbles here!

Now, a few notes on these before you run off!
  • This might go without saying, but the Magic Words Core is required for these agents to function
  • The lovely sprites used in the Magic Words Marks were made by the talented Mea! I can't thank her enough for all her hard work on these cute little marks, and this agent flat out would not exist without them! 
  • That said, the idea for these marks and auras was inspired by Kittie's comment on Jessica's DS World Concept, as a method for easily telling creatures of varying social classes apart!
  • The syntax for putting a mark over a creature is "[name] mark [color]", for example, "star mark blue". The magic words help dialogue (typing "help" after injecting) will list all the marks and colors. However, if you enter an unrecognized mark or color, the system will pick a random one for you. So typing "star mark shjkgyres" will give your creature a randomly tinted star mark, and typing "dsjghr mark jsaghre" will give your creature a  random mark with a random color.
  • The magic words auras make heavy use of both TINT and ALPH, commands that tend to use a lot of resources, so it may not be suitable for slower computers. I personally have not experienced any problems with them, but use caution.
  • A creature can have one mark and one aura at a time. "Clear Aura" and "Clear Mark" will get rid of them.
  • The "Air Bubbles" command toggles the bubbles on and off on a creature. It doesn't conflict with the marks or auras.
Did I forget anything? Sorry for taking so long to finish these up, especially the marks and auras; I've been sitting on them for pretty much ever. But I hope you guys have fun with them now!

Saturday, April 14, 2012

Garden Box Conversion Poll

So I just wanted to make clear what my personal goals were for converting the C3 plant and animal life for Garden Box, and give you guys the chance to let me know exactly what it is that you want most!

Did you ever know there was so much life in C3? I honestly didn't pay a lot of attention to the sheer number of plants and animals there were until I looked into converting them all! Just looking at the length of this survey is a little bit daunting, and perhaps even moreso when I consider the tasks I set out for myself.

The C3 conversions you've seen in the preview videos are mostly pretty "dirty" conversions consisting 95% of C3 code with a garden-box install script attached. But when I release these conversions officially, I would like them to meet a certain set of personal standards to ensure that they can thrive, which I've decided on as follows:
  • All critters and bugs should be edible/pushable/pullable/hitable. All seeds/detritus should be edible. Generally, the more ways a creature can interact with an agent, the better.
  • Critters that aren’t logically edible (sorry, I just can’t really imagine a norn stuffing a grazer in its mouth) should be reclassified as beasts.
  • No plants or animals should require certain CA levels to function (light, soil nutrients, etc). Due to the generally unreliable nature of CAs, and the fact that several popular metarooms don't properly utilize them, I've decided that this would be best to ensure that these agents won't be handicapped in these areas.
  • All plants and animals that reproduce should have checks in place to avoid overpopulation.
  • Edible animals (and seeds for reproducing plants) should have some sort of defense mechanism that kicks in when the population is low to help keep creatures from eating them into extinction (fleeing from creatures, seeds germinating faster/plants producing more seeds, turning invisible, etc)
  •  Animals/Plants that must consume a food source should ideally have that source specified by genus, not species, for sake of ecological flexibility (Example being to allow the gnarlers to gain nutrients from all toys).
  • While not exactly a hard standard, I would like to add some sort of special touch/personal flair to as many of these conversions as possible. For example, I think I would like to make the snail, when it dies, leave behind its shell as a toy for creatures, or give more animals and plants the ability to color mutate. I have a cute idea for allowing some critters, when pushed by creatures, to potentially get attached to them and follow them around, but I dunno how painful that would be to implement.
Furthermore, all conversions will have their own classifiers, so they're not going to mess with any already-established C3 life. All my C3 conversions will also be named with the suffix, "(AMK)" (so, "Grazers (AMK)"). I would recommend that developers doing conversions adopt a similar naming convention, since two agents cannot have the same name. And lastly, I plan on annotating the scripts as much as possible and making them easily available, so hopefully others with a working knowledge of CAOS can easily modify the agents to their liking.

Anyway, rambles aside, on with the survey! I realize not everyone will be aware of exactly what everything is in the C3 world, so the far right option is reserved for that case. (But if you want to double check, the C3 Ecology page on the Cwiki should be able to help you out!) Maybe I'll even do a post on the lesser-known C3 life, hah!

Note: This survey is for traditional plants/animals, not patch plants (but no worries, apples and pumperspikels are certainly coming along as patch plants)