Extending MBS_MapZoom Plugin

Discussion in 'JS Plugin Requests' started by Kirimoar, Nov 14, 2019.

  1. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Good evening everyone,

    I'm looking for someone who could help me with my problem - I'm also willing to pay something in return.
    It probably is something that is not that hard to achieve if you know what you're doing.

    My problem is:
    I want to have a permanent Zoom ingame, so Charsets and Tilesets are always 2x bigger than in original, but all the images, menu,... not.

    It kind of works with the MBS_MapZoom Plugin (Github Link)

    However - nearly all other Camera-Plugins (Galv, SRD,...) stop to work correctly as soon as it is included in the game (some don't load at all, some have jittering pixels,...).

    With MBS_MapZoom, it is possible to set the "Zoom Center" onto an event, so this event is the new Center of the Camera. However, when it's set, it sets it INSTANT. So - it kind of jumps just to the given event.

    What I want is that like in many other plugins, the camera does not just jump to the given event, but slides to it (so, kind of a transition).

    As an alternative, I also tried to achieve the permanent zoom on my own with this script as parallel event:
    Code:
    var xPos = $gamePlayer.screenX()
    var yPos = gamePlayer.screenY()
    $gameScreen.setZoom(xPos,yPos,2)
    It then zooms in, but the camera is not keeping the Player in focus but sliding around in a way I can't really explain.

    As said, I'd be ready to pay something for someone who could achieve this.

    Greetings,
    Kirimoar
     
    #1
  2. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    *bump*
    I really hope anybody could help :rswt
     
    #2
  3. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    One way to do this would be to just double the size of the sprites and tiles, though this would also create larger files.

    Would a Plug-in that simply renders the player, tiles, and events 2x work instead of zooming in? This way you wouldn't need to deal with a camera at all outside a cutscene.
     
    #3
    Kirimoar likes this.
  4. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi,

    Double-size of sprites would probably work, but doubling the size of the Tilesets would kind of destroy the mapping, I suppose.

    Well yeah, a Plug-in that simply renders the player, tiles, and events 2x (with pixelated rendering) would probably be even better and seems like it would do what I need.

    Do you know such a plugin or somebody who could create it? I couldn't find anything even after many many hours of research.
     
    #4
  5. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    Okay, I looked at the PIXI code and see what's going on now.

    They are using shader programs to draw everything. The shaders use a matrix to Scale, Rotate, and Translate (Move position of) what they draw. This means my idea of simply doubling the tiles on the map really means scaling the entire map sprite by 2 in the X and Y directions. The Plug-ins you mentioned probably scale just the entire display, but all you want is just the map.

    The Jittering is probably caused by the Diamond Exit Rule.

    Basically graphics cards can have ambiguous situations where points (which have no width or height, only a position) can sit between pixels.

    Offsetting points by 0.375, if done correctly, will cause the shaking to go away without causing overdraw (assuming the Diamond Exit Rule was the cause).

    Right now I have some working code up and running, but I'm still looking for edge cases and any other things needing to be fixed. The only issue so far is scaling by 0.5 creates tiles below and to the right of the map giving about 50% more rows and columns than what should exist.

    I'll post it to my repository once I've tested it some more tomorrow.

    For the scrolling effect you want, try calling these functions:
    Code:
    $gameMap.scrollUp(n)
    $gameMap.scrollDown(n)
    $gameMap.scrollLeft(n)
    $gameMap.scrollRight(n)
    
    They scroll 1 tile up/down, left/right, but you can give them a fraction (like 1/48 to scroll 1 zoomed-in-or-not pixel).

    I do not want any money. My Plug-ins in my repository are under the MIT License which is about as unrestrictive as you can get (outside of the public domain).

    EDIT:
    $gameMap.startScroll(direction, distance, speed)
    With that function I'd say it is the diamond exit rule at play making the sprite and map jitter at slow speeds by one pixel dispite both being aligned with each other.
     
    Last edited: Nov 18, 2019
    #5
    Kirimoar likes this.
  6. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi,

    thank you very much for your very informative answer!

    In fact - I didn't even think about just calling some scripts before using the MBS Plugin Call (which is obviosly very dumb from me....), without extending the Plugin itself at all.

    I tried the $gameMap.startScroll command - and it works like a charm! No jittering at all.

    So, my plan was now to use it and then set the center of the camera to the event with MBS, and follow it (if needed).

    So the following steps:
    • $gameMap.startScroll to Event X
    • focus on X with MBS_MapZoom call "MapZoom center event X"
    However, this comes with another problem: Here the shaking is very strong on the event if it is moving.
    This hasn't to do with your solution now, but it shows me that the MBS_MapZoom is still not working as expected.

    Which kind of code do you have? I'm very interested, as it seems like the MBS_MapZoom brings many difficulties with it and I probably should avoid it.

    Greetings,
    Kirimoar
     
    #6
  7. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    Take a look:
    https://github.com/MrNybbles/RPG-Maker-MV/blob/master/nyb_MapScale.js

    After writing my Plug-in I took a quick look at MBS_MapZoom. At first glance some of MBS's code looked shockingly similar to what I had just written, but that all has to do with making sure the scaling doesn't mess things up in other parts of the game. The way his zooming and my scaling and work are by their nature very different.

    Summary:
    NYB 147 total lines of code to do nothing more than scale the map.
    MBS 527 total lines of code to do dynamic zooming.
     
    #7
  8. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi,

    wow, thank you so much, this seems like to be a really great alternative for me!

    However, there is only 1 problem:
    It seems not to work together with "Terrax Lightning" Plugin:

    upload_2019-11-18_10-34-11.png

    In Terrax, you can set an event to have an additional light-source.
    It seems like the light of the event is not scaling together with the tileset.

    Could you maybe fix this?
    I would be really thankful!

    Greetings,
    Kirimoar
     
    #8
  9. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    Short answer: Yes.

    Long answer:
    Plan A:
    I think the issue was caused because I avoided overriding Game_Map.prototype.tileWidth() and Game_Map.prototype.tileHeight() because we sometimes need to know the real tile width. I'll try the other way around sometime later today, but I don't know if any other plugins will require knowing the actual pixel widths.

    Plan B:
    Terrax Lighting is under the same MIT license so this gives me lots of options if for some reason Plan A doesn't work.


    Notes:
    Game_Interpreter.prototype.pluginCommand() // Position, needs to know the scaled location.
    Lightmask.prototype._updateMask() // Position, needs to know the scaled location.
    Bitmap.prototype.radialgradientFillRect2() // Calculates a size.
    Looking at your image, unless you already doubled the radius, might want to know the actual sizes. However, you should be able to just double the radius if that is the case.

    I'll be able to work on this once I get back home tonight.
    EDIT:
    Plan A worked. New version 20191118c should now work with TerraxLighting.js.
    I say "should" because my testing isn't exhaustive, but so far the two plugins seem to play very well together.

    https://github.com/MrNybbles/RPG-Maker-MV/blob/master/nyb_MapScale.js

    Edit #2:
    Optimizations and fixed a bug where the mouse/touch indicator displayed in the wrong location.

    Edit #3:
    Version: 20191119d
    Plug-in is more thoroughly tested now and I haven't found any other issues.

    The Plug-in will also adjust the map by centering on the player when the map is scaled.
     
    Last edited: Nov 20, 2019
    #9
    waynee95 and Kirimoar like this.
  10. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hello again,

    thank you so much for all your effort!

    Seems like it's working with Terrax now, yeah!

    However - now it seems to collide with even 2 other plugins, which are "Kaus Ultimate Overlay" (or Orange Overlay which is quite the same) and "OcRam_Passages"...

    On the other hand - you already had so much effort, so I don't want to ask you for another update. But I also just didn't want to answer nothing at all :rswt

    So even if it's not usable for me - there are probably other users without using parallax-mapping that can make use of it!
     
    #10
  11. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    You're very welcome Kirimoar.
    Your post caught my attention because it is an interesting problem (one that I could also use an answer to) and has inspired me to write the Map Scale plug-in.

    After quickly looking through the two other plug-ins I don't see any obvious comparability problems, but I suspect it is either because both plug-ins create new layers for placing graphics, or the graphics are not being placed and/or scaled correctly.

    But rather than just guess, I could use some information on what the issues are (a screenshot like before and/or descriptions of unexpected behavior).

    Also, I could use links to where you got the conflicting plug-ins. I found plug-ins with the same name, but there is a chance I found different versions.

    Regarding Kaus Ultimate Overlay, he and his plug-in were banned with some quite serous allegations which means I won't be able to test with it, but I did find OrangeOverlay so hopefully that one is working for you (more or less).

    I might be able to get OcRam passages to work somehow, but I might write another plug-in.

    It is another interesting problem that I had been thinking about because I have sprites that are about 2 tiles tall and can't walk against the lower edges of walls as one would expect.

    I'd like to make a plug-in that normally knows the right thing to do and probably use regions to override normal behavior (like create a horizontal doorway by overriding a wall-top tile to allow passage under it or bridge tiles). In my plug-in repository you will see one called Tile Offsets which deals with similar mechanics by shifting overlay tiles so windows and such can cross tile boundaries without requiring extra tiles in a sprite sheet.

    OrangeOverlay.js
    By Hudell - www.hudell.com
    Version: 1.1.4 - Update by Chaucer
    https://www.dropbox.com/s/p637j9gnbkqsirl/OrangeOverlay.js?dl=0

    OcRam_Passages.js
    By OcRam
    Version: 4.03
    https://forums.rpgmakerweb.com/inde...ssages-plugin-v4-03-updated-2019-11-18.88047/
     
    #11
    Kirimoar likes this.
  12. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hello!

    I see! Well, if you are still interested, I will ofc try to help:

    The Plugins you linked are exactly the ones I used, yes.
    And unfortunately, there is also a problem in combination with this one:

    Exhydra_BasicShadows.js
    By Ossra (former Exhydra)
    https://forums.rpgmakerweb.com/inde...ns-plugin-count-13-13th-september-2016.65327/
    https://www.dropbox.com/s/ixljxc8cwk84kbv/Exhydra_BasicShadows.js?dl=0

    Problem with it: the shadow just does not get drawn at all.

    For better explanation of the other Plugins, I made some screenshots:

    Here you can see how the OcRam behaves: The tiles should be on top of the roof, so the player is hidden behind it. It seems like they are scaled even 4 times?
    OcRam.png


    Here is another Map how it should look (but with scale, of course):
    WithoutMapScale.png


    But depending on the plugin-order, it looks either like this:
    Orange before MapScale: (wrong Terrax Light Positions, wrong Camera Position, should be on the player lower right)
    OrangeBeforeMapScale.png



    Or like this:
    Orange After MapScale: some part is scaled, some not, Terrax anywhere on the map
    OrangeAfterMapScale.png




    I think this is exactly what OcRam Passages does!

    I just realized that you updated this - but now you will see quite too much of the end of the map, right? So what I mean is: when you run to the edge of a Map you can see very far into the "black nothing". This wasn't the case in the original Version of your Plugin.
    Could you maybe make this optional?

    Edit:
    Just thinking about it - as it seems like the scaling-process interferes with quite some other plugins - maybe the option of keeping MBS_MapZoom and just extending it's functions with the "scroll thing", like mentioned in the first post, would be easier to achieve?

    Greetings,
    Kirimoar
     
    Last edited: Nov 21, 2019
    #12
  13. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm going to try a different technique for zooming/scaling the map which should deal with these issues (basically draw everything, then scale up) like what $gameScreen.setZoom() does. The map scrolling needs to be dealt with this way, but it will always need to be dealt with.
    .
    The zoom effect my plug-in currently uses has issues when Game_Map.setDisplayPos() hits the edge of the map because it scrolls in 1 tile increments. I didn't set it to zoom to anything other than the player because I wanted to deal with this first.

    This may take a few days, or maybe I'll get lucky and all the plug-ins will behave.
    But at least now I'll know what type of tests to run along with the other 3 plug-ins.

    Also, there are rules against double-posting within 72 hours so all try "start a conversation" in your profile as I think that might be how this forum does Direct Messages.
     
    #13
    Kirimoar likes this.
  14. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi,

    I'm very glad that you are not giving up! Thank you so much.

    Drawing everything first and then scale up seems to be a good way to not interfere with other plugins.

    If I would have kind of a "wishlist", it would be:
    • obviously: permanent zoom/scale of Charsets and Tileset
    • set the center of the camera to something else as the character (e.g. an event or specific position) with a smooth sliding to it (maybe even with a parameter for the duration how slow/fast it will slide)
    • zoom/scale even further inside the current center to have a "zoom of the zoom" for transitions, or zoom/scale outside.
    But as I learned from you, points 2 and 3 can also be achieved with some Script-Calls, so it would be only more convenient if they would be even inside a plugin.

    As I answered now there should be no problem with double-posting for you.

    Greetings,
    Kirimoar
     
    #14
  15. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm not 100% done with this plug-in yet, but it seems to be working and playing nice with other plug-ins (at least the 3 you mentioned). Please let me know if you have any issues.
    https://github.com/MrNybbles/RPG-Maker-MV/blob/master/nyb_Camera.js

    As for your Wishlist:
    1) Done. The scale will persist over map changes and a default can be set.
    2) Will add in a future build (but most of what it needs is already there).
    3) Done. Each camera move is relative to the current position.

    Current Features:
    1) Camera can follow the player (default) or be detached from the player.
    2) Camera movement can be bound within the map (default) or always stay centered on it's target.
    3) Some limited movement with the move sub-command.
    4) Camera moves are asynchronous.
    5) Parameters can be provided by variables if an integer is prefixed with a $. $3 will cause the contents of Game Variable 3 to be used as the parameter.

    Future Features:
    * Asynchronous execution of queued commands. Currently calling a second camera command while the first is still executing may have unexpected results.
    * Duration of camera moves NOT tied to framerate.
    * Adding Map Events, Followers, and Vehicles as valid targets to follow.
    * Adding moving to a map tile X Y location.
    nyb_Camera.png
    I looked at MBS_MapZoom and it states "Especificações do plugin (Não Modifique!)" and "Plugin Specifications (Do not modify!)" so it looks like the author specifies that he does not want his plug-in to be modified by others.
     
    #15
    Kirimoar likes this.
  16. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi,

    wow, I', very glad that you are still working on it!

    First: it seems to work very good with all plugins I have!
    Also the Plugin-Commands are very nice!

    I could test it now and found 3 issues:
    1. if I start on large Map, the camera seems to be off - it starts to far on the top left. However, if I run with my char to the middle of the screen, after that it behaves correctly.
    2. the mouse-pointer position is wrong when clicked
    3. when I enter the menu, it works as expected - no zoom applied. But when I enter the battle, the zoom stays. Could you maybe add this as optional?
    Thank you so much for your work until now, hope you are keeping it!

    Greetings,
    Kirimoar
     
    #16
  17. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    Version: 20191123c
    https://github.com/MrNybbles/RPG-Maker-MV/blob/master/nyb_Camera.js

    * Fixed camera not centering on player on transition to new map.
    * Fixed mouse/touch input not matching where clicked.
    * Fixed entering battle while still zoomed.

    In the future I might add camera control during battles, but currently I'm working on getting the camera to look decent when following an event (or anything that isn't the player). When I try to do it the same way as the player's sprite it causes sudden shifts when the map scrolls.

    I also came across Sum Random Dude's plug-in. I think it might do everything you want so please give it a try. I haven't used his plug-in, but from the video it looks like it might do everything that you need. I'll continue to work on my plug-in regardless.
    http://sumrndm.site/camera-core/
     
    #17
    Kirimoar likes this.
  18. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi,

    wow, yeah, the problems with being not centered and mouse-input seem to be fixed now!

    I only encountered two new ones :rswt

    1. before entering battle, the zoom is completely reversed in the animation before starting the battle (on map), which looks a bit odd. But that's not that of a problem, probably I would like to get other "into battle" transitions anyway.
    2. when I show a picture (with the normal show-picture command from the maker) it is also scaled I think (so, double the size and the position off). I wonder if you could maybe prevent this? So that the picture is shown in normal size and position? The interesting thing is: all pictures that are shown by other plugins behave normal.

    I tried it with him before, but the problem is that with his plug-in you are not able to walk to the side of the map if it's permanently zoomed in. It means the player will just walk out of the screen. Furthermore it's not compatible with Moghunters Weather EX Plugin. Therefore, I couldn't use it.

    I'm very glad to hear this, you are kind of a life-saver :rhappy:

    Greetings and thankfully,
    Kirimoar
     
    #18
  19. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    58
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    Issues fixed:
    1) I added an option (on by default) to correct the Encounter Effect issue. Because the flashing effect makes me blink I'm not 100% confident I've accounted for everything, but to me it seems a bit better. I think I need to play around with scaling the
    2) Pictures should now be the only thing within the Map Scene not being scaled.

    My current TODO list:
    1) Replace the current FPS-dependent camera movement system with a time-based one.
    2) A smooth scroll system for following Followers, Map Events, and Vehicles. They are all derived from the same base character prototypes so there isn't much more work to do all three instead of just one.
    3) Look into scaling the Terrax Lighting layer. I think the Encounter Effect will show more map area than intended when it zooms in.
    4) Because the camera will still be updated concurrently I'll probably implement a plug-in command to call a Common/Map Event once the move is finished. Camera commands will be queued like so:
    camera move 0 5 2 60
    camera call map event 3 <-- Waits until camera move has finished before calling.

    I'll probably also do a 'camera wait' command to give more options. Triggering multiple things to happen at once may be powerful, but sometimes you just need something simple and linear.

    The next version of the plugin might take a few days, but let me know if you run into any more issues and I'll see about correcting those before the next intended version is ready.

    Take care!
     
    #19
  20. Kirimoar

    Kirimoar Villager Member

    Messages:
    21
    Likes Received:
    2
    Location:
    Austria
    First Language:
    German
    Primarily Uses:
    RMMV
    Hello!

    That's so awesome. The issues are fixed now, yeah.

    It seems that everything with the plugin seems to work now as expected when not using Plugin-Commands!

    But I found two other issues with the Plugin-Commands, I'll try to explain as easy as possible:

    Initial scale is 2.0

    plugin-command: "camera move 3.0 60"
    expected: zoom in further into the player
    real: zooms in to the top left of the player


    And one more problem, but maybe it will be fixed anyways ith your TODO-list:

    plugin-commands: "camera move 5 0 60" + wait 60 frames + "camera move 3.0 60"
    expected: camera goes to the right and then zooms in
    real: camera goes to the right, then nothing happens anymore.

    However, all of this is not urgent! Your TODO-list seems to be very good, I'm looking forward to it!
     
    #20

Share This Page