Cross Platforming: Switching to Java?

Started by
11 comments, last by excito 8 years, 4 months ago

Dear gamedev.net community!

During the last days I started thinking to stop my development of my C++ visual novel and switch to Java or another language being better/easier in multi platforming.

However I am quite far in terms of development thus I would lose a lot of progress, also I rely on a C based GUI library and SFML.

I really like C++ but it feels like it is a hassle to cross platform it. Especially because I wanted to support Windows, Linux, Mac, Android and iOS. Therefore supporting Mac sounds a bit difficult when I am on a Windows computer.

Since everything I need is a bit of managing images, some visual effects, text and a neat GUI library, I am not sure how to progress.

Everything I use is supposed to support cross-platforming, which is SFML, Lua, Lunajson and TGUI.

I am not a big fan of Java but it feels like the only logical solution if I want to support all (popular) platforms.

It is a really bitter feeling move though so I wanted to ask you for some thoughts and ideas about this.

Also I am aware that I should have started to check if my application is able to run on the other systems already. However I was way too much into the work flow that I missed this out. I learned from this already. Additionally (as mentioned above), I cannot really test it on Mac at all.

Are there any easier solutions for me?

What libraries/scripting languages could compensate the mentioned ones when using Java?

Should I maybe look into a completly different language?

Is sticking to C++ a wise decision in this case?

Right now I am bit worried about this project because this whole subject about cross platforming is such a huge topic and feels a bit overwhelming.

I would be really thankful for some suggestions!

Advertisement

Java is not going to magically make everything work flawlessly on multiple platforms. You still need to pay attention to what you're doing, choose libraries that are available one way or another on all platforms (just because the library is written in Java does not mean it does not use some interop to a platform-specific feature). So you'll still have to test it; if you can't test it on a Mac now, you can't test it on a Mac with Java, and so you should not support the Mac.

I wouldn't bother. You have project in a language you know that mostly works and that you're comfortable with. The effort you expend solving your outstanding cross-platform issues with that code may very well be the same as (or less) than the effort in starting over in a unfamiliar language with very little.

Stick with what you have and finish it.

I'll suggest an alternative - what about something like Unity? I believe that would offer you significantly easier cross platform ability. I think you could also target browsers too but I haven't tried that, only a simple windows game when I wanted to try it out.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

Josh Petrie's advice about testing is spot on. It certainly is much easier to deploy Java across multiple platforms these days. Libraries like LibGDX make it a painless process. Low-level bindings like LWJGL ship with all of the binaries they need on each platform. You only need to compile on one platform and the world is your oyster. Still, it's possible for platform-specific bugs to pop up in those low-level libraries, and they do from time to time. So you should always test on every platform to which you plan to deploy.

That said, there's a cost-benefit issue here. Is the benefit of using Java greater than the cost of abandoning your current implementation and starting over in Java? From what you describe, the answer is most likely "no." There are other factors to consider besides deployment, such as productivity in an unfamiliar language. You are using cross-platform libraries anyway, and that greatly reduces the amount of work you need to do for multiplatform in C++.

So, a) since you're already rather far along in the project, b) apparently the only problem you're trying to solve is to avoid compiling and packaging on multiple platforms and c) you ought to have those platforms available for testing even when using Java, then I would advise you to stay your current course.

Dear gamedev.net community!

During the last days I started thinking to stop my development of my C++ visual novel and switch to Java or another language being better/easier in multi platforming.

However I am quite far in terms of development thus I would lose a lot of progress, also I rely on a C based GUI library and SFML.

I really like C++ but it feels like it is a hassle to cross platform it. Especially because I wanted to support Windows, Linux, Mac, Android and iOS. Therefore supporting Mac sounds a bit difficult when I am on a Windows computer.

Since everything I need is a bit of managing images, some visual effects, text and a neat GUI library, I am not sure how to progress.

Everything I use is supposed to support cross-platforming, which is SFML, Lua, Lunajson and TGUI.

I am not a big fan of Java but it feels like the only logical solution if I want to support all (popular) platforms.

It is a really bitter feeling move though so I wanted to ask you for some thoughts and ideas about this.

Also I am aware that I should have started to check if my application is able to run on the other systems already. However I was way too much into the work flow that I missed this out. I learned from this already. Additionally (as mentioned above), I cannot really test it on Mac at all.

Are there any easier solutions for me?

What libraries/scripting languages could compensate the mentioned ones when using Java?

Should I maybe look into a completly different language?

Is sticking to C++ a wise decision in this case?

Right now I am bit worried about this project because this whole subject about cross platforming is such a huge topic and feels a bit overwhelming.

I would be really thankful for some suggestions!

First, I think learning java is important for both learning process and usage process (Where you actually have to deploy a java application).

So go ahead and start learning.

Secondly, is it wise using java? Depends on your end goal,

If you really need to make fast development rather gaining much more stable application with C++, then yes.

If you consider yourself time wise and you have the time to develop a serious application with C++. Then no.

It is all based on your goals and motivations.

See Java as a tool that resides in your toolbox. Not an easier solution for something,

Edit:
Forgot to mention, Java has many good libraries to work with. If you're an experienced OpenGL developer, you don't even need to relearn any api.

Java is not going to magically make everything work flawlessly on multiple platforms. You still need to pay attention to what you're doing, choose libraries that are available one way or another on all platforms (just because the library is written in Java does not mean it does not use some interop to a platform-specific feature). So you'll still have to test it; if you can't test it on a Mac now, you can't test it on a Mac with Java, and so you should not support the Mac.

I wouldn't bother. You have project in a language you know that mostly works and that you're comfortable with. The effort you expend solving your outstanding cross-platform issues with that code may very well be the same as (or less) than the effort in starting over in a unfamiliar language with very little.

Stick with what you have and finish it.

Oh, well, but is not maintaining Java on multiple platforms way easier? Once I am done checking whether my libraries and everything is perfectly working for all the operating systems, it could not be such a hassle as in C++ whenever I want to change just a little thing? I might be totally wrong at this point but as far as I know, providing an ultimate build of C++ supporting all operating systems is not meant to be done (compile once, run everywhere)? Well, I read about defining the operating system in headers but then again it was not recommended to do.

Also using the NDK seems to be something one should avoid if there is a chance to use Java. It also seems to add up to the effort once I want to support mobile support.

Sticking to it really gave me some confidence at first but then made me feel bad. Only sticking to it because I have done stuff in it but then realised that C++ might be not the ideal decision? Feels like such a lazy move of mine : (

I'll suggest an alternative - what about something like Unity? I believe that would offer you significantly easier cross platform ability. I think you could also target browsers too but I haven't tried that, only a simple windows game when I wanted to try it out.

Sorry, I am not interested in using an engine.

Josh Petrie's advice about testing is spot on. It certainly is much easier to deploy Java across multiple platforms these days. Libraries like LibGDX make it a painless process. Low-level bindings like LWJGL ship with all of the binaries they need on each platform. You only need to compile on one platform and the world is your oyster. Still, it's possible for platform-specific bugs to pop up in those low-level libraries, and they do from time to time. So you should always test on every platform to which you plan to deploy.

That said, there's a cost-benefit issue here. Is the benefit of using Java greater than the cost of abandoning your current implementation and starting over in Java? From what you describe, the answer is most likely "no." There are other factors to consider besides deployment, such as productivity in an unfamiliar language. You are using cross-platform libraries anyway, and that greatly reduces the amount of work you need to do for multiplatform in C++.

So, a) since you're already rather far along in the project, b) apparently the only problem you're trying to solve is to avoid compiling and packaging on multiple platforms and c) you ought to have those platforms available for testing even when using Java, then I would advise you to stay your current course.

Well so this basically backs up using Java in terms of cross platforming, right? Java is a not an unfamiliar language to me. I am just not a huge fan of it.

You mentioned that using multiplatform libraries would greatly reduce the effort I would have to commit using C++. However is it not a really exhausting progress to keep all my builds working?

Dear gamedev.net community!

During the last days I started thinking to stop my development of my C++ visual novel and switch to Java or another language being better/easier in multi platforming.

However I am quite far in terms of development thus I would lose a lot of progress, also I rely on a C based GUI library and SFML.

I really like C++ but it feels like it is a hassle to cross platform it. Especially because I wanted to support Windows, Linux, Mac, Android and iOS. Therefore supporting Mac sounds a bit difficult when I am on a Windows computer.

Since everything I need is a bit of managing images, some visual effects, text and a neat GUI library, I am not sure how to progress.

Everything I use is supposed to support cross-platforming, which is SFML, Lua, Lunajson and TGUI.

I am not a big fan of Java but it feels like the only logical solution if I want to support all (popular) platforms.

It is a really bitter feeling move though so I wanted to ask you for some thoughts and ideas about this.

Also I am aware that I should have started to check if my application is able to run on the other systems already. However I was way too much into the work flow that I missed this out. I learned from this already. Additionally (as mentioned above), I cannot really test it on Mac at all.

Are there any easier solutions for me?

What libraries/scripting languages could compensate the mentioned ones when using Java?

Should I maybe look into a completly different language?

Is sticking to C++ a wise decision in this case?

Right now I am bit worried about this project because this whole subject about cross platforming is such a huge topic and feels a bit overwhelming.

I would be really thankful for some suggestions!

First, I think learning java is important for both learning process and usage process (Where you actually have to deploy a java application).

So go ahead and start learning.

Secondly, is it wise using java? Depends on your end goal,

If you really need to make fast development rather gaining much more stable application with C++, then yes.

If you consider yourself time wise and you have the time to develop a serious application with C++. Then no.

It is all based on your goals and motivations.

See Java as a tool that resides in your toolbox. Not an easier solution for something,

Edit:
Forgot to mention, Java has many good libraries to work with. If you're an experienced OpenGL developer, you don't even need to relearn any api.

As I said above in this post, I already gathered experience in Java.

Fast development is not really for what I am looking. I just like the idea of having something that is cross platform once done well. Having one final application that supports so many operating systems (including mobiles) sounds like a really wonderful concept.

How would an application in C++ be more stable?

This whole cross platforming support really makes me anxious about programming in the future. On the one hand it feels like something I really want to support for my applications but then again being bound to Java to achieve this feels really restricted.

Oh, well, but is not maintaining Java on multiple platforms way easier? Once I am done checking whether my libraries and everything is perfectly working for all the operating systems, it could not be such a hassle as in C++ whenever I want to change just a little thing?


If you are changing just a little thing and it breaks a platform, something is horrifically bad with your code.

That said, set up a CI (Continuous Integration) system. You shouldn't manually compile and test each change for each platform. A CI system will check your changes for you either after every single commit or even before each commit (if you're using a change review process, i.e. pull requests in git).

There are a number of relatively cheap services or free tools for setting up CI that will work for all interesting platforms (Windows, consoles, Android, iOS, OSX, Linux, etc.).

Sean Middleditch – Game Systems Engineer – Join my team!


Well so this basically backs up using Java in terms of cross platforming, right? Java is a not an unfamiliar language to me. I am just not a huge fan of it.
You mentioned that using multiplatform libraries would greatly reduce the effort I would have to commit using C++. However is it not a really exhausting progress to keep all my builds working?

For a new project, perhaps. I just don't think the costs of compiling and deploying a project on multiple platforms add up such that they outweigh the cost of switching to a new language midstream. I also don't think it's as exhausting as you make it out to be. Using cross-platform libraries, you should rarely, if ever, touch any platform-specific code.

Ease of cross-platform testing and deployment is certainly a rational factor to consider when selecting a language in the beginning of a project, but it's not a reason to switch languages halfway through.

As I said above in this post, I already gathered experience in Java.

Fast development is not really for what I am looking. I just like the idea of having something that is cross platform once done well. Having one final application that supports so many operating systems (including mobiles) sounds like a really wonderful concept.

How would an application in C++ be more stable?

This whole cross platforming support really makes me anxious about programming in the future. On the one hand it feels like something I really want to support for my applications but then again being bound to Java to achieve this feels really restricted.

I meant making a C++ stable application, not that C++ is more stable than java.

C++ can be easier to use as Java if you are experienced enough, I don't think it should be your limitation.

Your considerations should focus on all aspects of the technologies:

- Experience with it (The quickest rode is the one you know),

- Limitations (Is there X/Y/Z in this technology).

- What kind of platforms you want to work with.

- Performance of the technlogoy (And your performance goals).

- Deploy costs.

- Much more...

As I said in my previous post, you should stop thinking about it so much and keep it as a tool in your toolbox to use when you really need to,

and not when Cross-platform seems neat to you.


Oh, well, but is not maintaining Java on multiple platforms way easier?
I might get downvoted but I'm going to say yes. Library linking/loading is standard and behaves the same in all the OSes that (desktop) Java supports.

Now the issue is that desktop Java isn't the same as Android Java. Yes, with desktop Java you get fairly simple multi platform support in all major OSes, with deployment of the application itself as simple as copying exactly the same .jars in all of them. LWJGL is well made, it will automatically load the native lib of the platform you're running the application on (for all the combinations between Linux, Windows, OSX, x86, x86_64).

But Android is different, you will have to code specific parts for it (input, display, sound, etc), moreover, you will need to "downgrade" your language support for whatever Java 6/7 bastard Android supports nowadays. iOS was supported through RoboVM for free, but Xamarin bought the company and moved it to their kind of strategy (ie, gotta pay up monthly). Same scenario if you want to use C#.

Also while you can reasonably expect the runtime of any OS to run your C++ program (or at worst you need to bundle some tiny binary, say a MSVS2015 redistributable), with Java you need to either bundle a 40-60Mb VM (not as complex as it sounds though) or provide a link for the user to download the VM from Oracle's site (and remember, Oracle bundles crapware with their JRE isntallers). Moreover, the "executable" itself might be multi platform, but it wont get you an OSX installer, Windows installer or a .deb package. That part you have to do on your own, probably regardless of the language you're using.

I still think its an scenario better than what you're left with C++, there are plenty of parts of the standard lib that are the same across desktop and Android, deployment is simpler albeit heavier, and ultimately, Java is a much simpler language to manage than C++.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

This topic is closed to new replies.

Advertisement