Jump to content
  • Advertisement
Sign in to follow this  
Markie

Cross Platform Game Development

This topic is 4187 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

Hi all, O.K., I'm one of those newbies who wants to make his own game in the size of something like Quake... ;-) The reason is not anything I want to be or be able to do but simply that the game I want to play simply does not exist and nobody else is going to make it. Since I am a newbie to game programming (I've been programming PHP for a while now and read 1.5 C books) I realize, I must learn a heck of a lot. I also realize I need the help of others and that my game must / will be open source. To interest others in my game it really should be cross platform, most importantly it should run on personal computers with Windows, Linux or Mac OS/X. I have no idea how to make computer games or the special kind of 3D engine my game requires, but I know it should be cross platform from the very start, it should be written in C, C++ and perhaps Assembly (not Java or anything slow) and it needs to be highly modular to allow third parties to make additions to it such as own games / levels, etc. using my 'game' / 'engine'. I want to approach this in a top-down manner. So before I learn to program in C and C++ I would like to know if and how a game can be made cross-platform from the very start and beginning (if at all). I searched Google on this and I found stuff like 'wyoGuide' and 'wxWidgets'. My question(s): How do 'professional' game developers make games cross platform and what is the best method to make a (eventually if it does work out) very large open source game with a 3D engine highly modular and cross platform? Is 'wxWidgets' the preferable or best choice here??? There is a book about 'wxWidgets'. Should I get it? Any help on planning or giving starting pointers for a large CROSS PLATFORM open source game with an existing or a self-made (if required) 3D engine is greatly appreciated. Greetings, Markie

Share this post


Link to post
Share on other sites
Advertisement
What use do you have for wxWidgets for a FPS game? If you are planning on learning C++ from scratch, then I suggest that you get started and concentrate on that for the next 5 years. Once you know it well you can start thinking about making your game. If you are going to try learning C++ whilst creating this game I can tell you now that you will most likely fail miserably.
I do not mean to sound harsh or be rude, I just thought you deserved to get a realistic view of the situation.

Share this post


Link to post
Share on other sites
Just to clarify, most 'professional' games are not cross-platform.

wxWidgets is a cross-platform GUI library.

If you are interested in cross-platform game development your best choice
would be OpenGL. Then you can either put all your platform-specific code
in one file and only port this file for each platform, or better yet
use a library such as SDL,GLUT or the like.

Hope this helps.

Share this post


Link to post
Share on other sites
For your goals, I suggest:

#1: program in C, not C++ --- or more exactly, program in C++ but do not program with classes/templates/funkyfeatures. If you were already a C++ expert I might give different advice, but you may have no idea how massively more complicated C++ can be than C. And frankly, I was expert in C++, but switched [back] to what I suggest for you (call it "advanced C" perhaps) about three years ago, and my programming life has become so unbelievably massively easier that I cannot describe the "relief" I feel. Not everyone will agree, I guarantee that, but mostly because the common wisdom repeated endlessly everywhere is the opposite advice (it's newer, so it *must* be better!) - NOT.

#2: as others said, you must adopt OpenGL, because nothing else that supports modern fast graphics cards also supports Linux/Windows/Mac/etc.

#3: find support libraries available for every OS you want to support. This includes support for sound, perhaps math though you are probably better off writing this yourself because you'll learn so much valuable information, etc.

#4: always adopt the lowest-level possible support libraries! the higher-level the library, the flakier it will be (in general), and the more often new versions will change in ways that break the code (and assumptions) your application makes.

Share this post


Link to post
Share on other sites
I deploy my games to all three major platforms, using SDL and OpenGL. C++ templates are supported well across these platforms, as are most advanced C++ features (including exceptions, etc), so don't think you're stuck with C.

The places you have to look out for are platform-specific gubbins in the OS layer. SDL masks a lot of this stuff, but there's still a lot of platform "niceties" you have to watch out for (such as native dialogue boxes, endianness, etc).

Being portable really isn't that hard if you think about it from day one. I wrote up a few older tips on how to keep your game portable, and I'll probably submit some articles on cross-platform dynamic library use, GLSL portability and common pitfalls to GDNet later this year.

I've collected most of my common code into a game api, which is admittedly rather hard to use in its current iteration.

Share this post


Link to post
Share on other sites
if you're making an open source quake like game, why not use the quake engine?

Share this post


Link to post
Share on other sites
Quote:
Original post by Markie
(not Java or anything slow)


How slow is 'Java'? What makes Java slow to you. What are your goals for this program? Java is perfectly fine for most things speed wise. If you find Java slow while you are just starting programming then chances are it isn't how slow the language is, but how you have your code set up.


You want cross platform, and yet you don't want one of the most cross platform languages because it is marginally slower?

You can do most of the code in something like Java or Python, then you use a profiler to find the parts of your code that are slow. You then either rewrite that code using a faster algorithm or in a faster language. The advantage of such a process is you can get your programs up and running quickly, while not having to worry about getting everything 'perfect' code wise.

You don't need to worry about how fast something runs before you have it programmed and try running it. Get it running, if it runs well on your target systems, why make it run faster? Do you need 200+ FPS?

Share this post


Link to post
Share on other sites
Wow! What a cool forum!!
:-)

Thanx a ton for all the cool answers! :-)
I see maybe I should be a little more specific, although I've
already learned a lot from all these cool answers!


Quote:
Original post by Omid:
What use do you have for wxWidgets for a FPS game?
Actually that was part of my question, let me rephrase that:
Is 'wxWidgets' used for cross platform game programming at all?
All I know about it due to my non-existent game programming experience
is that 'wxWidgets' is, according to their own page a 'framework' for
generating cross platform applications. Here's the exact text from
their home page:
------------------
wxWidgets lets developers create applications for Win32, Mac OS X, GTK+,
X11, Motif, WinCE, and more using one codebase.
---------------
Due to my lacking knowledge, that SOUNDS like something I might
need or which could help a lot in creating a cross platform game, which
is an 'application for Win32, Max OS X, GTK +, etc.' after all, no?
From your answer I guess 'wxWidgets' is not used for First Person Shooters
then? Or maybe not for games at all? If so, it would be nice to know why...
:-)

Also I'd like to stress that I do not plan on making a First Person Shooter.
Sorry for not being too specific, I just hate my ideas being torn apart
by others without knowing why something won't work myself yet. ;-)

Actually I want to make a turn based role playing game, BUT, with a
3D engine that lets you choose any perspective you like. While walking
and looking around it should be like a first person game, but then in
combat I want the same engine to switch to turn based, overlay everything
with square tiles / hexes or cubes and allow the player to choose any camera
angle which gives the best overview.
Sort of like a tile based rpg game, only rendered with a fully capable 3D engine.

Quote:
Original post by Omid:
If you are planning on learning C++ from scratch, then I suggest that you get started and concentrate on that for the next 5 years. Once you know it well you can start thinking about making your game. If you are going to try learning C++ whilst creating this game I can tell you now that you will most likely fail miserably.
I know I have a lot of studying to do before I ever get started on actually even
adding two bytes of code for such a game together. I *will* concentrate on
learning C++ and *anything* else it takes to make this "game". And while I
start learning C++ in the next 5 years I might as well try to learn as many
required other things I need to know as well. Such as cross platform programming,
software engineering, 3D math, running a successful open source project, etc.
I have a vague *idea* what C++ is, having read some books on C and using
Objects and Classes in PHP. What I can't fathom is cross platform stuff,
3D engines, etc.
So, I am *not* trying to learn C++ whilst creating this game, that would probably
literally have me trash the entire code about 100 times (or much more) and restart
from scratch. What I am trying to do is learn C++ AND everything else needed
to MAKE this game.
I have a rather pragmatic approach to this: While C++ might be fun, I
don't like doing things with computers unless there is a specific reason.
The only reason why I haven't learned game programming yet is because
I never saw a need to make an own game. Others do a pretty fine job.
But this has changed with my wish for something which does not exist
and which will not be created by others. I'll learn to make this game,
not make the game to learn. If it takes 5 years to learn C++ or the rest
of my life to make this 'game', so be it. As my game will be open source,
someone else can continue it if I don't live to see it get finished.
That's my 'angle' on this. :-)

Quote:
Original post by Omid:
I do not mean to sound harsh or be rude, I just thought you deserved to get a realistic view of the situation.
Not at all! Praise you! :-)
That's what I came here for: A realistic view of the situation / knowledge.
:-)


Quote:
Original post by CableGuy:
Just to clarify, most 'professional' games are not cross-platform.

wxWidgets is a cross-platform GUI library.

If you are interested in cross-platform game development your best choice
would be OpenGL. Then you can either put all your platform-specific code
in one file and only port this file for each platform, or better yet
use a library such as SDL,GLUT or the like.

Hope this helps.
It sure did. :-)
I don't want to make this game for any money. It will be open source
to enjoy for everyone who likes these kind of games like me. I'm using
the term 'professional' in terms of a well tested and best possible path
to take.
I will definitely be using OpenGL. I just made my mind up about
that thanks to the great article 'Direct3D vs. OpenGL' here and
thanks to Wikipedia. Thanks. :-)
This will probably reveal my horrible newbie lack of knowledge, but
is a GUI library not needed for games at all then? I mean a 3D engine
/ display is a graphical interface for the user isn't it? Even if not, doesn't
it run in a window which is a graphical user interface?

I am planning to separate platform specific code from all other code
and your tips on SDL and GLUT, obviously both cross platform
specific libraries which make cross platform specific programming
much easier are perfect! :-) That's the kind of info I was looking for.
Thanks!

Let me recite my shopping list for my 'game' or maybe I
should better call it my 'project' as follows:
Needed: C, C++, OpenGL, SDL, GLUT
Not needed: wxWidgets
Is this better? :-)


Quote:
Original post by bootstrap:
#1: program in C, not C++ --- or more exactly, program in C++ but do not program with classes/templates/funkyfeatures.
<snip>
(it's newer, so it *must* be better!) - NOT
Thanks for all your other tips as well!
As to using C instead of C++ I think I agree with you even if
this might not speak for you, me being a total newbie. ;-)

I heard / read this bad thing about C++: Using Classes and Objects
where it could be done otherwise (standard procedural programming)
is bad because the large overhead of objects slows things down.
It's like using Assembler instead of C or even higher languages
because that's faster too. I also heard you can do a LOT with plain
C, such as MAME for instance which is programmed purely in C, not
in C++ if I'm not mistaken. That speaks a lot for C for such a
complex program like MAME probably is.

On the other hand I might need some classes and objects because
I want the program to be very highly modular, allowing to run not
only on different platforms, but maybe also to use different
(open source) 3D engines and to allow easy programming or
adding of new levels / games / worlds / characters, etc. And that
seems to be asking for objects.


Quote:
Original post by Ravuya:
Being portable really isn't that hard if you think about it from day one. I wrote up a few older tips (http://rav.efbnet.com/article.php?a=portable) on how to keep your game portable, and I'll probably submit some articles on cross-platform dynamic library use, GLSL portability and common pitfalls to GDNet later this year.

I've collected most of my common code into a game api (http://ravuya.ballofdoom.com/propaneinjector.php), which is admittedly rather hard to use in its current iteration.
You're a God's sent! AWESOME! :-))
Now that's a load of 'pointers' to digest and munch on!
:-) Thanks man!
If I keep my motivation going for my project I think
we will or should hear from each other again! – I hope! :-)
'Tips for Writing Portable Games' certainly is very valuable!
Why not post it as an article to GameDev.net, or did I miss it?
(I had to laugh about your other texts, 'Bad Game Ideas'... :-)


Quote:
Original post by eedok:
if you're making an open source quake like game, why not use the quake engine?
As said, it will be an rpg with free camera choice and turn based
combat with a tile overlay over a real 3D world. I have almost a full page
as a whish list of what I want the 3D engine to be able to do (won't publish
it here though… TOO Newbie… at least not yet…;-). I don't know if
the Quake Engine could handle all my whishes, but as it is a Cross Platform
3D engine using real 3 dimensional data (instead of just processed 2
dimensional data) AND open source, I will have to consider this idea
very heavily! :-) Especially because it would probably save a heck of
a lot of work (even if I still have to learn all the programming and
tech stuff to use it).

Quote:
Original post by Talroth:
How slow is 'Java'? What makes Java slow to you.
<snip>
You don't need to worry about how fast something runs before you have it programmed and try running it. Get it running, if it runs well on your target systems, why make it run faster? Do you need 200+ FPS?
Sorry to step on your or Java's toes. Wasn't the intention.
I'm sure Java has it's good use for many things. In fact, I have
at least one big Java book on my shelf, I just never read it
because I never needed it yet.
My limited knowledge is simply that Java is not used for 'professional'
(again meaning best possible solution used by most) PC games with
3D engines.

The point is this: No, I don't know Java. I also don't really know C or
C ++, well C maybe a little. But I see what other's are using and I
am *NOT* trying to *LEARN* anything which might as well be Java.
I am trying to make, or first choose the best possible solution and
approach for the game I envision / want to play / create.
(Or at least see how far I can get.)
I see Java is used for mobiles, but rarely for large or very large
games or projects such as MAME for instance.
To tell you the truth, I don't really know why, but I assume there
is *higher knowledge* in this of the people who choose C and
C++ for most large / complex projects / games.
I'm not saying my mind is set about this. But I'm saying I do NOT
have two shots on this as you seem to think. As is, I might never
even see the day this 'project' of mine is finished, even if I do
nothing else for the rest of my life. I don't have two chances.
I can't try it in Java as you suggest, and then, after 5-10 years,
when it becomes visible if C or C++ would have been a better
choice, to just start from scratch again or rewrite everything.
I don't know: Do you think something like MAME for instance
could be realized totally in Java? And if so, why was C chosen
for MAME and C++ for most 3D games?


Anyway, thanks all for a *LOT* of useful thoughts!
:-)

Greetings and regards,
Markie

[Edited by - Markie on April 8, 2007 5:04:24 PM]

Share this post


Link to post
Share on other sites
Quote:
I don't know: Do you think something like MAME for instance
could be realized totally in Java? And if so, why was C chosen
for MAME and C++ for most 3D games?


http://www.physics.ox.ac.uk/jpc/

x86 emulator written entirely in Java.

There's are reasons why Java is or isn't used, performance isn't one of them. But I won't go there, it's a topic chewed over too many times.

What I will say, is that portable C++ development is a chore for console applications. Doing it for 3D, even moreso. If you're thinking about C++, then you'll need Boost. That's probably the only viable option for anything semi-serious that is truly portable. You can do without, but you'll just be re-inventing the wheel. Unfortunately, C++, STL and Boost take a long time to learn.

This is the reason, why, despite having top notch developers, lots of money, and years of development time, game developers usually don't provide it. It's simply too much work.

Share this post


Link to post
Share on other sites
Quote:
Original post by Talroth
Quote:
Original post by Markie
(not Java or anything slow)


How slow is 'Java'? What makes Java slow to you. What are your goals for this program? Java is perfectly fine for most things speed wise. If you find Java slow while you are just starting programming then chances are it isn't how slow the language is, but how you have your code set up.


Java programs take quite some time to start the first time you run them. (As they are then compiled and optimized for the users platform). after that the performance is normally the same as for C# or somewhere around +-10% of Well written C++ code. (Yes it can actually be faster under some circumstances).

Java was slow 7-8 years ago, it isn't slow today unless you specifically tell the VM to skip the JIT compilation (i do this for some smaller applications to reduce startup time)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!