THE WORLD FOUNDRY COOKBOOK
Levels are composed of many individual pieces working together to create the overall world. Much of mastering level creation is about understanding the interrelationship of the many World Foundry components.
The cookbook is a place where you can see these interactions at work through actual working examples created in the World Foundry engine.
Please feel free to add to this document and make it a resource for designers to share information on creating worlds.
TYPICAL OBJECT INTERACTIONS
SWITCHED DOOR
A door that opens once the player stands on a switch.
The door will begin closed, and open the first time the Player enters the activation box.
Classes Used:
The Recipe:
- Create an Actbox object to enclose the area where the virtual switch will appear in the Gameworld. This probably will be larger than the graphic will appear in the game itself, since we want the character to be able to appear to hit the object, without having it to be too exact.
- Set the Activated By field to Actor.
- Set the Actor field to the player object's name
- Create a platform on a path (the "door"), with its starting position being the "closed" door position, and its ending position being the "open" door position.
- Set At End of Path to Stop.
- Select a global mailbox that is not used elsewhere in the level.
- Set the door's Movement mailbox to the global mailbox.
- Set the Actbox's Write To Mailbox to the global mailbox.
- Set the Actbox's Clear on Exit boolean to False.
LAVA PIT
A pit of death that will damage any object that stands on it.
Classes Used:
The Recipe:
- Create a Spike object the size and shape of the lava.
- Set the Health Modifier to -1.
- Set Activated By to all.
CONVEYOR BELT
A generator creates an endless supply of moving platforms. When they reach the end of their path they destroy themselves.
Classes Used:
-
-
- Generator
- Platform (with path).
The Recipe:
- 1. Create a platform and give it a path which moves where you want the conveyor belt to go. It should start and end inside of another object, or group of objects, so that the platforms cannot be seen when they are destroyed.
- Set Movement | At End Of Path to Delete on the platform.
- Set Flags | Template Object to True.
- Create a Generator object.
- Set the Generator | Object to Throw to the name of the platform object you have created.
- Play with Generator | Generation Rate the Platforms are being created in a continuous string where the leading edge of each new object is in contact with the trailing edge of the previously generated object.
SOLAR SYSTEM
Create a simple solar system, with a moon that orbits a planet as the planet orbits a sun.
Classes Used:
- Create a Platform named "Planet"
- Create a Platform named "moon" and create a path so that it orbits the Planet object.
- Create a Platform named "Sun".
- Creat a path for "Planet" so that it orbits the Sun object.
If you look at this animation in 3D studio you will have a planet that orbits the sun, but the moon will orbit the position where the planet started without moving around the sun.
This is how it will appear in the game unless we make the moon follow the planet:
- Set the Movement | Object to Follow attribute on the moon to "Planet"
- Set the Movement | Follow Offset attribute on the moon to "Planet"
Now the moon will properly orbit the planet no matter where it goes.
Note that this effect is not reflected in 3Dstudio.
BASIC CAMSHOT
Set up a camera to look at the Player when in a particular area.
The camera will switch to this Camshot whenever the player is inside of the Actbox. Note that the Gameworld requires that there be a Camshot specified at all times, so you will be creating many of these.
You are allowed to nest
ActBoxOR's, so you can make room sized Camshot, and then create specific shots within the room as needed.
Classes Used
The Recipe:
- Create a CamShot object.
- Create a Target object.
- Set the CamShot's Target attribute to the name of the Target object created in step 2.
- Set the CamShot's Follow attribute to the name of the Target object created in step 2. To be able to visualize how the shot will appear in the game you need to think of your objects in the following way; The CamShot object is the camera, and the Target object is the Player object in the world. Use the Camshot/Target object pair to determine the relationship between the camera and the player object. Remember that the actual location of the CamShot/Target pair will be ignored. It is the relationship between them that you are creating. See the FAQ for further details.
- Set the CamShot's Track Object attribute to the name of the Player object.
- Create an ActBoxOR that surrounds the area where you want the shot to be active. Note that if the player object is ever outside of an ActBoxOR object there will be no active camera, and the game will crash. In order to avoid this always create a default camera that encloses all objects in the Gameworld.
- Set the ActBoxOR's Object attribute to the name of the CamShot you created above.
- Set the ActBoxO's Write to Mailbox to 1000.
1000 is the system global mailbox, which is used to determine which
CamShot to use.
A complete list of mailboxes can be found in mailbox.def in the levels directory. If you implement prioritized camshots in the director script, you will need to write to one of the mailboxes read by the director, instead of mailbox 1000 directly.
A Platform that falls away after an object is standing on it for a fixed amount of time:
Uses:
- Create a Platform and give it a path where the first key is located at its starting position, the second key is also at the starting position , and the last key is its fallen destination.
- Create an Actbox above the Platform at its starting position.
- Set the Actbox | Activated By field to Actor.
- Set the Actbox | Actor field to the Player object's name.
- Select a global mailbox that is not used elsewhere in the level and put that value in the platform object's Movement mailbox
- Set the Actbox object's Actbox | Activated Actor Mailbox to the same value as the Movement mailbox above.
- Set the Actbox object's Actbox | Clear on Exit to False.
You can adjust the falling delay by using 3D studio to change which frame number the second key is placed in. Because the first and second keys are in the same location the object won't begin moving until it reaches the keyed frame.
A moving platform that creates a deadly raincloud that drops bombs whenever the player is under it:
Uses:
-
- Actbox
- Platform
- Generator
- Missile
- Explosion
- Relative paths
- Create a Platform object and give it a Path. This will be its bombing run.
- Create a Generator object and place it just below the platform.
- Give the Generator a path made up of two keys at the same position. This will allow it to move relative to the platform object.
- Select a global mailbox not used elsewhere in the level and set the Generator's Activation Mailbox attribute to the global mailbox value.
- Set the Generator's Object to Follow attribute to the name of the Platform.
- Set the Generator's Follow Offset attribute to the name of the Platform.
- Create a Missile object.
- Set the Missile's Flags | Template attribute to True.
- Set the Generator's Generator | Object to Throw attribute to the Missile object's name
- Create an Explosion object.
- Set the Explosion's Flags | Template attribute to True.
- Set the Missile object's Object to Throw attribute to the Explosion's name
- Create an Actbox beneath the platform's starting position.
- Set the Actbox's path with two keys at the same position. This will allow it to move relative to the platform object.
- Set the Actbox's Object to Follow attribute to the name of the Platform.
- Set the Actbox's Follow Offset attribute to the name of the Platform. This means that this object’s path (which we set above) will move relative to the Platform.
- 17. Set the Actbox's Write to Mailbox attribute to the global mailbox.
Now both the Actbox and the Generator will follow the Platform along its path. Whenever the Player is in the Actbox, the generator will generate Missiles.
"STAR TREK" DOORS
Clases Used:
A door that splits open when the Player stands in front of it.
- Create a Pair of Platform objects with a common vertical edge. These will be your doors.
- Create a second, larger set of Platform objects one on the outside edge of either door. These will be the walls the doors will slide into.
- Give each door a path so that they move into the walls.
- Create an Actbox object in front of the doors.
- Set the Actbox | Activated By field to Actor.
- Set the Actbox | Actor to the Player object's name.
- Select a global mailbox that is not used elsewhere in the level and put that value in the Movement Mailbox for both Platform doors.
- Set the Actbox object's Actbox | Activated Actor Mailbox to the same value as the Movement mailbox above.
- Set the Actbox object's Actbox | Clear on Exit to False.
VEHICLES
There are 2 ways to handle the player on a vehicle:
- Have him stand on it. As long as it didn't accelerate too quickly he would remain on it as it moved.
- Write a script to copy the vehichle position to the player's position.
For control write a script which fails to pass the joystick input through
to the player physics when in a vehicle and instead have it control
the vehicle. Since the player's visibility is also controlable from
a mailbox you could even have the player disappear and become the vehicle.