Would it be possible to create a set of rooms and as the player goes to the next room (from a starting room), the game chooses a room from random? The trick would be that once each room is picked, then the game would remember that so the player could back track.
So, basically a map of random rooms each time the game is played that the player can explore.
I hope this makes sense. Any help or insights would be greatly appreciated. I apologize in advance if this has been covered before.
It's possible, but it depends on how many rooms the player goes. You could create an item tile and use the load function to randomize variables of the different rooms before the player enters them.
on load do
randomRoom = random 1,3
randomRoom2 = random 4,6
randomRoom3 = random 7,9
end
Then specify the room and the coordinates when the player is in the tile.
on collect do
if event.room=="start" then
if event.px == 11 then
if event.py == 12 then
goto 3,4 in "room {randomRoom}"
end
end
end
end
While this is not complete randomness, you can create different variations of a room with this and randomize the map for every time the game is loaded. @orkn has a better explanation on how to randomize rooms but this should allow you to backtrack to the same room.
Been having a play with this as I'm hoping to do something similar in rootin tootin eventually (moving between random screens, but without needing to go backwards). I didn't want to create an extra variable for each room, but did end up creating an extra item for each room, so it's a trade-off. For larger numbers of rooms though, I'd probably find creating items easier than adding in extra variables.
The problem is that Pulp is missing any concept of either arrays or shuffling, so we need to hack it in. Storing a list of values as a row of tiles has been done before, and might work.
My current approach is this:
Set up random rooms called "room_index_1" to "room_index_X"
Create item tiles called "index_1" to "index_X" to match the number of rooms. These can be blank, so they get hidden when on screen.
Have a screen dedicated to shuffling the order and moving between rooms. Script it so that when needed, it automatically inserts the index_X tiles on a "hidden" row, and then loops through to swap them randomly with other index_X tiles. This gives us a randomised list we can jump forwards/backwards between (by just keeping track of an X position on the row as our "current index"), but the screen does either need to be disguised as some kind of "transport" or "loading" screen, or put up with a flash of a screen between rooms.
When moving to the next screen, just increase the X value of the index pointer, check the tile name (eg "index_2") and then goto the room that matches that index (eg goto 1,1 in "room_{nextRoom}")
The attached JSON is a proof-of-concept with a few comments which may help! It's not perfect, and it'd be interesting to know if it's possible without setting up all the tiles...