How do i go about this map system...?

Discussion in 'RPG Maker VX Ace' started by Halno, Sep 11, 2019 at 4:07 AM.

  1. Halno

    Halno Villager Member

    Messages:
    14
    Likes Received:
    1
    Location:
    Brazil
    First Language:
    Pt/Eng
    Primarily Uses:
    RMVXA
    Good morning/afternoon/evening my fellow makers, I've been having this problem lately where, on my game, the character has to walk through several zones/areas and do quite a bit of backtracking to complete certain quests, since the game has some focus on exploration. I've seen some 'fast travel' and 'world map' scripts around that could help me, and while i'm sure i could do it with Images/Eventing, the amount of variables and images needed to do what I am trying to complete seem quite extraordinary, and I don't think I am ready to get on with such a project; Thus I come to you today to ask...

    How do i go about this map system (Metroidvania style)? Is there a script for it? How would i do it with common events/switches/variables?

    I'll show some pictures to tell you what i'm talking about:

    So we have David, our adventurer, strolling through the woods around the village...
    [​IMG]
    However, he feels quite lost, surely a map would be of great help... aha!
    [​IMG]
    As you can now see, he is in Inya Village, and his spot is highlighted in yellow. you can see where 'important' things are, like quest markers, and the exit zone so he can skittle out of the forests when he needs to.

    However, to add a little flair and [Exploration] to the game, the maps wouldn't come pre-filled, and while he would know how large the forest actually is (and where he can exit to the next zone) he can't make a beeline for it, since the map would be obscured!
    [​IMG]
    (Well, that wasn't quite obscured, but blanked out, oh well...)

    Oh wow, while we were talking, David has managed to go all the way across the globe to a distant town in the desert! what an absolute madman!
    [​IMG]
    David has absolutely no idea where he is, however he is smart enough to pull out a map of that actual zone, and not try to transverse the deserts like he did with the forests, therefore, he pulls his other map out...
    [​IMG]
    And voila, David now knows exactly where he is.

    So these pictures pretty much represent where i'm trying to go with this, and what i want to do. Have maps be obscured, certain locations always show, and tiles being uncovered as you visit them.

    Is there anything like this already available for commercial use (preferably for free, college student budgets are tough) or how would i go about creating something like this from scratch with events? I have no programming knowledge whatsoever, and scripting it myself would be quite a impossible endeavor.

    In any case, kind regards, and thank you all in advance.

    DISCLAIMER: I did use some of Avery's icons on this post, they're fantastic, and I use them on my project aswell. they're quite swell! credits go to her and this is her workshop's post: https://forums.rpgmakerweb.com/index.php?threads/avys-icon-workshop-back-to-buisness.21623/

    EDIT: Oops, image links broke... did them on imgur now.
     
    Last edited: Sep 11, 2019 at 4:19 AM
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,305
    Likes Received:
    6,432
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Doing exactly that will not be possible without a custom plugin.
    However, if you were to modify it a bit it would become quite easy to do.

    The main key is the map visible on the background. If you make your minimap into an independent map, then it would be much easier to do.

    Create a map item that calls a common event.
    that common event stores the current position into three variables (X Y MapID)
    Then it checks the map and transfers the player to a spot on a "minimap" that depends on the current map id - and on that minimap each tile stands for one of the maps in your main game.

    That minimap is completely covered in events using tiles and not sprites as graphic, with the default page having an impassible balck tile.
    For each map where you'll want something else you'll need a general switch that is turned on when the player has entered that map by regular means and that new page uses a passable tile of whatever fits, with the event page set to "below player" and "action button" and the command there a transfer to a predefined point on that map.

    Will probably need a bit of finetuning, but that should be doable on events alone.
     
    #2
  3. Halno

    Halno Villager Member

    Messages:
    14
    Likes Received:
    1
    Location:
    Brazil
    First Language:
    Pt/Eng
    Primarily Uses:
    RMVXA
    Hm, that might work, but i want to avoid teleporting the player if at all possible, since it could break other things in my game, but i get your idea.

    The item/common event was pretty predictable and was what i was going to go for when i first started thinking on this, but, I was thinking, since all of my maps have a paralell process event I use for ambience/image calls/effects, i could also throw in some variable sets in it that define what actual map zone to call, for example, Variable 001[MapZone] could be the variable that detects which exact map zone I am, and i could use a switch for that specific zone (001[MapZoneForest]/002[MapZoneDesert] for example) that would check if the player actually has the map for that zone, or if they have to go out and acquire it.

    However, going from area to area is a huge leap forwards and quite complicated, the variable part is quite simple, on the event i can have it set any n number for whichever zone i need, and for area i just have it set any n number for what area it is, however, the conditional switches to see if you actually have ever discovered that area before is what is giving me the chills, since i think i would need a switch for every single map that is significant on the game to appear on the map, it would quickly turn out to be 50+ switches for a single zone alone, and don't even get me started on what i would have to come up with for calling the images that make up the actual map, I could just make the full map on an image editor and then chop up pieces in a game-screen size canvas and use that, but the images would be quite large and increase the file size of the game quite significantly, and if i chop each icon up, i could save a lot of spaces by making a "Sprite set" of image tiles but then it would get a lot harder as i would have to know each and every coordinate for every image and where to drop it in the map, this second method could be quite flexible - but again, as i said on the original post, The number of switches, images, and event calls i would need to make this with just events would be quite massive and i fear it would affect the game performance significantly, or have too many things to worry about at once which would be difficult to work with/troubleshoot.
     
    #3
  4. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    721
    Likes Received:
    526
    First Language:
    English
    Primarily Uses:
    RMMV
    Actually, you could use a Common Event, images, and some script calls to create the mini-map.Although, to be honest, at that point you may as well think about creating an actual plugin. But hey, here is how I broke the mini-map down :

    [​IMG]

    First, RPG Maker MV has a built-in feature that creates variables when specially formatted text is used in the 'note' field for each map. So you could toss in the following for each map you want the mini-map used on to create the data for the map :

    Code:
    <miniMapTitle:titleImg>
    <miniMapSq4:town>
    <miniMapSq12:poi>
    <miniMapSq13:exit>
    <miniMapSq22:poi>
    
    The 'miniMapTitle' variable will be equal to 'titleImg', the name of the image which we will use in a Show Image command to display above the map itself. The 'miniMapSq' variables will tell us what image needs to be placed in which square on the mini map.

    You could use 24 'reveal' switches to determine which area has already been visited. So, if you wanted areas of the map hidden until he discovered them, this would work fine. We could also use $gameMap to store the variables, since it is backed up every time we save the game. This would help us keep track of the player's map progress.

    Image wise, we would need a scroll-map image, an indicator, some directionals, and then some icons to sprinkle of the map.



    So ... yeah, it could be done without creating a plugin. But with how uh, intricate that Common Event would be ... may as well create a plugin and be all super-cool.



    EDIT: Dah, I just realized this is for RPG Maker VX Ace. But yeah, the above pretty much still stands.
     
    #4
  5. Halno

    Halno Villager Member

    Messages:
    14
    Likes Received:
    1
    Location:
    Brazil
    First Language:
    Pt/Eng
    Primarily Uses:
    RMVXA
    Hah, Indeed... I've actually been scurrying around for a metroidvania style map system for quite a bit of time now, and i'm genuinely surprised that I haven't seen any.

    In any case, thank you for dropping so much effort in a reply, i'm really grateful! But as you said, the sheer complexity of the common event(s) needed to make this work without a hitch would be quite problematic.

    I myself have no background on coding or programming whatsoever, and have spent most of my time with image editing software, so while i have a good idea on how i should break up the images and go about for the best 'look', i have little to no idea how i should tackle this...

    Perhaps i'll drop this in a script request thread, and see what comes out of it.

    Thank you very much, cheers!
     
    #5
  6. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,555
    Likes Received:
    10,495
    First Language:
    English
    Primarily Uses:
    RMVXA
    @Ossra Your solution and the script calls necessary for it are for MV. This is VX Ace, and script calls etc. are different. Do you know how to translate your solution to Ace?
     
    #6
  7. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    721
    Likes Received:
    526
    First Language:
    English
    Primarily Uses:
    RMMV
    @Kes Yeah, I realized I was responding in the VX Ace sub forum the moment after I posted. I actually started to create the script and event whatnots for the mini-map ... but it is just too clunky, so I abandoned it. The mini-map as I envisioned above can potentially eat up 74 image slots. Yum, yum.

    Notes in the Map Properties :
    Code:
    <map 1 d___ none>
    <map 3 d___ town>
    <map 9 d_u_ none>
    <map 14 ___r poi>
    <map 15 _lu_ none>
    
    The number in each map note denotes the square on the map. The letters and underscores in the middle denote which directions are displayed on the aforementioned square. I simplified the process and named the images after the directions (e.g. d_u_.png, etc). The last option is which icon, if any, is displayed on that square.

    The following is the code that gathers and decodes the map data, and then outputs all the images to the screen.

    Code:
    base_x   = (Graphics.width / 2) - 131
    base_y   = (Graphics.height / 2) - 98
    
    map      = $game_map.instance_variable_get(:@map)
    regex    = /<map\s+(\d+)\s+(\w+)\s+(\w+)>/i
    map_data = map.note.scan(regex)
    
    def place_image (el, idx, bx, by)
      el_id = el[0].to_i
      x     = bx + (32 * (el_id % 6))
      y     = by + (32 * [(el_id / 4), 1].max)
    
      screen.pictures[10 + idx].show('map-area-bg', 0, x, y, 100, 100, 255, 0)
      screen.pictures[34 + idx].show(el[1], 0, x, y, 100, 100, 255, 0)
      if el[2] != 'none'
        screen.pictures[58 + idx].show(el[2], 0, x, y, 100, 100, 255, 0)
      end
    end
    
    screen.pictures[9].show('map-bg', 0, base_x, base_y, 100, 100, 255, 0)
    
    map_data.each_with_index { |el, idx| place_image(el, idx, base_x, base_y) }
    
    After tinkering around with button input to display the map on the screen for a bit, I abandoned the idea. Much too clunky. Far better served as an actual, dedicated scene in a script.
     
    #7
  8. Bex

    Bex Veteran Veteran

    Messages:
    1,209
    Likes Received:
    273
    First Language:
    German
    Primarily Uses:
    RMMV
    Why not make a complete Map in Graphic Program, just exclude the POI and the Fog Picture Tiles.

    Than show your Map with 1 Picture, use more Pictures for the POI, and than use the Fog Tile to obscure the other Tiles with different Picture Ids.
    Thisway you just need to turn one of 24 Switches to On.
    When you show the Map, you make 24 conditional branches, if map tile a1 is off or on if a2,a3, a4,a5,a6 , b1, b2 to b6 and c1, to c6 are on or off.
    depending on that , you show the fog tile picture or you dont show it.
    best name the switches like your map grid, a1 to a6 and so forth.
    If you enter a Map, you just turn the Switch to ON and next time you Open your Map, that Maptile will not be covered in Fog.
    You also need to change a Variable, to keep track on which Map you are
    in that Area.
    And one Variable to keep track of the Continent/World you are in, to show the correct Picture Map.

    Theoretically that could make this code less complicate. I did not build something like that yet, so iam not totally sure.

    Edit:
    One Question.
    What is the max grid for your Picture Map? 6x4 like shown above in the Pictures?
    Vx-Ace can max show around 100 Pictures at the same time on the Game Screen.
    Thats why i ask. If you want it much bigger, than a Script or another Solution would be needed.
     
    Last edited: Sep 13, 2019 at 9:53 PM
    #8
  9. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    721
    Likes Received:
    526
    First Language:
    English
    Primarily Uses:
    RMMV
    @Bex Yeah, you certainly could create the entire map beforehand and then cover areas with a fog tile. That would certainly reduce the amount of pictures that were needed on the screen. I was aiming for a completely dynamic map so that all you would need to do is plop map data into the properties of the map file.

    And yeap, the grid is 6x4 at the moment. To be honest, I think a full-fledged script would be best. Then you could have a dynamic map and a bunch of bells and whistles.
     
    #9
  10. Bex

    Bex Veteran Veteran

    Messages:
    1,209
    Likes Received:
    273
    First Language:
    German
    Primarily Uses:
    RMMV
    Edit: Sorry i cant sit long at the moment and i should not write when i came to my limit^^.

    I was stupid, instead of using switches to turn fog on or off when entering a map, i could have used variables,
    and turn them to the correct number for the correct maptile later on. There are so many possible routes to come to one of many possible solutions.

    This needs planing before starting, else one could run into redoing/restarting it from Scratch a few times.
     
    Last edited: Sep 14, 2019 at 3:30 PM
    #10
  11. Halno

    Halno Villager Member

    Messages:
    14
    Likes Received:
    1
    Location:
    Brazil
    First Language:
    Pt/Eng
    Primarily Uses:
    RMVXA
    Whoa, I'm surprised for all the following this thread is getting. Thanks for the contributions everyone!

    Anyways, I've been brainstorming ways to make the discovery system (which is a primary feature of this specific map system) work properly, Which in the first few replies we came to the conclusion that it would either require several switches, with one for each map tile, or a custom script. Well, i think that i've come with a fair solution that uses a single variable to store the map discovery information, aswell as a system for naming the map tile image files properly and summarily.

    [​IMG]


    Edit: Regarding the coloring of the image, orange is a transparent background, darkening the game, since it will all be done through images and teleporting the player is not viable, dark blue is the map graphic edges, and the grid is where tiles will be placed inside the map. this allows some flexibility regarding how the map will look.

    So the naming convention for map tiles is divided into 3 'states', 0-1-2, each referring to the state of the border, and 4 'bits', for the corresponding edge. 0 means a blank edge, 1 means a closed edge and 2 means a passage, and with these you can make pretty much all box-shaped tiles you might ever need (adding T/X/L junctions would add just way too much complexity) meaning that a tile with a name of 2101 would have it's north edge be a passage, the eastern and western edges be solid and the bottom edge be open to another adjacent tile.

    Regarding the variable, it would simply take 2 to the power of the map's ID for each map, this makes sure that each possible combination of discovered maps is covered, and makes things like expanding the map further down in development viable since you don't have to worry about specific routes. all you have to do is make sure that the first time and the first time only, when you enter that map (thus, 'discovering' it) a value of 2 ^ Map's "ID" is added. Lets say that our town is the 'first map', and give it an ID of "1". we can have two adjacent maps with higher mapid's and not have to worry about interference, because say that the town is adjacent to an alcove, lets call it "2", and to the south is an intersection that leads to wherever you need to go next, let's call it "3". You could go either way, but the map would still be revealed correctly since the value that would be added is a power of 2 that doesn't cointerfere. let's say you start at the town, thus a value of 2^1 ( 2 ) is added to your ShowID Variable, now you visit map 3, which adds a value of 2^3 ( 8 ) to your ShowID variable. You start decomposing this number by the highest power of 2 you can fit in it, therefore, even though the final value of ShowID in that instance will be ( 2 + 8 = 10 ), and it being higher than the sum of map's 1 and 2 (which would come out to 6) it WONT show map 2, since when you decompose it, it will first detract 2^3 ( 8 ) and then 2^1 ( 2 ), taking the powers of these will show you what map tiles should be shown in that instance.

    In this particular example, ID 3 is a multi-tile, using the [2] Map tile graphic i talked about. this is merely visual, and would simply suggest a 'larger' map. when map '3' is visited from whichever entrance, it's ammount is added and both of it's tiles are shown in the map when you open it.

    Edit: Regarding keeping the map discovery to a single variable, it makes it VERY easy to work around quests revealing maps before you actually get to them.

    The major roadblock i've come to though, is that i have no idea how to make that power decomposition in the maker. i'm not sure if the maker is capable of this kind of mathematical application, or if it would take a script or addon to do so. Other than that, knowing which tiles should be shown at which times, what values to add and what values to detract to make them show approppriately, making overlays for the images so they don't come over the 100 image-at-once total, and making the discovery system work, are quite very doable, if would take a lot of work...

    Anyways, i hope this helps clarify some of my thoughts and adds to the overall integrity of this thread.

    Thanks for the attention guys, let's see if we can get this thing working.
     
    Last edited: Sep 15, 2019 at 10:17 AM
    #11
  12. Bex

    Bex Veteran Veteran

    Messages:
    1,209
    Likes Received:
    273
    First Language:
    German
    Primarily Uses:
    RMMV
    This is a very good and advanced Solution you created. Well Done. I dont get all the Math, but i understand what you are doing.

    I would like to mention another Workaround.
    Yanflys Event Self Switch and Self Variables Plugin.
    You could create 1 Map the Player will never Enter, on that Map is 1Event for each individual Map. Every Event contains the
    Self Variables for the Map Grid. When your Player enters a Map you change the matching self variable or switch of that event on the never used map.
    Could be an alternative to putting it all in one Variable. Not better but maybe a little more readable.
     
    #12

Share This Page