is it worth updating position every x ms?

Discussion and feedback on Construct 2

Post » Sat Jun 11, 2016 1:58 am

Yo,

Do you guys think it is worth it having different objects positions being updated every x milliseconds? Did it gave any of you better performance?
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 » Sat Jun 11, 2016 2:29 am

It can, and does in instances where you have LOADS of objects updating position - particularly container objects (or shadow caster).

It can also reduce the fluidity of motion though, and make it "feel" janky even though it's not janky. Also be aware that there is a minimum time for a tick to process (I think it's 0.16 seconds) so setting your timer to less than that means it's running the same as "every tick".

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Sat Jun 11, 2016 1:56 pm

SoldjahBoy wrote:It can, and does in instances where you have LOADS of objects updating position - particularly container objects (or shadow caster).

It can also reduce the fluidity of motion though, and make it "feel" janky even though it's not janky. Also be aware that there is a minimum time for a tick to process (I think it's 0.16 seconds) so setting your timer to less than that means it's running the same as "every tick".

~Sol


Thanks. Yeah, I do notice a stutter, either way thought. I have set every x s between 79ms and 120ms originally. I did ask about position, but actually it was a general question, cause I use that to check distance between player and object and turn physics on and off as well as opacity. Maybe there is a better way. Or maybe some of it isn't even necessary?
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 » Sat Jun 11, 2016 2:46 pm

setting position by x and y coordinates with system expression seems a bit pricey to me. why not use just some movement behaviours to do it? (custom or bullet), i think they're more optimized for performance then setting x and y every z miliseconds.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
42
S
14
G
12
Posts: 624
Reputation: 9,421

Post » Sat Jun 11, 2016 9:48 pm

saiyadjin wrote:setting position by x and y coordinates with system expression seems a bit pricey to me. why not use just some movement behaviours to do it? (custom or bullet), i think they're more optimized for performance then setting x and y every z miliseconds.


Heya, I do use pin if I want object to follow. Now, I really should have be more precised, because I am mostly turning physics on and off as well as set opacity, both depending on the distance from the player, every x ms, however I am not sure if that's necessary ( although my levels have floors, so I'm checking z position of the player based on other events, from which I turn on or of tiles physics).
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 » Sun Jun 12, 2016 8:37 am

so you use pin to make an object follow yours but when it gets on some distance it changes it's physics on and off ?
why not just leave physics on for it? or is the physics for player?

if you can't do it any other way - check every 200ms, that's about 5x a second, seemed to work best for me in my game when i did rotation (360 frames, each 0.2sec instead of each tick for 1°) worked like a charm and saved a lot of processing
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
42
S
14
G
12
Posts: 624
Reputation: 9,421

Post » Sun Jun 12, 2016 5:16 pm

saiyadjin wrote:so you use pin to make an object follow yours but when it gets on some distance it changes it's physics on and off ?
why not just leave physics on for it? or is the physics for player?

if you can't do it any other way - check every 200ms, that's about 5x a second, seemed to work best for me in my game when i did rotation (360 frames, each 0.2sec instead of each tick for 1°) worked like a charm and saved a lot of processing


Cool. That gives me a good idea of how to use it. Thanks.

I ave loads of objects that change opacity depending on the distance as well as objects that change their physics depending on players virtual z position.
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 » Mon Jun 13, 2016 7:58 am

megatronx wrote:
Cool. That gives me a good idea of how to use it. Thanks.

I ave loads of objects that change opacity depending on the distance as well as objects that change their physics depending on players virtual z position.


Opacity can easily be changed to Every 0.1 - 0.2 seconds, you won't notice much difference. Movement/position can be a little bit jumpy if you set it too low. I'm not sure if it would use less performance or not, but you could lerp between postions if you set the poisition as low as every 0.2 seconds. I did that in my multiplayer game for other players since I'm just recieveng their position evey 0.2 seconds, but on your scale with many objects I'm not sure it would be very efficient. Worth a try maybe?
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320


Return to Construct 2 General

Who is online

Users browsing this forum: LaDestitute, MPPlantOfficial, rbailey83 and 35 guests