AdoptionAgentsBreedsFanTipsWorlds & MetaroomsNewsSlink/'s TreasuresCreatureLabs Official UpgradesCreatures Community
Official CreatureLabs Files
Creatures | Creatures2 | Creatures3 | C3 & DS | Docking Station | Development

Official CDN Development Articles

Using the Map Editor: Part #2


All files on this page are copyright of Creaturelabs (see copyright statemtent below) and are provided here only because Creature Labs has stopped trading, and no longer has a website. This page will be taken down at the request of Creature Labs, or the party that purchased rights to the Creature Labs Intellectual Property, at any time.

"All files on this page are copyrighted by Creature Labs. Creature Labs and Creatures are registered trademarks of Cyberlife Technology Ltd. The Creature Labs, Creatures 3 and Docking Station logos are trademarks of Cyberlife Technology Ltd. in the United Kingdom and other countries."

Using the Map Editor: Part #2


Created: 18 Apr 2002 12:44:14 by Masha
Last modified: 15 Nov 2002 11:11:17 by Frimlin

Part 1 of the Map Editor tutorial covered how to convert your own image into a metaroom, define floors and walls, and mark rooms as being of a certain type. That tutorial finished with the room being injected into your world and those of you that were paying attention would have probably wondered how the heck the creatures were supposed to actually get to that room now!

This tutorial will attempt to highlight the other things you need to do to have a fully functional area of ship; an area in which creatures can enter and leave, and how to make a 'signpost' for it so that it appears as an option alongside the other metaroom icons in game.

An understanding of CAOS is expected, so if you don't know what NEW: SIMP does (at least!) then you will need to follow a CAOS tutorial first - try this one: Balloon Maker for DS

Getting Started

The most important thing you need to do first is to identify what exactly your new metaroom is for; is it a location that creatures can live in - or is it purely for the user? Rooms that are created to house machinery for the player to use don't necessarily need food sources or doors whereas a room designed to house creatures will obviously need food sources and things for them to play with.

Signposts and Favourite Places

As you explore around the ship you collect icons at the top of the screen that allow you, the player, to move quickly from metaroom to metaroom; these are known as favourite places. The Favourite Places mechanism is relatively straightforward, and the workings can be summarised like this:
  • There are two aspects to the mechanism; an invisible signpost positioned in your new metaroom, and the favourite places icon at the top of the screen.
  • If the signpost is on screen (i.e. because that part of your metaroom is on screen) then it checks to see if your favourite place icon has been launched. If it hasn't been launched then the signpost will create it for you, highlight it and turn the other favourite place icons off. If the icon is on screen then it will turn off the other ones and highlight the one for this room.
  • If you click on the icon the view will be moved to point at your signpost.
And that is it! You don't even need to make CAOS scripts to get this working, you just need to reserve a classifier for your signpost and favourite place icon (both should use the same species number) and create the signpost in your room. An article explaining this process can be found here: Favourite Places in DS

Doors

Doors are used to allow creatures to move around the ship and usually operate in pairs; one door to get into the metaroom and one door to get out. The basic workings of a door are fairly simple, but there are some things you need to watch out for. Although throughout this section we will be referring to 'doors' the actual look and feel of the agent can be anything you desire - it might be a teleporter to get in and out of your room, it might be a glimmering forcefield, or it could even be a spatula of power that transports creatures when picked up.

Basic Code

Here is the basic code that will:
  • Create a door object inside your metaroom
  • Create a companion door somewhere else in the ship
  • LINK the two doors together, which allows smells (and other CA elements) to pass through
  • Clicking either door with the hand will transport nearby creatures to the other door, and change the display to point at your new metaroom
  • A Creature clicking the door will transport themself to the other door

Create two doors

Here is the CAOS Code, you will need to customise this to make it work:


******Create one door
*** You will need to choose your own classifier and sprite file.
new: simp 2 2 998 "ds door" 13 65 0
attr 4
bhvr 1
*** You will need to choose a decent location for your doors
mvto 1690 9056
* Save the Room number
setv va50 room targ

******Create the other door
*** Again, you will need to choose your own classifer and sprite file
new: simp 2 2 999 "ds door" 13 0 0
attr 4
bhvr 1
*** Again, you will need to choose a decent location
mvto 2182 8976
** Save the Room number
setv va53 room targ
* CA link the rooms together
link va50 va53 100

Give them scripts

These doors only need one or two scripts, this example uses two scripts; one when clicked on or activated by a creature, and the other that deals with animation of the partner door. Again, you will need to customise these scripts to get things working in your world.
Both doors will have nearly a identical set of scripts- only in a few key places do they need changing. For the sake of brevity only one set of scripts is shown here.

We will be using one OV variable as a permanent variable - OV00 - as follows:
***OV00 is state of door
*0=closed, 1=open


*** The main script - Door has been pushed.
*** You will need one of these scripts for each of your doors.
*** REMEMBER to update script classifier with your real door classifier.
scrp 2 2 998 1
lock
inst
** stim with "wait"
stim writ from 75 1
** we'll be using VA99 to indicate whether a metaroom visual change is required, or just a creature transfer
* clear 'change metaroom' signal
setv va99 0
* check who gave signal
targ from
* check if its the pointer
doif targ eq pntr
* flag metaroom change
setv va99 1
endi
* check your neighbour door
*** THIS PART WILL NEED CHANGING FOR EACH DOOR, make sure you use the correct classifiers
rtar 2 2 999
doif targ ne null
doif ov00 eq 1
stop
else
*** WE NEED THESE 3 VALUES TO KNOW WHERE TO MOVE THE CREATURE/VIEW TO
* store X Y location
setv va00 posx
setv va01 posy
* store metaroom number
setv va02 gmap va00 va01
*** THIS NEXT LINE TRIGGERS AN EVENT IN PARTNER DOOR. This is usually used to animate the recieving door.
* otherwise animate
mesg writ targ 1
endi
endi
targ ownr
* flag you are open
setv ov00 1
* DO YOUR OPENING ANIMATION HERE


***************************
** Only transfers all touching creatures if the pointer activated the door,
** if it wasn't the pointer then it only transfers the creature that touched it.
inst
doif from = pntr
etch 4 0 0
* move creatures because hand clicked door
*** IMPORTANT SAFETY CHECKS HERE! We are making sure that the creatures we are moving aren't
*** being held by the hand, being carried, asleep or dead
doif targ ne hhld and carr = null and aslp = 0 and dead = 0
mvft va00 va01
stim writ targ 95 1
endi
next
else
* or only move the creature that pressed the door
doif touc ownr from = 1
inst
doif from ne null
targ from
mvft va00 va01
stim writ targ 95 1
setv va99 0
endi
endi
endi
targ ownr
* if meta change wanted
doif va99 eq 1
inst
subv va00 100
subv va01 250
doif hhld eq null
meta va02 va00 va01 0
slow
endi
endi
targ ownr
* SORT OUT YOUR CLOSING ANIMATION HERE

* reset your movement flag
setv ov00 0
endm



***open and close event from partnering door.
***You will need one of these scripts for each door.
scrp 2 2 999 2
lock
* mark as open
setv ov00 1
* ANIMATE OPEN AND CLOSE HERE
* mark as closed
setv ov00 0
endm

The above scripts are cut-down versions of the code used to create the doors in Docking Station, only the code for locking out a particular species is missing. If you want to look at the complete code then you should open up the "doors.cos" file in your Docking Station bootstrap folder.

What else?

Now we have a metaroom that has a way for the user to access it anytime they desire, using the favourite places mechanism, and also a way for both user and creature to enter the room, using the door mechanism. What else do you need to bring your world to life?
If your room is designed for creatures to live in then you will need to provide some facilities for them. The minimum you will need is some food and some toys. If you want the room to have its own food chain then you might like to make some plants and animals. If you are into making quite advanced agents and food chains you will also want to use the Cellular Automata (CA) system in the engine, as this is an advanced topic it will be covered in a different tutorial.

REMEMBER:
If you don't know anything about CAOS then you need to start somewhere, a good starting place is this tutorial on making a Balloon Maker object

Food

All creatures need good sources of food to survive, here's a tutorial on making a simple fat/protein rich food - change the STIM to make other types. Add your own images to make your own food.
Making food for C3

Food vendor

Rather than having food lying around the place making it look untidy you might want to dispense food from a vending machine, and a tutorial to show you how to do this can be found here:
Making a vendor for C3

Toys

Creatures get bored and need distractions like the rest of us, make them something to keep them occupied! Here's a tutorial on making a simple toy object.
Making a toy for C3

Elevators

Elevators and lifts can be viewed as some of the hardest agents to make properly, but the basic workings of a lift are pretty straightforward.
The elevators in Docking Station can be described, at a high level, as working like this:
  • Each lift consists of a carriage with an up and a down button, and a number of call buttons - one on each level the lift can travel to.
  • If the lift is moving then presses on the carriage buttons are igored.
  • When the up button in the carriage is pressed the lift will move up, to the level above its current level (if one exists).
  • When the down button in the carriage is pressed the lift will move down, to the level below its current level (if one exists).
  • Pressing one of the call buttons will summon the carriage to that level, if the lift is already moving then this request is stacked until the lift is stationary
The DS lifts were written to be general purpose, that is to say that the code for one of the elevators in DS is the same as all other elevators - there is no inherent 'awareness of location' in the code itself. This means you can re-use the code for the lifts and simply create your own install script so that some are created in the location you desire.
In this section the install code for the lifts will be explained, so you can make the changes you need. Open up the file called "nav lift.cos" which is in your Docking Station bootstrap folder.

This code is for the creation of the lift in the Norn Meso area. It creates the carriage part and 3 call buttons. When creating your own lift code you need to have the answers to these questions; How many call buttons will there be and at what level does the lift start




*base part
new: vhcl 3 1 3 "ds lifts" 1 0 10
* open air cabin (+512)
attr 512
* creatures can act1 and act2 this object
bhvr 3
* define the cabin
cabn 55 80 190 210
cabp 50
cabw 100
*the animating internal part
pat: dull 1 "ds lifts" 1 63 104 1
*the doors
pat: dull 2 "ds lifts" 3 44 89 200
part 2
frat 3
*anim [0 1 2 3 3 3 2 1 0 255]
*the left foot
pat: dull 3 "ds lifts" 7 -1 161 1
*the right foot
pat: dull 4 "ds lifts" 12 184 161 1
*the navigator!
pat: dull 5 "ds lifts" 17 75 -1 0
*bottom left flame
pat: dull 6 "ds lifts" 26 -10 190 0
*bottom right flame
pat: dull 7 "ds lifts" 28 203 190 0
*top left flame
pat: dull 8 "ds lifts" 30 22 45 1
*top right flame
pat: dull 9 "ds lifts" 32 184 45 1
*the go down button - send activate 2
pat: butt 10 "ds lifts" 22 2 115 186 1 [] 1 0
*the go up button - sends activate 1
pat: butt 11 "ds lifts" 24 2 115 157 1 [] 0 0
*position it in the Norn area
mvto 1165 9035
*give it ID of which level it is at
** THIS PART IS IMPORTANT. YOU WILL SEE IN A MOMENT THAT EACH CALL BUTTON IS GIVEN A NUMBER. THESE NUMBERS ARE USED TO LABEL
** EACH LEVEL THE LIFT STOPS AT. EACH LIFT ALSO KEEPS TRACK OF THIS NUMBER SO IT KNOWS WHAT LEVEL IT IS AT.
** THE LOWEST LEVEL IS 0, THE NEXT LEVEL UP IS 1, THE NEXT LEVEL UP IS 2 ETC. WE WILL BE CREATING
** 3 CALL BUTTONS, AND THE LIFT STARTS ON THE MIDDLE LEVEL. THIS MEANS IT IS GIVEN AN OV01 VALUE OF 1.
setv ov01 1
*store it's TARG ID in temp variable
*** WHEN WE CREATE THE CALL BUTTONS IN A MOMENT WE WANT THEM TO KNOW WHICH LIFT THEY 'BELONG TO'. CREATING AN AGENT VARIABLE TO
*** RECORD THE ID OF THE LIFT ALLOWS US TO STORE IT IN THE CALL BUTTONS LATER.
seta va00 targ
*set variable for type agents
*** THE CODE FOR THE LIFTS REQUIRES THEM TO GRAB A PARTICULAR CREATURE SOMETIMES, WE ARE JUST SETTING UP THIS VARIABLE TO BE
*** ABLE TO STORE 'AGENT' TYPE RATHER THAN AN INTEGER OR STRING.
seta ov02 null


*** WE CAN NOW CREATE EACH INDIVIDUAL CALL BUTTON, STARTING WITH THE BUTTON AT THE LOWEST LEVEL AND WORKING OUR WAY UP.
*********CALL BUTTON
*each button needs an ID - OV00
***top level of norn area
new: simp 2 12 21 "ds lifts" 2 34 310
attr 4
*creatures can act1 this object
bhvr 1
*** AS MENTIONED EARLIER, EACH LIFT NEEDS AN ID TO TELL IT WHICH LEVEL IT IS AT. THIS IS THE BOTTOM MOST BUTTON SO HAS A VALUE OF 0
setv ov00 0
*store ID of corresponding lift in OV16
*** NOW WE CAN STORE THE AGENT POINTER TO THE LIFT INSIDE AN OV VARIABLE OF THE CALL BUTTON, USED IN THE SCRIPT TO TELL
*** THE CORRECT LIFT TO MOVE
seta ov16 va00
mvto 1156 8954

*** NOW WE CREATE THE SECOND LIFT
***mid level of norn area
new: simp 2 12 21 "ds lifts" 2 34 310
attr 4
*creatures can act1 this object
bhvr 1
*** NOTICE THE DIFFERENT LEVEL NUMBER STORED IN OV01
setv ov00 1
*store ID of corresponding lift in OV16
*** AND THE POINTER TO THE 'PARENT' LIFT IS STORED IN THIS BUTTON TOO
seta ov16 va00
mvto 1432 9185

** AND NOW WE CREATE THE LAST LIFT
***bottom level of norn area
new: simp 2 12 21 "ds lifts" 2 34 310
attr 4
*creatures can act1 this object
bhvr 1
*** DIFFERENT LEVEL NUMBER AGAIN
setv ov00 2
*store ID of corresponding lift in OV16
*** AND STORE THE ID OF THE PARENT LIFT
seta ov16 va00
mvto 1424 9595

And that is it! When creating your own lifts just make sure you create your lift call buttons with increasing level numbers, and remember to position the lift and the buttons in your own location. If you use the DS lift graphics and make these changes there is no need for you to alter the classifiers used, or write your own scripts. Your newly positioned lifts should function just like the existing ones.

For a greater challenge, why not take the basics of the code and create your own lift images? With a small amount of reworking you can easily make your own elevator code.

IMPORTANT
All images and code included with Creatures 3 and Docking Station are copyright Creature Labs Ltd. You have permission to use them within your own Docking Station and Creatures 3 development projects unless you are making them for commercial gain. All commercial uses of our code and images are prohibited without a license.


HomeBackListRandJoinNext