microsecond-accurate timing on Windows

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

wgarvin
Posts: 838
Joined: Thu Jul 05, 2007 5:03 pm
Location: British Columbia, Canada

Re: microsecond-accurate timing on Windows

Post by wgarvin »

mar wrote:
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.
I work as a game engine programmer, and my experience has been that programmers in this industry are as good as anywhere else. The best among them, are as good as the best programmers you'll find anywhere. We're on the cutting edge in many areas (3d graphics techniques evolve so rapidly that programmers specialize in it, and if they stop doing graphics programming for as little as 2 years, they get left behind). Modern games are huge and complicated, containing hundreds of thousands, sometimes millions of assets. 50+ programmer teams and multi-million line codebases are the norm now.

As for Diablo3, Blizzard's profit from box sales of Diablo3 is only part of the picture. It has a real-money auction house, and Blizzard takes a cut from every sale.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: microsecond-accurate timing on Windows

Post by diep »

the moneyhouse is supposed to not deliver much according to some official statements. Also in some of the nations where it would deliver a lot it has been forbidden as it falls under casino law there.

i disagree with your statement - you have no idea how good some of those chessprogrammers are :)

And i've been talking to the biggest game companies on the planet. It's easy to figure out which and when. When i was searching for a game for a 3d engine i also encountered some weird things there in some of the bigger companies.

Yet again - it's all about the graphics design.

If a 3d engine already is doing its job then that's it from business viewpoint - as simple as that. I took one of those decisions myself as well. If the programmer in question knows how to solve it that way and it's sufficient to produce the game - let's do it. The easiest possible decision to take.
If someone is on a salary that's not above that of a senior engineer elsewhere logically you can't expect him to be briliant :)

Yet on every website some of those big games you see benchmarks and those engines have some big weaknesses.

What you refer to with graphics effects is indeed true; yet from computerchess programmers viewpoint seen that's a *requirement*. You refer to that specific graphics effects must be there, as not all 3d engines solve that in the same correct manner (and there is always many ways to do it). I'm speaking of a level higher here from software engineering viewpoint.

That's *after* you have all that, to really low level optimize everything.

Which means in this case that you also try to reduce the bandwidth that the graphics is eating from the CPU cores and the GPU, meanwhile having the same great graphics effect :)

The old fashionned computer chess programmers, majority of which is not posting here, they're a lot better than you guess there at that low level solving of problems.

Now you seem to argue that, but look at it from business viewpoint. There is 0 motivation for the big games to optimize it lower level. What runs ok with all features, is sufficient for them. And if not then produce the game quick and wait for a new graphics card to solve your problem :)

It works that businessapproach. For example adding more cores to cpu's won't help much for most games, more cores for gpu's doesn't either. Just internal bandwidth.

That already selfexplains they're not optimal. If they would be doing better then the cores would catch a bigger load than the bandwidth of the RAM.

Yet they get away with it for basically 1 reason and that's that the hardware is that much better than what the software engineers can program, as a single designer can simply deliver this and that much work a month. 1 head a designer a month is the max, if you want it full featured.

So human designing skill is not only the money limitation of each game it's also the practical limitation to what the GPU's can display.

And i'm sure for next game they'll find something better and greater and manage to sell that :)

Vincent

p.s. in the end it's all about the unwillingness to pay salaries and the hard fact that despite quoting big number of workers in 1st world nations, majority of the work, vaste majority of the work nowadays in game industry, it happens in cheap Asian nations. And no that is not Japan nor Korea :) The workers in the 1st world nations there are simply subsidized biggest part of them. Keep them busy mentality. Do not actual deliver much that can get sold. Especially Ubisoft.
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: The old fashionned computer chess programmers, majority of which is not posting here, they're a lot better than you guess there at that low level solving of problems.
Noone questioned that. But not only chess programmers can optimize at low level.
And AFAIK noone has patent for programming :)
Btw. If your app is crap already at high level then low level optimizations are pointless. And the best optimization is to not calculate something instead of calculating it faster, don't you agree? :)
diep wrote: Now you seem to argue that, but look at it from business viewpoint. There is 0 motivation for the big games to optimize it lower level. What runs ok with all features, is sufficient for them. And if not then produce the game quick and wait for a new graphics card to solve your problem :)
Are you sure? It's very easy to hit the limits and then not even sacred water will help you.
It's not only about code optimization but also about asset optimization. I believe that for example having lower complexity collision meshes would help more than having a slightly faster vector math library.
Of course who says you can't have both :)

And don't forget that most sales are for the consoles (PS3 and 360). So until next-gen consoles come you're much more limited there than on a PC which does usually a fraction of console sales.
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 »

wgarvin wrote:50+ programmer teams and multi-million line codebases are the norm now.
Thanks for the insight, that's really a vast amount of code,
this means that the days when one supergenius did all/most
of the work himself are definitely gone :)
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: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.
Yes I also never was much into CVs and stuff like that. I have seen guys with academic degree who were useless for practical programming but I have also seen very talented guys so it's always individual.
As for bugfree software: there's nothing like that. Less bugs means quality for sure. But no one on the planet writes without any bugs. Of course I can claim I can write bug-free hello world :)
But as the project grows large, no matter how good you are you will ocasionally produce bugs (not necessarily show stoppers).
You can never catch all of them, you would have to simulate each possible scenario which is impossible for a large project.
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: microsecond-accurate timing on Windows

Post by tpetzke »

Yes, unfortunately like Alan Turing showed already 1936 you cannot even proof that an algorithm will terminate, let alone produce always the desired outcome.


Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
== Rich Cook ==


Thomas...
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: The old fashionned computer chess programmers, majority of which is not posting here, they're a lot better than you guess there at that low level solving of problems.
Noone questioned that. But not only chess programmers can optimize at low level.
And AFAIK noone has patent for programming :)
Btw. If your app is crap already at high level then low level optimizations are pointless. And the best optimization is to not calculate something instead of calculating it faster, don't you agree? :)
diep wrote: Now you seem to argue that, but look at it from business viewpoint. There is 0 motivation for the big games to optimize it lower level. What runs ok with all features, is sufficient for them. And if not then produce the game quick and wait for a new graphics card to solve your problem :)
Are you sure? It's very easy to hit the limits and then not even sacred water will help you.
It's not only about code optimization but also about asset optimization. I believe that for example having lower complexity collision meshes would help more than having a slightly faster vector math library.
Of course who says you can't have both :)

And don't forget that most sales are for the consoles (PS3 and 360). So until next-gen consoles come you're much more limited there than on a PC which does usually a fraction of console sales.
Several of those 'top 3d engines' are doing stuff O ( n ^ 2 ) where it can be done O ( n log n ).

That's why they need all that bandwidth.

Which low level optimizations?

They lack many optimizations. The 'low level optimizations' they leave to the graphics cards.
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:
wgarvin wrote:50+ programmer teams and multi-million line codebases are the norm now.
Thanks for the insight, that's really a vast amount of code,
this means that the days when one supergenius did all/most
of the work himself are definitely gone :)
And total BS, the big 3d engines are usually 1 person products from the graphics algorithms viewpoint (we don't speak here about making some glue to connect it to this or that game). At most 1 other guy has optimized it a tad to low level (so not algorithmic but simply adaptation to a different platform).

The big programming is for the scripting and stuff - that's something different from efficient implementation of the chosen the 3d engine algorithms.

But it's not so interesting here. A fool can claim more than 100 experts can answer, we have as a saying here. This is a computerchess programming forum.

There is a huge difference between having an algorithm to let something look cooler than the other guy and trying to implement that specific idea/algorithm in a very efficient manner. Computerchess programmers are world champion in that last.

But well you wouldn't your government have guys worse than that is 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: Several of those 'top 3d engines' are doing stuff O ( n ^ 2 ) where it can be done O ( n log n ).
That's a bold claim. Can you give an example?
diep wrote: A fool can claim more than 100 experts can answer, we have as a saying here.
diep wrote: This is a computerchess programming forum.
Yep. This thread degenerated and is way too off topic already. Feel free to contact the mods to delete it. I'd be fine with that.
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: Several of those 'top 3d engines' are doing stuff O ( n ^ 2 ) where it can be done O ( n log n ).
That's a bold claim. Can you give an example?
diep wrote: A fool can claim more than 100 experts can answer, we have as a saying here.
diep wrote: This is a computerchess programming forum.
Yep. This thread degenerated and is way too off topic already. Feel free to contact the mods to delete it. I'd be fine with that.
Oh you could ask Johan de Koning, didn't he work a few years for ubisoft?

You realize they first have you sign 20 secrecy contracts before you can even deliver for $100 something? In some cases they just talk talk talk and still don't give YOU the contract job but throw it to the cheapest 3d world nation.

However if you analyze yourself the benchmark results of the big games you will see that MAJORITY of games doesn't scale with the number of cores times Ghz.

So that's the simplest form of proof you can find. And very conclusive evidence.

They are total dependant upon the bandwidth to the RAM of the GPU and the bandwidth of the RAM of the CPU.

You can easily verify this yourself.

Also if you open a book on graphics algorithms you'll figure out that it doesn't need to be like that. In the end it's not steering a trillion pixels. It's steering just a few displays with objects inside.

If you draw things in a simple manner, then you obviously need huge bandwidth. If you do it more clever, it'll work great at a GPU from 10 years ago.

Realize however that they focus upon supporting all features in a manner that it works for you. Optimization is simply not the focus, unlike game tree search.

The luxury the game industry has when producing games is that those gpu's deliver effectively several teraflops each.

However if you use a few displays of 2560 * 1600 or something like that you'll realize that it effectively can do with just a bunch of gflop.

So the rest is inefficiency.