Creating Virtual Worlds
Section 2 - Two roomsOur 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 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.
|