Jump to content
IGNORED

Pitfall!x256 (was: Pitfall!x16)


Thomas Jentzsch

Recommended Posts

I had thought about a spreadsheet doing the work, but then I got lazy. icon_smile.gif

 

Funny, I was thinking of doing exactly that.

 

Are you sharing your code for your new LFSR routine?

 

BTW, this is outstanding. I should be working now and just spent 45 minutes playing the game! Excellent mod.

 

Someone should Mr Crane about this, I'm sure he would be impressed. Well done!

  • Like 2
Link to comment
Share on other sites

Sure!

 
; seeding:
    lda     gameIdx     ; selected game variation number - 1
    and     #$0f
    tay
    eor     gameIdx         
    eor     NextRndTbl,y
    eor     #%10100101 
    sta     random      
    ...

; retrieve number of random loops:
; Y = gameIdx & $0f
    lda     gameIdx
    and     #$0f
    tay
; X = iterTbl[gameIdx >> 4]
    eor     gameIdx
    lsr
    lsr
    lsr
    lsr
    tax
    lda     IterTbl,x
    tax 
    ...

; going right:
    lda     random
.loopRandom:
    lsr
    bcc     .skipEor
    eor     NextRndTbl,y
.skipEor
    dex                    
    bne     .loopRandom    
    sta     random
    ...

; going left:
    lda     NextRndTbl,y
    sec
    rol
    sta     temp
    lda     random
.loopRandom:
    asl             
    bcc     .skipEor
    eor     temp
.skipEor
    dex                  
    bne     .loopRandom  
    sta     random
    ...

NextRndTbl
    .byte   $8e, $95, $c6, $a6, $af, $b1, $b2, $b4
    .byte   $b8, $c3, $96, $d4, $e1, $e7, $f3, $fa

IterTbl
    .byte  1,  2,  4,  7,  8, 11, 13, 14
    .byte 16, 19, 23, 26, 28, 29, 31, 32
Please let me know if something is missing. I am really looking forward to your mapping and hope you can detect passages.
  • Like 1
Link to comment
Share on other sites

Sure!

 
; seeding:
    lda     gameIdx     ; selected game variation number - 1
    and     #$0f
    tay
    eor     gameIdx         
    eor     NextRndTbl,y
    eor     #%10100101 
    sta     random      
    ...

; retrieve number of random loops:
; Y = gameIdx & $0f
    lda     gameIdx
    and     #$0f
    tay
; X = iterTbl[gameIdx >> 4]
    eor     gameIdx
    lsr
    lsr
    lsr
    lsr
    tax
    lda     IterTbl,x
    tax 
    ...

; going right:
    lda     random
.loopRandom:
    lsr
    bcc     .skipEor
    eor     NextRndTbl,y
.skipEor
    dex                    
    bne     .loopRandom    
    sta     random
    ...

; going left:
    lda     NextRndTbl,y
    sec
    rol
    sta     temp
    lda     random
.loopRandom:
    asl             
    bcc     .skipEor
    eor     temp
.skipEor
    dex                  
    bne     .loopRandom  
    sta     random
    ...

NextRndTbl
    .byte   $8e, $95, $c6, $a6, $af, $b1, $b2, $b4
    .byte   $b8, $c3, $96, $d4, $e1, $e7, $f3, $fa

IterTbl
    .byte  1,  2,  4,  7,  8, 11, 13, 14
    .byte 16, 19, 23, 26, 28, 29, 31, 32
Please let me know if something is missing. I am really looking forward to your mapping and hope you can detect passages.

 

First, thank you for this.

 

Now I need to brush up on my assembly ;)

Link to comment
Share on other sites

I can post pseudo code instead, if you prefer that.

 

That would save me a lot of time, thank you. If you have it handy, that's greatly appreciated.

 

I've started building some code to decipher the scenType byte. I used your original decompile of Pitfall! as the source.

 

My goal is to build a) a mapper for all 255 variations, b) find the shortest path to collect the 32 treasures.

 

 

Thomas, if I may, how did you figure out how to create your own LFSR? Technically the 255 variations are the same 255 screens in different sequences from what I can tell. I guess the possible sequences are 255! (factorial)?

 

Again, this is brilliant.

Link to comment
Share on other sites

Pseudo code:

; Notes:
;   gameIdx = selected game variation number - 1 (0..255)
;   & = bitwise AND
;   all values are 8 bit
 
; seeding:
    random = (gameIdx & $f0) XOR NextRndTbl[gameIdx & $0f] XOR %10100101
 
; retrieve number of random loops:
    loops = IterTbl[gameIdx >> 4]
 
; going right:
   for i = 1 to loops
     if ((random & 1) == 0) random = random >> 1
     else random = (random >> 1) XOR NextRndTbl[gameIdx & $0f]
 
; going left:
   xorVal = (NextRndTbl[gameIdx & $0f] << 1) + 1 ; inverse XOR value
   for i = 1 to loops
      if ((random & $80) == 0) random = random << 1
      else random = (random << 1) XOR xorVal
 
NextRndTbl
    .byte   $8e, $95, $c6, $a6, $af, $b1, $b2, $b4
    .byte   $b8, $c3, $96, $d4, $e1, $e7, $f3, $fa

IterTbl
    .byte  1,  2,  4,  7,  8, 11, 13, 14
    .byte 16, 19, 23, 26, 28, 29, 31, 32

Yes, the 255 screens are the same as in the original in difficulty B, for A I added a bit more variety. All 16 LFSR I am using generate a sequence of 255 random numbers (so called Maximum Length LFSR Sequences), so all games are 255 screens long. The code for the LFSR is pretty standard, as it is used in many games (especially homebrews).

Edited by Thomas Jentzsch
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

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 did some more thinking on this procedurally generates dungeon.

 

If one LFSR was used per direction on a map that was 64 screens left/right (x), and the other 8bit LFSR was used for up/down (y), and the exits for the room were controlled by the bits in the resultant next LeftRightLFSR, then wouldnt the exit directions be exactly the same for every X screen on the map?

 

I.e that screen (23,10) would have the same exits as (23,9) to the North and (23,11) to the south of the current room.

 

I dont think that even splitting up the exits so that 2 bits of the Up/Down LFSR were handling two exits and the Left/Right LFSR were handling two exits. Since that will still cause the exits to be the same in two directions always when at the same x coordinate.

 

Instead what would be needed so that the exits werent the same for rooms above/below is a 16-bit LFSR where 4 bits are used for the exits (take the lowest nibble), and when moving Left/Right only the next/previous LFSR results lowest nibble is used for the exit, and when moving Up/Down the 64th next/previous LFSR results lowest bubble is used for the exits. (Similar to how Pitfall underground skips 3 screens instead of 1)

 

Considering that the LFSR loop needs to be computed 64 times for a 64x64 random dungeon, before displaying the next up/down room instead of just once...

What sort of delay would be expected before displaying the next vertical screen? Could this be calculated in the ~2,000 cycles available during Overacan?

Edited by CapitanClassic
  • Like 2
Link to comment
Share on other sites

  • 9 months later...
  • 3 years later...
  • 1 year later...
On 7/5/2017 at 1:10 PM, Thomas Jentzsch said:

What's wrong with Pitfall!x256? :)

Nothings wrong with Pittfall!x256! I’m just now playing this version for the first time. This is a awesome version of Pitfall!

This blew my mind! POW! 256 mazes! Logs rolling this way and that way! Pits open and close faster! Random maze selection!

this is great! Thanks Thomas!

  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...
On 1/14/2024 at 3:04 AM, Thomas Jentzsch said:

Nope. But you can make a cart for yourself. Or ask Al to do that for you (personal use only).

Hey Thomas, I received my copy of Pitfall!x256 it’s awesome! Thanks to Al! I have to design a better label though. I wasn’t sure if adding the creators name along with your name was allowed. Thanks again, having a blast with this version! And it works great on the 2600+!

BA2371BA-3136-4109-B022-6F256555E2FE.jpeg

Edited by MrChickenz
Link to comment
Share on other sites

1 hour ago, MrChickenz said:

Hey Thomas, I received my copy of Pitfall!x256 it’s awesome!

Glad you like it. Which variant do you prefer? The normal one or the hard one?

1 hour ago, MrChickenz said:

Thanks to Al! I have to design a better label though. I wasn’t sure if adding the creators name along with your name was allowed.

No objection from my side. :) And maybe add the missing '!' too.

1 hour ago, MrChickenz said:

Thanks again, having a blast with this version! And it works great on the 2600+!

BA2371BA-3136-4109-B022-6F256555E2FE.jpeg

Since it is just 4K, I would have been surprised if it would not work.

 

Please let me know about your further experience.

Edited by Thomas Jentzsch
  • Thanks 1
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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