• entries
4,299
2,535
• views
1,752,993

# Cranberry update

105 views

A lot of work has been put into the raining in Quest of the Cranberry for the Channel F. And since I added a snowflake falling in the snow level, that too. The gist of the random number generator, I think, is this:

1. Generator gets number between 0-255 in a certain table of numbers (that seems random) that the lookup point increases by one if you add to it.

2. Make the number be between 10-73 with some code.

3. Put said number into the x position of the raindrop or snowflake.

If you're using random numbers in a game (whether it be Channel F, or Atari 2600, or anything else), it's not really random numbers. You're just looking up a certain number in a table to use as the value for your number. The trick is, you can change the table (there are only a few different tables, though), or the starting point. That is what makes it seem random. I knew this, but the snag was I didn't know how to program it to do that. But I think I figured it out.

In version 39 which I posted on the game's website, I made it so the x position is random when you start at the left side of the screen. I debated whether or not I should do this, or put the raindrop/snowflake at the right side of the screen so the player knows it's raining. But I figured I should make it random because right now it's really kind of hard to lose health. This (and Frank the Fruit Fly) is a game where sometimes the player has to figure out how to advance, and sometimes the player has to play it like a normal video game (like dodge stuff).

What's next is a very fast moving yeti-type character that moves randomly (again with the "random" numbers) around the screen and you need to avoid running into it. I expect this will be challenging to program. I need to design a Yeti, which is kind of hard since I can only have a 6x6 character. So we'll see how that goes. I'm thinking perhaps I can make it look like E.T. Should I make it green? Choices, choices...

## 1 Comment

You probably could implement a lagging Fibonacci PRNG instead of a LFSR. It is a little more work, but I've found it has a much greater entropy. For most purposes, a proper LFSR will work though, in particular as you mention you have different entry points. If you also can afford dummy calls to the LFSR, like once if the player moves to the left, twice for right, thrice for up, four times for down, you will further obfuscate it because then you're advancing it a non-deterministic amount of steps.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.