3
\$\begingroup\$

The answers to this cross-platform related question are useful, however I want my (C++) game to run on Windows and Linux (and be packaged for Ubuntu) only. I'm not interested in platforms like mobile or consoles.

Are there any specific tips or suggestions for this case?

Also, if I get the game to work on linux, is it difficult to add support for OSX?

Updating with more information:

It will be a 3D game simulating the motion of spacecraft in the solar system. We will use Ogre3D for the graphics. We're still in the design phase, so there's no code written yet.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ You should me more specific. \$\endgroup\$ Commented Sep 6, 2011 at 11:16
  • 1
    \$\begingroup\$ From my experience, use solid C++ practices avoiding implementation defined behaviour, and build it just for one O/S. Once your ready, you can port it. Obviously using libraries that are cross-platform (GLFW for example) from the start will decrease the amount of work later; but don't let it hinder getting everything else done first. \$\endgroup\$ Commented Sep 6, 2011 at 11:17
  • \$\begingroup\$ Ogre should take care of your cross-platform woes.. or most of them, anyway. Just don't use windows APIs for anything and you should be ok. =) \$\endgroup\$ Commented Sep 6, 2011 at 12:37
  • \$\begingroup\$ Oh well this renders my answer useless, there aren't any competent 3D implementations for JavaScript yet, I think. \$\endgroup\$
    – jcora
    Commented Sep 6, 2011 at 12:40
  • \$\begingroup\$ Is there any reason the general cross-platform guidelines don't answer your question? \$\endgroup\$
    – user744
    Commented Sep 6, 2011 at 17:30

2 Answers 2

1
\$\begingroup\$

One thing you might want to keep in mind from the start is that if your game relies on floating points physics calculations the behavior on one OS could be different than on the other without some careful considerations. This is not dramatic if your game doesn't rely on perfect synchronization across different platforms such as multiplayer RTS games and will only be apparent in some edge cases but it's still something I consider important to keep in mind ahead of time.

Other than that, using C++, cross-platform specifications (OpenGL if you ever need it, I don't know Ogre3D) and cross-platform librairies (and of course the STL where possible) should pretty much help you make your game platform-agnostic. Just make sure to abstract implementation details (Window management, threading, networking, etc.) during your conception and all you'll need is some solid testing on all platforms.

\$\endgroup\$
5
  • \$\begingroup\$ Actually there will be lots of floating point physics calculations, and we want them to be very precise. However we are not planning to include multiplayer. If there is a site or resource that details the differences you talk about, could you please direct me to it? \$\endgroup\$
    – IGRSR
    Commented Sep 7, 2011 at 10:18
  • 1
    \$\begingroup\$ This article: gafferongames.com/networking-for-game-programmers/… explains the problems in this situation for multiplayer synchronized lockstep games. Both the article and the comments are very insightful. In your case howerever, synchronization is a non-issue so floating point physics calculations across platforms isn't THAT dramatic. \$\endgroup\$
    – anthonyvd
    Commented Sep 7, 2011 at 20:44
  • \$\begingroup\$ I'll just write the relevant code and do some tests to see if it's acceptable, then. Thank you for the link and the advice! \$\endgroup\$
    – IGRSR
    Commented Sep 7, 2011 at 21:04
  • \$\begingroup\$ Good luck, I'd love to hear about the results! \$\endgroup\$
    – anthonyvd
    Commented Sep 7, 2011 at 21:09
  • \$\begingroup\$ Does this happen between different OSes under the same architecture? I thought FP results are consistent under the same platform. \$\endgroup\$
    – kaoD
    Commented Sep 8, 2011 at 2:14
2
\$\begingroup\$

I currently work in the GIS industry, and so many of our software libraries (e.g. GDAL) are designed to be cross platform. They cause nothing but headaches

The best way to write applications intended for multiple platforms is to architect them such that platform dependencies are abstracted away completely. Write code that is easy to port, rather than cross-platform. You'll save yourself a lot of headaches and wasted time trying to figure out why you umpteen millionth#ifdef WIN32 doesn't work properly.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .