Thread: cross platform game programming

  1. #1
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589

    cross platform game programming

    I have become a linux coder, and dread the thought of going back to windows. I want to write a cross platform game. I'm assuming i would need to use opengl for my graphics and portable c/c++ code, or even java. do any of you gaming gurus have any suggetions on what is the best way to go. I want my windows fellows not to be excluded from my code, let alone the remainder of the non-windows crew too. Does anyone publish a good cross-platform "how to" game program book? or possibley an online tutorial that has cross-platform gaming? i have looked at the majority of the posts in the "Game Programming Links" post, but I want it specific to my needs. Do not get me wrong I found a good amount of useful information in those links. I guess my questions are.

    (1) Is there a standard portable c, c++, and java iso document that has a list of all portable gaming code?
    I think I saw a post on this before, but it was for code non-specific to gaming.

    (2) Other than opengl, what options do I have for opensource cross platform tools?

    Thank you for your help in furthering my knowledge of the code.
    Last edited by xviddivxoggmp3; 08-21-2004 at 01:08 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    I want to write a cross platform game. I'm assuming i would need to use opengl for my graphics and portable c/c++ code, or even java.
    for cross platform you'll have to use only standard C/C++ libs or ones that are available on all your target platforms.

    I recommend using OpenGL with GLUT. They are both supported on many platforms and code for each is essentially the same.

    Java is always a good solution if multi-platform is your primary goal. not only will the same source run on different platforms, but the same compiled .class files will. You will lose the performance and shear spiffyness of C/C++ and OpenGL though, (although Java3D does use OpenGL, its performance sux)

  3. #3
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    is c99 what is concidered the standard?
    or is there a site that gives me all standard libraries and discriptions of what is in them?
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  4. #4
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    yes c99 is a standard, but that really isn't what he is talking about. If you want to use cross platform gaming don't even consider DirectX. So that leaves you with OpenGl. Plus the only other two cross platform window command libraries are SDL and GLUT, that I know of. Does this help you?

  5. #5
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    ok it is a little clearer.
    i thought glut and opengl are the same thing.
    I will post again after I have done more research.
    thanks for the help.
    Last edited by xviddivxoggmp3; 08-21-2004 at 02:05 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  6. #6
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by xviddivxoggmp3
    i thought glut and opengl are the same thing.
    OpenGL is a rendering library.
    GLUT is a multi-platform windowing toolkit for OpenGL (handles things like window creation, Input, right click menu's, etc...)

    This link is technically for the python bindings of OpenGL but the pages show the C specifications as well. GL and GLUT libs are documented here.
    http://pyopengl.sourceforge.net/docu...nual/index.xml

  7. #7
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    Perspective,
    Thanks for posting, but your link isn't working.
    Can you repost or correct the link, so I can look at the page.
    Thanks.

    Linuxdude,
    I want to make sure I'm going in the correct direction here.
    SDL is that Simple DirectMedia Layer?
    From your post is it safe to say GLUT and SDL are almost the same thing?
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  8. #8
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    I was going to recommend SDL too, my current project uses OpenGL and SDL, I'm doing the development under Linux, while trying to keep the code as Win32 compatible as possible, currently I use OpenGL for graphics and SDL for the window stuff and sound.

    GLUT is a portable framework for creating an OpenGL window, SDL does that and more.

    So if you need something simple go for OpenGL/GLUT, otherwise I suggest looking into SDL.

    SDL homepage (docs and tutorials)
    http://www.libsdl.org/index.php

  9. #9
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by xviddivxoggmp3
    Perspective,
    Thanks for posting, but your link isn't working.
    works fine for me....

  10. #10
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    perspective,
    I keep getting an xml error. It could be on my end.
    not sure though.

    (1) what open source compiler supports the opengl and sdl libraries?

    I only c++ compilers I know of are g++ or kdevelope.
    Last edited by xviddivxoggmp3; 08-21-2004 at 08:02 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  11. #11
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    you'll need a browser capable of viewing xml... (like firefox)

    You can develop with OpenGL/SDL using pretty much any compiler out there as long as you have the libraries. You may need to download them.

    i use g++

  12. #12
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    shouldn't explorer use xml?
    my work browser is ie 6.0.2800.1106C0
    how would I make the library available for g++?
    I have only done opengl and glut with M$c++.net
    [edit1]
    would it be the same as including another header file?
    Code:
    #include"someheader.h"
    then placing it in a specific directory?
    [/edit1]
    Last edited by xviddivxoggmp3; 08-21-2004 at 08:47 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  13. #13
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Pretty much, but you need the library as well. Look at the SDL site and it'll show you what you need to do to get it to work. Dev-C++ should be good for compiling the Windows Binaries. G++ should be good for testing on Linux - though obviously you'll want to distribute the source.

  14. #14
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by xviddivxoggmp3
    how would I make the library available for g++?
    would it be the same as including another header file?
    then placing it in a specific directory?
    You need the headers and you have to link the libraries. See my cheesy Nibbles game's makefile for an example. http://cboard.cprogramming.com/showthread.php?t=55182

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. Need book to program game into multiplayer...
    By edomingox in forum Game Programming
    Replies: 3
    Last Post: 10-02-2008, 09:26 AM
  3. Cross Platform appplication - porting easy?
    By eroy4u in forum C++ Programming
    Replies: 2
    Last Post: 12-11-2007, 06:17 AM
  4. Cross platform XML library
    By Josh Kasten in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2007, 04:04 PM
  5. Cross Platform Question
    By PreachA in forum Game Programming
    Replies: 4
    Last Post: 07-12-2006, 07:36 PM