vdub_bobby Posted September 6, 2005 Share Posted September 6, 2005 (edited) Here's a Pitfall! with a randomly generated map. Well, it starts off with the same one every time, but hit (and hold for a fun tour, ) RESET to change to a new random map. I increased the starting time so that you have more time to explore. Thoughts? EDIT: The map probably isn't random, just your starting location. See here: http://www.atariage.com/forums/index.php?s...ndpost&p=927514 RandomPitfall_.bin Edited September 8, 2005 by vdub_bobby Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted September 7, 2005 Author Share Posted September 7, 2005 New version, no noticeable changes; just cleaned up some code a little. RandomPitfall_.bin Quote Link to comment Share on other sites More sharing options...
supercat Posted September 8, 2005 Share Posted September 8, 2005 Here's a Pitfall! with a randomly generated map. Well, it starts off with the same one every time, but hit (and hold for a fun tour, ) RESET to change to a new random map. I increased the starting time so that you have more time to explore. Thoughts? 926343[/snapback] It might be nice to include "Freecell-style" randomness, where you allow the player to select a random speed. This would allow people to e.g. hold a contest for who can get the best score within a week on game #4921. Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted September 8, 2005 Author Share Posted September 8, 2005 Here's a Pitfall! with a randomly generated map. Well, it starts off with the same one every time, but hit (and hold for a fun tour, ) RESET to change to a new random map. I increased the starting time so that you have more time to explore. Thoughts? 926343[/snapback] It might be nice to include "Freecell-style" randomness, where you allow the player to select a random speed. This would allow people to e.g. hold a contest for who can get the best score within a week on game #4921. 927071[/snapback] Yeah...I thought about that. Couple reasons why I didn't, and probably won't, code that in: 1. It would require a lot more code, and probably require making the binary 8K. A lot of work. 2. The way the random number generator works in Pitfall! means that *I think* that, no matter the initial random seed, the map is always the same - you just start at a different point in it. And what's so cool about that? Once you figure out where you are starting, you can run through the game basically the same way you would for regular Pitfall!, just starting at a different point. Quote Link to comment Share on other sites More sharing options...
Crimefighter Posted September 8, 2005 Share Posted September 8, 2005 Reading this post, I had thought this game had generated a randomized gamemap entirely instead of moving your starting position in random locations. Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted September 8, 2005 Author Share Posted September 8, 2005 Reading this post, I had thought this game had generated a randomized gamemap entirely instead of moving your starting position in random locations. 927647[/snapback] So did I, at first. Quote Link to comment Share on other sites More sharing options...
+FujiSkunk Posted September 8, 2005 Share Posted September 8, 2005 (edited) Reading this post, I had thought this game had generated a randomized gamemap entirely instead of moving your starting position in random locations. 927647[/snapback] So did I, at first. 927667[/snapback] So it isn't a new, randomly generated map? If not, you might want to tweak your first post and/or the thread title. Edit: Unless this is the September 8th version of an April Fool's joke, in which case I aplogize for not getting it. Edited September 8, 2005 by skunkworx Quote Link to comment Share on other sites More sharing options...
+batari Posted September 8, 2005 Share Posted September 8, 2005 Here's a Pitfall! with a randomly generated map. Well, it starts off with the same one every time, but hit (and hold for a fun tour, ) RESET to change to a new random map. I increased the starting time so that you have more time to explore. Thoughts? 926343[/snapback] It might be nice to include "Freecell-style" randomness, where you allow the player to select a random speed. This would allow people to e.g. hold a contest for who can get the best score within a week on game #4921. 927071[/snapback] Yeah...I thought about that. Couple reasons why I didn't, and probably won't, code that in: 1. It would require a lot more code, and probably require making the binary 8K. A lot of work. 2. The way the random number generator works in Pitfall! means that *I think* that, no matter the initial random seed, the map is always the same - you just start at a different point in it. And what's so cool about that? Once you figure out where you are starting, you can run through the game basically the same way you would for regular Pitfall!, just starting at a different point. 927514[/snapback] In that case, I assume the random number generator is 8-bit. I'd see about making it 16-bit, which I think would only require a few bytes of ROM and one byte of RAM. Quote Link to comment Share on other sites More sharing options...
+batari Posted September 8, 2005 Share Posted September 8, 2005 In that case, I assume the random number generator is 8-bit. I'd see about making it 16-bit, which I think would only require a few bytes of ROM and one byte of RAM. 927722[/snapback] Looking at source, I found that the LFSR in the game is much more complex than it needs to be, which could save lots of space: .loopRandom: ; random' = random >> 1 | (bit4^bit5^bit6^bit1) * $80 lda random ; 3 asl ; 2 eor random ; 3 asl ; 2 eor random ; 3 asl ; 2 asl ; 2 rol ; 2 eor random ; 3 lsr ; 2 ror random ; 5 dex ; 2 bpl .loopRandom ; 2³ The above is for movement to the left. For movement to the right, it does this: .loopRandom: ; random' = random << 1 | (bit3^bit4^bit5^bit7) lda random ; 3 asl ; 2 eor random ; 3 asl ; 2 eor random ; 3 asl ; 2 asl ; 2 eor random ; 3 asl ; 2 rol random ; 5 dex ; 2 bpl .loopRandom ; 2³ The LFSR I have been using is as simple as this, and probably works just as well: lda random lsr bcc noeor eor #$B2 noeor sta random Making the above 16-bit would actually save space. Note that Pitfall's LFSR is reversible. However, making mine reversible is not too hard if you use this in place of the other one. lda random asl bcc noeor2 eor #$65 noeor2 sta random Then there's room to play with to add another byte and make a 16-bit LFSR... Hopefully. Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted September 8, 2005 Author Share Posted September 8, 2005 Then there's room to play with to add another byte and make a 16-bit LFSR... Hopefully. 927779[/snapback] I don't know much about pseudo-random number generators (LFSR) - if you give me a 16-bit reversible LFSR I'll try to put it into Pitfall! There is a fair amount of space (and free RAM) if you remove the screen saver code. Quote Link to comment Share on other sites More sharing options...
+batari Posted September 9, 2005 Share Posted September 9, 2005 (edited) I don't know much about pseudo-random number generators (LFSR) - if you give me a 16-bit reversible LFSR I'll try to put it into Pitfall! Try this - I think it will work. Replace the LeftRandom and RightRandom subs with these. You also need to define random_hibit to be equal to an unused byte in memory. LeftRandom SUBROUTINE ; generate new random scene on the left: lda random lsr random_hibit ror bcc noeor eor #$B2 tax lda random_hibit eor #$A0 sta random_hibit txa noeor sta random RightRandom SUBROUTINE ; generate new random scene on the right: lda random_hibit asl random rol bcc noeor2 eor #$41 tax lda random eor #$65 sta random txa noeor2 sta random_hibit jmp ContRandom EDIT: Oh yeah, there are four locations in the code where there is "lda random" and these need to all be modified to this: lda random eor random_hibit Don't do a global search and replace though, as the "lda random2" doesn't need changing, and you don't want to change the code you just replaced with the above. Edited September 9, 2005 by batari Quote Link to comment Share on other sites More sharing options...
supercat Posted September 9, 2005 Share Posted September 9, 2005 In that case, I assume the random number generator is 8-bit. I'd see about making it 16-bit, which I think would only require a few bytes of ROM and one byte of RAM. 927722[/snapback] Going with a 16-bit LFSR makes the game have a set of 65536 rooms (or whatever the period is) rather than 256, but the game will always play the same for any position within the set. Because of the larger set of rooms, there's no realistic way to traverse all of them within a reasonable time. If the goal is to ensure that all 256 of the original rooms appear once within a 256-room map, there are two other approaches that may work better: -1- Keep the room number as a byte 0-255. When going into a room, put that number through a mapping function to convert it into the room contents. -2- Apply a reversible transformation before and after doing the room-to-room movement. For starters, assuming the original routines are called "left" and "right" and there's stack space (and time) to call them, I would suggest the following: newleft: jsr left lda room clc adc seed sta room jsr left lda room sec sbc seed sta room jmp right newright: jsr right lda room clc adc seed sta room jsr right lda room clc adc seed sta room jmp left I don't know whether the sequences generated by the above will be interesting, but they should all be 256 rooms long and visit all of the original rooms, though (except for seed #0, corresponding to the original game) they will be in different sequences. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.