[Suggestion] Update to pin object

Discussion and feedback on Construct 2

Post » Wed Apr 30, 2014 1:50 pm

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?
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Wed Apr 30, 2014 1:56 pm

are you saying that a 1 tick delay is messing up your game??
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Wed Apr 30, 2014 2:22 pm

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.
Image
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.

Image

If you add a wait it works.
Image

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 :D

If you change it to go to the parent it works fine.
Image
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Wed Apr 30, 2014 2:45 pm

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.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Wed Apr 30, 2014 2:51 pm

@nimos100
Already been asked
viewtopic.php?f=152&t=67260&p=572503&hilit=pin+lag#p572503

You will just have to use a work around.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Wed Apr 30, 2014 2:54 pm

Wait action is my fav work around :D
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

Post » Wed Apr 30, 2014 2:58 pm

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 :)
Last edited by nimos100 on Wed Apr 30, 2014 3:08 pm, edited 1 time in total.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Wed Apr 30, 2014 3:04 pm

jayderyu wrote:@nimos100
Already been asked
viewtopic.php?f=152&t=67260&p=572503&hilit=pin+lag#p572503

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:
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.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Wed Apr 30, 2014 3:06 pm

megatronx wrote:Wait action is my fav work around :D

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 :D. 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.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Wed Apr 30, 2014 3:17 pm

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.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 17 guests