Hello Guest

[solved] Best way to do time?

  • 21 Replies
  • 25626 Views
*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: [solved] Best way to do time?
« Reply #15 on: December 04, 2010, 21:51:05 »
Also just so you know, it makes little sense to use a syncMethod Like:
Display.sync(1000).
as this will vary between different Video cards, weather or not a single frame can even be rendered in 1000 fps.
The human eye cant possibly see more than 250, from what I know.

try (for testing purposes) just using Display.sync(60) don't manage any of the delta values yourself. dont make logic changes based on time, but rather use a set value for an expected gamecycle length.
just so you know, Doom3 uses a capped frame rate of 60

so with the example method:
Code: [Select]
  private void update(double delta) {
    shipX += (int)(shipXSpeed * delta);
    shipY += (int)(shipYSpeed * delta);
  }
change it something like:
Code: [Select]
  private void update() {
    shipX += shipXSpee;
    shipY += shipYSpeed;
  }
only adding "Display.sync(60);" into your game loop

and if your ship speeds are not fast enough/slow enough then change them till they are, and keep it at that specific value for each game cycle.

you will probably need to make sure either v_sync is off, also your screen refresh rate needs to be higher than 59hz to be accurate (My first method removes this issue though).

Re: [solved] Best way to do time?
« Reply #16 on: December 04, 2010, 22:36:48 »
Personally, I'd rather use delta; I want computers that can hit 100FPS to be able to use the available computing power, and I think that it's consistently smoother across all systems.  Without the delta, it's choppier in my tests.

I use Display.sync(1000) because without any Display.sync that was what my FPS was hitting.  It doesn't really matter anyway because with Display.sync the highest my FPS can go up to is 120 FPS, even if you were to put >120.  Any arbitrary high value of 120 or higher is fine.  60 seemed to be too choppy, so I'll just use 100.  The problem is that Thread.sleep is chopping more time than is expected of 1ms in Display.sync and the code itself chops time, so 60 is actually 50 or less, etc.  "timeLate" in Display.sync should probably be a higher amount.
cool story, bro

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: [solved] Best way to do time?
« Reply #17 on: December 05, 2010, 22:36:23 »
Something else to think about, if your ever plan on making a multiplayer game.
If using a delta it might be hard to sync up gameplay. You would also have to make sure that the delta is calculated using strictfp, so it performs the same over all systems.

Re: [solved] Best way to do time?
« Reply #18 on: December 17, 2010, 10:16:30 »
I tried all three timers in the benchmark and their overall average is pretty close to each other. So i wonder which one to use when it comes to multiplayer.

And the ship demo had some fps bump that applied to all three timers ;)

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: [solved] Best way to do time?
« Reply #19 on: December 17, 2010, 10:45:25 »
I tried all three timers in the benchmark and their overall average is pretty close to each other. So i wonder which one to use when it comes to multiplayer.

And the ship demo had some fps bump that applied to all three timers ;)

to get real time multiplayer games working in sync, with a decent timer.

I find the a sync timer, with "lock step" style networking to be an easy and effective solution.

*

Offline basil

  • **
  • 81
Re: [solved] Best way to do time?
« Reply #20 on: December 20, 2010, 21:47:35 »
wicked benchmarker btw !  :D

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: [solved] Best way to do time?
« Reply #21 on: December 21, 2010, 01:29:27 »
wicked benchmarker btw !  :D
Thanx basil. Even though it still has a while to go, Im glad its starting to shape up.