Procedural Maps Generator

Status
Not open for further replies.

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
No, it does not ignore.
are you transfering to the same map?
 

Icey1992

Villager
Member
Joined
Feb 14, 2017
Messages
7
Reaction score
2
First Language
enlish
Primarily Uses
RMMV
it is using the same map that is randomized. ex of needed] leaving map 1 brings you to the entrance of the randomized map(Random map is 2), the exit of the random map brings you to map 3, which is a cave. I need it so that when you leave the cave and go back into the random map that you will be next to the original exit (which lead you into the cave) so that event now needs to be the entrance instead of the exit. so that it wont just put me right back at the map 1 entrance.
 

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
Ok, at the event you're using as exit, before the transfer command, add the plugin command:

map refreshentrance

This will save the last player position before transfering.
 

Icey1992

Villager
Member
Joined
Feb 14, 2017
Messages
7
Reaction score
2
First Language
enlish
Primarily Uses
RMMV
Thank you SO MUCH! also thank you for your patience.
 

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
You're welcome!
I hope you enjoy it. [:
 

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
Small update:
  • btr_map_grid v1.01 - Fixed "push" error on generation.
 

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
874
Reaction score
562
First Language
English
Primarily Uses
RMMV
Is there anything specific I need to do if I want 'erase event' to work for removing enemies? I did a quick test in a new project, and while some of them do get erased, others just freeze in place, or keep moving. Is it something with how the event duplication works?

So, having had a chance to play around with this a bit more, there's a few controls I don't quite understand:
  1. What do the fTop/fLeft/fCenter controls actually do for events? I'm not seeing a difference between the settings.
  2. How do I control where the player spawns when I send them to them map- I.E. how would I enforce the player starting at the bottom of a map and exiting to the top?
  3. Related to that, is there a good way to loop the player around the same map without messing up dungeon generation? If I just teleport the player to their current map, it seems to remove all of the events.
  4. Events aren't being drawn along the very bottom-most tile of the screen, so when moving up or down there's some noticeable pop-in. Using the Dungeon module, if that matters.
  5. The aforementioned Dungeon module also likes making rooms that go off the edge of the map, that is, they have no outer wall and you just hit the screen edge. Is this is a quirk of the generator, or something I can adjust in the settings?
 
Last edited:

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
What do the fTop/fLeft/fCenter controls actually do for events? I'm not seeing a difference between the settings.
Those tags are used to spawn events in the "floor" type tile, from the top of my head, they can be used for city and town maps. Check the help file for each specific extension.

How do I control where the player spawns when I send them to them map- I.E. how would I enforce the player starting at the bottom of a map and exiting to the top?
You can only do that when using the world plugin, use the tag <entranceSide:X> to the map, where X is one of these numbers:
Code:
8: top
6: right
4: left
2: bottom
This may also work on the grid map, but I don't recommend using the grid plugin, it was an experiment for another generator that I've done.
Also, if using the grid plugin, the note tag may be <entrance:X> instead of <entranceSide:X> (I probably forgot to update it :b)

Related to that, is there a good way to loop the player around the same map without messing up dungeon generation? If I just teleport the player to their current map, it seems to remove all of the events.
No, it wont work. The player will always be teleported to the map entrance.
You can however set a new place for entrance using the plugin command:
Code:
map refreshentrance
This will set the new entrance coordinate to the current player position.

Also, I tested it on on the dungeon map and it's not removing the events.
Be sure your map does not have the <regenerate> note tag.

Events aren't being drawn along the very bottom-most tile of the screen, so when moving up or down there's some noticeable pop-in. Using the Dungeon module, if that matters.
Are you using Fog of War? If so, the "pop out" happens because the event was under the fog and is being revealed.
Otherwise I could not reproduce the problem.

The aforementioned Dungeon module also likes making rooms that go off the edge of the map, that is, they have no outer wall and you just hit the screen edge. Is this is a quirk of the generator, or something I can adjust in the settings?
It may happen some times because the room creation is made using binary partition, by divinding the map in "leafs". Sometimes rounding a division will result in an undesired room size.
This can probably be solved by tweaking the generation code, but I don't have the time to work on it anymore. As stated on the OP it'd be cool if anyone would like to improve these plugins, they work but they are not perfect :/
Anyway, try messing around with the <maxLeafSize:X> tag in the map, set it to numbers above 11. The map width and height should be at least the double of that number, so if the leaf size is 11, your map size should be multiple of 11 (22x22, 33x33, 44x44...). Using odd numbers for the leaf size gives better results.

I hope it covers all.
Sorry about the delay, I'm working on a game myself so the time is scarce hahaha

Have beautiful day!
 
Last edited:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
874
Reaction score
562
First Language
English
Primarily Uses
RMMV
@Lantiz That clears up most of my questions, thank you very much! I will probably start doing my own modifications once I get a bit more comfortable with them, if I get anything useful / interesting / cleaner than normal, I'll post it here.

Are you using Fog of War? If so, the "pop out" happens because the event was under the fog and is being revealed.
Otherwise I could not reproduce the problem.
I was not using fog of war- I created a new project, copied over the entire maps folder, dropped in the plugins, set them in the order specified, and slapped my player's spawn point in the middle of $dungeon, then hit run. It's only visible when the event moves across the bottom edge- either coming on-screen from below, or dropping down off-screen.

Those tags are used to spawn events in the "floor" type tile, from the top of my head, they can be used for city and town maps. Check the help file for each specific extension.
And as to the tile types- I can understand stuff like "floor / wallbase / walltop" but there's no indiciation of what "fLeft" is left of, or if there's something to the left of it, etc, at least not that I can find in any of the plugin documentation so far. Still using the Dungeon setting, if that matters.
 

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
I will probably start doing my own modifications once I get a bit more comfortable with them, if I get anything useful / interesting / cleaner than normal, I'll post it here
That's great [:

I was not using fog of war- I created a new project, copied over the entire maps folder, dropped in the plugins, set them in the order specified, and slapped my player's spawn point in the middle of $dungeon, then hit run. It's only visible when the event moves across the bottom edge- either coming on-screen from below, or dropping down off-screen.
Is that bottom tile a black tile? Can you walk over or under it?

And as to the tile types- I can understand stuff like "floor / wallbase / walltop" but there's no indiciation of what "fLeft" is left of, or if there's something to the left of it, etc, at least not that I can find in any of the plugin documentation so far. Still using the Dungeon setting, if that matters.
They are used to spawn events in specific places:
Code:
fLeft = The event will spawn on a floor tile by the side of the left wall of a room
fRight = The event will spawn on a floor tile by the side of the right wall of a room
fTop = The event will spawn on a floor tile by the side of the top wall of a room
fBottom = The event will spawn on a floor tile by the side of the bottom wall of a room
fCenter = The event will spawn on a floor tile away from any wall
 

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
874
Reaction score
562
First Language
English
Primarily Uses
RMMV
Is that bottom tile a black tile? Can you walk over or under it?
It is not a black tile. Everything looks fine when it's not moving, which is making it hard to get pictures- if I had a tool for taking video, it'd be easier.

You know how when you move vertically, there's one row at the bottom that's only partially on-screen? Either the new row coming into view, or the old one sliding offscreen? That row is the problem- the map itself is drawing correctly, but the events don't show up while that row is partially on-screen- so, when I move up, the bottom row of events pops out as soon as I move 1 pixel; when I move down, the events pop in as soon as the step completes. It feels like an issue with the box that specifies which events to draw, maybe, or if there's something that calculates the 'height' of events that's assuming they're 0 pixels tall, or something. No problems along the left or right edge or the top.
 

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
What screen resolution are you using?
Also, what are the map dimensions?
Does this happen if you use the same map size without the plugins?
 

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
874
Reaction score
562
First Language
English
Primarily Uses
RMMV
My personal screen is 1920x1200, but I'm running it in whatever the default window size is, with no other plugins.
It happens on every one of the test maps, before and after I've modified the map sizes- obviously, they need to be large enough to scroll, though.
It does not happen if I disable the map generator plugins, but when they are enabled, it happens on all maps, generated or not.

Also, while I was messing around, I managed to get a screenshot of a crash I've seen a few times- this one came up three times in a row when generating a City map, but I've seen it once or twice with Dungeon and Cave. Once again, using no other plugins whatsoever, everything is set up according to the instructions in the zip. I attached the resulting error console.
BT_Error.PNG

From a glance at the error message and the line it's pointing to ( map[x + 1][y - 1] == values[3] ), I'd imagine it's trying to generate rooms too close to the right-hand edge (hence, map[x+1][7] => map[x+1]={undefined}, {undefined}[7]).
 

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
My personal screen is 1920x1200, but I'm running it in whatever the default window size is, with no other plugins.
It happens on every one of the test maps, before and after I've modified the map sizes- obviously, they need to be large enough to scroll, though.
It does not happen if I disable the map generator plugins, but when they are enabled, it happens on all maps, generated or not.
Honestly I cant fugure. I tried setting up a map that has 17 tiles vertically, added an event to the bottom line, but its all normal (I used the default screen size).
I asked about the resolution because that black line should appear when the screen size is not a multiple of 48 pixels, but its not the case with the examples that you gave.
So, I'm lost on this one. I have no idea on what may be causing this as all the plugin does is to fill the $datamap object with tiles and events (the same done by the RM map editor).

Also, while I was messing around, I managed to get a screenshot of a crash I've seen a few times- this one came up three times in a row when generating a City map, but I've seen it once or twice with Dungeon and Cave. Once again, using no other plugins whatsoever, everything is set up according to the instructions in the zip. I attached the resulting error console.
From a glance at the error message and the line it's pointing to ( map[x + 1][y - 1] == values[3] ), I'd imagine it's trying to generate rooms too close to the right-hand edge (hence, map[x+1][7] => map[x+1]={undefined}, {undefined}[7]).
It was a check for drawing the roads. Looks like I managed to fix that, for the city and for the dungeon.
I generated 50 times each and it worked, so I guess it's ok now lol.

Although I could not find the problem with the cave, I found another one: sometimes it'd freeze while trying to set the entrance position.
I implemented a fix for that. (also tested 50 times '-')

By the way, on a prior post I said that the grid plugin is not reliable, but I was actually wrong. For some reason I wrote about it but was thinking about the city plugin. as noted on the OP, that is the not reliable one... after the last fix it looks stable though.

I've just uploaded the new fixes.
Thanks for the help.
 

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
874
Reaction score
562
First Language
English
Primarily Uses
RMMV
Honestly I cant fugure. I tried setting up a map that has 17 tiles vertically, added an event to the bottom line, but its all normal (I used the default screen size).
I asked about the resolution because that black line should appear when the screen size is not a multiple of 48 pixels, but its not the case with the examples that you gave.
So, I'm lost on this one. I have no idea on what may be causing this as all the plugin does is to fill the $datamap object with tiles and events (the same done by the RM map editor).
I feel like it must be part of whatever code checks if a sprite is "on-screen." Since the sprite anchor is at the bottom, it's probably doing "x anchor - height < screen y + height" type of check somewhere- and if the sprite height is being overwritten accidentally, say, with a 0, it could be triggering it? I'm poking around but haven't found anything yet.

[UPDATE] .underHidden in btr_map_core seems to be causing it:
Code:
Game_CharacterBase.prototype.underHidden = function(value) {
    var sx = this.screenX();
    var sy = this.screenY();
   
    return (!$gameMap.tileId(this.x, this.y, 7) || sx < 0 || sx > Graphics.width || sy < 0 || sy > Graphics.height);
};

var mapCore_game_characterBase_isTransparent = Game_CharacterBase.prototype.isTransparent;
Game_CharacterBase.prototype.isTransparent = function() {
    return mapCore_game_characterBase_isTransparent.call(this) || this.underHidden();
};
It looks like screenY returns the bottom edge, so the moment the bottom edge went below the screen, it would get marked as "transparent." I was able to suppress the issue by removing all of the sx / sy checks- is there a reason you need those, when you're already checking the tileID to calculate the fog of war?
 
Last edited:

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
Oh I see. That's great.
I checked the funcion before comming here and found almost the same problem.
Actually there's a reason for the check, it's for hidding huge events that should be under the fog of war when the event graphic is bigger than the event itself.

There should have a validation to check if the fog of war is active though, which is the fix I've just added.


EDIT: I made a mistake, I guess you're right. I'll just leave the way you said, if I ever remember another reason for that I'll add it back again.

Code:
Game_CharacterBase.prototype.underHidden = function(value) {
    return !$gameMap.tileId(this.x, this.y, 7);
};
Sorry about that, It's been a long time since I coded those hahaha
Thanks again!
 
Last edited:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
874
Reaction score
562
First Language
English
Primarily Uses
RMMV
Finding another issue- <reset> tag isn't working. It looks like it's an issue with "evt.mapId" always returning 0, regardless of the actual current map ID, in cacheData in btr_map_core. Not sure if that's supposed to be a function call, or if mapId hasn't been set correctly by that point?

[EDIT] Looks like the issue is affected by, at least, using evt.mapId / evt.eventId, whereas the game engine normally uses evt._mapId, and evt._eventId (or evt.eventId()). Not sure if this solves everything, but it might help?

Also, I'm using the <regenerate> tag on my map so I'm not sure why it should be saving self-switches in the first place.
 
Last edited:

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
No, it's not a function call. It's triggered when transfering the player back to the map where the event is. So it should only work when transfering to another map and comming back. Is that the case?

The mapId in this case is a property of the event data, not the event object.
The event data is loaded from map.json file (raw data), this data is used to create an event object on map (Game_Event instance).
This information is set at line 875 when the event is copied.
 
Last edited:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
874
Reaction score
562
First Language
English
Primarily Uses
RMMV
No, it's not a function call. It's triggered when transfering the player back to the map where the event is. So it should only work when transfering to another map and comming back. Is that the case?

The mapId in this case is a property of the event data, not the event object.
The event data is loaded from map.json file (raw data), this data is used to create an event object on map (Game_Event instance).
This information is set at line 875 when the event is copied.
Yeah, I'm starting to see that when I'm testing. A bigger issue is "this._mapId" is always zero on the line "data.mapId = this._mapId;" when the map ID in question is 3. So, the event in question is actually accessing the self-switch [3, eventid, "A"] when the <reset> tag is clearing the switch for [0, eventId, "A"], because the actual map is 3.

[EDIT] To specify, the "control self switch" action gets the ._mapId property from $gameMap, not the event in question, so if I just swap "evt.mapId" for "$gameMap.mapId()" in the reset function, it works. It feels like evt.mapId should be getting set to the actual map ID, though, still?

Also, I feel like maybe you shouldn't have to manually specify <reset> if the map has <regenerate> but that's more just cleanliness.
 
Last edited:

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,074
First Language
Portuguese
Primarily Uses
Other
[EDIT] To specify, the "control self switch" action gets the ._mapId property from $gameMap, not the event in question, so if I just swap "evt.mapId" for "$gameMap.mapId()" in the reset function, it works. It feels like evt.mapId should be getting set to the actual map ID, though, still?
Yeah, I think the mapId was added to the event just for reseting it so I removed the mapId property from the copied event and got it from the current map just like you tested. It may now be possible to reset any event, even in non generated maps.

I also added that cleaning loop to the copyEvent function to ensure the event's switches are always clean when generating a new map.


Also, I feel like maybe you shouldn't have to manually specify <reset> if the map has <regenerate> but that's more just cleanliness.
You dont need to. The event will be deleted before generating the map again.
EDIT: oh yeah, now the switch is reseted when recreating the map, so you don't need
Also the download link is updated.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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.

Forum statistics

Threads
105,868
Messages
1,017,096
Members
137,587
Latest member
Usagiis
Top