Syncing Clocks

edited April 2012 in Help request
If you want to keep all your user-created clocks in sync with the core one, you can either ask for no maximized DT for the core clock in the render module config section or set the same maximized DT on your user clock with the orxClock_SetModifier() function.

Does this need to be called every frame, or just on clock creation?

Comments

  • edited April 2012
    Only once. But I have to admit I haven't found a practical use for it so far.
  • edited April 2012
    Our clocks are de-syncing. Would you suggest we remove our maximum DT or use that function to set the same DT on all clocks?
  • edited April 2012
    If I were you I'd cap the DT with the same value everywhere.

    What I meant is that I don't see why clock desync would affect anything in-game. Or at least I haven't encountered not thought of a case where that would matter.
  • edited April 2012
    Clock desync is killing our enemy movement patterns. The enemy waves and boss clock are separate from the main clock, and if they desync, patterns end up overlapping and things like that.
  • edited April 2012
    Obviously I don't know how you wrote your code nor what your clock setup is but what I'm saying is that if your enemy/boss clocks are separate from the core one, it should not matter if they are synced or not.
    The time within a clock is consistent. If two clocks have the same settings, the time between those will also be consistent.
    As you're using your own clocks, I assume you're not using the core clock (if you are, what is then the point?), and in that case I don't see why desync between your clocks and the core one should matter.
  • edited April 2012
    Let me describe the problem to you. We have one user-created clock that runs the enemy waves. However, if the game slows down, that user-created clock does not, and then we have tons of enemies' patterns overlapping. Have you had a problem like that, and do you know how to fix it?
  • edited April 2012
    On my phone, so please excuse a.y mistakes etc.

    I've a few questions: have you considered using the main clock for everything, and simply 'skipping' clock cycles to achieve each various element's appropriate tick rate? Not the nicest answer but seems a "simple" fix if nothing else is available.

    Secondly; if I ever write on this forum with my phone again, please yell at me :D

    Real secondly: are you using a different clock per enemy? Or are the timing issue arising from enemies being spawned by the main clock at 'wrong' time etc?
  • edited April 2012
    As Grey pointed out, do you really need a user clock?

    Let assume you need it, for doing some time stretching for example, all your logic should then be on user clocks and nothing on the core clock, beside orx's internal inputs, rendering, ...

    Lastly, do you know why you have slowdowns? The profiler is there for that exact reasion: letting you know why things slow down and where it happens.

    So no, I never add similar problems, but by simply removing the maximised DT on the core clock, that should remove your problem for the time being.
  • edited April 2012
    OK, will do. By the way, how would I go about pausing the game? I want to pause most of the game and add a pause menu, and I can't think of a good way of doing it.
  • edited April 2012
    In our game, I do this by setting an Orx config property IsInPlay. When I pause the game and create the pause menu, I set IsInPlay == false. When I unpause it, I set IsInPlay == true instead.

    I have functions that are responsible for responding to user input, updating time left in the round, etc. In these, I just check the current value of IsInPlay and don't update if false.
  • edited April 2012
    That's a good option!

    What I did in a recent proto is that I add a new clock (a paused one) to all my game objects (ie. not menu ones) that I remove when un-pausing. By default my objects don't have any clock, so it's easy for me.
    That's also the strategy I used for slowing down projectiles around the player in Mushroom Stew when the time special weapon is activated.
Sign In or Register to comment.