• entries
657
2,702
• views
901,808

# There be Walls

2,272 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:

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:

* 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.

NTSC

PAL - let me know if the score is visible on PAL TVs, I made need to shift it upward based on Stella.

Source

Thats a really neat way to generate rooms!

Thanks!

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:

DLLL

RRRU

RRRD

ULLL

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.