Some questions about API's

Started by
10 comments, last by Antheus 16 years, 7 months ago
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>
____________________________I'm 15, and beginning C#, and maybe Python. I'm fairly experienced in GML as well, and would be happy to help in GM related questions.
Advertisement
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++).

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.
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.
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>
____________________________I'm 15, and beginning C#, and maybe Python. I'm fairly experienced in GML as well, and would be happy to help in GM related questions.
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


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.
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>
____________________________I'm 15, and beginning C#, and maybe Python. I'm fairly experienced in GML as well, and would be happy to help in GM related questions.
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).
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.

-LuctusIn the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move - Douglas Adams

This topic is closed to new replies.

Advertisement