0 Favourites

REQUEST - better timing for c2 engine

  • 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!

  • Mind posting a simple capx to illustrate the problem?

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

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

  • have to test that!

    i always test on phone btw.

  • 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"

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

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

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

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

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

    thats what i did in an interface that scrol down and worked but the problem is that

    if someone is creating a bomb for example that explode in X second it will have that problem.

  • AFAIK it is not possible to do this between frame (like, lets say the 1 second just happen between 2 redraw, you will get the irregularity, that should be lower than the refresh rate), also I would recommand using a timer rather than a wait but that is more so you do not have to remember that wait and is irrelevant (unless the timer is more precise)

    as for the framerate independancy, not only it is important in real time multiplayer, it also prevent having the refresh rate issue (a game running at a V-sync of 60 Hz or 120Hz will run the same, without it, you ahave a frame rate dependent movement that, well, will be twice as fast on a 120 Hz display rather than on the 60Hz one), I'd say if you want perfect accuracy you would have to create a way of placing it exactly where you need it at the last tick.

  • This article pretty much sums up dt, fixed with this algorithm.

    http://blog.sklambert.com/using-time-ba ... implement/

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • For any game with high dependence on collusion checks, I highly recommend the "slowdown" feature.

    It is amazing in terms of compensation on lower frame rates and keeps everything smooth.

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