Yar

Sign in to follow this  
  • entries
    208
  • comments
    383
  • views
    65546

Screen Shots and more

Sign in to follow this  
H_o_p_s

159 views

On windows 98, Thread.sleep() is poorly accurate (minimum sleep is 50 ms, so Thread.sleep(1, 2, 3...) == Thread.sleep(50) ). The timer gets better on later versions of windows, but still under what we expect off of Linux Solaris, and macs.

http://www.mactech.com/articles/mactech/Vol.14/14.05/WritingJavaCross-Platform/
This links to an article with some help with threads based on the mac. Evidently the biggest thing that is handled differently on the mac is how the threads operate... So I went to work and redid a bunch of the Java2D code, and now with Thread.yield() I can get up to 500FPS, but an average of about 150... not too bad! Now, all I have to do is see if it works on windows better then the last build...

Anyway, screenshots!!




The First one is with 'Smart Render Mode', Second one without it, and the third one is what happens when the FPS is too low.

The reason there is a black bar on the bottom of the first one, is so that when the game isn't refreshing, the FPS and the Load still are. So in order to keep from having to triple buffer, I just blacked out that section... why not? it is only for debugging right?

I'm heading back into VPC to recompile with JSmooth... new demo should be up soon.
Sign in to follow this  


3 Comments


Recommended Comments

Quote:
On windows 98, Thread.sleep() is poorly accurate (minimum sleep is 50 ms, so Thread.sleep(1, 2, 3...) == Thread.sleep(50) ). The timer gets better on later versions of windows, but still under what we expect off of Linux Solaris, and macs.

According to this article:

Operating System System Clock
Windows 95, 98 55 ms
Windows NT, Uniprocessor HAL 10 ms
Windows NT, Multiprocessor HAL 15 ms
Windows NT 4.0 Alpha 7.5 ms


However, by default on Win2K and XP, Sleep takes at least 10 ms. That can be changed with some system call that I don't recall.

Share this comment


Link to comment
Yeah, I gave up on the Thread.sleep() and went with the Thread.yield(). I'm hoping that when I release this next build that it will be running better on more systems. But I must say that changing over to the yield() made a dramatic improvement in speed. The next thing I'm going to do is go through my SpriteCache class and rid of it the Strings that I use for references. Int values should calculate faster than Strings...

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now