Tuesday, January 16, 2007
After last week's mention of the invisible maze in the Messenger, I decided to pull an old project out of limbo and finish it.
Here I am inside the newly completed Grid Maze. The maze is a 20 meter by 40 meter by 4 meter rectangle, with interior corridors composed of 2 meter by 4 meter panels. It rezzes on demand in the SkyArena (teleporter located near the entry point linked there on the right). Just touch the black sphere in the center of the Arena, and select "Maze" from the dialog box. Give it a moment to generate the maze, then have a go at it!
Oh, and I'll let you, dear reader, in on a secret: it cheats! The maze walls rotate at random every few seconds... But only if you're not looking. Each maze wall checks for the presence of an avatar before moving. If an av is too close, or is facing in the direction of the wall, it stays still. If the player's back is turned, the wall has a 50-50 chance of moving. Repeat this across a couple hundred maze wall elements (there's a reason I don't keep this thing rezzed full time!), and the overall effect is quite disorienting.
The maze makes no attempt to verify that a valid path exists in any given configuration. This just adds to the confusion. Dead ends appear where open hallways were before, while new paths open up behind you. I've found that it's quite possible to work your way from one end to the other, simply by retracing your steps until a new pathway appears. But, if you become trapped, there are random teleporters built into the floors and ceilings. Right click on them and select "Teleport," and your av will be transported to a random location inside the maze. (Or, actually, a random location within the same 20 meter by 10 meter rectangle.) And, if you get frustrated, any wall can be used in the same way to teleport outside.
Working out the Arena rezzer for this one reminded me of an important lesson: always look for the simple solution. I spent an inordinate amount of time trying to work out schemes to deal with avatars standing inside the borders of the maze as it was being rezzed. I tinkered with scanners to lock it out if the area was blocked, push scripts to nudge avatars out of the way, IMs to warn avatars they're about to become trapped, as well as combinations of those and more. Everything was cumbersome and unreliable. Finally, more or less by accident, I stumbled across a simple hack that worked: the rezzer first temporarily rezzes large, invisible boxes to fill the work area. Then, if anyone is inside that volume, their avatar is slowly, but surely, squirted out of the way. Why not let Havok's version of the Pauli Exclusion Principle do the work? A single sensor sweep on rez drives a modest push script, with just enough force to nudge the avatars inside the volume and "wake up" physics for avatars that remain still after the blocking prim is rezzed. (Also a handy tip if you need an avatar to stop hanging in the air after the floor disappears.) After adding that refinement, this turned out to be much more reliable than any other scheme I could devise. So, lesson learned: look for the simple solution first.