Hmm… Seems I struck a nerve somewhere. Where to start, where to start. We’ll start here:
[i]Love the Lord thy God with all thy heart, soul, and mind
and
Love thy neighbor as thyself
Based on your initial reaction, I’d say you might want to review the second.
[/i]
The Bible also says:
He who keeps his mouth and his tongue keeps himself out of trouble.
as well as
He who rebukes a man will afterward find more favor than he who flatters with his tongue.
Your response to Cas was unprofessional. Plain and simple. Should you not have been rebuked for it? Or are you going to argue that implying (without any evidence) that good, helpful people are incompetent idiots isn’t inflammatory? Any of us would be happy to have an intelligent debate. It does however, require that we act like intelligent people.
I’m sorry to drag religion into this, but it just doesn’t seem right for someone to profess to be a Christian (or is it Jewish? No matter.) and yet attack one of his neighbors at random.
Okay. This is just plain ridiculous. There’s not much I can say against wild assertions like this.
You said yourself that you hadn’t checked. I have. Games will take all the CPU available to them if they can. You can check for yourself sometime. VSyncing is usually the only block point in games.
When a game determines that it doesn’t need 200 milliseconds of processing time,
This is a contrived example. The only reason for yielding a thread instead of sleeping is for the purpose of sub-millisecond accuracy. If you’re going to sleep for 200 ms, you are not writing time critical code.
If you’re interested in books, papers, newsgroups, etc… on the topic, just ask.
No thanks, I’ve read them. On the other hand, if you’d be interested in real world experimentation and results, I’d be happy to share my findings. They’re complete enough to where I wrote an entire timing library around them.
This depends upon your platform, but, definitely, for at least many versions of Windows, the timer tied to System.currentTimeMillis() is nowhere near as accurate as the internal timer used by the thread scheduler. You’ll also probably see much better behavior on a non-DOS operating system like Windows 2000.
I used Windows 2000 as one of my testing platforms. Its ability to time is poor. Unixes are better. MacOSX is probably the best consumer OS for timing.
That would depend upon your target platform wouldn’t it? It seems that would be why the Java API actually provides a nano-second resolution API.
I’m not sure about OSX, but no other consumer OS (i.e. Gaming target) has a sub-millisecond task scheduler. In fact, the Java sources explicitly change any nanosecond request into an extra millisecond.
IIRC, a long time ago, someone posted some code on JavaGaming.org for a timer that was much more accurate based on the thread scheduler, then one based on System.currentTimeMillis(). I don’t remember the relevant platforms at the moment.
The relevant platform was Windows. And it did not produce sub-millisecond timing. It merely provided an approximate timing with a potential drift of 1 to 2 milliseconds for every tick. The reason for its existence is that Win9x platforms are only accurate to 50ms, while the NT line of platforms are only accurate to 10ms. For more info, look up my dissertation on a new Timing algorithm in the Shared Code section.
This would only be true if the game I was running was the sole process executing on my machine - but that’s kind of the whole point of our ongoing discussion here, isn’t it?
It is not true. CPUs are anywhere from a hundred to a thousand fold faster than the memory subsystems that service them. They can (and will) sit in a wait states while that information arrives. Consumer hardware relies heavily on caches to decrease the wait time. Swapping some registers is such a small amount of data that it will most certainly operate out of cache if possible. Of course, the only way to know the real world performance characteristics for sure is to profile!
As an example, pretend I’m running a program to find the next prime number.
It seems silly to run such a processor intensive app while you’re trying to play a video game, but I’ll bite. The program will get near the same amount of CPU time using yields as it would get if the game used sleeps. Why? Because it’s asking for full CPU time as well. That means it will keep running until the scheduler pre-empts it and gives some time to our game which (wait for it) yields its time back to the prime number generator! Cool, huh? ;D
You do want a game to run as close as possible to the refresh rate. If it only takes 50% cpu to do that, then the game should only use up 50% of the cpu.
And how are you going to do that without accurate timing? ???
Can nobody dispute Cas? Cas may be the god of video games (he makes a mean AF, but I’m not convinced yet), but that doesn’t mean he’s an expert in computer architecture and operating systems.
Sounds like a case of jealousy to me. I would suggest Jesse Duplantis’ sermon on “The Green-Eyed Monster Whose Eyes Turned Red”.
For the record, Cas is as human as you or I. That doesn’t mean he deserves to be attacked for stating his educated opinion.
As I see it, you have two choices from here. You can have the humility to calm down and have an intelligent discussion (most welcomed) or you can continue an attack. If you’re going to do the later, please use the private message feature. The rest of JGO doesn’t need to be subjected to a flame war.