• Java and Game Development - What's the problem?
    47 replies, posted
java does have a JIT compiler and it is a compiled language. Because of the optimisations possible with the java architecture java has become pretty fast at many things. The problem with game development is just that you just cannot use the hardware directly. This article explains it quite well: [url]http://scribblethink.org/Computer/javaCbenchmark.html[/url]
[QUOTE=Richy19;28551598]Bu its 4th on your list before C# And c# is one of the most used languages for tool development[/QUOTE] C# isn't even in my list, are you even reading the right post?
[QUOTE=gparent;28564092]C# isn't even in my list, are you even reading the right post?[/QUOTE] Thats what i mean. Which means assembly would be more important to know than C#
[QUOTE=gparent;28564092]C# isn't even in my list, are you even reading the right post?[/QUOTE] welcome to the world of richy19
[QUOTE=deloc;28564526]welcome to the world of richy19[/QUOTE] This post makes less sense than your life. Read the post above yours
[QUOTE=Richy19;28564220]Thats what i mean. Which means assembly would be more important to know than C#[/QUOTE] Correct. Are you just testing out your reading comprehension, or is there a bigger picture I'm not seeing?
[QUOTE=robmaister12;28541113]that example only uses something like MyEnum.Value1, not something that uses a bitwise operator like MyEnum.Value1 | MyEnum.Value2. If you want to use bitwise operators on an enum, you can't. You need to do the class with public static final ints thing, or have the enum store an int value, which would basically get around the whole point of having a type-safe value. There is an EnumSet class, but it's too slow for a game on a cell phone, where every little thing counts for performance. and storing a value in an enum requires writing a constructor for it: [url]http://www.java2s.com/Code/Java/Language-Basics/Useanenumconstructor.htm[/url][/QUOTE] Ah, okay. Thanks for explaining that to me. I honestly don't know very much about enums.
[QUOTE=gparent;28566175]Correct. Are you just testing out your reading comprehension, or is there a bigger picture I'm not seeing?[/QUOTE] What? You said that the preffered languages would be C++, HLSL/GLSL, C, asm So i asked why would assembly be more important than C# considering now a days companies use C# for most of their in-house tools
[QUOTE=Richy19;28568902]What? You said that the preffered languages would be C++, HLSL/GLSL, C, asm So i asked why would assembly be more important than C# considering now a days companies use C# for most of their in-house tools[/QUOTE] Because the guy I asked hires for a company where they don't use C# for tools. I'd be happy to see where you got your stats from, though. Can you link me? Sounds interesting.
[QUOTE=gparent;28568991]Because the guy I asked hires for a company where they don't use C# for tools. I'd be happy to see where you got your stats from, though. Can you link me? Sounds interesting.[/QUOTE] No stats but looking at a couple of job adverts they mention C# is a plus [url]https://www.develop-online.net/jobs/job/4041/Senior-Tools-Programmer-wanted-for-AAA-game-studio[/url] [url]http://canadajobs.allstarjobs.ca/job/2011-02-18/81979?action=search&offset=1920[/url] Also this guy went for a job where they wanted C# knowledge [url]http://www.facepunch.com/threads/1009257-UK-Universities?p=25405912&viewfull=1#post25405912[/url]
I think that it's only good for cell phone games
[QUOTE=Richy19;28569771]No stats but looking at a couple of job adverts they mention C# is a plus [URL]https://www.develop-online.net/jobs/job/4041/Senior-Tools-Programmer-wanted-for-AAA-game-studio[/URL] [URL]http://canadajobs.allstarjobs.ca/job/2011-02-18/81979?action=search&offset=1920[/URL][/QUOTE] Alright, so let's stop claiming that "most" companies use it then ;) At any rate, I never said knowing C# wasn't important. I just said that if you want to do game programming (and by that I did target mostly engine development, just a habit), I think the languages are listed are pretty important. Take it or leave it.
[QUOTE=garychencool;28575361]I think that it's only good for cell phone games[/QUOTE] "X company has recently decided to use Y programming language for their platform, therefore the only use for Y is under X's platform"
going to add my 5c... maybe abit more... but still... Java was developed to be multiplatformed. Yes, it is an interpretted language, however, the performance gap between Java and other languages like C++ is narrowing at a rapid rate. Java is an excellent choice for game programming if you want to write one set of code to be played on multiplatforms. Of course each platform has some minor bugs you will need to account for (like windows setPrefferedSize glitch <insert rage face here>) but it is quite a brilliant system. I would recommend having a look at lwjgl ([url]http://www.lwjgl.org/[/url]) it basically combines all the essential parts of game production for Java into one package (OpenGL, OpenAL, JInput, etc) and it is under the BSD license. Ok, so I am typing a wall. Most developers frown upon java as programming language for games. However, multiple companies embrace it. Look at Mojang Studios or Jagex Studios, both of those run almost completely off of Java. Take a look at Jake2 aswell ([url]http://bytonic.de/html/jake2.html[/url]). It is also a brilliant example of Java's capabilities. If you are in possession of an android... Take a look at Pocket Legends ([url]http://www.pocketlegends.com/[/url]). Ok, so I have come up to like 20c so far. Most companies will prefer you to know C# or C++ because it is too much to go and recreate their game engines or acquire others and learn a new API in time to create a new game. Heading off to next class now, sitting on campus... I will possibly update this if i remember... tl;dr: feel free to use java... oh, and have a look at [url]http://www.lwjgl.org/[/url]
[QUOTE=robmaister12;28541113]If you want to use bitwise operators on an enum, you can't. You need to do the class with public static final ints thing, or have the enum store an int value, which would basically get around the whole point of having a type-safe value.[/QUOTE] That's no different from instances of any other class; you can't use bitwise operators on a String or a List or an Elephant. How is that a problem with enums? I've been developing in Java professionally for several years and I can't think of a case where I'd ever wanted to switch on a bitwise combination of several enum values. If you want to handle several enum values with the same code in a switch statement, you do it like this: [code]switch(myEnumValue) { case Value1: case Value2: doStuff(); break; }[/code] The usefulness of having enums be classes rather than integers is that they can have methods and even implement interfaces, and you can define the methods differently for each enum value. If you put this to good use, you can often avoid the need for switch statements entirely. For example, I created an enum to represent the various ways of sorting a multi-column list, with values like NAME_ASCENDING, NAME_DESCENDING, SIZE_ASCENDING, SIZE_DESCENDING, and so on. When it comes time to actually sort the list, you might think to use a switch statement to run different code depending on the chosen sorting order, but instead I made the enum implement Comparator<MyClass>, with a different compare() for each enum value. That way I could just call a sort method on my list, and pass the current sorting mode as the comparator to be used by the sort method. No switch needed.
[QUOTE=CountNoobula;28632579]Java was developed to be multiplatformed. Yes, it is an interpretted language,[/QUOTE] Why do people keep repeating that as it mattered in the slightest? Do people talk about how C# is "interpreted" every time it is brought up?
[QUOTE=Wyzard;28633875]That's no different from instances of any other class; you can't use bitwise operators on a String or a List or an Elephant. How is that a problem with enums? I've been developing in Java professionally for several years and I can't think of a case where I'd ever wanted to switch on a bitwise combination of several enum values. If you want to handle several enum values with the same code in a switch statement, you do it like this: [code]switch(myEnumValue) { case Value1: case Value2: doStuff(); break; }[/code] The usefulness of having enums be classes rather than integers is that they can have methods and even implement interfaces, and you can define the methods differently for each enum value. If you put this to good use, you can often avoid the need for switch statements entirely. For example, I created an enum to represent the various ways of sorting a multi-column list, with values like NAME_ASCENDING, NAME_DESCENDING, SIZE_ASCENDING, SIZE_DESCENDING, and so on. When it comes time to actually sort the list, you might think to use a switch statement to run different code depending on the chosen sorting order, but instead I made the enum implement Comparator<MyClass>, with a different compare() for each enum value. That way I could just call a sort method on my list, and pass the current sorting mode as the comparator to be used by the sort method. No switch needed.[/QUOTE] I just personally find it annoying because I can't use enums for flags like I can in C# and C++ (C++ enums aren't type safe, but I still prefer it to a separate class with a bunch of "public static final int CONSTANT = 1;" lines).
C-style enums aren't really suitable for holding flags either, because the bitwise OR of two enum values isn't necessarily valid to store in a variable whose declared type is the enum. You may use enum syntax to declare names for some numbers, but you use plain ints for actually working with them. Java enums serve a different purpose, but I think it's a useful one.
Sorry, you need to Log In to post a reply to this thread.