microsecond-accurate timing on Windows

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: microsecond-accurate timing on Windows

Post by diep »

mar wrote:
diep wrote: Are you sure about timeGetTime()?

It has 100% same behaviour like GetTickCount() here.
[snip]
That looks strange indeed. I see you even removed Sleep.
May I ask what hardware and OS are you using?

What bothers me are the first two lines of your output
diep wrote: delta = 1 totalreads = 6731
delta = 35 totalreads = 6732
I tried other numbers but that doesn't do much. Delta is 35 and 40 when initialize it to 5 milliseconds. However the total number of reads goes up bigtime then. It starts at 263142 in this run for example.

If i run same exe again it starts at 138485
then 231727, 135972, 229838 etc

It's not deterministic of course :)

Why not build OpenGL code like others do it?
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: microsecond-accurate timing on Windows

Post by mar »

diep wrote:hi, I tested it at windows vista ultimate. installed at dual opteron dual core 2.4Ghz which is my development machine currently, though i intend to switch to one of the newer Xeon systems i have here.

So most important thing: 2 cpu system. That it's opteron or one of the many Xeon systems here of cluster is not so relevant. Same problem.
Hi, that's a strange. I just tested on a quad running Windows 7 Professional (32-bit) and got same results as on XP...
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: microsecond-accurate timing on Windows

Post by mar »

diep wrote: Why not build OpenGL code like others do it?
And that would be? :) id software guys use timeBeginPeriod(1) and timeEndPeriod(1) too. They are to game industry what you or Bob or others are to computer chess.
If it's good enough for them it's good enough for my simple app too :)
timeBeginPeriod, if it works, also affects Sleep() granularity and timed waits. So when i use Sleep(1) after timeBeginPeriod(1), i get a sleep for 1 or 2 msec. If I don't, Sleep(1 or 2 or whatever less than 10 or 15)
will sleep for 15 msec.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: microsecond-accurate timing on Windows

Post by diep »

mar wrote:
diep wrote:hi, I tested it at windows vista ultimate. installed at dual opteron dual core 2.4Ghz which is my development machine currently, though i intend to switch to one of the newer Xeon systems i have here.

So most important thing: 2 cpu system. That it's opteron or one of the many Xeon systems here of cluster is not so relevant. Same problem.
Hi, that's a strange. I just tested on a quad running Windows 7 Professional (32-bit) and got same results as on XP...
You mean you tested at a single CPU having 4 cores.

I have 2 CPU's inside. Whether that's 2, 4, 8 or 16 cores doesn't matter.

Do you understand the difference?
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: microsecond-accurate timing on Windows

Post by diep »

mar wrote:
diep wrote: Why not build OpenGL code like others do it?
And that would be? :) id software guys use timeBeginPeriod(1) and timeEndPeriod(1) too. They are to game industry what you or Bob or others are to computer chess.
If it's good enough for them it's good enough for my simple app too :)
timeBeginPeriod, if it works, also affects Sleep() granularity and timed waits. So when i use Sleep(1) after timeBeginPeriod(1), i get a sleep for 1 or 2 msec. If I don't, Sleep(1 or 2 or whatever less than 10 or 15)
will sleep for 15 msec.
You are overestimating the Game Industry. Most hire very bad programmers to get their 3d stuff done; guys who have algorithmic little clue but all share they want to work for very small salaries. $60k a year is not uncommon, whereas other programmers, even here in The Netherlands who do well they're closer to 100k euro which including pension is $150k a year, than to $60k a year; it goes so far that even some major gaming companies simply buy in 3d engines from other companies as they simply do not know how to produce a 3d engine themselves.

We have our own 3d engine here by the way... (OpenGL)

Though a tad outdated by nowadays standards it's still better than those some games use that sell or sold bigtime... ..it's all about the graphics anyway.

Graphics is 99% of the work, not the game engine.

Game engine is just 1 programmer, no matter what platform.

Most of those game engines are from algorithmic viewpoint seen pretty bad. Basically they let bandwidth in the GPU solve their problem.

Simple examples are that one first has to sort its graphics objects, that speeds up things exponential in some cases. Not many do it...

Anyway, the gpu's are so much superior to what the graphics artists are capable of designing anyway - hardware is far ahead of the software anyway.

Note it's always a mystery to me how some game companies manage to survive. Yesterday i checked Blizzard software. Statement when i googled from bloomberg was turnover of Q1 of 500+ million dollar in 2011.

Yet in 2011 basically only Diablo3 released.

Cost $60 a piece. What wouldbe blizzards profit on that? Maybe $25 maybe $30? Not that much more. The shops want big profit!

$30 * 6.3 million copies sold from diablo3 is under $200 million.

If we compare that 200 million dollar with the 2 billion turnover there is a big gap, even if i'm afew factors off. Because basically no other game theirs sold that well AFAIK, though i could be mistaken. There is a huge gap between income of the company and published sales...

Would it be all government subsidy?

They claim 4500 employees or so. Probably that's creative counted as usual - but even then. A game like that, person or 20-60, from which majority graphics designers, that is the max.. So the rest is probably subsidized.

They seem to have 3 big titles. So that's under 200 employees what you need.

Most of the chessprogrammers from 90s are really a lot better than anyone i ever met in the game industry. As for the new guys with engines nowadays - i haven't seen anyone of them invent something new past years so can't judge there, yet i do realize they didn't invent anything new; this whereas todays hardware really allows inventing new algorithms. Most seem to copy from another guy and creatively rewrite existing code and then claim it's theirs. That's easy to do.
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: microsecond-accurate timing on Windows

Post by mar »

diep wrote: You mean you tested at a single CPU having 4 cores.

I have 2 CPU's inside. Whether that's 2, 4, 8 or 16 cores doesn't matter.

Do you understand the difference?
Yes I guess I misunderstood. I don't have access to multi-CPU machine.
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: microsecond-accurate timing on Windows

Post by mar »

diep wrote: You are overestimating the Game Industry. Most hire very bad programmers to get their 3d stuff done; guys who have algorithmic little clue but all share they want to work for very small salaries. $60k a year is not uncommon, whereas other programmers, even here in The Netherlands who do well they're closer to 100k euro which including pension is $150k a year, than to $60k a year; it goes so far that even some major gaming companies simply buy in 3d engines from other companies as they simply do not know how to produce a 3d engine themselves.

We have our own 3d engine here by the way... (OpenGL)

Though a tad outdated by nowadays standards it's still better than those some games use that sell or sold bigtime... ..it's all about the graphics anyway.

Graphics is 99% of the work, not the game engine.

Game engine is just 1 programmer, no matter what platform.

Most of those game engines are from algorithmic viewpoint seen pretty bad. Basically they let bandwidth in the GPU solve their problem.

Simple examples are that one first has to sort its graphics objects, that speeds up things exponential in some cases. Not many do it...

Anyway, the gpu's are so much superior to what the graphics artists are capable of designing anyway - hardware is far ahead of the software anyway.

Note it's always a mystery to me how some game companies manage to survive. Yesterday i checked Blizzard software. Statement when i googled from bloomberg was turnover of Q1 of 500+ million dollar in 2011.

Yet in 2011 basically only Diablo3 released.

Cost $60 a piece. What wouldbe blizzards profit on that? Maybe $25 maybe $30? Not that much more. The shops want big profit!

$30 * 6.3 million copies sold from diablo3 is under $200 million.

If we compare that 200 million dollar with the 2 billion turnover there is a big gap, even if i'm afew factors off. Because basically no other game theirs sold that well AFAIK, though i could be mistaken. There is a huge gap between income of the company and published sales...

Would it be all government subsidy?

They claim 4500 employees or so. Probably that's creative counted as usual - but even then. A game like that, person or 20-60, from which majority graphics designers, that is the max.. So the rest is probably subsidized.

They seem to have 3 big titles. So that's under 200 employees what you need.

Most of the chessprogrammers from 90s are really a lot better than anyone i ever met in the game industry. As for the new guys with engines nowadays - i haven't seen anyone of them invent something new past years so can't judge there, yet i do realize they didn't invent anything new; this whereas todays hardware really allows inventing new algorithms. Most seem to copy from another guy and creatively rewrite existing code and then claim it's theirs. That's easy to do.
I basically agree that nowadays it's a big mess. Most use existing engines.
But I think you underestimate game industry. I was of course talking about nineties when there was a boom. No GPUs, just a single core CPU at 75MHz, FPU was very slow at that time, no SIMD either, no MMX. I was referring to guys who wrote the first DOS quake, that's 1996.
The first game to have precomputed visibility, precomputed lighting (now outdated lightmaps), dynamically offset world geometry to reduce collision detection to raycasting, a game which ran at playable rates using software rasterizer with adaptive perspective correction on early Pentiums. So certainly i wasn't talking about copy-paste guys or noobs.
A game engine is not only about graphics, that's just a tiny fraction of what it has to do. Collisions and physics, sounds, networking, scripting, game logic + AI and pathfinding, persistent game state and of course rendering (geometry LOD, visibility, lighting, shadows, particle systems, skeletal animations and inverse kinematics, GUI, some stream huge texture to cover the geometry) and editing tools. Some have to do realtime content streaming and today writing for multiple cores is a must. And everything has to be optimized to the maximum. And everything has to run on multiple systems so portability is also a must.
There's algorithmically so much more to it that a chess engine compared to it looks like a toy.
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: microsecond-accurate timing on Windows

Post by mar »

As for Blizzard, I think you forgot World of Warcraft which I believe does a fair portion of income.
Developing a game costs a lot and AAA titles take around 4 years or more to complete. And the same money goes into marketing, I believe it's 50% development costs and 50% marketing these days.
Hard to say how much the developers get. But there are also online sales where they get much more than a fraction of the retail price you mentioned.
Many good companies went bankrupt (for example my all time favorite Looking Glass Studios). It's a tough business for sure. A fight for survival. One mistake and it's all over.
What I don't like about today's games is that it's 100% effect, 0% gameplay. Remember good old Space invaders? 8-bit games where idea was worth much more than tons of graphics? 6-pixels guys floating around... Today it's more like Hollywood movies, unfortunately.
I guess that's why indie games gain more and more popularity (back to the roots).
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: microsecond-accurate timing on Windows

Post by diep »

Even though i'm at liberty to quote names here, i was not too long ago negotiating for a job at a big gaming company. After some talking i very quickly figured out there that this huge major company that everyone knows basically had no job for me that is of any interest. The salary they offered also was just a joke. Not even serious salary for a senior engineer let alone someone with 100 IQ points more. About 50% less than normal senior engineers in software make in Netherlands actually. I soon found out why.

They don't have their own 3d engine though they will never admit this when selling their products. Now i'm not here to throw mudd at them, you wouldn't even believe it i guess. This was a billion dollar company you know...

Yet fact is they pay idiotic salary and get back guys who are not so very well for that. This is how they run their billion dollar companies and somehow get away with it.

So it's not just the fact they buy in elsewhere, which is simply a decision you can make; there is simply no culture of hiring any good people as well.

The persons who have these huge employers at their CV/resume - i would never hire them - they have no idea how to produce high quality bugfree software you know - they're used only to work with total idiots.

Vincent
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: microsecond-accurate timing on Windows

Post by diep »

mar wrote:As for Blizzard, I think you forgot World of Warcraft which I believe does a fair portion of income.
Developing a game costs a lot and AAA titles take around 4 years or more to complete. And the same money goes into marketing, I believe it's 50% development costs and 50% marketing these days.
Hard to say how much the developers get. But there are also online sales where they get much more than a fraction of the retail price you mentioned.
Many good companies went bankrupt (for example my all time favorite Looking Glass Studios). It's a tough business for sure. A fight for survival. One mistake and it's all over.
What I don't like about today's games is that it's 100% effect, 0% gameplay. Remember good old Space invaders? 8-bit games where idea was worth much more than tons of graphics? 6-pixels guys floating around... Today it's more like Hollywood movies, unfortunately.
I guess that's why indie games gain more and more popularity (back to the roots).
Yes as i mentionned they have 3 big titles. The other titles yo udon't need to look at as that's peanuts. Yet WoW tehre is not salesnumbers. "10 million subscribers" is all they mention. That's going to be a creative counted number as well as it'll include lots who just subscribed for a month for $15.

If you do the most optimistic scenario that most paid a $42 subscription on average, which probably is already factors too optimistic, then you get to $420 million.

Now we can be sure that's going to be factors too much.

Learn me something about game industry - bragging to the sky about any small thing and multiply your number of users by 10 if not 100, that's how it works there.

Even if we use for sure numbers that ain't true, It doesn't add up to 2 billion you know...

Note there is very much confusing numbers. The wikipedia they maintain they speak about 10 million online users. At their yearreport 2011 they speak about 50 million users 'active online in december 2011'.

They keep spreading mudd those game companies and always will, yet the numbers don't make sense.

Also it seems their annual turnover was less than i had calculated based upon their quarter reports. I had calculated 2 billion. It appears to be 1.6 billion over 2011.

Basically i would say they do a lousy bad job of objectively informing the market on their actual results, which they legally are obliged to.

Yet it tells enough about how those game companies work...

Claim is 30.3% profit margin of the 1.6 billion, which i also find very little, as producing games costs basically near nothing, just salary and some dirt cheap computers, and they pay their employees real bad anyway :)

probably also have an expensive building :)

Note that the subscirption fees only are valid for USA. To subscribe from elsewhere on this planet, especially the many users in Asia, they pay like just a small part of what we would need to pay as a subscription fee...