• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Custom Feature Question] Progressively revealing region maps?

17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
I was thinking of having a feature where as the player enters routes and towns, the region map gets updated to show the new area. Think sort of like routes and towns getting added in like train track pieces as the player arrives at each of them. Perhaps the map is covered by a sort of "fog of war" kind of thing, or my original idea of having the map be something the main character "draws in" as they explore the world. I couldn't find any sort of tutorial online or even anyone talking about this, be it with RPG Maker XP or Pokémon Essentials. I thought that this could theoretically be done by warping the player to a new area that looks like a region map, that way events can reveal new routes once switches have been activated. But this might cause conflicts with the fly system or the pokémon encounter map in the pokédex. It's all a little too complex for me to figure out.

I have no idea where to begin scripting this sort of thing, or if even people would like this to be a feature in a Pokémon game in general. What are everyone's thoughts on this idea? Is it even possible with Essentials?

Edit:
A solution has been found! Visit this thread here for the most up to date code.
 
Last edited:
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
Just an idea I had while reading you but I'm not sure how to do it.

I guess it's not too hard to create an item that shows a picture when used. you could then develop an item which is a sheet of paper with kind of a handmade draw of the map on it. You make multiple pictures of this sheet of paper but with more road drawn each time. and where you define the item you make it so it shows the first, second or... depending of a variable which is implemented each time the character goes further.

This way it would look like the character is drawing his progress himself. when all is discovered you could make an event giving him the entire map with a message like "come on man you draw on a sheet of paper, don't you know there are electronic maps now?!"

Just an idea :D
 
Last edited:
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
I struggled a lot to find how to do this and the only solution I managed to find is to make the item a mail and putting the pictures in Graphics/Pictures/mail and naming it "mail_internalnameofyouritem"

you can then put an automatic event which triggers once, the first time you enter a new map and replaces your item handmap1 by handmap2... note that you can give the same displayed name for all handmaps so there is no difference ingame
 
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
You know, Tsuina, you might have just solved this! The item idea is a good one, perhaps adapting the town map item. The issue with having multiple pictures for the item is that if the player decides to go left instead of right, then there will need to be an entirely separate series of pictures to account for this choice, meaning there will be dozens of iterations of the map. Possible, but I think that would be unnecessarily large.

But! If instead of separate maps, there is one blank map and several small route and town pictures in the file folder. As the player explores around to the different areas, switches are activated for each different route and town. When the player accesses the blank town map, the game will check to see which switches are on and simply display the picture for each route that has a switch activated. A bit of rejigging the town map's code to display the different pictures of routes will be needed too.

I thiiiiiink this might work. I'll try implementing it like this and respond to this thread to let others know if it worked. But if someone comes up with a better idea then I'd be more than happy to hear! As this idea so far will take up like 30 switches to do, depending on your region's size.
 
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
After a bit of testing, I stumbled across a base feature in Essentials that I had completely forgotten about, the hidden islands. It works to use this feature to list all of the routes and cities on a blank map (no routes and towns, just the landscape), revealing each route and town as the player activates their switches. Basically every route and town is a hidden island. So awesome! Problem solved if you're using the base map in essentials!

However. I quickly realized that this won't work for my project, as I'm currently using Marin's Better Region Maps script. It doesn't handle the hidden islands feature in Essentials. I'm too attached to this script to part with it, so I'm back at square one with the idea of progressively revealing the map. Not to mention my map is relatively large, so there is no real way to show it to the player on screen without Marin's Better Region Maps anyways, even if it's activated by an item.

That said, if I forego Better Region Maps it would be possible to split my map up into 4 regions, and using the standard pbShowMap(region number) will allow me to have the hidden routes reveal progressively with the hidden islands feature. Just the idea of splitting up the region map into 4 separate maps doesn't seem like a great player-friendly way to approach this.
 
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
Oh I didn't know this hidden island thing, that's cool. I'll dig into it too because I want to understand how to display several pictures using a script.
Your project seems huge :D for how long have you worked on it?
 
Last edited:
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
check my threat "script list for events" Ego explained me how to display an image and all the tools needed for your idea are on the page. If you cannot figure it out, let me know. I have a clear idea on how to do it now.
 
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
Thanks again Tsuina! I checked out your "script list for events" thread and I see what you mean. That could possibly work! Displaying an image along side other images is basically what I was talking about with my original question. However, using Marin's Better Region Maps Script adds a second hurdle. If you're not familiar with it, it basically allows you to pan up and down and left and right over an image. Letting you have an unlimited map size. In doing so, I think there might be an issue with placing new images on screen, as the X and Y coordinates wouldn't be fixed positions. I'm not quite skilled enough to adjust the code the same way Ego had done in your thread and adapt that to plug in to Better Region Maps.

So the issue then becomes, how to adapt Marin's script to allow for more than one image to be manipulated at the same time without it being a laggy mess, if even possible. I'll play around with this to see if I can come up with a solution.

And as to my project: I've been working on it for about a year now, but mainly working on story stuff up until a few months ago when I started actually getting to work in essentials. I have a lot planned, so I needed a large region! Hence my dependence on Better Region Maps.
 
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
I see. Not sure how to do that but I guess how the map can move is defined in the better map script you added. Maybe by copying how images are fixed on the screen (because they stay at the same place depending on the movement of your character) and modifying it so there position depends on the same thing as the map moving.
This or by doing a conditional in how maps are fixed "if switch "map activated" is on then move with ..."

but without seeing the better map script I have no plan for from where to start
 

Ego13

hollow_ego
311
Posts
6
Years
In doing so, I think there might be an issue with placing new images on screen, as the X and Y coordinates wouldn't be fixed positions. I'm not quite skilled enough to adjust the code the same way Ego had done in your thread and adapt that to plug in to Better Region Maps.

So the issue then becomes, how to adapt Marin's script to allow for more than one image to be manipulated at the same time without it being a laggy mess, if even possible. I'll play around with this to see if I can come up with a solution.

For placing new images you don't need to have fixed value. You can always place it in relation to another graphics. Though I agree that you might not want to have hundreds of sngle images being displayed at the same.

I don't know Marins scipt, so I can't tell you exactly what you would need to change. One question though comes to my mind: What do you want your map to actually look like? Your answer might change how you wan to approach this issue.
 
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
One question though comes to my mind: What do you want your map to actually look like? Your answer might change how you wan to approach this issue.

To answer this: I would like my region map to be just the land area, without any routes, towns, water routes or anything. I want the player to explore the world organically, and as they explore, the map fills in where they have been. Basically I don't want the player to know what's at the end of a route, I want them to explore to find out! And in fact, I might even have the world change as the player goes through, so some routes would need to be removed from the map and replaced by a different one.

This question got got me thinking though, I could have been approaching the question wrong from the beginning. I don't know the logistics of this entirely, as it might have some wacky ramifications in Essentials, but would it be possible to display an image that's larger than the game's window? In this case a 1024x576 map image, by increasing the game's window size when the map is opened? And when the map is closed, simply resize the window back to the original size. This might be a work around, and I wouldn't need to use Marin's script to scroll around the map. And since I wouldn't be using Marin's script, I can use the Hidden Islands feature built in to essentials to display the routes and towns as I wish.

I'm not sure where to begin coding something like this, but perhaps one of you brilliant minds might be able to find the right place! I'll try to tinker in the meantime.

Edit:
So after a bit of tinkering, I think I finally found my solution! I just don't have the know-how to implement it. In line with the idea to resize the game window, it does in fact work to resize the window to the map's dimensions by changing the DEFAULTSCREENWIDTH and DEFAULTSCREENHEIGHT in the Settings to 1024 and 576 respectively. The full map is displayed properly with pbShowMap and everything works great with displaying hidden routes on this large game window. However, the game runs terrible at this screen size, so I need to find a way to change the default screen width and height back to the standard 512x384 when the map is closed.

I thought of using a game variable to do this, but setting DEFAULTSCREENWIDTH = $game_variable[30] comes up with an error, as expected. Not to mention the game wouldn't even load properly because the screen size would be set to an undefined variable at launch (I think that's what would happen). I don't know of a way to redefine DEFAULTSCREENWIDTH during the Pscreen_RegionMap script, as that would be the only time I would need to change the screen width and height was when that script was called. If someone can come up with a way to redefine the DEFAULTSCREENWIDTH and DEFAULTSCREENWIDTH variables during the Pscreen_RegionMap script, you'd have solved this whole thread!
 
Last edited:
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
you gonna love me

in Item effects:
Code:
ItemHandlers::UseFromBag.add(:ZOOM,proc{|item|
pbSetResizeFactor(2,false)
   next  2 
})
Code:
ItemHandlers::UseInField.add(:ZOOM,proc{|item|
pbSetResizeFactor(2,false)
   next  2 
})

and in pbs

688,ZOOM,zoom,zooms,8,0,"a zoom",2,0,6,

give yourself the zoom through event:
Code:
Kernel.pbReceiveItem(:ZOOM)

it will store an item called zoom in your key item pocket and when you use it will close the menu then make the screen larger.
I leave you figure out how to reduce the screen again after a while but I think what Ego wrote about loops do could be a nice start

Edit:

actually solved it:

replace the useInField from above by this

Code:
ItemHandlers::UseInField.add(:ZOOM,proc{|item|
pbSetResizeFactor(2,false)
  loop do
    Input.update
    $game_screen.update
    if Input.trigger?(Input::C) # image will be closed and properly disposed when the player presses c / enter

     pbSetResizeFactor(1,false)

      break
    end
  end
  pbWait(20)# wait a bit to prevent double input
   next  2 
})

Now when you press c or enter the screen goes back to normal.
if you want to add a map display on this you'll need the line

Code:
Graphics.update
under the two other updates
 
Last edited:
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
That's awesome Tsuina! But not quite what I meant, I'll be more clear here. We might figure out how to adapt your code though!

So your code does work successfully! For what you were trying to get it to do. But Rather than simply scaling the window to be larger, what I need is for the game to stay at the same zoom level, but make the window larger in order to see more of the game. If you change the DEFAULTSCREENWIDTH and DEFAULTSCREENHEIGHT in the Settings to something larger, you'll see what I mean. Where the screen is larger and lets you see more tiles on the overworld map, etc. By doing this, it is possible to display a very large map on screen with pbShowMap without it getting cut off.

I just spent a bit of time trying to tweak your code to be able to change the DEFAULTSCREENWIDTH and DEFAULTSCREENHEIGHT constants. I've learned a little bit more of Ruby coding from this, but still nowhere near capable of producing something that works. I've narrowed down the issue to being Ruby and how it deals with constants like the two mentioned. I can't seem to adapt your code to redefine DEFAULTSCREENWIDTH and DEFAULTSCREENHEIGHT, and then redefine them both back to the original values when the map is closed.

Related side note: There is a const_set(const, value) method in Ruby to change the value of a constant, but it doesn't seem to work no matter how I've tried to rig the code. I eventually came into an error that said "DEFAULTSCREENWIDTH is not a symbol" even though it's a clearly defined constant. I stopped there as it's a little bit above my knowledge in Ruby to address this sort of thing.

I feel like we're really close to cracking this wide open!
 
1,403
Posts
10
Years
  • Seen Apr 18, 2024
I eventually came into an error that said "DEFAULTSCREENWIDTH is not a symbol" even though it's a clearly defined constant. I stopped there as it's a little bit above my knowledge in Ruby to address this sort of thing.

I can't comment on the rest of your post (haven't read any code), but DEFAULTSCREENWIDTH isn't a symbol, :DEFAULTSCREENWIDTH (i.e. with a colon in front) is.
 
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
Oh yeah I realised zooming and changing screensize had not the same effect. Though I'll use my zoom item to display images and for cinematic.
 
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
I can't comment on the rest of your post (haven't read any code), but DEFAULTSCREENWIDTH isn't a symbol, :DEFAULTSCREENWIDTH (i.e. with a colon in front) is.

Ah! Thanks for the correction! I'm still new to Ruby so I obviously still have much to learn. With this small oversight I was able to do a bit more troubleshooting.

And through some more troubleshooting, I've come to yet another impasse with my original question! So it turns out DEFAULTSCREENWIDTH and DEFAULTSCREENHEIGHT are Fixnum values. Completely unchangeable values in Ruby once the game starts running. I didn't know that, so my idea to increase them when a map is open is actually impossible in Ruby. Which would explain why there are no functions in Essentials to change their values on the fly.

I'm once again back at square one, although I've definitely have learned a lot thanks to everyone's help. The only solution I see to having a large, progressively revealing region map is modifying Marin's Better Region Maps script to handle a Hidden Island feature that base Essentials does. Or perhaps I'll split my map up into pieces to utilize the Essentials' Hidden Islands.
 

Ego13

hollow_ego
311
Posts
6
Years
First off I wanna say: WOW! and AMAZING!
I really like how you actually do research on what you are trying to do and post what you have learned here! And you never came off as demanding. It would be great if people were acting more like you around here.

Anyways, I was playing around with DEFAULTSCREENWIDTH a bit, but also couldn't find a solution to it. BUt I also still can't quite imagine what your map looks like. Could you provide a dummy example?

I still believe that your best option is to write code for your case specifically,using viewports and maybe somebitmap manipulation. But to know the best way to handle all this, we need to know what this whole thing is supposed to look like. Like the actual thing.
 

Swdfm

Game Developer
245
Posts
5
Years
  • Age 27
  • UK
  • Seen Dec 8, 2023
Okay, so, in order to change the screen size mid game, you will have to change quite a lot of core code.
When Essentials (or your game) runs, it starts off as a certain size window, and then goes to the 512x384, doesn't it?
Well, that is where one of the core codes (like Main, or the RGSS window, i don't know which one exactly) changes the screen to that size.
It would be quite a dangerous game changing it in the middle of running the program, but possible.

However, I have a radical idea that could help you solve your initial issue:
So, I have not seen the code for Marin's map, but I presume it requires a background graphic.
As you unlock an area, what it should do is add an area graphic on top of the map RELATIVE TO THE BACKGROUND'S x and y values.
Then (and this is where it gets technical), you produce another picture based on this picture, by literally calling a program that saves a bitmap to somewhere in the graphics folder. The disadvantages? Players could see it, but if that does not matter, then what you would do is indeed save this picture somewhere, and then bring it up BEHIND the background, and dispose of the background and additional locations sprites before the player could move the map. This will make the player move only one image, and therefore drastically reduce any lag, as the lag always comes from when you try to move the image rather than the generation of the image (unless it is MASSIVE!)

Hope that was clear, and that is an approach I would take. Unfortunately, I do not know the exact code for that just now.

Hope I helped

Swdfm
 
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
First off I wanna say: WOW! and AMAZING!
I really like how you actually do research on what you are trying to do and post what you have learned here! And you never came off as demanding. It would be great if people were acting more like you around here.

Anyways, I was playing around with DEFAULTSCREENWIDTH a bit, but also couldn't find a solution to it. BUt I also still can't quite imagine what your map looks like. Could you provide a dummy example?

I still believe that your best option is to write code for your case specifically,using viewports and maybe somebitmap manipulation. But to know the best way to handle all this, we need to know what this whole thing is supposed to look like. Like the actual thing.

Thank you for the compliments! I appreciate that. I'm trying to find out how to do this just as much as anyone else is who happens to read this thread, so it only makes sense that I try to figure it all out too! Plus I'm still learning, so I find trying things out practically is the best way to learn.

As to my map, sure thing! Here's an imgur link of both the overlay of the routes and of the map's terrain. Both are 1024x576. Once I get this whole thing figured out, I plan on chopping up the route overlay into each individual route to place them on the map's terrain as the player explores. Hence the original idea. If you need more info or anything I'd be happy to explain.
 
17
Posts
5
Years
  • Age 30
  • Seen Feb 21, 2021
Okay, so, in order to change the screen size mid game, you will have to change quite a lot of core code.
When Essentials (or your game) runs, it starts off as a certain size window, and then goes to the 512x384, doesn't it?
Well, that is where one of the core codes (like Main, or the RGSS window, i don't know which one exactly) changes the screen to that size.
It would be quite a dangerous game changing it in the middle of running the program, but possible.

I was poking around in the Sprite_Resizer mainly, as there is code in there that deals with the size of the window as well as directly calls upon DEFAULTSCREENWIDTH and such. I couldn't really get anywhere with that though. But I agree, that it seems dangerous to change the game size mid game. The biggest reason I started looking at modifying the DEFAULTSCREENWIDTH and DEFAULTSCREENHEIGHT values was because when changed to 1024x576, my map works as intended with a simple pbShowMap and Hidden Islands feature. However, you then go on to say:

However, I have a radical idea that could help you solve your initial issue:
So, I have not seen the code for Marin's map, but I presume it requires a background graphic.
As you unlock an area, what it should do is add an area graphic on top of the map RELATIVE TO THE BACKGROUND'S x and y values.
Then (and this is where it gets technical), you produce another picture based on this picture, by literally calling a program that saves a bitmap to somewhere in the graphics folder. The disadvantages? Players could see it, but if that does not matter, then what you would do is indeed save this picture somewhere, and then bring it up BEHIND the background, and dispose of the background and additional locations sprites before the player could move the map. This will make the player move only one image, and therefore drastically reduce any lag, as the lag always comes from when you try to move the image rather than the generation of the image (unless it is MASSIVE!)

Now this is a very interesting idea! Essentially doing the brute force method of having a bunch of map files of all possible routes, but progressively replacing them as you go by essentially taking a screenshot of the new updated map then removing everything and replacing the image with the new screenshot before the player has a chance to pan around the map. Or at least that's what I think you were getting at (You were very clear and helpful, by the way!). This might be an interesting approach, as there wouldn't be a need to have 100+ individual map pictures in the game's folders because the "screenshot" of the map simply replaces the old one. Plus since it's only one static image, there wouldn't be any lag. I don't think there would be much lag, I wouldn't describe my map as massive, just double-sized, essentially. So I don't foresee this being an issue when capturing the new map image each time.

Issues with this idea however is if routes change shape. The old static map image would need to be altered and then the new route overlayed back on top in the same spot. I can't quite see a work around for this right now using this method. If the method you've suggested can be implemented practically inside of Marin's script. I'll try to work with this idea for a bit to see how I can make it work. It's come time for me to learn proper graphics manipulation in Ruby anyways!
 
Back
Top