Sign in to follow this  

Some questions about API's

This topic is 3740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

DirectX and OpenGL. I have a few questions about these API's. 1.) Which would be better to use? I know it's all in the eye of the beholder, but DirectX is restricted to Windows isn't it? Would OpenGL be a better choice if I wanted to make my game portable? 2.) Should there be a need for me to use DirectX, is there much need to download DirectX 10.0? I have 9.0 and downloaded the SDK while I still had access to high-speed internet. So my question is, does it really matter in terms of performance which I use? 3.) Here's a non-API related question. This game will be a 3D game that will be showing quite possibly tens-hundreds of thousands of polys at a time. Would the performance boost of C++ be worth learning and using it? I ask these questions as I have an idea for a game that will be my first major (and I mean major) project once I've had a lot of practice and experience under my belt (a game for me to aspire to), and I'd like to know where to direct my learning focus. Thanks for your time. ~TDOT>

Share this post


Link to post
Share on other sites
Quote:
Original post by that dude over there
DirectX is restricted to Windows isn't it? Would OpenGL be a better choice if I wanted to make my game portable?


Yes to both

Quote:
Original post by that dude over there
Should there be a need for me to use DirectX, is there much need to download DirectX 10.0?


DX10 is only compatible with Vista and brand new video cards. Unless you want to fool around with the new features it would be better to stick to DX9 or OGL.

Quote:
Original post by that dude over there
This game will be a 3D game that will be showing quite possibly tens-hundreds of thousands of polys at a time. Would the performance boost of C++ be worth learning and using it?


1) Languages do not have a speed.
2) API calls are the same regardless of language.
3) You should be making as few draw calls as possible.
4) Rendering is done by the GPU.

It doesn't matter if you use C++ or something else regardless of how many polygons you're pushing. Use what gets the job done as painlessly as possible(usually not C++).

Share this post


Link to post
Share on other sites
Quote:
Which would be better to use? I know it's all in the eye of the beholder, but DirectX is restricted to Windows isn't it? Would OpenGL be a better choice if I wanted to make my game portable?


Portable to what?

X-Box? PS3? Gameboy? Or just linux?

Quote:
Would the performance boost of C++ be worth learning and using it?


Yes. After about 2 years of intensive C++ study and experience on a given platform.

Add a year more for portable C++ Windows/Linux, and a year on top for other platforms.

Using lower level language will give you more performance once you master the concepts of both, language and platform. Higher level languages give you that out-of-box, and it takes a *lot* of effort to surpass that. Just improving on SC++L is a demanding task.

Share this post


Link to post
Share on other sites
A few things:

-The newest version of the DX SDK still works for DX9, so its generally for the best you download the latest version. It will have improvements to the support classes and the tools (shader compilers, profiler, etc.)

-What I think is the biggest difference between the API's is the fact that Direct3D comes with a fully featured support library, D3DX. It contains classes and functions for vector and matrix math, handling shaders, loading textures, static and skinned meshes, sprites, environment maps, and other useful things. With OpenGL, you'll have have to use third-party libraries or implement a lot of this stuff yourself. IMO, it can greatly expedite your learning and your overall progress to have a reliable library like D3DX at your fingertips. DirectX also comes with PIX, which is a powerful profiling and debugging utility.

Share this post


Link to post
Share on other sites
Ok, first, thinks for the fast replies. Ok, so it really doesn't matter which language I write it in. Well, the game I have in mind is to high a task for Python or Java, and C# could only port to the 360 (other then windows). I guess now it's up to me to choose the easier language with the fewer ports, or the harder language that's more easily accessible to other platforms. DirectX may be a good place to get my feet wet in 3D, but I think I'm gonna eventually use OpenGL, as I would like to write everything myself anyway.
Antheus:
Yes, I'm well aware of the fact that I'll be studying for most likely years before I even begin the game, but I wanted to know which direction to lead my learning in. Anyway, thanks for the replies, I think I have a good idea the direction I should be going in now.

~TDOT>

Share this post


Link to post
Share on other sites
Quote:
Original post by that dude over there
Well, the game I have in mind is to high a task for Python or Java,

What does this mean?


Quote:
Original post by that dude over there
and C# could only port to the 360 (other then windows).

False mono can run c# on linux/bsd


Share this post


Link to post
Share on other sites
I think it means he needs to see for himself that calling an api is the same speed regardless of what you call it from. :)

To answer your question simply (and utterly): Use whatever you a) enjoy b) feel most comfortable writing in. The most effective optimizations come from algorithm design, which isn't bound by your choice of language.

Share this post


Link to post
Share on other sites
Cshowe:
I meant that I don't think I can use Python or Java to get the quality I'm looking for in my game. I've never seen a really good loooking 3D game written in Python, and I've heard very bad things about Java and 3D.

The main reason I said that, is because C# is my language of choice right now, and C++ is the language I'm interested in for later.

~TDOT>

Share this post


Link to post
Share on other sites
Quote:

I think it means he needs to see for himself that calling an api is the same speed regardless of what you call it from. :)


Well, not exactly. Calling an OpenGL function from Python is indeed slower than calling it from C/C++, as the Python function is a wrapper around the "real" function, not to mention that the general overhead of calling a function in Python is bigger anyway(Python is interpreted,after all). Of course, the goal in either C++ or Python is to batch and make as few API calls as possible anyway, so with some smart programming the problem is mostly solved.

However, there is something to be said about speed of Python. Granted, languages do not have inherent speed, but interpeters do. There are some things, like math calculations, that aren't Python's strong points. I'm currently making an space RPG game in Python. Everything, including vector math, is written in Python. Not anything complicated, some simple vector arithmetic. I tried, just for the sake of it, to put on screen 1000 asteroids. It gets slow, something that didn't happen when I was writing a similar program in C++. Of course, with smart and proper management of objects(don't render what you can't see,etc...) it gets better, but it still takes an effort, whereas in C++ the whole thing would be certainly faster. So, there is a speed issue here for more advanced games, but it is solved by optimizing the algorithms and/or moving some critical code in C/C++ or even Pyrex(or using an existing library that already does that).

Share this post


Link to post
Share on other sites
Quote:
Original post by that dude over there
I've never seen a really good loooking 3D game written in Python
Graphical quality is not a propery of languages. How do you know what language game X is written in anyway?
Quote:

I've heard very bad things about Java and 3D.
I've "heard" that the moon is made of cheese, but that doesn't make it so. Without context and credible sources to back it up, such statements are worthless and amounts to nothing but spreading fud.

Share this post


Link to post
Share on other sites
Quote:
Original post by that dude over there
I've never seen a really good loooking 3D game written in Python


Then you need to look around a bit more; Civ4's game code was done in Python, and Eve Online has most of it's game code done in Python (including large amounts of the server code)

Share this post


Link to post
Share on other sites
Quote:
Original post by Luctus
I've "heard" that the moon is made of cheese, but that doesn't make it so.


But... But... It's on google. It has to be true.


When it comes to evaluation of performance, theory works similar to integration.

While deriving, you sum up contributors, and end up with one of O notations. For example, O(n).

However, in reality, this equation is: O( n + C1 ) + C2, where C1 and C2 are arbitrary constants.

These constants are intristic to languages. C++ is preferred since in many cases both of these constants are small. Java or C# have higher constants, but those decrease during run-time due to JIT to those close (and in rare extreme cases lower) that those in C++.

Interpreted languages (not quite, but bear with me) such as Python or VB have these constants much higher.

This has immediate effect only on linear performance. A for loop written in C++ will be a few percent faster than that in Java or C# and a few percent faster than that in Python.

But ultimately, applications break on scalability. Linear search may be fast for small lists, but is horrible for large ones. O(n^2) algorithm is usually good for very small n, but disastrous for moderately sized. And so on.

Language impact of graphics programming doesn't come from languages, but from platform - memory management. In graphics, where large chunks of data need to be passed around (hundreds, thousands of megabytes per second), manual management will bring benefits. But this type of management is possible even in Java or C#, it just makes code a bit more unwieldy. To the exactly same degree as manual management in C++, C or assembly.

For everything else (the remaining 95% of the code), automated memory management is greatest productivity improvement development tools have ever offered.

Share this post


Link to post
Share on other sites

This topic is 3740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this