Forum rules - please read before posting.

[Bug] Sorting map breaking after "change sorting layer" action

edited October 2017 in Engine development
I set up a sorting map which affected the sprite's order in layer, and configured the player and an NPC to follow it. Then I ran an actionlist to make the NPC follow the player. So far so good. When both characters walk up and down the y axis and overtake each other, I can see micro-adjustments being made to the z axis so that they are rendered correctly in front of each other depending on where they are, despite having the same sorting layer and order.

The issue happens when I use a "change rendering -> sorting type -> sorting layer -> new layer" action on a character. The sorting map immediately stops affecting the character who changed layers - the order in layer doesn't change anymore, and I stop seeing the z axis micro-adjustments as well. Strangely, the character scale is still affected as normal. This continues to happen even if I change the character back to the original layer, or even when I use the action to "change" the layer to the same layer the character is in (i.e. there's no actual layer change, but it still breaks).

I'm inclined to believe this is a bug, but I'm wondering if I'm just doing something wrong?

Comments

  • That's to be expected.  The Character: Change rendering Action is used to lock a rendering aspect in place.  The Action you're using locks the sprite's Sorting Layer, meaning it won't be affected by the Sorting Map layer options, micro-adjustments included.

    It doesn't, however, lock the scale options - which is why the scale still changes.  If you want to lock the scale, the same Action can be used to Set (or lock) to a particular value.

    If you want to have the character "return" to use the Sorting Map for rendering, then use another Character: Change rendering Action to set the Sorting value to Release - which basically unlocks it again.

    What it is you're expecting / trying to achieve?  Is this due to the Sorting Map affecting Order In Layer, while you're locking it to a particular Sorting Layer?
  • edited October 2017
    Thanks, Chris! I didn't realize the action locked the rendering aspect (though I should have guessed, since there's a release option...). But yes, the issue was that the Sorting Map was affecting Order In Layer when I had only locked it to a Sorting Layer. Chaining it with a release action has solved the problem.

    I'm making a onion-like side-scroller with several layers on top of each other (street, garden, interior front, interior back, etc). While walking along the street, the player can click on a house's front gate. This will change (1) the character's sorting layer, and (2) the camera's culling mask to hide the gate and the front wall. Then the player can walk within the garden, click on the front door, and another layer will be "peeled": the walls of the house will disappear, allowing the player to wander inside, all with little to no change to the y axis. That's why I needed to be able to change sorting layers as the player went deeper into the house. This would actually work without a sorting map at all, except when the player character and her NPC companion need to climb a flight of stairs. It only looks right when the z micro-adjustments are on.
  • This reminds me: to accomplish all of this, I make use of a lot of different cameras with different culling mask settings (I'm using a script to copy them over to the main camera). It would be really helpful if you could expand a Hotspot's "Limit to camera" setting to take an integer and allow you to pick however many cameras you wanted.
  • That would unfortunately create a lot of upgrade notes for users.  Could you elaborate on the need for that?  I'm not sure how culling masks etc come into it - it's a visual problem so any screenshots you can share would be appreciated.
  • edited October 2017
    It's okay, if it's a big problem I can do without, it'd only streamline things a lot for me.

    It's not a visual problem. Culling masks aren't directly related to what I was asking, I was just explaining how I use them to basically create a scene within a scene - I have the outside of a building sitting perfectly on top of the interior, and I make the façade fade out by crossfading cameras with different culling masks when the player enters it. And then I limit player interaction with exterior and interior hotspots, depending on where they are, by limiting the hotspots to the exterior or interior camera (so they can't talk to an NPC outside the building while inside, for example).

    Sometimes I need to use more than one interior and exterior camera, though. So if I have two interior cameras that I use at different moments, right now I have to duplicate all the interior hotspots and limit them to each interior camera. I also have to remember to duplicate all my hotspot actions so the set of duplicate hotspots are always the same. It's doable, but a bit cumbersome, and could be easily solved by allowing me to limit a hotspot to several cameras instead of just one (like you can do in the Limit Visibility to Camera script, for example).
  • This is what I mean:

    Managing hotspots in this scenario would be easier if I could limit them to more than one camera.
  • edited October 2017
    I see.  Smart use of culling masks.

    While I stand by my previous comment re: upgrading, I agree that you shouldn't have to go about creating multiple instances of the same Hotspot.

    This could be solved by dynamically altering the "Limit to camera" field through script - and hooking into the OnSwitchCamera custom event.

    I've gone and written a script to the AC wiki: http://adventure-creator.wikia.com/wiki/Limiting_a_Hotspot_to_multiple_cameras
  • Perfect! Thanks, Chris, this will be very useful. I really appreciate it.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.