Jump to content
Thomas Jentzsch

Pitfall!x256 (was: Pitfall!x16)

Recommended Posts

Hi,

I had a few hours of spare time and, based on my old disassembly from 2001, created a little hack of Pitfall!. This hack allows you to select one of 16 all new maze variations. Especially for those who have still fun in mapping screens and underground passages. Enjoy!

 

NTSC and PAL-60 (with some small color adjustments) versions included.

 

Update: The x256 version has 256 mazes and additional variety of the existing game elements. See this post for details.

Pitfall!x16.zip

Pitfall!x256 v1.20 (2017) (Activision, David Crane, Thomas Jentzsch) (NTSC).bin

Pitfall!x256 v1.20 (2017) (Activision, David Crane, Thomas Jentzsch) (PAL-60).bin

Edited by Thomas Jentzsch
  • Like 29

Share this post


Link to post
Share on other sites

Hi,

I had a few hours of spare time and, based on my old disassembly from 2001, created a little hack of Pitfall!. This hack allows you to select one of 16 all new maze variations. Especially for those who have still fun in mapping screens and underground passages. Enjoy!

 

NTSC and PAL-60 (with some small color adjustments) versions included.

 

Back in the day my mother had her own map memorized to complete the game. I have never been that good. lol I will try this though :D

Share this post


Link to post
Share on other sites

Why stop at 16? Yesterday I had the idea how to have 256 variations. So here is: Pitfall!x256

 

The game now contains the 16 variations (1..16) of Pitfall!x16 plus 240 all new ones. And each variation has its own, unique map. This should keep fans busy quite long. :)

 

With SELECT you can manually select a variation. If you press SELECT + RESET simultaneously the game with select a random variation for you. If you hold the switch(es), the selection is now accelerated.

 

Note: The PAL-50 version is speed adjusted. So it will play at the same speed as the NTSC or PAL-60 version.

 

EDIT: Faulty ROMs deleted. New ROMs will be in the first post.

Edited by Thomas Jentzsch
  • Like 8

Share this post


Link to post
Share on other sites

Some people continue to claim that there is no variation in Pitfall!.

 

Maybe this silences them. :)

  • Like 4

Share this post


Link to post
Share on other sites

From my memory, the rooms aren't stored in some sort of data table, instead a PRNG is seeded and then an algorithm generates the next number when going right or previous number going left.

 

(Assuming you didn't have to modify the algorithm) If the PRNG used a 8bit 256 cycle, then wouldn't Pitfall!x256 just give you a different staring location. If it used a 16bit 65535 cycle PRNG, is Pitfall!x256 still solvable in 20 minutes? The original is barely finishable within the limit, and that is with skipping probably 2/3-1/2 of the game using the underground.

  • Like 1

Share this post


Link to post
Share on other sites

From my memory, the rooms aren't stored in some sort of data table, instead a PRNG is seeded and then an algorithm generates the next number when going right or previous number going left.

Correct.

 

(Assuming you didn't have to modify the algorithm) If the PRNG used a 8bit 256 cycle, then wouldn't Pitfall!x256 just give you a different staring location. If it used a 16bit 65535 cycle PRNG, is Pitfall!x256 still solvable in 20 minutes? The original is barely finishable within the limit, and that is with skipping probably 2/3-1/2 of the game using the underground.

Pitfall! uses a 8 bit cycle PRNG which allows for 255 screens before repeating.

 

I changed the a bit convoluted PRNG code into a simpler, standard LFSR. This one uses an XOR-value, which I change depending on the game variation. Each XOR-value creates a completely different sequence of random values. However there exist only 16 XOR-values which generate a 255 values (0 isn't allowed) maximum length sequence (I cannot switch to 16 bit, because then the number of treasures within 255 screens is not determined). This resulted into the 16 variations of Pitfall!x16.

 

To get to 256 variations, I simply repeat the LFSR multiple (1, 3, 5, ..15) times for each screen. This causes different value sequences, which also repeat after 256255 values.

 

And while I was answering your questions (thanks a lot!), I realized that I have made a big mistake here :roll:. I always had 256 screens in mind, so I chose those odd values for repeating the LFSR. But there are only 255 screens, and this breaks the code. :x

 

Fortunately this seems easy to fix. 1, 2, 4, 7, 8, 11, 13 and 14 iterations should do the job. But before I post the new ROMs, I better double check.

  • Like 2

Share this post


Link to post
Share on other sites

Correct.

 

Pitfall! uses a 8 bit cycle PRNG which allows for 255 screens before repeating.

 

I changed the a bit convoluted PRNG code into a simpler, standard LFSR. This one uses an XOR-value, which I change depending on the game variation. Each XOR-value creates a completely different sequence of random values. However there exist only 16 XOR-values which generate a 255 values (0 isn't allowed) maximum length sequence (I cannot switch to 16 bit, because then the number of treasures within 255 screens is not determined). This resulted into the 16 variations of Pitfall!x16.

 

To get to 256 variations, I simply repeat the LFSR multiple (1, 3, 5, ..15) times for each screen. This causes different value sequences, which also repeat after 256255 values. .

Makes sense, as in bits shifting and XORing 0000 0000 just gets you 0000 0000 back again.

 

I wonder if this has been discussed before, but could a similar method be used to generate a random rogue-like game, with one algorithm (and register) handling the Y location, and algorithm handling the X location (and current D X location register)

 

You could then use 4 bits to handle the available edits from a room (with doors that close behind you in situations where you can go North, but the room N does not have an exit south)

 

0000 & 1111 representing all exits NSEW

0001 W

0010 E

0100 N

1000 S

...

1110 NSE

1101 NSW

1011 SWE

0111 NWE

 

Using a different seed to get 255 different dungeon layouts. (Actually 65535, because the UP/Down seed is different than the LEFT/RIGHT seed)

The worst situation might be starting location with one exit, and that room you have an exit to only having an exit back to the starting location.

 

Perhaps so algorithm to force the starting location to have all exits open, 0000 or 1111.

 

That leaves a total of 12 other bits to control information like enemies, treasures, weapons etc.

Share this post


Link to post
Share on other sites

For sure, you can create whole worlds randomly. This is no rocket science. And one LFSR per direction is a possible solution. But the problems arise when you want to make your world alive and interacting. Then things get quite complicated soon.

 

E.g. there is a certain treasure, which exists only once. The position must be constant per game and not depend in which order you visit the rooms. Now, if you want create this on-the-fly, how can you do that? You could create it at the game start, but that has to be stored somewhere. And the 2600 is very short of RAM.

 

Lookup "The Stacks" (which is still in development) is you want to see an example of a large, randomly generated world for the Atari 2600.

  • Like 1

Share this post


Link to post
Share on other sites

I have the deleted the faulty ROMs. The fixed ROMs can be found in the first post.

 

These ROMs contain further changes, which add more variety to the game itself. These should make the game itself (even) more entertaining and provide more varying timings.

 

Note: Some changes are there from the beginning and some start when you have collected a certain number of treasures. The latter will also make the game more challenging. To reflect that, I have increased the scores.

  • Like 1

Share this post


Link to post
Share on other sites

For sure, you can create whole worlds randomly. This is no rocket science. And one LFSR per direction is a possible solution. But the problems arise when you want to make your world alive and interacting. Then things get quite complicated soon.

 

E.g. there is a certain treasure, which exists only once. The position must be constant per game and not depend in which order you visit the rooms. Now, if you want create this on-the-fly, how can you do that? You could create it at the game start, but that has to be stored somewhere. And the 2600 is very short of RAM.

 

Lookup "The Stacks" (which is still in development) is you want to see an example of a large, randomly generated world for the Atari 2600.

 

i see what you mean. According to , Retrogame Archeology: Exploring Old Computer Games, Pitfall! Uses 4 bytes to track all 32 treasures, and its ingenious design to use the PCG (procedural content generation) of maximal length, ensures that all 32 treasures can be found within the 255 screens.

 

If someone wants a pseudo random world where you can actually interact with it by picking up objects such that they are removed from the world when you return to the screen, you start eating up RAM fast.

Share this post


Link to post
Share on other sites

I suppose I wasn't clear. Each treasure only appears once in Pitfall!

 

From glancing over the book above, the PCG generates an 8bit value that represents everything you see on the screen, log count, where the holes are, the tree pattern, rope or not, etc. This includes the specific treasures that need to disappear once you collect them. (I.e. If you leave the screen and return to it, the treasures don't respawn)

 

All treasures appear on a black disappearing pond which is 101x xxxx the remaining 5 bits indicate one of the 4 type of treasure (2-bits, that refer to a specific byte of RAM that contains and the last 3 bits the number of the specific treasure of 8 possible ones.

 

So to track the 32 treasures, you need 32bits or 4 bytes.

  • Like 1

Share this post


Link to post
Share on other sites

That book you are referring too, does it show source code? I wonder if they used my disassembly or if a different source exists.

Share this post


Link to post
Share on other sites

I have updated the x256 ROMs at the first post to fix some minor issues.

Share this post


Link to post
Share on other sites

Added one more variety element and fixed two gameplay issues. ROMs v1.14 in the first post.

 

BTW: When you play the game, please give me some feedback.

Edited by Thomas Jentzsch
  • Like 2

Share this post


Link to post
Share on other sites

Added one more variety element and fixed two gameplay issues. ROMs v1.14 in the first post.

 

BTW: When you play the game, please give me some feedback.

 

Thomas...The 'pits' open and close too fast now. There's no way to cross it in time.

Tried the initial (Start up) "1" variety with the Diamond ring on screen with tar/black pit under Stella 5.0.0-pre9 and MAME 0.187.

Same results under both emulators for the NTSC ROM v1.14.

  • Like 1

Share this post


Link to post
Share on other sites

You can cross them if you jump into the pit when it has opened and then jump again before it opens again.

 

BTW: It's not all pits. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...