Page 1 of 1
Cross Platform coding
Posted: Sat Jul 25, 2009 4:25 pm
by hayk0510
Just had a quick question, I couldn't seem to find the answer searching the forums.
I want to make games for Linux, and contribute to expanding the Linux gaming scene, but I would also like for my games to be able to run on Windows as well.
Let's say I am using C++ with Python and use SDL and openGL with them. Coding them in Code::Blocks and compiling them with the GCC compiler.
My question is, will I be able to run the game on both OS's by just recompiling the code in each? Or will I run into OS specific code and have to rewrite a lot of it?
I'm a big Linux fan, but I want everyone to be able to play my games. (Which might mean a Mac port also. But I have no experience in their OS.)
Re: Cross Platform coding
Posted: Sat Jul 25, 2009 6:55 pm
by JaxDragon
If you use just C++, Python, SDL, and OpenGL, you shouldn't come across any errors. And when you do, they're generally not hard to fix. Its when you get into things like GUI programming(unless you use pythons built in GUI library), networking(unless you use something like SDL_Net), thats when you start rewriting code.
Re: Cross Platform coding
Posted: Sun Jul 26, 2009 11:40 am
by Falco Girgis
If you see yourself doing something like:
or
punch yourself in the face, and you'll be fine. :D
Re: Cross Platform coding
Posted: Sun Jul 26, 2009 8:25 pm
by hayk0510
GyroVorbis wrote:If you see yourself doing something like:
or
punch yourself in the face, and you'll be fine. :D
Haha, I'll keep that in mind.
Btw, I'm just curious. But which programming languages did you know before you learned C++? And when did you start learning it?
People in other forums tend to avoid C++ like the plague, and usually recommend C over it. But then again, those people aren't really game developers either. :D
Re: Cross Platform coding
Posted: Mon Jul 27, 2009 2:22 pm
by K-Bal
hayk0510 wrote:
People in other forums tend to avoid C++ like the plague, and usually recommend C over it. But then again, those people aren't really game developers either. :D
The worst C++ programmers are often the ones who have learned C before. They try to abuse C++ for procedural programming.
I would recommend a OOP language from the beginning. Not because I'm propagating OOP but because it makes software design for beginners more intuitive.
Re: Cross Platform coding
Posted: Mon Jul 27, 2009 6:47 pm
by MarauderIIC
<windows.h> and <unistd.h>, I don't think there are extensionless version of them.
Falco knew C before C++ but I can't say what he knew before that. C is "better" for game development because it's more "lowlevel".
Re: Cross Platform coding
Posted: Mon Jul 27, 2009 7:01 pm
by Falco Girgis
K-Bal wrote:hayk0510 wrote:
People in other forums tend to avoid C++ like the plague, and usually recommend C over it. But then again, those people aren't really game developers either. :D
The worst C++ programmers are often the ones who have learned C before. They try to abuse C++ for procedural programming.
I would recommend a OOP language from the beginning. Not because I'm propagating OOP but because it makes software design for beginners more intuitive.
I resent this statement.
I came from a C background. While I definitely had to learn object-oriented programming, I am also more competent with low level APIs, drivers, embedded machines, and things like that than OO exclusive C++ and Java programmers.
Sure, start with C++, but learn both.
Re: Cross Platform coding
Posted: Mon Jul 27, 2009 8:29 pm
by K-Bal
I used the word "often" for a reason :D
Sorry, it's late (Germany) and I'm a bit drunk. I'll give a more decent answer on this tomorrow.
Cheers,
Marius
Re: Cross Platform coding
Posted: Mon Jul 27, 2009 10:53 pm
by dandymcgee
GyroVorbis wrote:K-Bal wrote:
The worst C++ programmers are often the ones who have learned C before. They try to abuse C++ for procedural programming.
I would recommend a OOP language from the beginning. Not because I'm propagating OOP but because it makes software design for beginners more intuitive.
I resent this statement.
I came from a C background. While I definitely had to learn object-oriented programming, I am also more competent with low level APIs, drivers, embedded machines, and things like that than OO exclusive C++ and Java programmers.
Not everyone can be as talented as you Falco.
I know a few C programmers whose attempts at C++ are well.. not so pretty. I'm not arguing with your point that with enough practice a C programmer can become more competent with C++ than an "OOP Whore" (as you call 'em), but it does indeed take some practice.
GyroVorbis wrote:
Sure, start with C++, but learn both.
Good advice.