Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411283 Posts in 69325 Topics- by 58380 Members - Latest Member: bob1029

March 29, 2024, 04:56:34 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Anyone use Java?
Pages: 1 [2]
Print
Author Topic: Anyone use Java?  (Read 2419 times)
oahda
Level 10
*****



View Profile
« Reply #20 on: September 19, 2015, 02:10:01 PM »

I think a lot of people (myself included at times) think of C/C++ as "man's" languages because they are a bit more labor intensive in terms of how you deal with memory and all that, but there's something to be said about the beauty of a virtual machine doing a lot of the heavy lifting for you.
Female C++ programmers certainly don't think of C++ as a "man's language", silly boy.

Yeah. I used SDL 2.

I don't mean to derail, but how hard was it to wire that up with JNI, ADK and everything? Like, what was your environment and flow? Is any of it open sourced?

I'm keen to try my hand at a mobile SDL2 game but my experience with the Android toolchain hints that it's a pretty deep rabbit-hole.
It was a bit tricky to get it working in the first place, with weird errors, but once I did get it working there were no further problems. Wrote the game in Xcode for both iOS and Android at the same time and wrote a little Bash script to update the makefile for Android (and compile for Android as well using make) whenever I compiled for iOS. I only used Eclipse to set up the project and press the play button whenever I wanted to test on Android.
Logged

moomat
Level 0
***



View Profile WWW
« Reply #21 on: September 19, 2015, 02:22:06 PM »

Female C++ programmers certainly don't think of C++ as a "man's language", silly boy.

My apologies for the sexism Smiley I meant it with the minimum amount attainable.
Logged

Check out Junk E.T. at junketgame.com

oahda
Level 10
*****



View Profile
« Reply #22 on: September 19, 2015, 02:32:48 PM »

Apology ac++epted!
Logged

Cheezmeister
Level 3
***



View Profile
« Reply #23 on: September 19, 2015, 04:41:03 PM »

Man vs. boy, not man vs. woman. Grown-up language =P

I really don't understand the whole fear of memory management thing. It's really not that hard, and it's not even necessary if you keep stuff on the stack. You can write an entire game and never use "new".

Contrast to Java where you *must* use "new" willy-nilly because all objects are on the heap whether you like it or not. Yes there's a GC. No, it is not magic. Furthermore you can't control it directly which makes it *harder*, in practice, to avoid memory leaks (unless you were being mega-sloppy to begin with). Basically, JVM says "memory leaks are a feature, not a bug!" Just look at how much RAM Eclipse and IntelliJ devour. Oink, oink.

Not to hate on Java, but...I hate Java Smiley Oracle is just throwing more dung on the trainwreck. Having used it professionally for several years, I'm not speaking from ignorance. I just don't see the appeal.
Logged

෴Me෴ @chzmstr | www.luchenlabs.com ቒMadeቓ RA | Nextris | Chromathud   ᙍMakingᙌCheezus II (Devlog)
moomat
Level 0
***



View Profile WWW
« Reply #24 on: September 19, 2015, 05:01:39 PM »

Man vs. boy, not man vs. woman. Grown-up language =P

I really don't understand the whole fear of memory management thing. It's really not that hard, and it's not even necessary if you keep stuff on the stack. You can write an entire game and never use "new".

Contrast to Java where you *must* use "new" willy-nilly because all objects are on the heap whether you like it or not. Yes there's a GC. No, it is not magic. Furthermore you can't control it directly which makes it *harder*, in practice, to avoid memory leaks (unless you were being mega-sloppy to begin with). Basically, JVM says "memory leaks are a feature, not a bug!" Just look at how much RAM Eclipse and IntelliJ devour. Oink, oink.

Not to hate on Java, but...I hate Java Smiley Oracle is just throwing more dung on the trainwreck. Having used it professionally for several years, I'm not speaking from ignorance. I just don't see the appeal.

I mean, I don't really understand *hatred* of a programming language. And if we are going to hate one, it should be Javascript, amirite? Kidding Smiley

Depending on what level of discussion you're having, it's not necessarily an issue of which one is objectively better, but rather which language is right for your project. In our case, given the framework and tools we wanted to use, we had to go with Java, and I really have no beef with the language itself. From sort of a bird's-eye view, both Java and C++ basically do a lot of the same things, just through different tactics (namely, the JVM versus native). The garbage collection thing...I'm emotionally neutral about its existence, really.

I don't know a lot about sort of the metastory of Java, although what I do know about it leaves me a little unimpressed, so I agree with that much. But in regards to the OP's general like "Is Java viable for game development" question, of course it is, and there are even some benefits to using it that you won't find elsewhere, but it's not necessarily a better or worse option than other languages.

Logged

Check out Junk E.T. at junketgame.com

Layl
Level 3
***

professional jerkface


View Profile WWW
« Reply #25 on: September 19, 2015, 06:07:02 PM »

Man vs. boy, not man vs. woman. Grown-up language =P

I really don't understand the whole fear of memory management thing. It's really not that hard, and it's not even necessary if you keep stuff on the stack. You can write an entire game and never use "new".

Contrast to Java where you *must* use "new" willy-nilly because all objects are on the heap whether you like it or not. Yes there's a GC. No, it is not magic. Furthermore you can't control it directly which makes it *harder*, in practice, to avoid memory leaks (unless you were being mega-sloppy to begin with). Basically, JVM says "memory leaks are a feature, not a bug!" Just look at how much RAM Eclipse and IntelliJ devour. Oink, oink.

Not to hate on Java, but...I hate Java Smiley Oracle is just throwing more dung on the trainwreck. Having used it professionally for several years, I'm not speaking from ignorance. I just don't see the appeal.

You -can- write an entire game never using new... but why would you want to? You lose out on a lot of important things when avoiding the heap, like polymorphism and dynamically sized arrays.

This is however a thing I agree on, data locality has been for me a big issue in game development in higher level languages. This is why I've personally always preferred C# over Java, since C# provides a way to get a bit of that data locality back in the form of C# structs. You can even directly put an array of structs into OpenGL and it will swallow it up nicely as an array of vertices.

However, overall if I would say I've come to hate a specific language, it would be C++. The sheer age, amount of legacy and bad decisions that that language is straining under is starting to break down. C++11 is a mess of trying to add in new features to keep up and it's only seemingly getting worse. I've just ended up moving to other low level languages where I can, my personal favorite being Rust (memory safety AND no GC, yay!).
Logged
J-Snake
Level 10
*****


A fool with a tool is still a fool.


View Profile WWW
« Reply #26 on: September 20, 2015, 04:14:02 AM »

However, overall if I would say I've come to hate a specific language, it would be C++. The sheer age, amount of legacy and bad decisions that that language is straining under is starting to break down.
Can you name few bad decisions?
Logged

Independent game developer with an elaborate focus on interesting gameplay, rewarding depth of play and technical quality.<br /><br />Trap Them: http://store.steampowered.com/app/375930
J-Snake
Level 10
*****


A fool with a tool is still a fool.


View Profile WWW
« Reply #27 on: September 20, 2015, 09:57:00 AM »

I am currently comparing C++98 vs Ada95 in regards of productivity and safety.
Logged

Independent game developer with an elaborate focus on interesting gameplay, rewarding depth of play and technical quality.<br /><br />Trap Them: http://store.steampowered.com/app/375930
Layl
Level 3
***

professional jerkface


View Profile WWW
« Reply #28 on: September 20, 2015, 10:12:19 AM »

Can you name few bad decisions?

A few big ones that I'm personally noticing a lot lately are the weird ways move semantics have to be added to a type, the exclusion of a modules system in C++11 (I'm aware that they excluded it to work on it later, but it's 2015 now and there's still nothing anyone has even heard about it), and that C++ continues to have a bonkers templating system that throws up the most incomprehensible of errors.

The biggest thing that kills any further use of C++ for me when I have a choice though is the lack of a maintained and well supported dependency system, making dependencies an absolute nightmare.
Logged
pelle
Level 2
**



View Profile WWW
« Reply #29 on: September 20, 2015, 11:30:49 PM »

When I first learned Java in the late 90's it was a no-brainer to start using that. In a quite simple language, about the size of C, you got simple object-orientation (the best parts from C++) without any confusing difficult things like template or macros or multiple inheritance. The standard library was small, but you got all the important maths and string functions, plus a GUI library, and threads. And all of it was portable to several different platforms and you could download it for free and it had a garbage collector! So easy to learn and you got so much for free.

Now I have worked with Java on and off for the last 15 years (mostly "on"), but I am no longer a fan, to say the least. First the language is not the simple, clean little language it once was. Java has become much more complex and bloated. C++ on the other hand has been expanded and they have worked hard on deprecating the worst parts of the language. If you program C++ now with smart pointers and STL and stay away from the most obscure low-level parts or most complex template-stuff it is not so bad at all, and there are nice cross-platform (free) C/C++ GUI/game libraries now unlike in the 90's. Plus you have auto (type deduction) and lambdas that you normally expect of much higher-level languages, while still working at a very low (and fast) level when you need that. C++ (and C) is also much more cross-platform than Java, but of course that was always the case. Even if the performance is not needed, choosing Java over C++ now does not feel as obvious as it was to me ~16 years ago. Even modern C is quite nice to work with really. As long as you can make full use of C++11 (or C++14) or C99 that is, not when you work with some ancient compiler.

I recognize that C++ is still a beast and not as programmer-friendly as higher-level languages usually are. If I need to get something done, and create readable code that works without weird hard-to-debug errors and do not worry much about performance there are very nice high-level languages like python or clojure. The latter even allows for seamless integration with Java libraries, when that is needed. So except for when someone pays me (good) to work with Java I can't really think of what niche of applications/games I would ever personally choose that for.

And all this is without getting into a long rant about how much I despise the Java culture of having big bloated XML-driven over-designed frameworks for everything, and other just plain bad design choices that are often made that are not strictly enforced by the language, but just seems to be part of how many choose to use Java. Or my fears for what Oracle might do.
Logged
Dacke
Level 10
*****



View Profile
« Reply #30 on: September 21, 2015, 01:38:26 AM »

From a different perspective:
Over those years the syntax has gotten simpler, everything in the standard library is optional and JVM has gotten much faster despite features being added. So I don't really see any downside to this "bloat" you say it suffers from. Except the fact that Java is mostly used for enterprise systems, so a fair number of libraries are geared towards that style (what you call over-engineered)
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
pelle
Level 2
**



View Profile WWW
« Reply #31 on: September 21, 2015, 03:18:10 AM »

From a different perspective:
Over those years the syntax has gotten simpler, everything in the standard library is optional and JVM has gotten much faster despite features being added. So I don't really see any downside to this "bloat" you say it suffers from. Except the fact that Java is mostly used for enterprise systems, so a fair number of libraries are geared towards that style (what you call over-engineered)

Sure. But I think Java had a great advantage in being a small and clean language that anyone could master quickly. It was easy to see how it became a huge hit. You can avoid parts in any programming language to make it small. You can use a small subset of Java or a similar size subset of C++, but in either case it is difficult to not sometimes/often have to understand also the other parts. I think Java is still better at this than C++, but it is not the huge advantage it was 15 years ago, by far.

The JVM speed is impressive. It is of course still very slow compared to native code (outside of carefully constructed benchmarks, out in the real world) and start-up time is not great, or memory use, but I agree it is fast enough for almost anything. Of course Clojure and Python are even slower and I don't mind as long something runs fast enough.
Logged
Dacke
Level 10
*****



View Profile
« Reply #32 on: September 21, 2015, 03:31:09 AM »

My impression is actually that the carefully designed benchmarks are to the comparative benefit of C++, because they make use of more low-level stuff than you'd usually see  Shrug
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
pelle
Level 2
**



View Profile WWW
« Reply #33 on: September 21, 2015, 03:54:43 AM »

Low-level things like... games, you mean? Smiley
Logged
Dacke
Level 10
*****



View Profile
« Reply #34 on: September 21, 2015, 05:14:17 AM »

Indeed, benchmarks and things that need a high level of optimization (like graphics/physics heavy game engines)
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Cheezmeister
Level 3
***



View Profile
« Reply #35 on: September 24, 2015, 08:01:13 AM »

To be fair, the lion's share of games most of us here are concerned with aren't large or deep enough that they need every last cycle to be performant. It's 2015, we can get some sweet eye candy with Python or even (gasp) JS.

In any case, "hate" is perhaps an exaggeration, I think I'm just weary of the limitations the language imposes on programmers, even after twenty years (e.g. ball.setVelocity(ball.getVelocity()+1) or DecoratedEntityManagerBuilderFactoryAdapter ) and the large contingent of "Java programmers" who refuse to try anything else. I've seen some shit. 10kloc jars where a 10-line script would suffice. 'Cause those same limitations are what makes Java one of THE most general-purpose languages/platforms out there. You can make it do anything if you have the patience for it.

The bottom line is, if you like it, use it! One of the perks of modern gamedev is the immense level of choice. Just keep an open mind!

♥♥♥

PS - JetBrains put out a nice piece on how C++ got to be where it is today, where it came from and where it's going. https://www.jetbrains.com/cpp-today-oreilly/books/Cplusplus_Today.pdf Highly worth a read if it interests you.
« Last Edit: September 24, 2015, 01:26:44 PM by Cheezmeister » Logged

෴Me෴ @chzmstr | www.luchenlabs.com ቒMadeቓ RA | Nextris | Chromathud   ᙍMakingᙌCheezus II (Devlog)
oahda
Level 10
*****



View Profile
« Reply #36 on: September 26, 2015, 03:46:54 AM »

That paper was a nice read! Read the whole thing.
Logged

WavePropagation
Level 0
*


View Profile
« Reply #37 on: September 29, 2015, 09:57:38 AM »

I'm using Java for my game engine. And I posted my last project here a few weeks ago, but didn't get any replies. So it seems like most people here are into other languages (at least what concerns game development). Smiley

In case you want to check it out, here is a link to that other thread: http://forums.tigsource.com/index.php?topic=50146.msg1175001#msg1175001
Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic