Jump to content

There be Walls

Posted by SpiceWare, in Frantic 03 May 2011 · 1,233 views

Initial wall routines.

The way this works is you are in a room denoted by X, Y coordinates. Exiting left/right will change the X coordinate while exiting up/down will change the Y coordinate. Each coordinate is an 8 bit value, so it wraps at 0/255.

Starting with a room with 8 posts:
Attached Image

Draw a single wall from each post, going either up/down/left/right. To control the drawing, I'm currently* using the X coordinate for the top 4 posts and the Y coordinate for the bottom 4 posts. There's 8 bits per coordinate, so I'm using paired bits to control the direction. Walls can overlap, so you won't always see 8 walls.

  • direction control
  • 00 = up
  • 01 = right
  • 10 = down
  • 11 = left

By using the room coordinates as the starting point for wall generation, you'll be able to exit right, up, left, then down and return to the room you started from.

For test purposes the joystick currently controls the coordinates, which are shown in the score. I shut my eyes and held the joystick in a few directions before stopping - results are:
Attached Image
Attached Image
Attached Image

* I plan to use the X-Y coordinates as a 16 bit seed into a 16 bit random number generator. To draw the walls I'll then seed the generated with the coordinates and advance it to the next random number (I might need to advance it 2 times, or even more, but whatever I use will be a fixed # of advances). That number will be split into the high and low bytes and those bytes will control the drawing of the walls.

Attached File  f20110503_NTSC.bin (32KB)
downloads: 142

PAL - let me know if the score is visible on PAL TVs, I made need to shift it upward based on Stella.
Attached File  f20110503_PAL.bin (32KB)
downloads: 141

Attached File  Frantic20110503.zip (205.67KB)
downloads: 157

Thats a really neat way to generate rooms!
  • Report

I'd read something last year about how the arcade version of Berzerk drew the maze, and it was along these lines. In theory there are 65,536 distinct rooms, but the reality is some of the rooms will look the same even if they're not drawn the same. For instance, both of these wall patterns will result in the center of the room being walled off from the edges:


  • Report
We've been considering doing a Berzerk game for the Jag, I'll watch this with interest :)
  • Report

Search My Blog

Recent Entries

Recent Comments

Latest Visitors

2 user(s) viewing

0 members, 2 guests, 0 anonymous users