[Suggestion] Update to pin object

0 favourites
  • 13 posts
From the Asset Store
Fantasy Game includes more than 600 sound effects inspired by hit computer games like World of Warcraft and Diablo.
  • Would it be possible to update the pin object functionality so when you pin an object to another and you move the parent object, that the child object(pinned object) moves along in the same tick instead of the next one?

  • are you saying that a 1 tick delay is messing up your game??

  • [quote:2actupvp]are you saying that a 1 tick delay is messing up your game??

    I don't really see how that's relevant, whether its 1 tick or 15 ticks? if something happens in 1 tick that screws up things it will screw up things.

    Its more that its not logic I think and I would assume that it could be done in the same tick. Since it must know how far the parent have moved it should be able to move the children that amount as well.

    Here is an example of the problem.

    Which is pretty simple the green square is getting pinned to the blue parent and moved to 250,250. The purple square is then told to move the green child. The result looks like this.

    If you add a wait it works.

    The last screenshot if you remove the wait, is how it should logically work if you ask me, because as mentioned above if it knows how far the parent moved it should know how far to move each children as well. But im just not sure if its actually possible so that's why I ask

    If you change it to go to the parent it works fine.

  • well, it's working as intended actually.

    every tick all values are stored for use.

    and on tick 1, green coordinates are "A". and you're telling purple to go to place A, that is green location for tick 1. Green's stored location is not going to be B until after it has been moved, which won't happen until tick 2.

    what you're asking for is that somehow the games stores all the values in a non-existent tick 0 that happens before the command is even issued.

    what you're doing with the "wait x seconds" actions, is effectively tell the game to wait for tick 1 to finish, at which point green's locations is stored at the destination.

  • nimos100

    Already been asked

    You will just have to use a work around.

  • Wait action is my fav work around

  • [quote:iulvo9u3]what you're doing with the "wait x seconds" actions, is effectively tell the game to wait for tick 1 to finish, at which point green's locations is stored at the destination.

    Yeah I know. However "Pin" is a behaviour so there must be some code behind it, which C2 uses to tell it that this particular object needs to be stuck to another object. So when you use the functionality to move an object to a new location there again must be some code in C2 that does that. If that code got expanded so if the object it tries to move is flagged as being pinned or having objects pinned, it could be possible for it to move all the objects which it involves before finishing the code. My guess is that the functionality that move any object in C2 just take 1 object and move it to wherever it needs to and it do that for each object in turns.

    So when the parent have moved all the children then get flagged as also having to move and it then happens again for each of these. It just happens so fast that it seems like it all happening at the same time. But I don't see why it wouldnt be possible to extend the "C2 move object functionality" to check for this first. But as I don't know how its done and just guessing I hope that Ashley can explain whether it could be done

  • nimos100

    Already been asked

    You will just have to use a work around.

    Im not really sure its the same, It a bit difficult to see I think. Because Ashley writes:

    [quote:3jpifp5g] As you can see from this modified example there is no lag at all if you only use a single pin:.........

    .............The problem comes from using two behaviors at once.......and the second pin updates before the first

    So it sounds like this have to do with two pin behaviours, but this example is only using 1.

  • Wait action is my fav work around

    Im not happy with the Wait solution so that's a no go for me, I don't want to slow down my game on purpose . And have solved it without using wait, so its just that I thought it could be possible and just curious if it could be done, as the work around is just a lot more complicated, than putting in a wait.

  • Same thing. It's an architecture design on how pin and the event sheet works.

    What Ashley mentions is that the behaviours become more noticeable with 2 pins. But there is pin lag and it's in C2 architecture. But by all means if you feel it's a bug. Fill one out.

    The order as I think I understand it is

    EventSheet

    Engine

    Plugins fall in under Engine.

    But you can't inherently change the order of what plugins fire in order.

    So if you end up with

    Weapon.Pin

    Player.platformer

    Then the Weapon.pin position is updated first

    followed by player being updated 1 tick. which will produce a 1 tick delay on pin.

    If you want to avoid the problem either use wait0 or set the object position manually in the ES. But pin intself is limited to the architecture design.

  • [quote:2hjuguqp]What Ashley mentions is that the behaviours become more noticeable with 2 pins. But there is pin lag and it's in C2 architecture. But by all means if you feel it's a bug. Fill one out.

    The order as I think I understand it is

    EventSheet

    Engine

    I don't think its a bug, that's why I added it as a suggestion here. But I see what you mean and think you are correct that its because the Pinned objects is not actually moved before all other actions are done. So guess its not possible unless that got changed and doubt that its going to happen

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • nimos100 just tell the game to wait 1*dt seconds or 0.016 seconds, both are just 1 (ONE) tick worth of waiting. Don't know any human on this planet that can be bothered of having to wait 1/60 of a second for something. do you? xD

  • nimos100 just tell the game to wait 1*dt seconds or 0.016 seconds, both are just 1 (ONE) tick worth of waiting. Don't know any human on this planet that can be bothered of having to wait 1/60 of a second for something. do you? xD

    Yes me

    Just kidding , I agree the problem is not really the wait in it self even if you use a wait of 0.1 its equal to 6 ticks if im not mistaken, so its hardly noticeable, so its not really a problem. The problem is that wait in it self even If it only have a duration of 1 tick can cause problems that can screw up things.

    Here is an example:

    [quote:2lh8k2e3]Repeat 10 times

    ------- Call function("Spawn enemy")

    Function Spawn enemy

    Create enemy()

    Call function ("initialize enemy")

    Function Initialize enemy

    Call function ("Create enemy weapon")

    Function Create enemy weapon

    Create Enemy_weapon

    Then suddenly things starts to go wrong as I see it.

    Because now there are actually two objects that doesn't exist yet, The Enemy and the Weapon that you want it to use. So if you throw in a Wait different places to solve it, It might work. However at the very start we are actually repeating this 10 times, to create 10 enemies which will then create 10 different weapons, so suddenly you might have 20 objects that actually doesn't exist, and then it seems to go wrong. Whether that's completely true im not 100% sure about, but it seems that a function doesn't count as a top level, which I find to be logic if its the case, but I haven't seen anything saying that it ain't which is why im not certain.

    I solved this by implementing an object handler which I use every time you would otherwise use a wait. This completely replaces the need for using waits, except for this problem with behaviours because it runs after all "Events" so in that case it cant solve it. But since I didn't knew that was how C2 handles behaviours, I thought my object handler could just fix it as well, but now that I know how C2 handles behaviours it makes perfect sense that it doesn't work with them. But since I made a work around for that as well, I can or should just be able to do that if I have problems with behaviours again, but I haven't actually had any problems with them except for the pin one, so doubt it will be a huge problem.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)