creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
Guide to Making Seasonal CA   
Liam

Liam
Australia  

 visit Liam's website: Spellhold Studios
  12/28/2011  1

This is a quick guide I originally wrote for malkin about how to make CA change with the seasons, but it's applicable to a bunch of other things as well, so I decided to flesh it out a bit more and post it.

The command we want to use is SEAN, which returns the season. From the CAOS documentation:


0 - spring
1 - summer
2 - autumn
3 - winter


Pretty straightforward. So how do we use this to make CA change levels according to the season?

The easiest way is to use GAME variables. GAME variables are wonderful things; they work just like any variable, except that they're global, which means any agent can check them. Pretty neat, huh?

To make use of this, we create our CA. For this example, I'm going to use light.


new: simp 1 1 xxxxx "blnk" 0 0 0
mvto xxxxx xxxx
*run every 5 minutes - 2 * 60 * 19.5 (there are approximately 19.5 ticks/second)
tick 2340

scrp 1 1 xxxxx 9
emit 1 game "mymeta_light"
endm


Basically, instead of making our agent output the light CA a set value, we're making it output light at a variable value that we can change easily. Do this with all of your CA, changing the variable name for each kind of CA (eg "mymeta_heat", "mymeta_moisture" etc). The tick script (which runs every 500 ticks) updates the emit value every 2 minutes.

Next we create a simple monitoring agent that changes our light value output depending on the season.


new: simp 1 1 xxxxx "blnk" 0 0 0
mvto xxxxx xxxx
*run every 5 minutes - 5 * 60 * 19.5
tick 5850

scrp 1 1 xxxxx 9
doif sean eq 0
setv game "mymeta_light" .8
elif sean eq 1
setv game "mymeta_light" 1
elif sean eq 2
setv game "mymeta_light" .7
elif sean eq 3
setv game "mymeta_light" .5
endi
endm


Pretty straightforward, right? That's all there is to it. Of course, there are many other ways to do do it, but this is probably one of the simplest.

Happy seasoning!


- Liam / K'aeloree

Spellhold Studios, a Baldur's Gate II, Neverwinter Nights and Oblivion Modding Community

 
Liam

Liam
Australia  

 visit Liam's website: Spellhold Studios
  12/29/2011

Whoops, updated, made a bit of a stupid mistake.

- Liam / K'aeloree

Spellhold Studios, a Baldur's Gate II, Neverwinter Nights and Oblivion Modding Community

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  12/29/2011

Whee! :D Thank you so much, Liam! This will be really useful. :D

I've never really used the GAME variables before, you make it look as simple as others, though. :)


My TCR Norns
 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  12/29/2011

Nice, Liam! I have a project or two up my sleeve that I wanted to use seasons for at some point, so this will be a great help. :D


 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
0 online
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki