Realistic Z / Height Levels


Jul 26, 2012
Reaction score
First Language
Primarily Uses
Hello Folks,

Our beloved Maker (i'm talking about XP) has three Layers for building shiny Worlds, beside the Event and Fog/Panorama Layer. Though 2D, you can create the illusion that there is acutally some Height on the Map, i.e. Hills with different Levels, Mountains and so on. With the Help of the Priority and Passage Settings you create the Illusion for the Player, that he stands above or below something. But this is breaking step by step when we, the developer, think about cool Ideas like Bridges for example that our Player can cross above and below. Sure, there are Solutions for this. You can help yourself out with Events, Terrain Tags and so on. It works but itis not cool and works only for the Player. Take the Bridge Example again, where the Player and some NPC's give the Illusion they are on different Levels but in reality ... they are not. The Player wants to cross a Bridge and at the same Time a NPC wants to go under the Bridge? Nah! Create cool Dungeons and Situations like in Zelda - Link to the Past where Players and Enemies could act on different Levels in the same Situation? Nah! Just look at this Picture here i made:

Thats actually my goal i want to achieve. The Situation on this Screenshot is, with the tools we are given at the Moment, not possible! Aluxes (our Player) is on a higher level than the blue Knight next to him for instance. So, logically, they should not interact and collide with each other and the Tiles affecting them should behave (passage and priority settigns) right and be drawn properly like you see above. Like said, it is not possible in the Moment because the Maker do not know what Elevation is. So we have to teach him.
I thought about how it could be done and got some Ideas already how it could be handled. The the big Question here though is not how but if it is possible at all with the Limits we have with the XP Maker. So I'm here to ask some mighty Scripters with enough Motivation to actually make this happen so we developers have the possibility to really create some cool Gameplay Mechanics and Concepts. I'll write down my Ideas and Concept how it could be scripted. There are actually two Solutions i've came up with. Question is which one is the more smarter approach and, performance wise, the better. But, first i'll write down what is generally needed for both solutions so we have a base. Please take a look:


- Z Level Variable
NPC's and the Player need a Variable that tracks and saves a value. This Value would be the actual Z level. It can change when the Player and/or a NPC walk from one Z level to another visualizing by Stairs for instance. That could be triggered easy through a Event touch/Player touch Event which changes the Z level Variable for that specific Event or the Player. The most important part here is the Variable. I think some sort of a local Variable for each Event and the Player (like a local Switch) would be the best.

- Collision/Trigger Detection only on same Z Level
Because every NPC and the Player have stored a specific Z Level Value, thanks to our Z level Variables, we can now teach the System if Events and Player should collide and interact with each other or not. When it comes to collision/triggering it should be checked, if a Player/Event is on the same Z level. If yes, well... do your thing. If no, ignore that one and just move through.

Great, those are the Things we need in any Case, now we are getting to the actual Solutions i've came up with:

Solution 1 - Z Terrain Tag

So you all know Terrain Tags, they are very helpfull. For this Solution we need an equivalent system for only one purpose: tagging specific Tiles with a Z level.

I know there are Scripts out there which offer unlimited Terrain Tags instead of only 7. Thats fine but we need the possibilty to give Tiles a normal Terrain Tag and another Value (or Values) at the same Time. And here comes the Z Terrain Tag System into Action.

- Passage Detection only on same Z Level
If you have Characters on different Z Levels they should can logically walk below and above on the specific Tiles which sperates their Z Level in the same Moment and on the same Map, right? In our example above it is the upper Cliff Tile. So for our Player Aluxes this one should be considered:

For the blue Knight next to him this one here should be the logically way:

To make this possible we would need those Tiles duplicated in our Tileset, each Tiles with the specific Passage and Priority Setting. Like this:

Now, take look at this Example here:

The Tileset for this Maps would look like this (i made a screenshot with the Passage and Priority Setting):

As you can see, i marked the Tiles with different Colors. When you look at the map above again, you can count 1 and 1 together. The blue Tiles in the Tileset were used on the Positions where the blue Color on the Map is. Same Procedure for the red ones. Now, thats important, the Tiles with the purple Color are not important to Mapping at all. But it is needed because those Tiles have the other Passage and Priority Settings and serve as a "source" for the System where it gets the different Settings when the Z Level Check does not match. In pseudo Code it would look like this:

Player/Event is moving one tile left and there is a upper Cliff Tile:

- Check if Tile has a Z Terrain Tag
- Yes
- Check if Player/Event Z Level is <= as the Tile Z Terrain Tag
- Yes
- take Passage Setting from the Tile id xx in consideration​
- No
- take Passage Setting from the Tile id yy in consideration​
- No
- Do nothing
Now, for instance, for our blue Knight NPC it would like this:

- Check if Tile has a Z Terrain Tag
- Yes <- it applies
- Check if Event Z Level is <= as the Tile Z Terrain Tag <- NPC has Z level 1 and Z Terrain Tag of Tiles used with blue Color is 1 too
- Yes <- it applies
- take Passage Setting from the Tile id xx in consideration <- Tile ID of the Tile with blue Color with Z Terrain Tag 1​
- No
- take Passage Setting from the Tile id yy in consideration <- if that would applie, the System would take the Tile ID of the Tile with the purple Color, because NPC would have a higher Z Level than one (in this case 2 or higher) and should walk on those Tiles.​
- No
- Do nothing​

So, as we can see, for each Z Level we just need another duplicate of the specific Tiles, marked with a higher Z Terrain Tag.

- Drawing Tiles/Events/Player on the right Z Level

Okay, we have the Passage Detection settled but one important thing is still unclear. The Sprites have to be drawn correct and in the right Order (with considering their Priority Settings too), accordingly to their Z Levels.

This could be done with increasing/decreasing the sprite_z Value of the specific Sprites. So, how would it look like? When the Player or/and a Event change their Z level, their sprite_z Value would increase or decrease by 32, for instance, for each level of priority. Actually easy, but we need to increase the sprize_z Value for the Tiles with a Z Terrain Tag too (same Procedure). So, for instance, the upper Cliff Tile with a Z Terrain Tag of 1 has the standard sprite_z value. The Upper Cliff Tile with a Z Terrain Tag of 2 has a increased sprite_z value of 32 (like the Player or a Event would). Because of this regulation Players/Events are now drawn correctly above or below Tiles, depending on their Z Level.

Okay ... phew ... i hope that was understandable :D . But we are not finished. That was Solution 1. We have another one.

Solution 2 - Height Maps/Pictures

I guess you all know the Pixel Movement Scripts out there. Some have a thing called collision map/picture. So as i know, you have a Picture for a specific Map on which there are colors that tell the System which Tiles or pixels are passable or not. I've taken this this approach for the Solution 2 and simply called it Height Maps/Pictures.

What is that? A Height Map/Picture is a Picture (saved in the pictures Folder) per Map which stands for one Z Level on that specific Map. Take a look again at this one:

Ignore the actual Game Screenshot below. This one represents two Height Maps/Pictures we would have lying in our Pictures Folder. A Picture with only the blue color and one with only the red one. Each Color stands for one Z level.

- Passage Detection only on same Z Level

If a Map, the Player is on would have Z levels activated (could be done through a simple Switch that says yes/now), the system would check which Z Level the Player has (and the other Events of course) with the Help of the Z Level Variable and then look at the specific Z Level Picture for passage Detection. Because every Z Level Picture has a different Color and one Z Level stands for one Color (customizeable) the system knows, which Tile Passage Setting in the Tileset it should check and take into consideration. Pseudo Code would look like:

Z Levels are present and activated on the Map and Player/Event is moving one tile left and there is a upper Cliff Tile

- Check which Color the Tile Position the Player/Event is moving to has on the Height Map
- Blue
- take Passage Setting from the Tile id xx in consideration​
- Red
- take Passage Setting from the Tile id yy in consideration​
- No Color
- Do nothing
Actually, pretty similar to Solution 1. Difference is just, the Information which Z Level the Tiles on the Map have does not come from a Z Terrain Tag but from a Picture with it specific Color.

- Drawing Tiles/Events/Player on the right Z Level

This one is pretty similiar too. The Sprite_Z Value handling for Events and Player does not change (stays like in Solution 1). But for the Tiles, instead of drawing with a specific sprite_z value based on their Z Terrain Tag, they would be drawn based on their height map color where each color, as we know by now, stands for a specific Z Level.

Okay .. that was it. Hope i could make my point clear.


Did an edit for Solution 1, because i had an error. Now it should be better understandable :) .

Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

I was away this days here in the forum but it was for a good cause!
The trailer of the demo of Luke Inn is on youtube and I am so happy!
I need to see the bugs of the game but I am happy that I have new content to show!

The last part of the modern interior will be ready soon. This will be a B-tile. With interior items for the kitchen, bathroom, toilet and storage room.
This frantic shooting ARPG plugin for MZ looks really great. Here is the link to a post from the official Japanese RPG Maker forum.
We start in 5 minutes!

Forum statistics

Latest member