Jump to content

  • Log In with Google      Sign In   
  • Create Account

Cross Platform Game Development


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
15 replies to this topic

#1 Markie   Members   -  Reputation: 102

Like
0Likes
Like

Posted 08 April 2007 - 03:02 AM

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

Sponsor:

#2 Omid Ghavami   Members   -  Reputation: 998

Like
0Likes
Like

Posted 08 April 2007 - 03:15 AM

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.
Best regards, Omid

#3 CableGuy   Members   -  Reputation: 899

Like
0Likes
Like

Posted 08 April 2007 - 03:19 AM

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.

#4 bootstrap   Members   -  Reputation: 100

Like
0Likes
Like

Posted 08 April 2007 - 03:31 AM

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.


#5 Ravuya   Moderators   -  Reputation: 127

Like
0Likes
Like

Posted 08 April 2007 - 03:54 AM

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.

#6 eedok   GDNet+   -  Reputation: 971

Like
0Likes
Like

Posted 08 April 2007 - 03:58 AM

if you're making an open source quake like game, why not use the quake engine?

#7 Luckless   Crossbones+   -  Reputation: 1807

Like
0Likes
Like

Posted 08 April 2007 - 05:24 AM

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?

#8 Markie   Members   -  Reputation: 102

Like
0Likes
Like

Posted 08 April 2007 - 11:04 AM

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]

#9 Antheus   Members   -  Reputation: 2397

Like
0Likes
Like

Posted 08 April 2007 - 11:13 AM

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.

#10 SimonForsman   Crossbones+   -  Reputation: 6122

Like
0Likes
Like

Posted 08 April 2007 - 11:40 AM

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)

#11 CableGuy   Members   -  Reputation: 899

Like
0Likes
Like

Posted 08 April 2007 - 11:12 PM

Ofcourse some kind of GUI will be needed at some point of the game,
but before displaying buttons,drop-down lists or whatever, you should
first concentrate on the basics of your engine/game.



#12 eedok   GDNet+   -  Reputation: 971

Like
0Likes
Like

Posted 09 April 2007 - 04:12 AM

if you're writing from scratch, because it's turn based speed should be your least concern. Personally I would do it in python with like OGRE or the likes as it requires the least knowledge to get going.


But IMHO it's far too early to even care what language you're going to use as it sounds like you don't have a concrete design down. Right now your focus should be making the design as specific as you can. Outline everything that will happen in your game(spare no detail), open up your modelling program/paint program and create some mock-ups of how it will look, and once you have your design fleshed out making decisions on what to use to make the game.

#13 Markie   Members   -  Reputation: 102

Like
0Likes
Like

Posted 09 April 2007 - 11:08 AM

O.K., I might have to give JAVA a little more thought.
However, I read the relevant parts of this paper:

Evaluating Java for Game Development (PDF)

Noteworthy is the conclusion where it says that tweaked Java code
is usually 20-50% slower than tweaked C++, with big variations
in practise (p. 85). That paper suggests mixing Java with
C++ for game programming to not get more than 22-32% slow down.
But if I have to mix and use C++, I might as well do it all in C++.

While I don't want or need top-notch graphics, I want
a lot of portability even to older and slower systems.
So speed might turn out to be important sometime down
the road.
Yes, it should be turn-based, but only in combat.
While moving, I want it to be able to render entire worlds
(not turn based!) with a lot of distance viewing abilities...
;-) And that's going to boog a LOT of speed in any case.
What's much more important though is that I plan to make
this game open source. And Java is just not generally used
in open source game programming for large projects yet,
at least what I've come to understand so far. It's just not
such a safe bet as C and C++, but I rest the case.
I'll think about it some more though.

So here's my updated cross platform game development
shopping list, just to give this thread some value:

Programming language: C, C++, perhaps (some) Java.

Cross platform libraries / API needed:
OpenGL
SDL
GLUT
Boost

Thanks all again for the tips!

Greetings,
Markie

#14 JBourrie   Members   -  Reputation: 1204

Like
0Likes
Like

Posted 09 April 2007 - 11:15 AM

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

Most professional games are cross platform. The majority of console games are not exclusives, and the majority of PC games are either written for Windows/Mac or (more often) Java/Web based titles that are written in cross-platform languages.

Most independent/hobby games and some core/hardcore games are not cross-platform. Console exclusives are not cross-platform (unless they are limited exclusives, like the GTA games) Most of the rest of them are.

You're planning on making an FPS, and you want cross platform? Sounds like you need Torque. You'll still need to take a year or two and learn how to write the code, but this is a well documented engine (and there are complete books on it on Amazon) that was designed for first and third person shooters (it was originally used for Tribes 2, and has full network/multiplayer support). Finally, it's really cheap for a full featured game engine.

Good luck!

Check out my new game Smash and Dash at:

http://www.smashanddashgame.com/


#15 Alpha_ProgDes   Crossbones+   -  Reputation: 4688

Like
0Likes
Like

Posted 09 April 2007 - 11:20 AM

First of all, ye who knows not "HTML (with variables)" need not critique other REAL programming languages (ie. fix your link).

Secondly, we're in 2007 and that paper was written in 2002; over 5 years ago. Java technology has matured and improved since then. (by the way, I'm pretty sure the author is a member here. so he can, officially, set his own record and findings straight)

Third, I'm not trying to bust your chops too hard but you have to be more objective when comparing, analyzing, and assessing programming languages or anything IT, CS, CE, and/or SE related. (ie. a favorite among the GameDevvers is: (s-expression vs. XML); oh happy days [smile])

#16 Omid Ghavami   Members   -  Reputation: 998

Like
0Likes
Like

Posted 09 April 2007 - 11:27 AM

If you check out the screenshots on wxWidgets' webpage you'll see the type of GUI it provides. It provides cross-platform GUI controls for business applications, ie windows, buttons, scrollbars, tab controls, textboxes etc. All the things you take for granted when using your operating system. When creating a game you usually only have a single window and all your GUI is drawn with your graphics engine in that window.

You have a pretty decent list there, it should get you started. You'll probably end up throwing in a few more libraries in there though.

The best advice I can give on C++ is to be very very very rigorous. Always make sure that your approach is a good one, if not the best. Always double-check your code, it's worth the time you save trying to debug later on when a small error creeps in. Whenever using libraries always check the references carefully to make sure you're using it correctly and that your assumptions are true.

I wish you the best of luck on this journey! [smile]

Best regards, Omid




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS