[XP] Creating realistic Z / Height Levels

Started by schmoggi, June 02, 2015, 07:20:52 am

Previous topic - Next topic

schmoggi

Hello Folks,

i hope the Title is straight forward but i explain it a little bit:

So, 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 fine illusion that there is acutally some Height on the Map, i.e. Hills with different Levely, 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. Right ... we know that, its cool.
But our little Illusion is breaking step by step when we, the developer, think about cool Ideas like Bridges for example that the Player can cross above and below. Sure, there are Solutions for this. You can help yourself out with Events, Terrain Tag and so on. It works, thats fine. But its not cool and it works mostly only for the Player. See, i thought in the past Days a lot about Situations like, we take the Bridge Example again, where the Player and some NPC's give the Illusion there 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!

Thats what i mean. Like i said, i thought about it and got some Ideas how it could work but the big Question is not how it could work but if it is possible at all with the Limits we have with the XP Maker. So I'm here to ask you cool mighty Scripters if there is any possibilty that this could be happen. My thoughts about it:

- Z Level Variable
NPC's and the Player have a Variable (a local Variable like local switches per Event would come in handy here) that tracks and saves a value.
The Z Level can change when the Player and/or a NPC's walk over some Event that Triggers by Event touch/Player touch and changes the Variable of that Event or the Player. Think of Stairs for example, where the Trigger Event would lie at the beginning and end of the Stairs.

- Collision/Trigger Detection only on same Z Level
We have our Z Level Variables stored, nice! Now the Collision detection must be altered. When it comes to collision/triggering it should be checked, if Player/Event is on the same Z level. If yes, well .. do your thing. If no, ignore that one. The Trigger/Interaction Thing would be a easy one (Conditional Branch checking if Z Level Variable are same). The big Thing, i guess, would be the Collision thing.

- Passage Detection ony on same Z Level
Now it is gettings interesting. Take the Bridge example again. The Bridge Tiles have different Passage Settings that the Ground below would have. So how we accomplish, that i.e. a NPC can walk below a Bridge and at the same Time the Player above the Bridge can actually walk over it and ONLY walk over it and not walk like through magic from one Bridge Tile to a Ground Tile that lies logically below?
Exclude Passage Detection for Tiles that don't have a specific "Z Terrain Tag". Okay, wait whats that all about i've come up with? Let me explain:
First, we would need an addition to Terrain Tag. There are scripts out there which allow unlimited Terrain Tags. Thats fine but we need the Possibility that a Tile could have a Terrain Tag and(!) another different Value (or Values), just call it "Z Terrain Tag" for this one. So in short another Terrain Tag Thing where we then can store the Value for the Z Level for a specific Tile. Imagine a NPC have a Z Level of 1 (Ground). The Bridge Tiles have a Z Terrain Tag of 2. Then the NPC would ignore the Passage Settings for the Bridge Tile because it is on another Z Level. It would interact with the Passage Settings of the Tile below the Bridge, in this case a Ground Tile with a Z Terrain Tag of 1.

- Drawing Tiles/Events/Player on the right Z Level
One but importang thing is still unclear. We have the collision detection settled, the Tile Passage Detection Settled. Fine, but how could we tell the System, that when the Player is a Level higher than our NPC under the Bridge and it will Draw the Sprites correctly? I will maker it short. We need more Priorities.
There are 0 to 5. Somehow we have to raise that to 10 for example. I hope that is even possible.
The Bridge Tiles could have a Priority of 1. We all know, a standard Character Sprite has the Priority 0 on the part below and a Priority of 1 on the upper Part.
Now, when the Player walk up stairs, his Z Level Changes to 2. Now his Priority Level would go up too, in this case from 0 to 1 (for the lower part) and from 1 to 2 (for the higher part). Now the Player would be correctly displayer on the Bridge, a NPC on the other Hand with a Z Level of 1 would have the lower Priority Setting and so be displayed under the Bridge because the Bridge Tiles have a higher Priority.

My God ..  i hope anbody can understand this :D. Anyway ... i think this could work. The Thing is, will the RPG Maker XP Limits allow us to implement such ideas?

greetz 

KK20

Could've sworn someone made a script like that already. If not, Heretic, this is the next big thing you should work on. At least the z-level stuff, not the priorities.

Since I've created a Tilemap rewrite, I can say that doing 10 levels of priorities is possible (with a tilemap rewrite) but you would be playing with the worst FPS possible. I also don't see why you would even need that many priorities. It's only purpose is for the larger character sets (like anything beyond 64 pixels in height). Instead of changing their "priority" as you say, you can just change their sprite_z value by increasing it via values of 32 for each level of priority you want to go up.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

ForeverZer0

Doing a rewite that allows more priorities is not a difficult issue, it's just that you are always still held back by the limitations of the editor. This is the whole point that for so many things that would be great to have in RMXP, the need for a new program, like ARC is required.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

schmoggi

June 03, 2015, 03:27:44 am #3 Last Edit: June 03, 2015, 03:30:01 am by schmoggi
Quote from: KK20 on June 02, 2015, 04:15:28 pm
Could've sworn someone made a script like that already. If not, Heretic, this is the next big thing you should work on. At least the z-level stuff, not the priorities.

Since I've created a Tilemap rewrite, I can say that doing 10 levels of priorities is possible (with a tilemap rewrite) but you would be playing with the worst FPS possible. I also don't see why you would even need that many priorities. It's only purpose is for the larger character sets (like anything beyond 64 pixels in height). Instead of changing their "priority" as you say, you can just change their sprite_z value by increasing it via values of 32 for each level of priority you want to go up.


The Priority increase was the first Thing in my mind that came up. Background of the increse are other Sprites like Trees and Roofs. As you know, the upper Tiles of that Sprites have, regular, a high priority setting like 4-5. I had in mind that if increasing the priorites to 10 for example, you could take the priorities for Sprites like Trees etc. from 2-5 up to 7-10 so you would have enough space, in this case 1-6 Priority, for playing with the z Level Thing. But, if increasing the sprite_z value by 32 is a smarter approach as you say and the Priorites from 0-5 are still handled correctly  then i'm full in. My Ideas are not "settled" so don't get me wrong :). I'm open for other (better) Ideas and ways that would make things easier.

By the way, hey KK20. I know you from the old rpg-studio ;). I'm looking forward to the rmxpace Project.

@ ForeverZer0

Well, yeah ... of course the "new" Priorites can't be set in the Editor (Database) then, thats clear. In this case you would set the Priorites in the Script itself for Tilesets you want.

greetz

schmoggi

Hey,

sry for double post but i had some Brainstorming.

First, the increase of sprite_z value like KK20 mentioned should also apply to the specific Tiles/Sprites drawn from the Tileset which are involved in the Z Level System (in this case a specific Z Terrain Tag). If not, Players/Events on higher z level would be drawn over Sprites/Tiles which are logically on a even higher Z Level and so above them.

Second, i've came up with a different way to make it possible to check, if the player and/or a event is on a specific Z Level and check the right Passage Settings. The Result would be the same, which one would be the easier and faster one (performance wise) is the right question. So, how does the other way look like? I guess you all know the Pixel Movement Scripts out there. Some have a fine thing called collision map/picture. So as i know it, 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. Let's use this approach for our Idea.

Simply, Height Map(s)! You can have Pictures (saved in the pictures Folder) per Map where 1 Picture would stand for one Z Level for that specific Map. In that Case, you could have as many Z Levels (1 Z Level = 1 Picture) for one Map as you want, in theory. If a Map, the Player is on has Z levels activated, the system would check which Z Level the Player has (and the other Events of course) 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. Here is a sample i quickly made so you can understand it better:

Spoiler: ShowHide


Okay, explanation:

In this Case you would have two empty Pictures (ignore the actual Game Screenshot below) with one showing the red color and the blue on the other in the Picture Folder. Those are our Height Maps/Pictures. The Colors are our equivalent to the Z Terrain Tag Idea. Below you have the Tileset which was used. As you can see, there are two of the same Sprites, in this Case the upper Cliff Sprites, for a Level Switch. That is needed so the System knows which passage setting it needs to check.

On the Screen, our Aluxes ist the Player. So he is on Level 2. The NPC next to him is clearly on Level 1 (Ground). So what is happening here? First, the Upper Cliff Sprites from the Tileset which are set to the Color blue are drawn with different (lower) sprite_z values that the ones with the color red (higher). Events with a increased sprite_z value when changing their Z Level are drawn properly now, like Aluxes in this case and the NPC next to him. Next, the System is checking which Z level the Characters are and can then, because of the help of our colored height Maps/Pictures, properly check the right passage settings for the specific Tiles. For the Player (Aluxes) the Passage Settings from the very first upper cliff Tiles in the Tileset are considered because he has a Z Level of 2 and the Color blue is configured to check for Level 1 and 2. The NPC next to Aluxes is on Z Level 1 (below the Player) so for him the Tile Passage Settings from the second 3 upper Cliff Tiles are considered.

greetz

Heretic86

I only read the OP and other comments briefly, but as KK20 said, my stuff does do this.  It ends up being a combination of mapping and script calls.  The script "NPCs on Event Tiles" allows NPC Characters to move on Terrain Tiles that are made from Events.  When I was building that script, I noticed that smaller characters like cats or butterflies didnt render correctly using the default setting so I put in some Z Index stuff so that you can make all the Event Terrain Tiles render as flat.  I also put in a couple other options for forcing the Z index per page by using Comments.  The Comments allow much more precise control than just the Priorities.  Priorities determines screen_z as 32 * @priority, where as using the comment allows very specific control.  For a normal Aluxes sized character, the default would be a screen_z value of 63.  To force the Z-Index by using comments in the "NPCs on Event Tiles" script, just add a comment that reads: "\force_z[64]" or "\force_z[56]" or "\flat" for large sprites that all characters should be able to walk over.

For your mapping images, you'd end up using different pages, each page using the same graphic, but a different Z-Index.  Then you can change pages when the player is on one "Level" and a different page when they are on a different "Level".  This allows the player to both move behind the terrain, and on top of the terrain on the same map.  I built a map a long time ago that does exactly what youre talking about by using Events for the Map Tiles the player can both move behind and on top of on the same map.  The map is available in my "collection".  Link is in my signature.

Adding new Priorities in the Editor tho isnt possible, which is why I had to resort to doing things like using specific Comments to achieve similar functionality. 

\force_z[63] makes small characters have a Z-Index used on taller characters so they render correctly, while \flat is very useful, especially for the graphic in 199-Support07 which looks like it shoudl be flat on the ground.  If youre really feeling froggy, you could hop to making a script based on Modular Passable (which preserves script compatability) and can achieve many of the goals you want, if what exists is not good enough.

PS, you can walk under and over my bridges as well.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

schmoggi

June 06, 2015, 06:42:29 am #6 Last Edit: June 06, 2015, 07:11:48 am by schmoggi
Hello everyone!

Great to see some of best Scripters participating on this Discussion :).

Quote from: Heretic86 on June 06, 2015, 04:25:58 am
For your mapping images, you'd end up using different pages, each page using the same graphic, but a different Z-Index.  Then you can change pages when the player is on one "Level" and a different page when they are on a different "Level".  This allows the player to both move behind the terrain, and on top of the terrain on the same map.  I built a map a long time ago that does exactly what youre talking about by using Events for the Map Tiles the player can both move behind and on top of on the same map.  The map is available in my "collection".  Link is in my signature.


Yes, and here we would get our first Problem(s). The Events on the lower Z level are also effected from the Event Page switch! Lets take my first Image from above where we have Aluxes and the blue NPC Knight next to him. Lets assume the upper cliff Tiles are Events with the specific Tile Sprite. On Page one we have the Tile Graphic with the Passage Settings from the second Line with the Cliff Tiles from the Tileset Picure. This one:



That makes sure, our Player can walk under those Tiles and is displayed under it. Now, Aluxes changes his Z Level to 2 when going up the Stairs. By that, he activates the Event Page switch for that Cliff Tiles. Now the second Page is active and the Tile Graphic on Page 2 looks the same, but is the other one from the Tileset (duplicated) with different Passage settings. In this Case, the first Line of the Cliff Tiles from the Tileset Picture (Priority 0 etc.). This one:



So that, again, makes sure that our Player Aluxes can now walk over those Cliff Tiles and is displayed above them. That is completely fine but we now have a Problem here i already mentioned in my first Post. It only considers Aluxes, the Player! What about our NPC next to him? As long as Aluxes stays on the Ground, it would be fine (considering there is no other NPC on the Cliffs above). But as soon as Aluxes changes his Z Level higher, the Events with Tile Graphic switch Pages and have different Passage Settings. The NPC now can not longer walk under those Cliff Tiles. Your NPC's on Event Tiles are, sadly, no great help anymore in situations like this. You could make the NPC's walk under it with the help of the\event_through commands and so on but that would also make it possible, that NPC's can magically walk on a higher z Level, in this case where the Player stands.

Thats actually what my point is all about. I could easily make it possible for the Player(!) without any fancy Script to walk over Cliff Tiles and under Cliff Tiles on the same Map by using duplicated Tiles in the Tileset with different Passage and Priority Settings and Events. But, like said, only for the Player (and of course for Events too with the Help of Heretics NPCs on Event Tiles Script). But this Solution does not consider other NPC's on different(!) Z Levels because it checks only Passage Settings, Priorites etc. on Tiles that are active in the actual Moment.
And, we have a dozen of Events, specially in bigger Maps, for showing Cliff Tiles. Would be better, it could be done jstu through Mapping. So in short, we need the Possibility to allow NPC's and the Player to take different Passage Settings, Priorities etc. in consideration when actually checking that stuff, based on their Z Level Variable. In pseudo Coding it would look like:

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

Now depending on the solution (Z Terrain Tag or Height Map) the Condition would look like:

Z Terrain Tag:
- Check if Tile has a Z Terrain Tag
 - Yes
    - Check if Player/Event Z Level is same as Cliff Tile Z Terrain Tag
       - Yes
          take Passage Setting and Priority from the Cliff Tile id xx in consideration
       - No
          take Passage Setting and Priority from the Cliff Tile id yy in consideration
 - No
   Do nothing

or

Height Map
- Check which Color the Tile Position has on the Height Map
 - Blue
   take Passage Setting and Priority from the Cliff Tile id xx in consideration
 - Red
   take Passage Setting and Priority from the Cliff Tile id yy in consideration
 - No Color
   Do nothing

Furthermore, the Tiles with Z Terrain Tags or Tiles (in a specific Mapping Layer) on a Position the Height Maps Color is indicating have to be drawn in different Sprite_z Values so Events and the Player are drawn correctly (below or above, based on their Z level) because they are changing their Sprite_z Value too when changing their Z level Variable.

Quote from: Heretic86 on June 06, 2015, 04:25:58 am
Adding new Priorities in the Editor tho isnt possible, which is why I had to resort to doing things like using specific Comments to achieve similar functionality.  


Yeah .. like KK20 also said, the "more Priorites" Idea is a bad and not needed Iead, i realized that too. Changing the sprite_z Value is the right thing here.

greetz

Heretic86

You've definitely got some fantastic ideas, but Im not able to write the scripts that youre looking for.  I dont have enough free time any more.  Using Modular Passable as a framework will get you started in the right direction, but beyond that, lack of time will hold me back tremendously.  I have other scripts planned, such as Modular Passable Damage Tiles and Platforms, but cant even work on those either.  Just be creative in your mapping and people will interpret similar effects as being quite neat.  One thing to do is focus on the Player Character.  People will hardly notice if NPCs can or can not move on Tile Layers, but will notice when the Player can walk on top of and below on those different layers.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

schmoggi

Of course, neither did i demand that you code that thing ;). I also think, your Modular Passable is a great Base to start. Real Elevation in a RPG Maker Game which affects the Player and other Events at the same Time is one of my Dreams. It would open so much possibilites and give more depth in Gameplay Techniques and Concepts, i hope i can see that Day happenings sometime. Maybe with the new RPG Maker coming or with the Help of some smart Scripters with enough Time and Motivation to code that stuff. After all, we are in the Script Request Section :). I guess, i will also look on other Boards for some Help, maybe i'm lucky. And if not, i guess i'll just have to stick to the Player only Solution or work somethingt out that comes near to what i imagine with the possibilties your Modular Passable Scripts offer.

greetz