Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

Cross Platform Project

4: Adsense

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
3 replies to this topic

#1 austinsheep   Members   


Posted 18 March 2014 - 09:52 PM

I was wondering this because I've never experienced this myself.  I was wondering what is the most efficient way to create a cross platform project.  I'm assuming you'd create the project originally on one OS and then build it to the others.  But lets say you have some code that is OS dependent and then you try building it on another OS.  Would it be best to copy the original project and create a new project that was specific for the new OS?

#2 Ashaman73   Members   


Posted 19 March 2014 - 12:27 AM

It depends a lot on the language and framework you use. Eg with java, a more or less plattform independent language and framework, it would be quite simple. With C++ you would need to use different libs on different plattform, often using only one code base (you switch between different code path by using pre-processor commands). An other consideration is the use of APIs, eg. DirectX is win-only whereas OpenGL is cross plattform.


A good start  for a cross-plattform application would be java+opengl.

Edited by Ashaman73, 19 March 2014 - 12:28 AM.



Gnoblins: Website - Facebook - Twitter - Youtube - Steam Greenlit - IndieDB - Gamedev Log

#3 Stainless   Members   


Posted 19 March 2014 - 03:35 AM

Except java is crap. Okay I suppose it has got better over time, JIT compilers give you a large speed increase over vanilla Java, but it's still crap.


Indies and start ups usually let someone else deal with the platform independence, so they use things like Unity.


Pros write their own platform independence layer. 


They will create an engine that has all the functions they need to render the game, then have a folder with the actual rendering code in it. At compile time they select the version of the rendering library they need for the platform.


This creates a lot of other problems. It's not just a straight choice of we will use OpenGL and that will do the job.


Shaders can be a nightmare. Shaders that compile and run perfectly on one platform will fail completely on others. Background asset loading is a nightmare. OpenGL is single threaded, so you can't load a texture on one thread and display it on another without jumping through hoops.


There are some great libraries out there to help. Can't remember the name of it, but there is a library that translates OpenGL function calls to DirectX. That might not sound like a great thing, but it is a hell of a lot easier to debug directx than opengl. Pixwin is awesome.


You need to decide how much effort you are willing to put into it. 


I would rather you just write a game for a platform rather than start worrying about how to get a game onto another platform when you don't have a game yet. 


You will understand the problems a lot better then.

#4 Álvaro   Members   


Posted 19 March 2014 - 09:30 AM

I don't think of Java as being cross-platform: The Java runtime environment  is a platform, and you can think of the implementations on different platforms as emulators. It's a bit like making a Windows executable and claiming it's cross-platform because you can run it under Wine. In any case, most interpreted languages can similarly claim to be cross platform.


If you are going to be programming in C or C++, there are libraries like SDL and SFML which give you a platform-independent interface to many platform-specific features (windows, graphics, sound, input handling...) and you should probably use them. For 3D graphics, OpenGL is the obvious choice. You also need to make sure your code can handle primitive types of different sizes (e.g., `long' could be 32 bits or 64 bits), different endianness and different alignment requirements. This can be tricky, but it's a great learning experience, especially if you have only programmed in one platform before.


Whatever you do, make sure you test your code on a variety of platforms, and don't be surprised if porting to a platform you haven't tested before requires some tweaks.

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.