Complex Character Scaling (3+ point perspective)

  • #1, by F_KalFriday, 03. March 2017, 03:05 7 years ago
    Here I am, back with another question:
    I'm trying to use the character size property of a way system in a scene with a peculiarity (@Ke4 is laughing already :-P)

    So far I've seen that character size works fine as long as scaling is performed on one axis only. But what happens in a scene like the one attached? What is the right way of doing it?

    My approach was creating two way systems that define different scaling behaviors. When the Characters enters an action area at the center of the scene (crossroad/intersection) where both way systems happen to have the same scale factor defined, loading of the other way system is being triggered.
    The one way system works good for the branch from the far left towards the center and then towards the camera (high pathway), and another one  goes from the center to the winding path down (lower pathway).

    The problem however is that when the action triggers the waysystem alternation, the action that was being performed stops (ie walking) - the character stops in his tracks and you have to click again to make him move. But I'm trying to make it appear as a seamless part of the same scene - Any idea on how to properly solve this?

    Thanks!

    Forum Fan

    107 Posts


  • #2, by darren-beckettFriday, 03. March 2017, 11:31 7 years ago
    I've come accross this issue, and I've always thought that in some instances we would like the size of the character to be based on the closest waypoint, not it's vertical location.
    Obviously the VS team would need to implement this.

    Great Poster

    384 Posts

  • #3, by afrlmeFriday, 03. March 2017, 13:10 7 years ago
    I've come accross this issue, and I've always thought that in some instances we would like the size of the character to be based on the closest waypoint, not it's vertical location.
    Obviously the VS team would need to implement this.

    I think it used to work like that - sort of. It could potentially create bizarre scaling issues depending on how the user sets up their way system paths & scaling which is why we recommend only scaling on y-axis & adding the scaling way points outside of the way border itself. It creates a much smoother scaling experience rather than confusing the engine.

    @F-Kal: the reason it stops (I assume) when you swap to another way system is probably because the engine doesn't know if the destination position/object you previously clicked on can be reached in the new way system without recalculating. When you update the destination target the engine calculates the best route automatically based on the current way system & way points. You could try storing the current destination position/object with Lua script, changing the way system then restoring the destination position/object afterwards. The character would still briefly stop, but they would resume afterwards.

    -- store data
    t_dest =
    {
        dest = game.CurrentCharacter.Destination,
        obj = game.CurrentCharacter.DestinationObject,
        cmd = game.DestinationCommand,
        evt = game.DestinationEvent,
        itm = game.DestinationItem,
        itm_picked = game.DestinationItemPicked
    }

    -- restore data
    game.CurrentCharacter.Destination = t_dest["dest"]
    game.CurrentCharacter.DestinationObject = t_dest["obj"]
    game.DestinationCommand = t_dest["cmd"]
    game.DestinationEvent = t_dest["evt"]
    game.DestinationItem = t_dest["itm"]
    game.DestinationItemPicked = t_dest["itm_picked"]

    P.S: can't guarantee it will work as I just wrote it out from my head & what I see in the data structure on the wiki page without testing it.

    Imperator

    7278 Posts

  • #4, by ke4Friday, 03. March 2017, 17:22 7 years ago
    Yep what's AFRLme suggesting could be the solution. What was i talking about in the PM was some kind of distortion of the character which could be theoretically achieved by the shader effect. Not sure if it's possible to apply shader only on charactet though. Probably not.

    Key Killer

    810 Posts

  • #5, by MachtnixFriday, 03. March 2017, 18:40 7 years ago
    Change to a second smaller character?

    Thread Captain

    1097 Posts

  • #6, by F_KalFriday, 03. March 2017, 21:33 7 years ago
    Thanks people! @AFRLme's script seems to be working smoothly (no perceptible pause in the walk cycle either)!
    @Machtnix's idea would be an option (different character sizes triggered at different parts of the scene) - but this wouldn't had been the smoothest one; and since the waysystem-swap works, I'm optimistic!

    I have stumbled upon a slight issue though regarding action areas:
    action areas are not always triggering (and loooots of crashes when working with them in the editor but I've read that this is because of the wxWidgets); I recreated the scene in case it was corrupt but seems it wasn't related. 

    The character definitely is passing over the region but once in a while it won't trigger. The action areas are a 100px or so apart, and the only actions are @AFRLme's store data, change way system and restore data

    any idea on what might be the case?

    Thanks again!
    -Fotis

    PS. hehehe @ke4, yes indeed; after our discussion I realized that this wouldn't probably work in my case - but I plan another scene where the scene camera is literally inside a TV, so maybe a fisheye+VHS/video-noise shader would work there ("shaders for the sake of shaders" that is) but that's for another time ;-)

    Forum Fan

    107 Posts

  • #7, by afrlmeFriday, 03. March 2017, 23:46 7 years ago
    Action areas are buggy in general, though I thought they were only buggy in the editor? I personally try to avoid them altogether whenever possible. wink

    & nice one for some feedback on the script, had no idea if it would work. Might be a good idea to create some functions for it instead to simplify the usage.

    Imperator

    7278 Posts

  • #8, by F_KalSaturday, 04. March 2017, 02:54 7 years ago
    I replaced the "Change waysystem" actionpart with hopefully its LUA equivalent (game.CurrentScene.SceneCurrentWaySystem=game.CurrentScene.SceneWaySystems["AltWaySystemName"]), put in some checks on the direction of movement, simplified the web-of-waypoints and now it seems that it works seamlessly - I can no longer reproduce  the glitches with the action areas that I had before and the visual results are unexpectedly satisfactory.

    Regarding the script, I've tested walking towards and interacting with scene objects across the two way systems and no problem thus far. I haven't tested inventory items or dialogs however (since I still haven't learned that part) but that's for another day ;-)

    Thanks again!

    Forum Fan

    107 Posts

  • #9, by MachtnixSaturday, 04. March 2017, 18:55 7 years ago
    My English isn't good enough to understand really what this solution is. I wanted a change between way systems months ago also, but there is only one way system for each character on a scene, well? I didn't find out how such a change could work, so I dismissed it. But it is possible to change the character's size with "CharacterScaleFactor" every time, right? I thought I didn't need more than one way system, but action areas the character enters to become bigger or smaller. BTW: the way system is very (VERY!!) sensitive. If there is only one single point without connected lines or two of them too close to each other the whole system crashes or does funny things...

    Thread Captain

    1097 Posts

  • #10, by afrlmeSaturday, 04. March 2017, 19:44 7 years ago
    My English isn't good enough to understand really what this solution is. I wanted a change between way systems months ago also, but there is only one way system for each character on a scene, well? I didn't find out how such a change could work, so I dismissed it. But it is possible to change the character's size with "CharacterScaleFactor" every time, right? I thought I didn't need more than one way system, but action areas the character enters to become bigger or smaller. BTW: the way system is very (VERY!!) sensitive. If there is only one single point without connected lines or two of them too close to each other the whole system crashes or does funny things...
    Yeah, it became even more sensitive after Simon reworked it for game pad support. He had to update the way the way system works, so that characters could also be controlled by keyboard/game pad.

    Things to look out for that will cause issues/crashes are...

    1. stray wayborder polygon points. You have to create a closed off shape, so you can't have loose polygon points or lines inside of the way system that don't form a closed shape.

    2. you can't overlap wayborder polygon shapes/lines.

    3. it's not a good idea to have wayborder polygon shapes too close to another wayborder polygon shape. Think ahead & plan you wayborder shapes & paths carefully before you create them.

    No, you should only need 1 way system per scene unless you have events that affect the layout of the scene, such as doors that can be opened & closed & allow the player to be able to walk through/behind them. Or maybe something in the scene falls over or gets destroyed thus blocking access to part of the scene. & yes, you can probably force scaling of characters by adjusting the scale factor percentage with Lua script.

    Imperator

    7278 Posts

  • #11, by MachtnixSaturday, 04. March 2017, 20:54 7 years ago
    Your three points are right smile Ich did my experiences with them and I agree.

    For my waterfall sound value I requested the position of my character and compare it with a fixed object position. The closer the character the louder the noise.

    If this Lua way system solution doesn't work I would set the character's size depending on the current position he stands. Because I know it works with music and sound I would try it again this way. The only problem ist to arrange hundreds of requests one after another and to decide which size the character must have at a specific (bestimmten) point... wink

    Thread Captain

    1097 Posts