I've recently applied the use of GageTimer in my game loop but now it runs slightly incorrectly with my code when it used to use System.currentTimeMilllis();

I already know about the need for sleepUntil() and all that, but i'm looking for the correct method of getting a millisecond value to update all game objects that will apply no matter what value the AdvancedTimer.getTicksPerSecond() is.

The reason for having: A firewall

Independance day, the aliens were destroyed because a computer was used to access their network and disable key systems. If they had had a firewall, the earth would be another worthless rock just floating in space

Not quite, whilst i can see how it can work, i can't see where to get the millisecond difference between each cycle of the loop to update the graphics. Whilst you have showGraphics() there is no value being passed and so although it does help a little, it doesn't quite do what i need it to.

The reason for having: A firewall

Independance day, the aliens were destroyed because a computer was used to access their network and disable key systems. If they had had a firewall, the earth would be another worthless rock just floating in space

The idea being that the millisecond value it takes to cycle is used to move/animate/process the information.

Now with Timer.dll i get 3579545 ticks per second and so the millisecond value i get is now 0 mainly due to the conversion process, but even fixed it is still too low a value to use as a millisecond value. So, as far as i can see it, i can change my code to take in nano or microsecond timings or find an equation that converts it and determines the best way of making it run at 60fps easily.

The reason for having: A firewall

Independance day, the aliens were destroyed because a computer was used to access their network and disable key systems. If they had had a firewall, the earth would be another worthless rock just floating in space

It would tend to give a zero value because ticks per second is larger than 1000. Ticks in a millisecond can be obtained with:

1 2

//Gets the number of ticks in a millisecondlongtime = timer.getTicksPerSecond() / 1000;

However, I think you actually want:

1

longtime = 1000 / 60;

Which will give you the number of milliseconds in a frame. That will work as long as you're certain that your time won't ever drift. The alternative is to use the milliseconds conversion I posted above, then figure out the difference between lastMillis and currentMillis.

The only problem i had was that the sleeptime being determined was already passed by the timer's ticks so i've used the none drag from http://www.gamelizard.com/JavaGameProgrammingPresentation.htm for the moment as then it's works fine. Seems ok for the moment, things need a little alteration here and there but i'll let you know if i need anymore help. Thanks

The reason for having: A firewall

Independance day, the aliens were destroyed because a computer was used to access their network and disable key systems. If they had had a firewall, the earth would be another worthless rock just floating in space

Ok, it works and there is an interval of a few millisecs but the trouble is that sometimes it is too small (i.e. 0). Either the sleepUntil value is too short or i'm getting the time at the wrong moment. Here's the code.

Independance day, the aliens were destroyed because a computer was used to access their network and disable key systems. If they had had a firewall, the earth would be another worthless rock just floating in space

Ok, it works and there is an interval of a few millisecs but the trouble is that sometimes it is too small (i.e. 0). Either the sleepUntil value is too short or i'm getting the time at the wrong moment. Here's the code.

Independance day, the aliens were destroyed because a computer was used to access their network and disable key systems. If they had had a firewall, the earth would be another worthless rock just floating in space

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org