[VX Ace] Issue with Galv's Layer Graphics

Hello! Recently, I've been toying with the idea of rotating maps by 90 degrees, a feature in my game. This has led me to use Galv's Layer Graphics (https://galvs-scripts.com/galvs-layer-graphics/) to make the process easier. It is generally similar to normal Parallax Mapping, but with far more customizability and features.

In RPG Maker XP, there was a feature that was left behind; the ability to use tiles on the same z-level as the player, leading to areas you could stand in front of, and walk behind. I've seen several threads exploring this concept, though they usually end with using either Terrain Tags or Regions. I cannot use those properly, not only due to the way my maps are set up, described below, but also due to the map's rotation, making their placement useless or even problematic after just one rotation.

Here's where my issue starts. As I'm no longer bound to use any form of tiles or grid, the map I've created is not very aligned to the 32x32 tiles; I've created walls that are not one-tile thick, for example. The player-character can walk behind these walls just fine.

Spoiler: Image
Game_Bug_001.png

However, the player cannot walk in front of them without this occurring.

Spoiler: I should have seen this bug coming, really...
Game_Bug_002.png

This surprisingly, does not affect collision. The player interacts with the wall as intended (though amusingly, they can activate events behind the wall from them, which I can fix), it's merely the character's display that's off. I first attempted to set the z-level of the walls to that of the player, hoping the one in front would display on top. This failed, of course. The player's Z level is approximately 101, as far as I can see.

Note: I am using GaryCXJk's Free Movement script (http://www.rpgmakercentral.com/topic/10694-free-movement/). Just in case- its presence affects all sorts of potential solutions.

Any help finding a practical solution would be appreciated.
it might be that the character sprite is offset on it's Y axis.
hard to tell with what you give out, you should post the map itself, or look up any modifications to your code that might interfere with Galv's

I believe Galv's code is intended as a complement to the "show picture" feature, that lets you add images on top of the whole scene.
if that's what you did, then it's always going to be on top of the screen, regardless of Z value.
also, Free Movement requires you to set collision boxes for walls.
I'm not sure how the y-axis could be relevant, so I'll just ignore that and continue.

The map is this:
Spoiler: Map Components
Third_Floor_Test_Base_South_4.png
Third_Floor_Test_Walls_4.png
map008.png
Tile_Testing_Grid_02.png

These images, in order, are the floor layer, the wall layer, the collision map, and a large 32x32 pixel tile-based grid, for comparing maps to their position on the tile grid. The screenshots I took had the grid included for scaling purposes.

I don't believe it's being caused by any sort of conflicting code. It's almost certainly being caused by the script not being able to discern when the player is under it or not, causing it to act the same when the player is standing in front of it, the same being to display on top of the player.

Galv's script has nothing to do with the 'Show Picture' feature. It's completely separate, and as I said, is similar to Parallax Mapping. In Parallax Mapping you often use 'Show Picture' commands, however, this script makes that obsolete.

The way you add a layer is to use a script call:

layer(8,0,["Third_Floor_Test_Walls_4",0,0,255,101,0,0,0])
layer(8,1,["Third_Floor_Test_Base_South_4",0,0,255,0,0,0,0])
layer(8,2,["Tile_Testing_Grid_02",0,0,100,250,0,0,0])

refresh_layers

The 5th field (101, 0, 250) is the Z level. If I set this to anything below 101 (even 100.99), the player will render on top of the wall. This reverses the problem; now the player can stand in front of the wall, but trying to stand behind it...

Game_Bug_003.png



And, finally, I don't need to set collision boxes for walls. The red you see in this image is the collision map, which defines where the player can and cannot walk, except for the square in front of the player-character, which is the interaction box, defining the field in which the player can activate events. Remember how I said I can activate events on the opposite side of the wall? It's because of that box, which is, fortunately, customizable.

Do you have any other suggestions? I had the idea to split the walls into multiple sections and display them on multiple z levels, but then I'd have to have the player change z levels and it's just a stupid idea in general, really.
the collision map should be a combination of the wall map and the floor map.
as it is, it's just the floor map.
if the red states where the player can and can't walk, then in that picture the player can walk into the wall.

I did make a formula to handle Z depth.
let me find it.

the problem is, the layers, and the player, are flat images.
how can you tell if the man is above or below the rectangle?
if it is above, it's always above over the whole rectangle.
there is no bending a flat shape.

idx8XG2.jpg



if you want certain parts of a something to be above or below another thing, you have to cut them to fit.
that's where the grid comes in.


here, this should move the characters up and down based on their XY coordinates.
and I say should because this was meant to work with characters against characters and tilesets.
you don't use tilesets, but the grid coordinates should still be valid.
either way, I guess you can see what I went for here.
Code:
class Game_CharacterBase
  def screen_x
      $game_map.adjust_x(@real_x) * 32 + 16
  end
  def screen_y
      $game_map.adjust_y(@real_y) * 32 + 32 - shift_y - jump_height
  end
  def screen_z
      ((@real_y || 0) * (200 / $game_map.width)) + (@real_x || 0)
  end
end
Ah, you misunderstand. The collision map is handled by a separate script, Hime's Collision Maps (http://himeworks.com/2013/09/collision-maps/). The collision map is the black and red image I placed in my spoiler, and besides, collision isn't the issue here.

I'm not sure how you say it's just the floor map. You don't combine the wall and floor images into a single image- that causes editing issues. They're separate layers loaded by the same script at different z-levels.

The red is the 'can-not-walk' color. Notice that the thickness of the red is the same as the thickness of the top of the wall. It's taking perspective into account. The player can't walk through the wall, or inside it, but they can walk in front or behind, or to the sides, without clipping, like in real life.
If by 'into the wall' you mean that the player can walk 'into' it and hit their nose, then yes, they can. (Making an animation for that!)

I'm excited to see what you have on calculating z-levels. Let me know if you can find it or not.
They're separate layers loaded by the same script at different z-levels.

and therein lies the issue.
check the previous post
It works beautifully, thank you so much. If I have any issues with your code, may I pm you for assistance?
It works beautifully
it does? 0o
I didn't think it would.

yes, pm me or post back here, although, that code is simple math and plain use of the Z rules: it goes from 10 to 200, and it had to be related to the map size.
wasn't hard to come up with a formula that related both.
I'm not sure how the y-axis could be relevant, so I'll just ignore that and continue.
It is very relevant in a special case.
If 2 or more sprites use the same viewport, or if all of them are without a specified viewport, and if they got the exact same Z value, the one with the biggest Y value will be the top sprite and the other ones will appear below it in the order of their Y value.

Or, with the words of the help file:
The sprite's z-coordinate. The larger the value, the closer to the player the sprite will be displayed.

If two sprites have the same z-coordinates, the one with the larger y-coordinate will be displayed closer to the player, and if the y-coordinates are the same, the one that was generated later will be displayed closer to the player.

Because the map images are way bigger than the player, chances are, your player image will always have lower/bigger Y value, so it will always appear below/above that layer if their Z value is the same.

If your images have varied oy values, it can complicate things even further.

No idea which viewport you use for your map images, so this might not even be related to your issue. Just wanted to let you know how can the Y value be relevant here. 😛

Btw, the screen_x and screen_y methods of that code are just a copies of the default methods, so that is not really needed.
After more testing, the script doesn't truly work. It only functions correctly in a small region on the left side of the map; the rest of the map has the player-character displayed on top of the walls.

@Sixth Any guess as to why this occurs?
I don't, sorry.
I didn't check Galv's script, so no idea which viewport(s) he used for the map images.

But doing what you want is not possible without a very specific Z level update for the player.
Since your maps can have different images (and they probably will), I don't think that this can be done with a simple static update method.

Maybe it would be better to add Z level changes manually on your maps instead of trying to make a single update method cater for every single map of yours (which might even be impossible).
So, for example, you setup the areas where the player's Z level will get changed to A value, and set up other areas where the Z level will be set to B value, and so on.
This is the only way you can do it, since your map images are all different.
This requires a new variable for character objects which will store the current Z level, and that variable will get changed whenever the characters enter an area with a Z level change trigger. This is how I would do it at least.
Ohh, and this requires your map images to be on the same viewport like the character images to work.

Looking at that screen_z method gstv87 wrote, I really don't get how can the map's width be related to the Z level or Y position of images.
I mean, what you want to do is set the Z level based on the vertical (Y) position of the player, so how did the width of the map end up in that method? 😳
I mean, what you want to do is set the Z level based on the vertical (Y) position of the player, so how did the width of the map end up in that method? 😳
what exactly is 10 in base 10?
what is 10 in base 2?
in base 8?
try counting in the numeric base "map widths".

from left to right, top to bottom, [0,0] is z = 0 (or, 10, corrected by the system), and [maxX,maxY] is z = 200.
the difference is split evenly.

I had to sort isometric battlers according to their death animation, which had to be "on the floor", so other characters could pass over them.
that's what I came up with.
But this is not an isometric grid system, it's simple 2D and without the grid part, so I can't see that logic working here.

The map images are giant images, and they only have 1 Z value (per map image).
Their size is the entire map "grid", so changing the Z level in a static, calculated way based on the grid position will not work here for sure.
But this is not an isometric grid system, it's simple 2D and without the grid part, so I can't see that logic working here.
*exactly what I told him*, and *it works for me, because I made it*
If it would help, I could easily break the wall layer into multiple sections- one for each wall, and one for the top of the walls, which would always be above the player-character.
I've been thinking about this the past few days. I'm almost certain that what I need here is far more complex than meets the eye, especially in the way I've been implementing the rotation feature. Correct me if I'm wrong, but I'm going to need a script specially made for this, yes? If so, I can just commission it. Doing something like this myself is still out of my league, haha.
IDK....
maybe just try something simpler with that script, just to make sure the layering is working correctly.
I get the feeling you're painting the colission wrong: it should cover the entire wall, not just the floor.
wether that is going to achieve the desired final effect? I don't know.

you could probably paint some part of the walls as being "the floor", that way, with a corrected collision mesh, it would always >always< appear below the player, retaining the wall's collision.
hard to explain with words, but this time I know exactly how to paint it.... give me a sec.


EDIT:

top left hexagon room.
I believe the logic is evident.
Spoiler
coll.jpg wall.jpg floor.jpg
That's good and all, but then the player can't actually walk down to the wall all of the way; the collision map for that wall is now thicker than the wall itself- too thick. You have to remember that the wall is only as thick as the grey stripe at the top, so there's no reason for the player to stop walking just because they're up to the grey stripe.

Perspective.png


Edit: Oh, and that's not a hexagon room. It's an octagonal room. All eight sides are nearly the same length.
they'd go further down than just the top.... more like

wl2.jpg


I didn't correct the diagonals all the way, only the door
but everything should follow the same logic: you *make wall the part of the drawing that is a player sprite size apart from the bottom of the wall, and make the rest, floor*
Right, I realized that partway through making the image, but I was almost done and said "Screw it." Regardless, my point still stands. The collision for the wall should only be as thick as the wall itself. At the very least, weird things will happen after a rotation.

Edit: A good rule of thumb is that a wall should be able to completely cover anything exactly as tall as it, or shorter.

Edit 2: The problem with your strategy is that there's overlap. There'll be a small band of wall on the floor layer that the player can stand on from behind the wall. The easiest way to fix that is, as you suggested, to change the collision so that the player can't walk there, but that in itself opens up new problems.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-issue-with-galvs-layer-graphics.87263/