Feature Suggestion: Edit NPC's May Layer Individually

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Feature Suggestion: Edit NPC's May Layer Individually

Post by sheamkennedy »

EDIT: Aww nuts I posted this in the wrong spot... Sorry.

I'm not sure how hard this would be but was just thinking it would be neat to be able to choose which layer the NPC is parented to in the "Edit NPCs" menu. By default the NPC layer would be the layer which has been defined in the Map Layers menu but if the creator wanted they could choose a different layer easily without writing a script to re-parent particular NPC's to other layers.

Example 1)
This would be useful if I wanted fish NPC's to appear below semi-transparent water tiles but also wanted my hero to ride a boat on top of the water tiles which are shrouded by a tree branch layer all whilst bird NPC's fly overhead.

Example 2)
It would also be cool to see someone use this for having monorail-train NPC's pass over a bridge which the hero is walking under.

I understand this can easily be accomplished in a map-autorun script but think it would be feature which almost everyone would find great uses for and thus would be a great addition to the engine features.
Last edited by sheamkennedy on Fri Sep 15, 2017 6:23 am, edited 1 time in total.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Funny, I was just thinking about that just today,

Yes, we do need to allow moving NPCs/heroes to other map layers. I'm quite interested in allowing each walkabout layer to have its own wallmap and letting you move between different layers automatically when you step on certain tiles.
Is there any need for different walkabout layers to share a passmap instead of having their own? I guess we should allow parenting to a tilemap layer or even other slices instead of a wall/walkabout layer, just for convenience, but we will still need to track which wallmap the NPC is considered to be on.

Actually, you can't currently do this even with a script. You can't reparent an NPC/hero slice to a different layer, for good reason.
I'd like to work on allowing that soon, but everything else I said is probably a way off.
Last edited by TMC on Fri Sep 15, 2017 8:14 am, edited 2 times in total.
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Post by sheamkennedy »

TMC wrote:I'm quite interested in allowing each walkabout layer to have its own wallmap and letting you move between different layers automatically when you step on certain tiles.
Woah I never really considered this. Multi-layer wall mapping would allow for some pretty technical map making! Not only would it allow for the easy creation of stairs, elevators, etc... but it would also give a method of making a winged-hero who could take flight at any time and become airborne at the click of a button and have a new set of walls while the NPCs below continue to use their layers walls. (I suppose this could be done at this point in time but it would be a bit annoying to script because you'd have to use vehicle walls and such).

Specifically I'm thinking how my line-of-sight script could be easily tweaked to allow enemies to see you from high ledges despite there being a wall in between you. The multi-layer mapping would make this easily possible.

I guess these two features sort of go hand in hand but having multiple wall maps in the editor sounds like a large undertaking.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

There would be lots of different things that need to be changed, (e.g. handling the old overhead tile bit), but most of those tasks look like they will be easy. Fairly big project overall.

I think by far the trickest thing is figuring out how the walking connections between layers should work. Likely it should be done with special zones (like one-way walls are). One zone for each map layer, stepping on it shifts you immediately to that layer.

Even trickier is how to do staircases, since they involve walking diagonally, over the course of 2 or 3 tiles. I guess this could be accomplished by changing your Z value rather than actually moving diagonally, but still I don't know how stairs should be defined in the map editor and how the engine should track your progress up and down them. And how to correct the Z value at the top and bottom. Messing with Z will affect airships too. And what if you want a really long staircase? Maybe that would require lots of wallmap layers. Or maybe there could be special zone properties "Slope: walking left/down increases Z by #"
Of course, I did put a stairs script on the wiki and gamelist, and you could still use that one if stairs aren't built into the engine.

You mentioned elevators, but how do you imagine that would work? Sounds like you would still need to script the movement.

But the layer connections can be added at a later time.
Step one is letting you parent NPCs/heroes to other layers. And you can comfortably use zones to get around the lack of multiple wallmaps. (Hmm, I meant to let you give heroes movement and avoidance zones too!) Don't use vehicle walls.

Actually, supporting multiple wallmap layers in a line of sight script could be painful, depending on how you want to do that.
Last edited by TMC on Fri Sep 15, 2017 11:35 am, edited 3 times in total.
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Post by sheamkennedy »

Yeah I figured a step-on zone or NPC would be what triggers the map layer change or there would be a coding function which would allow you or any NPC to change it's layer and thus change which walls affect it.

Ahh yeah I guess handling the z-value makes built-in stairs difficult especially if the creator is using the z-value to accomplish other things. Perhaps stairs should never really be a built-in feature.

For elevators I wasn't meaning they should be a built-in feature. I just think coding an elevator would be easier since you could change the wall-layer using a coding function when the hero or NPC reaches a different floor.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
User avatar
Pepsi Ranger
Liquid Metal Slime
Posts: 1457
Joined: Thu Nov 22, 2007 6:25 am
Location: South Florida

Post by Pepsi Ranger »

Having scripted these switches in elevation a number of times, I can tell you the smartest move, if not the easiest, on an object level (above/below bridges, up/down stairs, in front of/behind fences, etc.) would be to allow optional bits for tiles to have toggled zones and layers, depending on which tags are set. For example:

Tile 0 = blank
Tile 1 = grass
Tile 2 = cliff
Tile 3 = bridge
Tile 4 = statue
Tile 5 = ladder
Tile 6 = alcove

0000000000000
0111111111110
0111133311110
0222533322220
0222533322220
0666533366660
04415333111111
01111333111111x = entrance
0222233322220
0222233322220
0111133311110
0111111111110
0111144411110
0111144411110
0000000000000

In this extremely ugly map of an enclosed valley, we want our hero to reach the statue at the bottom of the map, but to get there, he has to walk under the bridge, climb the ladder, then cross the bridge south. We can do this somewhat easily through step-on NPCs at key choke points to redraw the bridge with a new underfoot layer (or, more realistically, erase the overhead layer the initial bridge belongs to) so that the player can now walk ON the bridge rather than UNDER it.

But with toggles, you can simplify how this works down to a single line of scripting, or no scripting at all.

Note: We should assume that the player can walk under the cliff if he enters the alcove (Zone 3).

With an optional zone assignment, you might have something like this:

Note: Underfoot/Overhead Zone 1 represents standard uses; Underfoot/Overhead Zone 2 represents overlaps and would rarely be needed and is there for precaution.

Layers 0-2 = underfoot layers
Layers 3-4 = overhead layers

Tile 0 = blank
Underfoot Zone 1 = No Zone
Underfoot Zone 2 = No Zone
Overhead Zone 1 = No Zone
Overhead Zone 2 = No Zone

Tile 1 = grass
Underfoot Zone 1 = Zone 1 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 0)
Underfoot Zone 2 = No Zone
Overhead Zone 1 = No Zone
Overhead Zone 2 = No Zone

Tile 2 = cliff
Underfoot Zone 1 = Zone 2 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 1)
Underfoot Zone 2 = No Zone
Overhead Zone 1 = Zone 3 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 3)
Overhead Zone 2 = No Zone

Tile 3 = bridge
Underfoot Zone 1 = Zone 4 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 2)
Underfoot Zone 2 = No Zone
Overhead Zone 1 = Zone 5 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 4)
Overhead Zone 2 = No Zone

Tile 4 = statue
Underfoot Zone 1 = Zone 6 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 1)
Underfoot Zone 2 = No Zone
Overhead Zone 1 = Zone 7 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 3)
Overhead Zone 2 = No Zone

Tile 5 = ladder
Underfoot Zone 1 = Zone 8 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 2)
Underfoot Zone 2 = No Zone
Overhead Zone 1 = Zone 9 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 4)
Overhead Zone 2 = No Zone

Tile 6 = alcove
Underfoot Zone 1 = Zone 3 (always set, active if Tag ## == ON, active if Tag ## == OFF) (default to layer 0)
Underfoot Zone 2 = No Zone
Overhead Zone 1 = No Zone
Overhead Zone 2 = No Zone

So, what we're looking at is an example of setting layers based on active zones.

"Always set" would be the default, and this would mean the zone would always be active, and the assigned layer would remained fixed (unless special scripting demands a different reaction).

"Active if Tag ## = ON" means that if the selected tag is on, then that zone becomes active, and that tile is automatically assigned to that layer.

"Active if Tag ## = OFF" means that if the selected tag is off, then that zone becomes active, and that tile is automatically assigned to that layer.

It should be assumed that a zone would become inactive if the selected tag is in its reversed state (except when the zone is manually drawn--to be explained in a moment).

"Default to layer" would be the layer that the tile would attach to if the zone is active. This does NOT assign zones to the layer, but the defined tile in that zone to that layer.

"No Zone" would cancel all special zone tags for that tile.

We should also assume that zones will still be manually drawn, so if Zone 1 is drawn over portions of the valley grass and alcove, then all tiles within that zone will adhere to the rules of that zone. This will allow the designer to create the map manually as he wants it (basically how zones are done currently), regardless of defined tile attributes (much like we do with hand-drawing wall maps vs. setting default wall maps to tiles). Zones manually drawn should override zones and attributes defined in the tile editor.

On that note, we may want to allow scripts to run on entrance to zones, or each-step within zones, to achieve special actions.

This could be experimented with, of course, but this would simplify the scripting necessary for toggling overhead/underfoot tiles, if not outright eliminate the need for scripting.

Obviously, you would need to backwards compatibility setting for old games, as this could affect how map tiles are drawn.

I realize this isn't perfect, but I think it can move this conversation in an appropriate direction.
Place Obligatory Signature Here
Post Reply