A efficient way to go back, and fourth with randomized mapping+ a innovative way to use variables

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
To recap: In my game there's this 100 fl module based randomized dungeon.

Now most of the randomized aspects are easy to handle, even though require a lot of work(pulling each map from the database, the enemies on the map, the treasure chests, and even the stairs), what Isn't however, is being able to return to a map you've been to already(if there were only 2 modules each floor or if the starting room only had doors that lead to dead end rooms, it would be easy, but what a crappy random map generator that would be).

There are atleast a few other ways to handle such, all of which are certifiable nightmares, so I've been trying to figure out a much more efficient way to handle such. 

Note: Evidently you'll need Hime's custom page condition script to pull this off(Everyone should be using it anyway, but I must admit, I never imagined I would be using it for this feature)

Normally you would handle similar things by using switches(and thus is why it took almost a day for me to figure out a solution), but in this scenario, you really don't want to. Even though all switches get reset when you leave the dungeon or leave the floor, It's a big mess to handle with switches.

Now here's what you want to do is assign a different "variable" to every door on the modular room maps that the random map generator can pull. Then here's the ingenious aspect, you also assign every door where that door may possibly lead to, a value.

That's it in a nutshell, damn I love variables, to pull something as complex as this off with switches, you would easily burn through a few hundred switches, if not much more, and the eventing procedure would be confusing as hell, where this feature will only require a small fraction of that, if you use variables, plus everything will be a lot neater.

Example: Say there's 4 rooms on the floor, you go through the first door(lets call it door 1), it pulls room 4, and for the example, lets say you end up infront of door 6, that will make door 1's variable fixed as Vaiable 1 + 6. Now every door is gonna have additional pages, in this case one of the page's page condition on room 4, door 6's event is Variable 1= +6. that page now becomes the active page(instead of page 1 which handles the random module pulling system), which will transfer the player back to the previous room, infront of door 1.

Basically what you're doing is assigning every door in all your rooms in the database that is a possible outcome with the random map generator, a different variable, the variable its self indicates the door you are first accessing, while the +X(value) indicates the door you are tranfering to. Then on the door you tranfered to event, one page will have the condition that uses the variable indicating the door in the other room, being = to whatever value you set to indicate this door. With that done, you can go ahead and add the transfer player event command to the location of the other room

I'm so glad I was able to find a more efficient method, I knew there had to be some way that wasn't a train wreck of a eventing procedure.
 
Last edited by a moderator:

Necromus

Veteran
Veteran
Joined
Mar 14, 2012
Messages
490
Reaction score
61
First Language
German
Primarily Uses
I must have read that like 10 times, and I still don't even have the foggiest what you're trying to tell us here, or what you're actually doing ._.

Seemingly you have discovered the proper use of variables for certain things, but I just don't seem to get what you're actually talking about.
 

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
I must have read that like 10 times, and I still don't even have the foggiest what you're trying to tell us here, or what you're actually doing ._.

Seemingly you have discovered the proper use of variables for certain things, but I just don't seem to get what you're actually talking about.
Ok, first off, know that there is no predetermined map for this dungeon. There's probally gonna be 66 rooms in the game's datatabase(something like that), that are gonna be possible sections of a randomly created map.

Now the tricky part is not going to a room the random map generator pulled, It's being able to go from the room that was just generated back to the other room freely. You can't do this with location type variables, as that would be even worse then using switches, so instead of using switches or location variables, you assign each door a different variable.

The actual variable is the door you first walk through(and is the door event that randomly generates the next room), and the 2nd number(the value) will indicate the room/door you are being transfered to. Now the room/door you just transfered to will have a page that has a page condition if variable = +whatever this door's number is, which will lock this randomly pulled room in place so to speak, with that door transfering you back to the room you came from.

Does that help you any? The entire map is made up from a bunch of different randomly pulled maps from the database, and I needed a efficient way to beable to freely travel between potentially dozens of randomly generated rooms, that by default have no predetermined transfer destination tied to the doors, because they are randomly pulled from the database.

In other words, I needed to figure a way for the randomly pulled rooms to know what maps/doors are tied to them, thus allowing the player to freely explore it, as if It's just one big map(which this is the sweet setup I came up with)
 
Last edited by a moderator:

Necromus

Veteran
Veteran
Joined
Mar 14, 2012
Messages
490
Reaction score
61
First Language
German
Primarily Uses
So you were trying to figure out how to tell your game what kind of rooms you already have pooled up, since you created your dungeon, so you can go back to them?

As far as I understand, you would have a number of rooms already mapped, but which map you enter is randomly picked right?

So what you need is a variable for each room available, empty variables for each room in your dungeon, and logic to fill the empty variables? 
 

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
So you were trying to figure out how to tell your game what kind of rooms you already have pooled up, since you created your dungeon, so you can go back to them?

As far as I understand, you would have a number of rooms already mapped, but which map you enter is randomly picked right?

So what you need is a variable for each room available, empty variables for each room in your dungeon, and logic to fill the empty variables? 
Well I figured it out, but yes, yes, and not exactly.

The last part is not exactly correct, It's not the room that needs a variable tied to it, It's each door in all the rooms, that need variables assigned to them. You see, alot of the room are gonna have more then one or even 2 doors, so the room its self doesn't matter..

I know what you're thinking of though, and that's a good idea in theory, but wouldnt work, because every door needs a different designation entirely, not just within a single room, but out of all the doors in the other rooms as well, so no two doors end up with a page that triggers off of identicle page conditions(aka variables). to do it by map, and door, you would need to set 2 variable as there's 2 maps, and 2 doors to tie together, so that wouldn't work very well.

With my method, each numbers in the variable represents a door. The first number(aka the variable its self) represents the door you're walking through, and the 2nd number(aka the value) represents the door you are being sent to. Then all you need is on the door event that you're being sent to, is a page condition that requruies the variable that was set, that = the value representing this door. There, now you know exactly where you came from, so you can have the event transfer you back.
 
Last edited by a moderator:

Necromus

Veteran
Veteran
Joined
Mar 14, 2012
Messages
490
Reaction score
61
First Language
German
Primarily Uses
Oh that was just assuming that each room had one entry and one exit point, not more than one.

Well sure, then you need more than just a variable to identify the room you're in.

Sounds like you now need a variable for the destination of each door.

Just thinking about what I would need to identify and to make sure what doesn't happen needs a lot more than what I'm getting from your first post.

You need to identify the destination of each door, and if no destination has been set, you need to randomly assign one.

Then you need to block the already pulled maps out of your map pool, so you don't end up with the same map again (assuming you actually want to prevent having the same room layout twice a row for example).

Then you need to identify the number of rooms per floor, and make sure that the last room you pull on that floor choses one with an exit to the next floor (assuming that you actually have different floors, with multiple rooms each, I don't really know after all).

All I can gather from your first post is transferring into one room and back, not how that would work for multiple rooms tho, or the other things I've mentioned.

Again, assuming the layout of what you're planning is actually what I just described.

So yea in short, your first post just doesn't really give enough information to grasp what you're really trying to do here ^^

Maybe post a demo?
 
Last edited by a moderator:

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
Oh that was just assuming that each room had one entry and one exit point, not more than one.

Well sure, then you need more than just a variable to identify the room you're in.

Sounds like you now need a variable for the destination of each door.

Just thinking about what I would need to identify and to make sure what doesn't happen needs a lot more than what I'm getting from your first post.

You need to identify the destination of each door, and if no destination has been set, you need to randomly assign one.

Then you need to block the already pulled maps out of your map pool, so you don't end up with the same map again (assuming you actually want to prevent having the same room layout twice a row for example).

Then you need to identify the number of rooms per floor, and make sure that the last room you pull on that floor choses one with an exit to the next floor (assuming that you actually have different floors, with multiple rooms each, I don't really know after all).

All I can gather from your first post is transferring into one room and back, not how that would work for multiple rooms tho, or the other things I've mentioned.

Again, assuming the layout of what you're planning is actually what I just described.

So yea in short, your first post just doesn't really give enough information to grasp what you're really trying to do here ^^
Yea actually I have it all worked out now, the OP was just explaining how I figured it out, and what needs to be done, if other people wanted to make a complex random map generator.

When I first started making this game, I already knew I wanted to add a random map generator in my game(for atleast the 100 fl side quest dungeon, that the player will be redoing a lot), but from first glance, it doesn't seem difficult at all, but when you factor in multiple doors per room, and multiple rooms in any given direction, some ways end up not working at all, while other ways require thousands of switches/variables.

Happily I figured out this method, which is a lot more viable, less confusing, and requires less resources then the other ways that exist.

Have you ever played Lufia 2 on the SNES? For a better idea of what I'm doing, I'm pretty much creating my version of the Ancient Cave. The actual rooms will likely differ some(as I'm not copying Lufia 2's maps), but It's the same kind of feel/gameplay of that dungeon.

Best side quest ever created, every game should have a Ancient Cave :)
 
Last edited by a moderator:

Necromus

Veteran
Veteran
Joined
Mar 14, 2012
Messages
490
Reaction score
61
First Language
German
Primarily Uses
Played it ages ago yeah, but I don't remember it, but I know what kind of dungeon you mean sure.

But still, if you want to actually show how you're doing it, I don't think your first post shows that really.

As you can see, I pretty much figured out what you did too, but while thinking about how I would do something like that, not because your post told me how it works.

So yea, all I'm saying is maybe you should either post a demo, or explained it more detailed.

But since no one else posted here yet, maybe it's just me, altho I kinda doubt it :p
 

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
Played it ages ago yeah, but I don't remember it, but I know what kind of dungeon you mean sure.

But still, if you want to actually show how you're doing it, I don't think your first post shows that really.

As you can see, I pretty much figured out what you did too, but while thinking about how I would do something like that, not because your post told me how it works.

So yea, all I'm saying is maybe you should either post a demo, or explained it more detailed.

But since no one else posted here yet, maybe it's just me, altho I kinda doubt it :p
Hm, I think the example I gave, explained it pretty damn well sigh. However I guess I can post a additonal footnote under the example.

Edit: I edited the OP, is that better?
 
Last edited by a moderator:

Necromus

Veteran
Veteran
Joined
Mar 14, 2012
Messages
490
Reaction score
61
First Language
German
Primarily Uses
Example.png

 

So you go from room 1 to room 2, from door 5 to door 23.

Each door has a variable named after the door itself, so door_5 and door_23.

When you first use door 5, the variable door_5 will be set to wherever you randomly decide (in this case 23).

For door 23, you set door_23 to 28(?) and in the many event pages on each door, that will decide where that variable will transport you to?

Example.png
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Bravo on thinking up this important wrinkle to how to randomize a dungeon (or other map), and on coming up with a way to implement it!

Now that you have, though, I'm realizing that you made things way harder on yourself than you need to.  By adding one simple (integer) property "destination" to Game_CharacterBase, you can avoid those hundreds of event pages and can allow the destination to be truly random instead of picked from a small set of event pages that you set up.

Upon entering (or leaving) the random dungeon, all events' "destination" properties should be reset to zero.  In each door's event page, if the destination is equal to zero, have it set its own destination property to a random value (which might represent all possible rooms, or might represent all possible rooms within a range instead, if you wanted to (for example) have five different "tiers" of difficulty within the dungeon based on what floor you're on).  Then, set the "current destination" variable equal to this door's destination property.  Optionally, you can also set a variable that says whether you just came through an East, North, West, or South door.

Then, transfer to a single common event that warps you to the correct place, based on the destination.  The most flexible but most time-consuming way to do this is to event the Player Transfer for every single possible value (which is still nice because you only need to event one transfer for each destination, instead of one for each door-destination combo - saving maybe 90% of your effort).  A more rigid but extremely time-savvy way to do it is to use a script call to transfer the player based on variables - for example, each dungeon room has its own floor and has its four doors in the same places (but is otherwise unique and different from the other rooms).  You can do a single Script... command in this common event that transfers the player to ((map based on destination variable), (x based on E/N/W/S door variable), (y based on E/N/W/S door variable)).  With a single three-ish line common event and meticulous setup, your entire system will be working properly!

With this way of approaching it, you can copy the door events freely throughout a dungeon map, which will make setting up that 100-floor randomized dungeon way easier and far more flexible.

Once again, very cool topic you created!
 

Necromus

Veteran
Veteran
Joined
Mar 14, 2012
Messages
490
Reaction score
61
First Language
German
Primarily Uses
That scripting is the better way to do that is a given, just that was about how to do it through eventing I'd guess.
 

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
To Wavelink: Just with handling the map randomization, and tranfering the char, yea it could probally be slimed down slightly, if I did it through scripting, but it would still be a troubling setup to pull off through scripting, so much so, the only real benefit of such, is to take stress off of the engine, due to fewer events on map.

If I was a expert coder, I "maybe" willing to do that(It's a one of the more confusing types of scripts though, It's pretty much like creating a AI type of system with scripting, not exactly a fun type of script to work with).

Nice thought on the common event use to make it so one less page is needed for each door event, but I figured out that wasn't as viable a option for a well polished random map generator awhile ago.

You see that assumes every door can "possibly" lead to any other door in any other map within the module pool, which is not the case, furthermore each door needs to identify itself. There is a way to work out both problems though, since to assign each room its own common event, you can just have the common event check to see where you are on the map, It's just not the cleanest method, because you would have the door event split between the individual doors them selves, and a room based common event to handle the randomization of all the doors, which have slightly different poors to pull from(not to mention, even one common event per room would = 66 common events, if there's say 66 possible rooms. the only other way to do it is have a single event first check what map you're on, then check the player's location on said map, and then do the randomization, which= a nightmare of condition branches).

The only real benefit that method has, is taking stress off of each map, which shouldn't be a problem anyway, since each room is its own map, and they'll be smaller then your typical dungeon maps, much smaller(they'll be closer to say a inside of a house/building map), so while there's a ton of events, it shouldn't be a problem.

A while ago I tested a insane mount of events, and event pages on each event on a map that's like 20-30% bigger then the average maps that I'm gonna use here, and there was no stress noticeable by the player at all, so there should be no need to split the events up like that.

Note: providing you can't read my mind or have played a Lufia game, basically the overall pool of maps will be split in half(which is kind of a good thing, since this means doors wont really need all that many pages  not like It's a problem anyway, like I said, I have ran some extreme eventing tests, but still). Basically doors will only be facing up or down, mapping tricks will make it look like there's rooms on the right/left as will, but the doors will only be facing up or down(this is so you get a better randomization poor, with half of the maps needed, this is why as big a feature/side quest it is in Lufia 2, wich it the greatest, and grandest side quest ever created, only makes up a small fraction of the space on the cart. A very smart design method for sure, to come up with such room/mapping design, design to save space, while having the maps be just as complex as doing it with 4 directions back then, is nothing short of genius).

Thanks for the input anyway though, hearing other people's idea's rather it ends up being better or not, is "always" a good thing. I have lost count of how many bad ideas alone, never mind good ideas for features I may not even be using in my game tobeginwith(not saying yours is a bad idea at all, I mean in general), that lead to me thinking up a new way to handle something(eventing, and game design is like breathing to me in this point in time, so it doesn't take much for me to think up ideas to use/manipulate a method for a unrelated feature in many different ways to fit my own needs)
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top