REQUEST - better timing for c2 engine

Discussion and feedback on Construct 2

Post » Mon Dec 29, 2014 9:09 pm

Hello everyone! well, this is my request, please make a better timing for the c2 engine, cause if im going to do a bullet that stop by X time, the bullet will stop in different positions every time i refresh the game. i think its because it have something to do with the fps ( i think)

i already tried with "move Xpixel * dt", Bullet behaivor, Everytick move, a invisible object and when the bullet collision with that invisible object it will stop, i think i tried everything.

thanks!
Image

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338

Post » Mon Dec 29, 2014 9:12 pm

Mind posting a simple capx to illustrate the problem?
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Dec 29, 2014 9:21 pm

its easy, just make a capx with a bullet and when the bullet get to for example X great or equal to 64 make the bullet stop, it will stop yeah, but every time you refresh the game and do the same, the bullet will stop in different places.

i fix the problem in my capx but it took me some time and bunch of events to rewrite the last position of a bullet.
Image

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338

Post » Mon Dec 29, 2014 9:21 pm

IJCT wrote:Hello everyone! well, this is my request, please make a better timing for the c2 engine, cause if im going to do a bullet that stop by X time, the bullet will stop in different positions every time i refresh the game. i think its because it have something to do with the fps ( i think)

i already tried with "move Xpixel * dt", Bullet behaivor, Everytick move, a invisible object and when the bullet collision with that invisible object it will stop, i think i tried everything.

thanks!


Sounds to me your trying to do things directly after run time.
The variable factor would be your computer and what ever it is doing.

Wait till the everything is loaded, and use a click button to fire an object which stops after X time.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Mon Dec 29, 2014 9:27 pm

have to test that!

i always test on phone btw.
Image

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338

Post » Mon Dec 29, 2014 9:56 pm

There we go:

http://goo.gl/gbLQyY

try testing this out! press F, the text show the object.X

its just a bullet and "wait 1 second, bullet disabled"
Image

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338

Post » Mon Dec 29, 2014 10:13 pm

All built in behaviors use dt to keep the game running at the same speed, even when the framerate drops. This is called 'framerate independence': the game speed is independent of the framerate.

The problem is, if too many frames are skipped, moving objects can 'jump' large distances, moving past barriers, or causing different collision patterns with the same scenario.

Often, this can be compensated for by having larger collision areas for objects. It is also possible to use the custom movement plugin to ensure that objects test collisions every X number of pixels they move.

However, in some cases, these steps are not enough. Sometimes, framerate independence will break a game. For example, take a physics puzzle game where the result of the player's actions are required to be constant so that a given playthru can be replayed. Or a gameplay demo that is required to behave consistently no matter what.

In these cases, you basically have to eschew most of C2's built in behaviors, and control movement and collision testing thru per-tick events. The drawback is, the game will run slower if the framerate drops. IIRC, it would also run faster for a user with a high hz monitor.

Pick your poison. ;)
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Dec 29, 2014 10:35 pm

isnt that a problem? cause many games can have low frame rates but object actions move the way it should.
Image

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338

Post » Mon Dec 29, 2014 11:43 pm

This problem is a result in relying on the browsers dt rather than lerping a dt value based on the system clock. Also you create variable dt or fixed variable dt to cope with these issues. C2 however only relies on the browser dt rather than handling it itself.

So there are fixes out there, but we don't have' the ability to set the time step dt.....
that would be nice actually. being able to have a dt script line where we write our own js snippet that sets the dt our own way. That would be a fantastic technical feature.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Tue Dec 30, 2014 12:09 am

I usually just brute force it with a blank subevent, and a system wait action.
Wait however many seconds it takes to go your speed, set xy.

At worst it will look like a frame skip.
Image ImageImage
B
169
S
50
G
173
Posts: 8,313
Reputation: 110,270

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests