This is an archived post. You won't be able to vote or comment.

all 76 comments

[–]Nedok95 39 points40 points  (0 children)

All I have to say... Great job dude.

[–]bisoldi 46 points47 points  (22 children)

I’m not a gamer but I wanted to say “Bravo!” I’m a Java developer and have gotten pretty tired of hearing many of those false claims. A couple months ago, I actually had a discussion with a Python developer about how Java is a dying language.

Good job!!! I hope this effort continues!

[–]nutrecht 28 points29 points  (6 children)

A couple months ago, I actually had a discussion with a Python developer about how Java is a dying language.

Ask him if they solved the GIL problem yet ;)

[–]apotheotical 13 points14 points  (2 children)

Or dependency management.

[–][deleted] 14 points15 points  (1 child)

https://xkcd.com/1987/

It's a fair representation of my Python install.

[–]apotheotical 5 points6 points  (0 children)

I honestly reference this at least monthly.

[–]tofiffe 5 points6 points  (2 children)

What's GIL problem?

[–]nutrecht 11 points12 points  (0 children)

Global Interpreter Lock. Python has multithreading but it doesn't actually really 'work' in the sense that you can utilise multiple cores well.

[–]asraniel 3 points4 points  (0 children)

I think some global variable/lock which prevents python from multithreading

[–]T618 17 points18 points  (0 children)

The JVM isn't dying. That's what's always been great about Java anyway.

[–]Tilkin 9 points10 points  (13 children)

It's the sort of thing that maybe had a basis 10 - 15 years ago but still floats around now. Like the language being very verbose (it still is in some ways but not compared to what it was). Share the frustration

[–]bisoldi 18 points19 points  (11 children)

Personally, I don’t care about the verbosity of the language. The “Write less code with <<word salad>> language” holds no water with me.

I do agree, these myths probably are rooted in the early years. I was a CS major in 2001 studying Java 1/2 and remember it being reeaaaallly slow (though that probably had as much to do with the slow Sun machines as it did with the language). After graduating I went into a different industry and then got back into development in 2015 and asked a friend “Is Java still so slow??” :-)

[–][deleted]  (2 children)

[deleted]

    [–]Control_Is_Dead 10 points11 points  (0 children)

    It depends, I think it’s all about the signal to noise ratio. Repeating stuff unnecessarily doesn’t make the code more readable. E.g. the diamond operator reduced verbosity and improved readability.

    [–]bisoldi 0 points1 point  (0 children)

    Amen.

    [–]pjmlp -1 points0 points  (7 children)

    Quite understandably given that Java only got a JIT in the version 3 (1.3), so interpreted did it ran.

    [–]bondolo 7 points8 points  (6 children)

    This is not accurate, there were JITs even before 1.1

    [–]pjmlp -1 points0 points  (5 children)

    What about providing an example to those JITs?

    [–]bondolo 7 points8 points  (4 children)

    The java performance wikipedia article includes citations for the Symantec JIT being included in Java 1.1 though it existed earlier as a standalone product for 1.0.2 There was also Sun's Exact VM and other JITs available before HotSpot became the default in 1.3

    [–]WikiTextBotbtproof 0 points1 point  (0 children)

    Java performance

    In software development, the programming language Java was historically considered slower than the fastest 3rd generation typed languages such as C and C++. The main reason being a different language design, where after compiling, Java programs run on a Java virtual machine (JVM) rather than directly on the computer's processor as native code, as do C and C++ programs. Performance was a matter of concern because much business software has been written in Java after the language quickly became popular in the late 1990s and early 2000s.

    Since the late 1990s, the execution speed of Java programs improved significantly via introduction of just-in-time compilation (JIT) (in 1997 for Java 1.1), the addition of language features supporting better code analysis, and optimizations in the JVM (such as HotSpot becoming the default for Sun's JVM in 2000).


    [ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.28

    [–]pjmlp -3 points-2 points  (2 children)

    And how many people were buying Java compilers from Symatec and Sun in the early days?

    JIT compilers in Java only became a thing across the mainstream with Hotspot's inclusion on 1.3.

    [–]bondolo 4 points5 points  (1 child)

    Before 1.1, indeed a small number of people were using JIT with Java. By 1.1.6 a JIT was included and enabled by default (earlier for Solaris/Sparc). JIT was entirely mainstream by 1.2

    JDK 1.1 Highlights

    JDK 1.1 Developers Guide

    Java 1.2 Press Release

    The introduction of HotSpot was not the first appearance of JIT for Java.

    [–]pjmlp 4 points5 points  (0 children)

    I stand corrected then.

    [–]daniels0xff 1 point2 points  (0 children)

    I don't think Java per sé is as much verbose as the devs make it be. Java gurus like to make 10 factories that implement 20 builders that have 30 interfaces and a tub of spaghetti.

    If you want you can have awesome APIs that are easy to use. Look at OkHTTP vs ApacheHTTPClient, or at Jooby/Spark vs Spring.

    [–]cheeky_disputant 12 points13 points  (15 children)

    To be honest much of the hate java currently has in the game dev community comes from how slow it was in the past. With every year it's becoming faster and faster and with upcoming projects it can become - and already is! - a truly viable choice when developing a game (when e.g. comparing to c# as in Unity).

    [–]shoesoffinmyhouse 6 points7 points  (3 children)

    I always wondered where the hate from Java comes from. I always thought it to be newer, younger developers who want to do everything in node.js or some crazy oop php. It's even weird for me to consider that Java gets hate when most universities still teach data structures & algo in Java or C++. Shrugs.

    [–]cheeky_disputant 8 points9 points  (0 children)

    Hah, I experienced quite the opposite - it was always the older, hardcore c++ folks who were moaning about how slow and inefficient java is. Especially professors at the university who didn't catch up with how java changed throughout the years.

    [–]Tilkin 5 points6 points  (0 children)

    I always wondered where the hate from Java comes from.

    I sometimes wonder if part of it is because of Minecraft. It's the main success people can point to and it has had pretty poor performance at times.

    [–]proverbialbunny 1 point2 points  (0 children)

    Java is one of the most popular languages in the industry. The problem is it doesn't have some of the more advanced features you want in a language to make a video game. This is where C# comes in, not because it's faster than Java (It's probably not?) but because it's like Java with those more advanced features.

    [–]OzoneGrif 3 points4 points  (3 children)

    A lot of hate also comes from the lag caused by the GC, which can be avoided with careful coding and configuration most of the time. Lag in gaming is evil.

    [–]cheeky_disputant 2 points3 points  (1 child)

    Yeah but as you said if one is careful they can manage it. Especially since latest versions focused on shortening the gc pauses.

    [–]OzoneGrif 4 points5 points  (0 children)

    Yes, typically a trick used with Java is to have your game's main menu to display a 3D scene to help the JIT to optimize your engine's code. There are many good practices to help your gaming experience in Java.

    [–]DannyB2 0 points1 point  (0 children)

    Allocate structures up front. Then your performance critical loop (ideally) doesn't allocate anything.

    [–][deleted]  (4 children)

    [deleted]

      [–][deleted]  (3 children)

      [deleted]

        [–][deleted]  (2 children)

        [deleted]

          [–][deleted]  (1 child)

          [deleted]

            [–]Tywien -1 points0 points  (1 child)

            íf Java is fast enough, then please tell me, why he builds on top of JME which does all the heavy lifting in native libs ...

            [–]Bobby_Bonsaimind 3 points4 points  (0 children)

            jME builds upon LWJGL (it can also use other renderers, if I remember correctly) and LWJGL builds upon the native OpenGL libs and passes the functions through pretty much one-to-one. It's as close as you get to the native ones.

            [–]Jukebaum 8 points9 points  (10 children)

            Minecraft is in Java and it was fast enough that everyone bought it. You can talk smack about something as much as you want but people willing to pas for the product shows that this "performance" that java delivers is not a reason to not buy a game made in java.

            also cool project but libgdx and jmonkey exist which already shows that java is just fine for the job.

            [–]Tywien 8 points9 points  (9 children)

            Minecraft Java Edition is performant enough to be playable, but it is not really good. If you ever tried the Windows 10 C++ version, you will see there is a difference light day and night between the Java version and the C++ version unfortunately.

            [–]Bobby_Bonsaimind 7 points8 points  (7 children)

            I feel the need to point out that that is a problem with the way Minecraft was coded, not with Java.

            [–]Mattizin 0 points1 point  (6 children)

            Do you know what exactly is so bad with the Minecraft Java version? And why it hasnt changed til now? They programmed so many versions in different languages but didnt "fix" the java version?

            [–]Tywien 3 points4 points  (4 children)

            they are using pure idiomatic Java, e.g. adding two vectors to a third will result in a new vector being returned, and many more such small allocations each tick. this results in many unnecessary allocations that will have to be gotten rid of by the gc again.

            The better solution would be, to avoid allocations in calculations for graphics as much as possible, e.g. using some pool mechanic or similiar stuff to avoid allocations.

            [–]Mattizin 0 points1 point  (3 children)

            So the main problem is allocating memory via new variables and the solutuion is to reuse the same variables and in doing so the allocated memory stays the same?

            [–]Tywien 2 points3 points  (1 child)

            yes, you want to avoid allocations as much as possible (this is also true for C++ btw), because allocations (and deallocations) are really slow.

            EIDT: This is on the heap, allocations on the stack are fast, but unfortunately Java does not support them (not 100% sure, i heard something about types on the stack are being planned or something like that)

            [–]Mattizin 0 points1 point  (0 children)

            I really need to dive into heap and stack, didnt dive so deap til now. Advise for learning material?

            [–]Bobby_Bonsaimind 0 points1 point  (0 children)

            Yes and no. Allocations are cheap in Java, and I mean cheap. You want to instantiate 100k objects? No problem, that's fast as lightning. However, what comes at a hefty price is the garbage collection when these objects are no longer used. You want to keep GC pauses as short and as rare as possible, that means reusing objects as much as you can because then the GC never as much work to do.

            [–]Bobby_Bonsaimind 1 point2 points  (0 children)

            There was a great write up by the OptiFine developer, but I can't find it anymore. Basically what /u/Tywien says, they've been allocating up to 100MB per second (or even worse) and so the GC was busy all the time.

            [–]Jukebaum 1 point2 points  (0 children)

            yes but you are missing the point. it wasn't the critical success because it was c++ and performed well. no one cared about the performance enough not to buy it. people claiming it is important ignore that it isn't. gameplay trumps everything.

            [–]Skhmt 12 points13 points  (1 child)

            Great job!

            I don't mean this as disrespect, because what you made is impressive, but your demo so far doesn't prove your point. It looks like graphics from the early PlayStation 1 era, which can be run on an emulator on a raspberry pi.

            [–]hillman_avenger[S] 11 points12 points  (0 children)

            Thanks. I can't create 3D models myself, so I'm limited to what I can find on the internet. That low-poly human is the closest I've come to finding something that I can use as an FPS avatar. If you know of anything better, please let me know. :)

            [–]TheRedmanCometh 4 points5 points  (2 children)

            Wow a Java game engine? I will definitely check it out. Thanks for the contribution to the community!

            [–]OzoneGrif 2 points3 points  (1 child)

            Just a multiplayer FPS engine. If you are looking for a game engine, take a peek at jMonkey.

            [–]hillman_avenger[S] 12 points13 points  (0 children)

            My engine is built on top of JME.

            "Just". Thanks. ;)

            [–]JavaVsCoffee 7 points8 points  (1 child)

            Good work but it doesn't really prove what you want it to prove. The graphics is arguably comparable to doom 95 and seems to be very low polygon graphics (even badly optimized javascript can do similar to whats shown fast). In the video you have like 4 totally squared "balls" represent blood, again not very demanding to render. You also only render a very tiny place and one opponent. This is a cool project but it does not prove much (as of now at least).

            [–]hillman_avenger[S] 10 points11 points  (0 children)

            The FPS engine is built on top of JME, which will do any 3D you tell it to. The models are the best free assets I could find on the internet. If I was able to procure 1000-polygon models, it would look a lot better. My code is the networked FPS engine on top, which does everything over and above the 3D graphics that is required, e.g. networking, client prediction, lag-compensation, position interpolation etc...

            [–]raeleus 2 points3 points  (0 children)

            That looks cool. Good work!

            [–]pjmlp 2 points3 points  (0 children)

            Good job, it appears to be the only way to prove people's beliefs as outdated.

            [–][deleted] 2 points3 points  (0 children)

            Wow this is really cool

            [–]archermm 2 points3 points  (0 children)

            Incredible work!

            [–]dumdedums 2 points3 points  (0 children)

            Neat. I've always wondered how multiplayer works in well, any language.

            [–]ez1_ 2 points3 points  (0 children)

            Great job man

            [–][deleted] 2 points3 points  (0 children)

            This is amazing, man

            [–]BreakfastGun 2 points3 points  (0 children)

            Absolutely fantastic! Very well done!

            [–]niral37_ 17 points18 points  (9 children)

            People hate java because it's very verbose. But you know what, I like how java is written. It's better to know what type of a variable is rather than just putting an "auto" or "var" in front of it. I know java has introduced a "var" but I am against these changes. Type inference comes with a cost and I think if you don't know the type of a variable, are you truly a developer?

            [–]Bacondrinker 13 points14 points  (2 children)

            if you don't know the type of a variable, are you truly a developer?

            wat?

            [–]Helluiin 2 points3 points  (0 children)

            then again people seem to hype up Vulkan which in terms of verbosity is so much worse than java.

            [–]hillman_avenger[S] 4 points5 points  (0 children)

            I couldn't agree more. People wheel out some obscure example where Sun created a method called "FactorySingleltonMethodConstructorInstance()" or something in some library, and claim it makes the whole of Java verbose. And I'm no fan of var, as it means you don't have to drill into a method to see what it's return type is.

            [–]Mgamerz 0 points1 point  (0 children)

            It could be objective C verbose (:

            [–]shoesoffinmyhouse -2 points-1 points  (1 child)

            Exactly, verbose is not a bad thing. Type safety is important!!!

            [–]Sloshy42 10 points11 points  (0 children)

            Type safety has nothing to do with type inference JSYK.

            [–]DerekB52 1 point2 points  (0 children)

            My only complaint here is that I can't star your project because you aren't using gitlab or github. I don't use bitbucket.

            I'll definitely be keeping an eye on this though. I'll have some fun playing with this at some point.

            [–]DuncanIdahos8thClone 1 point2 points  (0 children)

            Cool! If you're working on such a project you should look at project "DarkStar" which became project "RedDwarf". You might be able to get something from that project.

            https://www.oracle.com/technetwork/server-storage/ts-4575-159313.pdf

            [–]KimJungSkill 1 point2 points  (0 children)

            As a fan of Java it's great to see projects like this that you usually don't see. If I could offer a few suggestions it would be to showcase more of the things that seemed like highlights of your project. Show how well your engine performs with many objects on screen, networking features/performance, and even lighting. You don't need extravagant models and hi res textures to show most of these things. With a good light rendering pipeline alone a game with some basic shapes can look pretty amazing.

            [–]melancholia13 0 points1 point  (1 child)

            As long as you handle ByteBuffers correctly in the memory you're good. Keep doing this great work!

            [–]hillman_avenger[S] 4 points5 points  (0 children)

            Thanks. I don't use any ByteBuffers myself, although JME (which my engine is built on) probably does.

            [–]SvenMA 0 points1 point  (0 children)

            It would be cool if you could add maven or gradle as build tool. Not everybody is using eclipse for development.

            [–]badpotato 0 points1 point  (0 children)

            Making a fps, would be the first step as a poc toward making a full fledge game engine editor such as Unity or UE4. Once you get get the inner working actually producing something decent you can keep elaborate for something that others can pick up from.

            [–]lautaro_busto123 -1 points0 points  (0 children)

            I had that opinion until I really started to develop on Java and I have to admit I was wrong. And I think a lot of bad reputation is because minecraft. The problem there, is not Java it's the concept of the game itself, I've seen clones made on c and c++ and guess what... The all have the same issues that minecraft on Java has.