Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (800)
Games in Android Showcase (237)
games submitted by our members
Games in WIP (867)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Would it be worth porting to c++?  (Read 4470 times)
0 Members and 1 Guest are viewing this topic.
Offline lcass
« Posted 2015-01-02 22:10:07 »

So after reading a lot on this forum a lot of people are intent that for game programming you SHOULD go with c++ , I am thinking about doing it but it seems like a lot of effort for a very small gain. The reasons for it is that its more efficient and that it's more well used however the reason why I don't want to do it is because I can see that java as a language in a whole is getting a lot more powerful , 8 years ago no doubt I would've switched to c++ but I can see from now that high quality games built purely in java that are able to implement hardware acceleration more and more efficiently.

What do you think if of course you kept with the way that java is going and its performance is it worth porting over?
Offline Elsealabs
« Reply #1 - Posted 2015-01-02 22:10:47 »

Would it really matter for anything other than an AAA level game?

Offline KudoDEV

JGO Ninja


Medals: 79
Exp: 6 years


Game Dev Hobbyist


« Reply #2 - Posted 2015-01-02 22:15:49 »

Would it really matter for anything other than an AAA level game?

Exactly. Are you going to be able to create a game of better quality if you take that route?

Most likely not. Java is perfectly fine for indie games

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Kernel


Medals: 383
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #3 - Posted 2015-01-02 22:19:11 »

The question you have to ask yourself is how much performance do you need, and will switching to C++ allow you to get that extra performance where Java didn't.

Simply having control over the memory you're using can allow you to make pretty decent optimisations, but at the same time you have to be very careful to not make mistakes.

Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Reply #4 - Posted 2015-01-02 22:26:20 »

Unless you are looking to get intimate the industry I would not bother.

Add I've said to others before, for the sake of learning go for it. For practicality stick with what you know.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline gouessej
« Reply #5 - Posted 2015-01-02 23:51:14 »

You will probably get no performance gain by switching to C++. I got a performance gain (about 5%) when switching from C/C++ with GLUT to Java with JOGL and I have never looked back. I'm still surprised by those who complain about the garbage collection because you get some problems when you do something seriously wrong and it has nothing to do with the language itself. I admit that I don't use any physics engine yet.

Even 8 years ago I wouldn't have switched to C++.

In my humble opinion, port it only to target platforms that you can't target with Java but then, is it worth the efforts??

Julien Gouesse | Personal blog | Website | Jogamp
Offline Tekkerue

Senior Devvie


Medals: 7
Projects: 1



« Reply #6 - Posted 2015-01-03 20:59:37 »

What about using LibGDX? From what I've read, LibGDX does the performance critical stuff in C/C++. And you get the added benefits of automatically handling ports to mobile devices (Android, iOS, and Blackberry).
Online CopyableCougar4
« Reply #7 - Posted 2015-01-03 21:16:10 »

There is also jnigen, which allows you to write native methods with c++ code right next to the native method for anything that could have improved performance with native code.

https://github.com/libgdx/libgdx/wiki/jnigen

Either wandering the forum or programming. Most likely the latter Smiley

Github: http://github.com/CopyableCougar4
Offline HeroesGraveDev

JGO Kernel


Medals: 383
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #8 - Posted 2015-01-03 21:20:27 »

I think there's a pretty big overhead in the JVM for calling native functions.

Offline gouessej
« Reply #9 - Posted 2015-01-03 21:57:27 »

I think there's a pretty big overhead in the JVM for calling native functions.
A few nanoseconds per JNI calls, this isn't what I would call "a big overhead".

There is also jnigen, which allows you to write native methods with c++ code right next to the native method for anything that could have improved performance with native code.

https://github.com/libgdx/libgdx/wiki/jnigen
There is also GlueGen, used in JogAmp (JOGL, JOAL, JOCL, ...).

Julien Gouesse | Personal blog | Website | Jogamp
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline lcass
« Reply #10 - Posted 2015-01-05 21:23:42 »

I prefer to write my own implemented engine in opengl , it allows me to write it much more freely and I can create the functions as I would like.
Offline Ghidra

Junior Devvie


Medals: 3



« Reply #11 - Posted 2015-01-16 04:52:54 »

A lot of you are missing the point:  performance doesn't need to have anything to do with choosing C++ over Java.  By writing your game in Java you are restricting yourself to platforms that run the JVM.  You have to rewrite your entire project if you want it to run elsewhere.  However, if your game is written in C++, all platforms become viable because C++ compilers are ubiquitous.  If you have carefully designed your project, the bulk of your code will not need to be ported, and you will only have to make adjustments for different graphics/audio/input libraries.  This is not trivial, but it is manageable.

Also, if you ever want your game to appear on a console--aside from the OUYA--you can't write it in Java. 

Chad Philip Johnson
Anacronist Software
Offline PaulReeves

Junior Devvie


Medals: 3



« Reply #12 - Posted 2015-01-16 13:32:11 »

In defense of Java and portability, you can target all Desktops, android, ios and html5 and it is easy to set up with libgdx. So unless you are developing something more than a spare time project that would do well on console then it probably doesn't mater if you use Java or not. Should you have a break out success then port to C++ to get on consoles or pay someone to do it.
Offline delt0r

JGO Wizard


Medals: 145
Exp: 18 years


Computers can do that?


« Reply #13 - Posted 2015-01-16 15:25:12 »

C++ is bloody hard to write fast code in. Really. Java is much more forgiving in this respect.

Portability is indeed something to consider. But if your not trying to sell out to a console out of a gate, it is probably not such a concern. If you are, use the native tools for that console, or give unity a go. C# is not all gold, but i would work with it sooner than C++.

BTW i did a lot of contract C++ work back in the day. And i shudder every time i recollect those days.

I have no special talents. I am only passionately curious.--Albert Einstein
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (351 views)
2019-09-04 15:33:17

hadezbladez (5154 views)
2018-11-16 13:46:03

hadezbladez (2038 views)
2018-11-16 13:41:33

hadezbladez (5405 views)
2018-11-16 13:35:35

hadezbladez (1124 views)
2018-11-16 13:32:03

EgonOlsen (4546 views)
2018-06-10 19:43:48

EgonOlsen (5409 views)
2018-06-10 19:43:44

EgonOlsen (3087 views)
2018-06-10 19:43:20

DesertCoockie (3981 views)
2018-05-13 18:23:11

nelsongames (4555 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!