Random connected maps

flimbo

Villager
Member
Joined
Nov 10, 2013
Messages
23
Reaction score
2
First Language
Portuguese
Primarily Uses
Hello,

 

Ok, so here´s what I would like to do:

 

- Connect several maps (around 20, selected out of 25) through teleport events.

 

- Each map could have one, two, three or four exits/teleport events. This info would be defined in each map 

 

- Each exit/teleport event would connect to another map. This would be random for each time you play the game, and would work both ways; if both exits are open, like, if going north from map 2 would lead me to map 12, going south from map 12 would lead me to map 2. 

 

- If one exit is open and the other is closed, its a one way ticket.

 

- Each time the game is played, the maps are connected in a different way. 

 

- All rooms are reacheable.

 

I tried to figure a way to do it, but unfortunately, it seems I lack the needed knowledge, both in algorithm and script knowledge, specially for the open path issue . 

 

So I wonder if is there any script (I suppose this could only be achieved through scripts) I could use as a starting point... I tried the Dungeon Generator one, but couldnt completely understand how could I adapt it

 

Thanks in advance
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,780
Reaction score
7,874
First Language
German
Primarily Uses
RMMV
no, it can also be made by eventing - it just needs a lot of variables to do so.

1) you reserve four variables for each teleport event to store the possible targets of that event

2) use control variable on a temporary variable to get a random number 1 to 4

3) have the teleport event use a variable depending on that roll to select the targeted map.

The biggest problem would be to fill all those variables at the beginning with random map IDs while preventing double uses or maps that are not reachable, but that would just be one long event for creating the different values (OK, a very complex, long event depending on how complex your maps are)
 

flimbo

Villager
Member
Joined
Nov 10, 2013
Messages
23
Reaction score
2
First Language
Portuguese
Primarily Uses
Thanks for the reply!

Yes, I think thats the main difficult for me;  preventing double use of maps and assuring  an open path. 

Regarding the open path, I found this suggestion.

Regarding populating all the data, I though about using an initial script and structs...

I have a (very) little experience in C programing language, so it seems is a bit easier for me to think how to solve using scripts than using events : )

no, it can also be made by eventing - it just needs a lot of variables to do so.

1) you reserve four variables for each teleport event to store the possible targets of that event

2) use control variable on a temporary variable to get a random number 1 to 4

3) have the teleport event use a variable depending on that roll to select the targeted map.

The biggest problem would be to fill all those variables at the beginning with random map IDs while preventing double uses or maps that are not reachable, but that would just be one long event for creating the different values (OK, a very complex, long event depending on how complex your maps are)
 
Last edited by a moderator:

Omnimental

Veteran
Veteran
Joined
Apr 27, 2012
Messages
237
Reaction score
83
First Language
English
Primarily Uses
Shouldn't it work by running a check before assigning the random number?

Page 1

Label: Top

Control Variables: [0001:Random] = Random No.(1...4)

Conditional Branch: Variable [0001:Random] == 1

 - Conditional Branch: Switch [0001:Area 1] == OFF

 - Control Switches: [0001:Area 1] = ON

 - Transfer Player: [0001:Map001] (x,y)

 Else

 - Jump to Label: Top

 Branch End

Branch End

-------

Page 2

Conditions: Switch 0001 =ON

Transfer Player: [0001:Map001] (x,y)

#repeat the condition branch for each connected map, with a different switch and transfer for each map.
Edit: No, wait.  You'd need two variables for each exit.  Incoming and outgoing.  Replace the self switch part with a double variable.  I'll make a quick demo with the idea when I get the chance if you want me to.
 
Last edited by a moderator:

flimbo

Villager
Member
Joined
Nov 10, 2013
Messages
23
Reaction score
2
First Language
Portuguese
Primarily Uses
Shouldn't it work by running a check before assigning the random number?

Page 1

Label: Top

Control Variables: [0001:Random] = Random No.(1...4)

Conditional Branch: Variable [0001:Random] == 1

 - Conditional Branch: Switch [0001:Area 1] == OFF

 - Control Switches: [0001:Area 1] = ON

 - Transfer Player: [0001:Map001] (x,y)

 Else

 - Jump to Label: Top

 Branch End

Branch End

-------

Page 2

Conditions: Switch 0001 =ON

Transfer Player: [0001:Map001] (x,y)

#repeat the condition branch for each connected map, with a different switch and transfer for each map.
Edit: No, wait.  You'd need two variables for each exit.  Incoming and outgoing.  Replace the self switch part with a double variable.  I'll make a quick demo with the idea when I get the chance if you want me to.
Im not sure I understood the code. Each map would have up to four open exits. Wheter they are open or closed is predefined, since the map itself is predefined. What changes is for each open exit on a map, to which of the 20 other maps it would lead. If the east exit of map 2 connects with map 18, I would know that it connects with the west exit of that map, and that the west exit of map 18 would connect with east exit of map 2, if its open.

The initial randomization code would also needs to track if a map already processed was left with non connected open exists, because from time to time I could end up with a only-one-open-exit map (kind of deadend) to connect, and the next map would have to connect in a previous processed map.

Maybe Im overthinking and its easier that that?

Regarding the demo, yes, if possible it would be great! Thank you!
 

Omnimental

Veteran
Veteran
Joined
Apr 27, 2012
Messages
237
Reaction score
83
First Language
English
Primarily Uses
Sure, I'll see if I can whip something up tonight.

Edit:  Lordy, the more I tinker with this, the more complex it looks.  Wanting all rooms to be reachable AND have compass directions maintained (Leaving North of one room puts you South of the next) adds a lot of variables to the equation.  Are you thinking more mystery forest or more randomly generated dungeons?  Eg, does the map have to make sense?

Double Edit: WAY easier method, although it does involve more planning on your end.  Have the map full generate when you enter the dungeon.  Randomize a single variable when you enter the dungeon, then have every door in the dungeon key off of that variable to determine where they send you.  Only difference is you need to plan out all of the possible layouts in advance then program them in.  Add as many different layouts as you want.  Graph paper is definitely your friend here.

If you want a truly dynamically generated dungeon, a script is probably your best bet.

To clarify the second edit:

Each door has a switch that determines whether you can pass through or not.

When you enter the dungeon, a variable is randomized.  Set the range to however many maps you've created.  After the variable is rolled, run a conditional branch for each map that turns each switch to the position they need to be in.  Then teleport the player into the dungeon.  It will seem random on the player's end (which is all that matters) and it still gives you solid control over how the player interacts with your game.
 
Last edited by a moderator:

Pinkdeadly

Warper
Member
Joined
Dec 10, 2013
Messages
1
Reaction score
0
First Language
English
Primarily Uses
I'm new but I'm hoping I can maybe contribute. Mind you I know next to nothing about scripting.

I think one of my favorite RPGs of all time may hold a clever solution. Parasite Eve for the original Playstation had a bonus level called the Chrysler Building. Now the levels weren't completely randomly generated but the floors appeared in a random order.

If you map entire floors/sections of the dungeon and put the whole floor on a large map, it makes the number of variables needed equal to the number of floors you have. Just generate a variable for each map and make sure it isn't equal to it's own number or a number already generated. Through clever eventing you can move floor to floor in a very specific yet randomly generated order. Just make sure every section/floor begins with you entering from the bottom and leaving from the top. Best part is you will NEVER have a pathing issue.

You can also use a +/-1 on a variable to keep track of how far along the player is. Dynamic eventing using this variable would let you have rooms appear different based on how deep in the dungeon it is. It will also give your dungeon more of a specific length as opposed to the player finding the end first door they walk through. You can still get a really random output.

For instance if you make 20 floors and use 5 of them:

1/4 chance of seeing same section again on second playthrough. (With different props from dynamic eventing this is easily disguised)

1/20 chance it ends up in same spot.

1/3,200,00 you would see the same specific combination again. (Every floor repeated in the same spot.)

These numbers only increase the more maps you have and more floors you use...
 

Baneddc

Warper
Member
Joined
Feb 19, 2014
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Interesting concept Im seeing what I can do with it.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

Is there a way to add pictures to profile posts?
I just graduated from high school yesterday!
I accidently wipe out my entire hdd...
Hey everyone, I'm going to do winners announcement post for the OCCIII after we get the edit bar fixed. It's kind of hard to do any announcement without formatting! Thanks for the patience.
3am me: So how do you feel about a character inviting their own character portrait to a tea party? =D

3pm me: //facepalms

Forum statistics

Threads
107,646
Messages
1,031,134
Members
139,772
Latest member
HelpMePleaseAAAA
Top