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:
      • Actbox
      • Platform.
The Recipe:
  1. 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.
  2. Set the Activated By field to Actor.
  3. Set the Actor field to the player object's name
  4. 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.
  5. Set At End of Path to Stop.
  6. Select a global mailbox that is not used elsewhere in the level.
  7. Set the door's Movement mailbox to the global mailbox.
  8. Set the Actbox's Write To Mailbox to the global mailbox.
  9. 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:
      • Spike.
The Recipe:
  1. Create a Spike object the size and shape of the lava.
  2. Set the Health Modifier to -1.
  3. 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. 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.
  2. Set Movement | At End Of Path to Delete on the platform.
  3. Set Flags | Template Object to True.
  4. Create a Generator object.
  5. Set the Generator | Object to Throw to the name of the platform object you have created.
  6. 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:
  • Platform
  • Relative paths
  1. Create a Platform named "Planet"
  2. Create a Platform named "moon" and create a path so that it orbits the Planet object.
  3. Create a Platform named "Sun".
  4. 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:
  1. Set the Movement | Object to Follow attribute on the moon to "Planet"
  2. 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:
  1. Create a CamShot object.
  2. Create a Target object.
  3. Set the CamShot's Target attribute to the name of the Target object created in step 2.
  4. 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.
  5. Set the CamShot's Track Object attribute to the name of the Player object.
  6. 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.
  7. Set the ActBoxOR's Object attribute to the name of the CamShot you created above.
  8. 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.

FALLING PLATFORMS

A Platform that falls away after an object is standing on it for a fixed amount of time: Uses:
    • Actbox
    • Platform.
  1. 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.
  2. Create an Actbox above the Platform at its starting position.
  3. Set the Actbox | Activated By field to Actor.
  4. Set the Actbox | Actor field to the Player object's name.
  5. Select a global mailbox that is not used elsewhere in the level and put that value in the platform object's Movement mailbox
  6. Set the Actbox object's Actbox | Activated Actor Mailbox to the same value as the Movement mailbox above.
  7. 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.

BOMBING PLATFORM

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
  1. Create a Platform object and give it a Path. This will be its bombing run.
  2. Create a Generator object and place it just below the platform.
  3. 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.
  4. Select a global mailbox not used elsewhere in the level and set the Generator's Activation Mailbox attribute to the global mailbox value.
  5. Set the Generator's Object to Follow attribute to the name of the Platform.
  6. Set the Generator's Follow Offset attribute to the name of the Platform.
  7. Create a Missile object.
  8. Set the Missile's Flags | Template attribute to True.
  9. Set the Generator's Generator | Object to Throw attribute to the Missile object's name
  10. Create an Explosion object.
  11. Set the Explosion's Flags | Template attribute to True.
  12. Set the Missile object's Object to Throw attribute to the Explosion's name
  13. Create an Actbox beneath the platform's starting position.
  14. Set the Actbox's path with two keys at the same position. This will allow it to move relative to the platform object.
  15. Set the Actbox's Object to Follow attribute to the name of the Platform.
  16. 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. 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:
    • Actbox
    • Platform
A door that splits open when the Player stands in front of it.
  1. Create a Pair of Platform objects with a common vertical edge. These will be your doors.
  2. 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.
  3. Give each door a path so that they move into the walls.
  4. Create an Actbox object in front of the doors.
  5. Set the Actbox | Activated By field to Actor.
  6. Set the Actbox | Actor to the Player object's name.
  7. Select a global mailbox that is not used elsewhere in the level and put that value in the Movement Mailbox for both Platform doors.
  8. Set the Actbox object's Actbox | Activated Actor Mailbox to the same value as the Movement mailbox above.
  9. Set the Actbox object's Actbox | Clear on Exit to False.

VEHICLES

There are 2 ways to handle the player on a vehicle:

  1. Have him stand on it. As long as it didn't accelerate too quickly he would remain on it as it moved.
  2. 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.

This topic: WorldFoundry > CookBook
Topic revision: 07 Oct 2002, MrLin;
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback