Jump to content
  • entries
  • comments
  • views

Randomized Walls



Left Difficulty = A, use the Room X/Y value as is to draw the walls (as in yesterday's build)

Left Difficulty = B, use the Room X/Y value as a seed and randomize the walls


There's no such thing as "random numbers" to a computer, so we simulate them using things like a Linear Feedback Shift Register (LFSR). For Frantic, I'm using a 16-bit Galois LFSR to control the drawing of the walls.


While the overall number jumps around a lot using the LFSR, the bits within the number move in a pattern that is readily apparently if you just move in the X or Y direction. To compensate for that, I advance the LFSR a number of times after seeding it (with the room's X/Y value) to really mix up the bits.


I started with just 1 advance of the LFSR and held the joystick right. If any of the walls did not change, or if they followed a pattern (like always moving clockwise around the post) I incremented the advance amount. If I didn't see a pattern, I then held the joystick down and checked for patterns there. The patterns stopped appearing when I advanced the LFSR 21 times, so that's what I'm currently using.


If anybody notices a pattern in the results, let me know and I'll increase the advance amount again. Make sure you have the Left Difficulty set to B though.


Since this LFSR is re-seeded for every room, I won't be able to use it to generate the layout of the robots or their movement, else the robots for room 1,1 would always appear in the same positions. So I'll maintain a second LFSR for randomizing in-game events.










  • Like 1


Recommended Comments

There are no comments to display.

Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...