Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
100 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

Creating Virtual Worlds


Section 2 - Two rooms

Our world is a cell, and we now want to split it into two rooms. First we add some more parameters to the room, to make it look more interesting.

$room = { texture => $txt->texture("wood"), 
          floortexture => $txt->texture('brick'),
          ceilingtexture => $txt->texture('rufgry'),
  };                                                     # line 1

Also we describe two cells, which will become the first and second room:

$room1 = cell ( name => "Room 1", size => 16 );          # line 2
$room2 = cell ( name => "Room 2", size => 16 );          # line 3

In our world description, we add these two cells as children, and the rest stays the same:

$world = cell ( name => "Hello World", room => $room, 
  div => inX(),                                          # line 4 
  cells => [ $room1, $room2, ]);                         # line 5

Example 2


2: Two rooms

In line 4 we tell the world cell that it should be split into subcells along the X-axis. In line 5 we define the two sub cells.

That's it!

The purple cubes encompassing our rooms are the Sound rooms, which are generated automatically by CoW. Forget that I ever talked about them.

Now you may wonder how we can split cells. Well, although you could split them in every conceivable way, I settled on splitting them always into cubes along the three axes. Funny thing is, you can describe nearly all possible designs with that, and even if you could split your cell into cylinders, that wouldn't work, since the Dark Engine can only have cubic sound rooms. Oh well! :)

But let's move to a more complex example.



Three rooms over the edge


Contents
  Introduction
  What you need
  How it was...
  A single room
  Two rooms
  Three rooms over the edge
  Another brick in the wall
  Doorways to Heaven
  Redefine the world
  Links, routes, etc.
  More ideas
  Afterword

  Printable version
  Discuss this article