Skip to main content
GameDev.net gamedev.net
🔒 Locked

API Wars horror - Will it matter?

Started by Veiled Glitch Jul 21, 2013 at 10:34 PM 28 replies 7.5k views
Original Post
Veiled Glitch
Veiled Glitch

Hi guys,

as you know, there is this war called the api wars, which will probably stay there for quite long. When looking at the popular companies now, such as CryTek, Epic Games and so on... Their game engines are focused on DirectX (Direct3D), weather it is because the marketing or because d3d has an advantage I'm still not quite sure off yet.

As a lone developer, or a shy one, I personally use DirectX. I can't exactly remeber why i picked dx, but this may be why:

As I was younger, the way I discovered Game Engines was to find a popular game on Wikipedia, and then read the page, and almost all the games I found used Directx/3D, so I guess that's why I chose it.

I have a small engine myself, which has been through alot, using C++ and Directx, and I have had a great pleasure in programming it, as a hobby. But then I became so worried when I started reading that OpenGL is better because it is portable and sometimes faster, blablabla... And then another one where James Camarack admitted that D3d is faster that OpenGL. But my real worry is, that when going to high school/university, I've read that they use OpenGL, so will I have to relearn it all? Or will it be easy as I'm already familiar with D3d? And how easy is it to convert a D3d project to opengl?

Actually one night I dreamt about this descision, and chose opengl, I think, which scares me happy.png .

So my questions are:

  • Why is Direct3D preferred by the large companies? (Dice, CryTek, Epic Games...)
  • Should I port my engine to OpenGL. (I have no thoughts of making my engine cross-platform)
  • Should I even worry about this? unsure.png
  • How does the future look for DX and OpenGL?
  • What API does PS3 use?
  • Is it normal to dream about API Wars? wacko.png

Well, thank you as always!

PS. My engine is in the signature if you want to know.

PS. I havn't spell checked this, going to do that the next morning.

TheChubu
TheChubu
And then another one where James Camarack admitted that...

roflmao hahahahahahaha That one is saved for posterity.

EDIT: People, "James Camarack" sounds funny. That's all I have to explain about this post. I don't know why people keep upvoting/downvoting it, it just sounds funny, that's all.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"   My journals: dustArtemis ECS framework and 
Aqua Costa
Aqua Costa

Why is Direct3D preferred by the large companies? (Dice, CryTek, Epic Games...)


I'm not sure because I don't work in a large company, but I'll guess that's the API they used in their previous projects and since it works and OpenGL won't give any big advantage why bother switching to OpenGL?

Also I'm guessing that the XBox 360 Direct3D version is more similar to Windows Direct3D than OpenGL is to PS3 OpenGL-based LibGCM.

Or it might just come down to preference...

Should I port my engine to OpenGL. (I have no thoughts of making my engine cross-platform)


Unless you want to learn OpenGL or a new version is released with awesome features that Direct3D doesn't support why waste time that could be used to add a cool new feature to your engine?

Should I even worry about this? unsure.png


No. If you know Direct3D learning OpenGL is really easy.
It's mostly functions with different names that do the same thing. They both use shaders, vertex/index buffers, render targets, etc. The differences are small and it's easy to google the answers.

I would say its like learning Java when you know C#, it mostly works the same way.

How does the future look for DX and OpenGL?


As you can see from the new versions of Direct3D (11.1 and 11.2) the changes are mostly small improvements, nothing revolutionary is being released, and the same goes for OpenGL.
I'm pretty sure we won't see a completely redesigned API update like Direct3D 9 to 10 anytime soon.

What API does PS3 use?


A modified version of OpenGL (more specifically OpenGL ES if I'm not mistaken) called LibGCM, but I never used it. I'll let someone else give more info.

Is it normal to dream about API Wars? wacko.png


You might be wasting more time thinking about it than you should xD

And then another one where James Camarack admitted that...

roflmao hahahahahahaha That one is saved for posterity.

Its a crossover of James Cameron and John Carmack happy.png

Matias Goldberg
Matias Goldberg
Well, luckily there's a great answer already posted regarding GL vs D3D.
And like the article explains, it's a history lesson, and epic failure on OpenGL's part.
Though today Microsoft is pulling some very irritating behaviors lately of having DX 11.1 for Windows 8, and DX 11.2 for Windows 8.1; not to mention their API documentation has became worst on every iteration of the API.
If they keep doing it (and Khronos Group doesn't fall asleep AGAIN) then GL may get a boost once more (but a redesign is needed).


What API does PS3 use?


A modified version of OpenGL (more specifically OpenGL ES if I'm not mistaken) called LibGCM, but I never used it. I'll let someone else give more info.


LibGCM is a library for very low level GPU access. The provided (partial) OpenGL implementation for PS3 built on top of libGCM is very slow and useless, to the point developers just prefer to work with libgcm directly (and it's more flexible btw.)

Is it normal to dream about API Wars? wacko.png

Actually, I dream of some day making a game called API Wars where two transformer-looking robots called Direct3D and OpenGL fight in a match to the death; shooting triangles bullets and recharging their Z Buffers for powerups.
Promit
Promit

There's no war. The only platform where you have a choice is desktop Windows, and on Windows Direct3D works better. End of story, period, full stop. OpenGL might be more convenient for many (including myself) but it does not and never has worked as well as Direct3D. That's why large companies prefer it.

On every other platform, there is no question. Universities teach OpenGL because most of their coursework and most of the professors' experience is derived from Unix/Linux work of questionable quality. Very few universities have graphics courses and education that is up to date with modern interactive computer graphics. (Maybe two dozen reasonably big name schools that I can think of across the US, it's gotten better over the last few years.)

The simple truth of the matter is that OpenGL is a mess. To write good OpenGL code that is high performance and in sync with modern techniques is hard because the resources out there are shitty and the API doesn't try very hard to help. (No, core profiles don't help. Ask me another time.) So beginners end up doing a lot of things that are bad, but they have no way of knowing it's bad or finding someone to point that out. Working in D3D 11 forces you to take exactly one approach that is very well structured, very well documented, and very difficult to get wrong. And moving to OpenGL after that experience is relatively straightforward. The same doesn't tend to apply in reverse.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Promit
Promit

Also if a game company wants to use some obscure new DX function they can call up somebody at Microsoft and have a programmer leased to them until the issue is solved.

I'm sorry, but this world exists only in your mind. A lot of us are annoyed because DX support from Microsoft is the worst it's been in literally decades.


I do not like how Microsoft does business and I am not going to help them any more than I have to. This is no different then the idea of voting with your wallet. If you do not like how they do business then don't support them any more than you have to.

You have a twisted view of the world and it's not healthy. Either you're making Windows/Xbox software or you're not, whether you use DX or GL or a softrast makes no difference to MS. If you don't like being part of the Windows/Xbox ecosystem/cabal/whatever, fine -- but it has absolutely nothing to do with graphics or APIs. It's a religious issue.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Hodgman
Hodgman

PS3 OpenGL-based LibGCM

I wouldn't call GCM "OpenGL-based". It's a procedural C-API, which makes it look a lot more like GL code than D3D code, but it's design is completely different from GL's design. If anything, I'd say it's based on nVidia's internal GeForce7 driver code, stripped down (which they'd then build GL and D3D interfaces on top of).

In any case, Migi0027, there's not much chance you'll ever end up using GCM at this point. You'd only be using it if you got a job at a professional studio who was making PS3 games, and most of them will very soon be making PS4 games instead ;)

There's no war. The only platform where you have a choice is desktop Windows, and on Windows Direct3D works better. End of story

This. Every different platform has it's own "native" graphics API.
If you want to write truly "cross platform" code, you'll have to know: D3D9, D3D11, GL1, GL2, GL3, GL4, GLES, GLES2, WebGL, GX, GCM, GCX, etc, etc, etc...

Simply learning OpenGL is in no way a silver bullet for having "cross platform" code.

With many of the above, you'll also have to make changes to your code not just for each platform, but for different hardware/drivers within a particular platform. e.g. some phones may support a particular texture format, while others don't, etc... or some PC GPUs might support some shader operation, while others' don't.

Why is Direct3D preferred by the large companies?

I prefer it on Windows, because it's more reliable than OpenGL on Windows, due to the fact that most of D3D is implemented by Microsoft, and is thus the same on everyone's PC.
To contrast: GL has no central body that enforces compliance with the specification. On Windows, OpenGL is implemented in the graphics driver, so 3 users with 3 different GPUs/Drivers, might be running three completely different implementations of OpenGL! My code might work fine for one of them, and have bugs for the other two that I've never noticed, because I've never tested my code with their particular driver.


On Mac, OpenGL is mostly implemented by Apple (like how MS implements D3D) -- they've stepped up to enforce compliance with the spec, so this problem doesn't exist as much, so GL is less objectionable on Mac. In any case, GL is your only option on Mac, so all the engine companies that you've quoted do also support GL for their Mac versions.

On Linux, your only choice is OpenGL, but the situation is just as dire as on Windows. There is no central authority (e.g. MS/Apple) to ensure that GL strictly follows the spec, so like on Windows, OpenGL is entirely implemented by your graphics driver. You game might run fine on one driver, and be buggy on another driver. To test your game, you need to test it against every different GPU driver that you want to support... but, if you want to support Linux, it's your only choice to deal with this shitfest.

To sum that up:

Windows - MS does work to ensure D3D is stable. GL is still an option, but with with only each GPU manufacturer supporting it on their own.

MacOS - Apple does work to ensure GL is stable. There is no other option.

Linux - You're on your own with GL or Wine. Plus you've got distros that even refuse to support official nVidia/ATI drivers out of ideology...

Web - It's the wild west, a new frontier! Use Flash, HTML5 Canvas, WebGL, Java, Silverlight, etc at your own risk.

Mobile - You're on your own with GLES. Test every device you want to support to discover their quirks!


So personally, I choose to use D3D on Windows and OpenGL on Mac for stability/ease-of-development, even though it means twice the work inside my low-level renderer library.
Basically, I have to port my code to every different platform that I want to support. I just see this as a fact of life. With OpenGL's inconsistencies (outside of MacOS), I don't like to use it because I'm also forced to port my code within a platform (e.g. supporting different drivers).

That's not to say that GL on Windows is the wrong choice though! It is entirely usable, and certainly a lot of professional Windows games have been released using OpenGL!
I disagree with almost everything marcClintDion said above, except for this bit of truth:

you should choose which ever one feels most natural for you.
If you feel that DX is the better API then use it, otherwise don't, or learn both.


I started with OpenGL because it made sense to me sooner than DX did.

Except I'd say that you should learn both anyway, in the long run!

I did also find GL easier to get started with when I was first learning ;)

Should I port my engine to OpenGL. (I have no thoughts of making my engine cross-platform)

If you want to release it on Mac or Linux, then yes, you'll have to port it. Otherwise, there's no reason to do that work.

But my real worry is, that when going to high school/university, I've read that they use OpenGL, so will I have to relearn it all?

This shouldn't really be a problem. Once you've learnt one graphics API, it's very easy to learn others.
I don't even worry about it any more... as long as I've got a reference manual for a new API, I can start working with it almost immediately.

marcClintDion
marcClintDion
Also if a game company wants to use some obscure new DX function they can call up somebody at Microsoft and have a programmer leased to them until the issue is solved. I'm sorry, but this world exists only in your mind. A lot of us are annoyed because DX support from Microsoft is the worst it's been in literally decades.

Really. This only exists in my mind.... If UbiSoft offers to pay Microsoft for one of their DirectX consulting programmers, you don't think that this will happen?

As for the rest of the insulting things you said to me, I'll respond with the following. Promit, you're an idiot. People like you are the reason sites like this have such bad reputations for being overpopulated with arrogant, condescending, know-it-all, half-wits. You're one of the big-fish in this department.

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.
Promit
Promit

Really. This only exists in my mind.... If UbiSoft offers to pay Microsoft for one of their DirectX consulting programmers, you don't think that this will happen?

"DirectX consulting programmers" -- these people don't even exist. There's not enough people working on the runtime and tools right now, let alone helping OTHER companies. Xbox developers get much more solid support, but that has never translated into consulting services. More like "priority bug fixes".


As for the rest of the insulting things you said to me, I'll respond with the following. Promit, you're an idiot. People like you are the reason sites like this have such bad reputations for being overpopulated with arrogant, condescending, know-it-all, half-wits. You're one of the big-fish in this department.

I've been here for twelve years plus, I've worked for this site, I'm a moderator, I've worked in the industry, and I've worked for Microsoft and NVIDIA. I know exactly what I'm talking about. You can think whatever you want and you can get as angry as you want. I will still be here long after you've run out of fantasy bullshit and I will always be here to call you out on it. The solution is to stop synthesizing posts that have no basis in reality. If you don't like it, you are welcome to leave any time. Until then, deal with it.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Promit
Promit

Ahem. Getting back to the point: Direct3D is great and there is no particular reason to jump away from it. OpenGL mostly works fine too, it's not ideal on Windows but I'm using it and getting by. (Allows me to share a lot of code.) The key point is to understand the underlying concepts and the underlying hardware -- and to some extent the OS and drivers, as well. With those things in hand, the APIs are really nothing more than necessary tools. Switching between them is just a matter of practical hassles, rather than any particular learning curve.

If I were teaching modern interactive graphics to undergraduate students today, I would spend the first few lectures on hardware and math. Those are far more important.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Veiled Glitch
Veiled Glitch

I'm sorry about the "James Camarack" thing. biggrin.png

And I have to thank you again, for clearing things up for me!

Aqua Costa
Aqua Costa

Well, luckily there's a great answer already posted regarding GL vs D3D.
And like the article explains, it's a history lesson, and epic failure on OpenGL's part.
Though today Microsoft is pulling some very irritating behaviors lately of having DX 11.1 for Windows 8, and DX 11.2 for Windows 8.1; not to mention their API documentation has became worst on every iteration of the API.
If they keep doing it (and Khronos Group doesn't fall asleep AGAIN) then GL may get a boost once more (but a redesign is needed).

What API does PS3 use?


A modified version of OpenGL (more specifically OpenGL ES if I'm not mistaken) called LibGCM, but I never used it. I'll let someone else give more info.

LibGCM is a library for very low level GPU access. The provided (partial) OpenGL implementation for PS3 built on top of libGCM is very slow and useless, to the point developers just prefer to work with libgcm directly (and it's more flexible btw.

My bad huh.png That's what I remembered reading in the past, but like I said I never programmed for the PS3.

_the_phantom_
_the_phantom_

My bad huh.png That's what I remembered reading in the past, but like I said I never programmed for the PS3.


At the start of the PS3's life time the fact a OGL|ES implementation existed was jumped on by the 'opengl everywhere!' gang and has since been reported as a fact the PS3 uses OpenGL... alas to this day the misinformation exists and thus this common mistake crops up sad.png
Khatharr
Khatharr
Its a crossover of James Cameron and John Carmack happy.png

Oh dear... We've created a monster...

WITH CHAINSAW POWERED LASER BEAMS!

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
RobTheBloke
RobTheBloke
  • Why is Direct3D preferred by the large companies? (Dice, CryTek, Epic Games...)

It's simpler. There is less variation in the drivers, and the debugging/authoring tools are much stronger.

  • Should I port my engine to OpenGL. (I have no thoughts of making my engine cross-platform)

    Probably not. It won't buy you much.
  • Should I even worry about this? unsure.png

    No.


  • How does the future look for DX and OpenGL?

    Same as always. New features will be added to the GPU. A new version of the API's will be released. Neither are going away any time soon.
  • What API does PS3 use?

    Native calls to the hardware. There is (a really bad) GLES implementation on top of the native calls, but no one uses it.
  • Is it normal to dream about API Wars? wacko.png

    Less so than it used to be. Both api's are pretty much the same save for some syntactic sugar.
RobTheBloke
RobTheBloke

If UbiSoft offers to pay Microsoft for one of their DirectX consulting programmers, you don't think that this will happen?

I'm an engine programmer at Ubisoft. DirectX consulting programmers don't exist. This doesn't happen.

AMD, Intel, Microsoft, and Nvidia, all have their own Field Application Engineers that are available to help optimise CPU/GPU codepaths for your product.
So yes, it can, and absolutely does happen. (although I'm in no way implying that marcClintDion is correct in everything he says obviously!)

NightCreature83
NightCreature83

If UbiSoft offers to pay Microsoft for one of their DirectX consulting programmers, you don't think that this will happen?

I'm an engine programmer at Ubisoft. DirectX consulting programmers don't exist. This doesn't happen.

The only graphics consultants you get in are the AMD and NVidia guys and mostly only if you have a deal with them to do a certain feature for their hardware. And there is a whole lot of nasty that happens with these deals as well as these guys pick their respective rivals driver apart and ask you to do features they know are faster in their implementation just to keep on top of the performance lists if your game is a benchmark game.

Promit
Promit

AMD, Intel, Microsoft, and Nvidia, all have their own Field Application Engineers that are available to help optimise CPU/GPU codepaths for your product.
So yes, it can, and absolutely does happen. (although I'm in no way implying that marcClintDion is correct in everything he says obviously!)

I'm not sure about MS on the Windows side, but this is absolutely the case with the hardware companies, and for Xbox and PS devs too. That's partly what those NVIDIA/AMD splash logos on games are about. And developers DO get paid to support new DirectX versions and features. All the time. Quite a bit of money changed hands when DX11 was released, in order to have some games support it. The payers are simply the people who get the most immediate and concrete benefit from gamers needing the latest DirectX features. That's not Microsoft, it's the IHVs.

What Microsoft has done, historically, is to go out of their way to make DirectX development easy for small and large developers. And they did that very well for a very long time.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
21st Century Moose
21st Century Moose
Also if a game company wants to use some obscure new DX function they can call up somebody at Microsoft and have a programmer leased to them until the issue is solved.

If the drivers for a major hardware company is having problems with a new DirectX API, You can be sure Microsoft will throw money at the problem to make it go away.

OpenGL doesn't have this vastly wealthy champion to ride in and fix problems in a timely fashion.

Valve would disagree with you:

We’ve been working with NVIDIA, AMD, and Intel to improve graphic driver performance on Linux. They have all been great to work with and have been very committed to having engineers on-site working with our engineers, carefully analyzing the data we see. We have had very rapid turnaround on any bugs we find and it has been invaluable to have people who understand the game, the renderer, the driver, and the hardware working alongside us when attacking these performance issues.

(source: http://blogs.valvesoftware.com/linux/faster-zombies/)

Seriously, there is no big MS anti-OpenGL thing going on; according to Alex St John (who should know, and who has been long enough out of MS to be able to say what he wants) the sole reason for D3D was not shenanigans, it was internal conflict: the Windows 95 team wanted OpenGL, the Windows NT team had the license, Microsoft wanted Windows NT to take on competitors in the workstation market, Windows NT needed OpenGL in order to do that, Windows 95 having OpenGL would undermine NT's position, so the NT team didn't let the 95 guys have the license. Without the license the only solution was a new API. (Note that Windows 95 didn't properly get OpenGL until OSR2.)

Believe that or believe it not if you wish; personally it makes more sense to me than MS inventing a new (and almost universally reviled) API just for the hell of it, especially considering that they really needed OpenGL for that workstation market. (If you've ever dealt with MS you'll know that they're fragmented enough to add to the plausability of this story; the fact that they're implementing WebGL in IE11 (admittedly layered on D3D11) is just further evidence.)

Regarding the state of OpenGL, reading issue #9 from the new GL_ARB_buffer_storage extension should give you enough of a feel for exactly what's wrong:

9) What is the meaning of CLIENT_STORAGE_BIT? Is it one of those silly hint things?

DISCUSSION: Unfortunately, yes, it is. For some platforms, such as UMA systems, it's irrelevant and all memory is both server and client accessible. The issue is, that on some platforms and for certain combinations of flags, there may be multiple regions of memory that can satisfy the request (visible to both server and client and coherent to both, for example), but may have substantially different performance characteristics for access from either. This bit essentially serves as a hint to say that that an application will access the store more frequently from the client than from the server. In practice, applications will still get it wrong (like setting it all the time or never setting it at all, for example), implementations will still have to second guess applications and end up full of heuristics to figure out where to put data and gobs of code to move things around based on what applications do, and eventually it'll make no difference whether applications set it or not. But hey, we tried.

This is the kind of thing that makes people trying to seriously use the API wince. D3D has no problems specifying explicit behaviour, and the hardware vendors have to live with it; the end result is that you as a developer get none of that nonsense; when you ask D3D to "give me a dynamic buffer, make it write-only, make it fast" you get a dynamic buffer that's write-only and fast.

You want another example? Did you know that the reason why glGetQueryivARB (GL_QUERY_COUNTER_BITS_ARB) was allowed to return 0 was so that Intel could claim GL1.5 support in hardware that didn't support occlusion queries? This kind of stuff is just nuts.

Yes, you're right about MS's recent model of tying a D3D version to an OS version, which is one thing that could make OpenGL appear a viable option again, provided that the ARB don't screw things up. Again.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.