Be a Supporter!
octoberthirty1st
octoberthirty1st
  • Member since: Jun. 9, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
C# or Java 2013-06-15 17:03:02 Reply

What is the difference and which is better for coding games?

PMMurphy
PMMurphy
  • Member since: May. 27, 2012
  • Offline.
Forum Stats
Member
Level 01
Artist
Response to C# or Java 2013-06-15 17:09:40 Reply

I havn't studied the frameworks of either language. But i do know that java has issues when it comes to game development.

C# is used for apple products such as the iphone and ipad. So whether or not the langage is actually good for gaming is irrelevent. That is simply just too large of a market to ignore.

If im not misstaken i am pretty sure c# and java are basically identical languages with some minor differnces.

The reason most people don't like java video games is because c++ is simply faster at it. Java forces you to create an object everytime you want to make a method call or make functionality. Where as in c++ you don't have to do this. So there are some aspects where if coded correctly you can speed up the process of the game.

Having efficient code and all these things are CRUCIAL for game engines. So the language is even more important. The way graphics is produced requires tons and tons of calcluations. If the language is slowing it down it can result in choppy play and poor animations.

In reality. Java isn't a bad language to make games in. Yes there will be issues here and there and it may be slow in some aspects so on and so forth. But it is still a solid language and the differences between that and the best language for video games is miniscule.

Depending on the scale of the product determines if java's lower performance is even noticeable. So basically, the only reason your language should matter in video games is on a professional level where everyone just wants to make the best possible product out there.

Its like, designing material where something is still good to get the job done. But there is just a logically more sound solution in existance that is already used for that purpose.

That is kinda like how it works with languages.

In the end everything can be broken down into assembly language.

These languges meerly juts organize assembly in ways to make programming easier, that may or may not improve quality for some applications of their use.

PMMurphy
PMMurphy
  • Member since: May. 27, 2012
  • Offline.
Forum Stats
Member
Level 01
Artist
Response to C# or Java 2013-06-15 17:29:58 Reply

Oh yea, i forgot. Java is encrypted into andriod language with andriod SDK.

Whether or not these languages are good for game development or not is now irrelevant.

Mobile gaming apps is too big of a market to ignore.

seel
seel
  • Member since: Jun. 27, 2005
  • Offline.
Forum Stats
Member
Level 21
Musician
Response to C# or Java 2013-06-15 17:51:13 Reply

Dear octoberthirty1st, please be a tiny bit more specific in your inquiry. What sort of games are you planning on developing exactly and for what platform(s)? I'm just going to assume that you have little experience with game programming since you're asking a question like this in the first place. I suggest that you pick one and get crackin'.
It's hard to pick a bad language when you're just starting out. Performance will be of no concern for a while anyway, and by the time it becomes relevant you should be educated enough to make your own decisions.

At 6/15/13 05:09 PM, PMMurphy wrote: i do know that java has issues when it comes to game development.

So does every language if you look at it from the right angle. Although it's hard to come up with a good answer when OP asks the worst question in the universe, I'll give you that.

C# is used for apple products such as the iphone and ipad. So whether or not the langage is actually good for gaming is irrelevent. That is simply just too large of a market to ignore.

I think you've gone and mixed up C# with objective C, they're quite different beasts entirely.

If im not misstaken i am pretty sure c# and java are basically identical languages with some minor differnces.

Sadly you're quite mistaken, here is a nice summary as to why that is.

octoberthirty1st
octoberthirty1st
  • Member since: Jun. 9, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to C# or Java 2013-06-15 18:11:12 Reply

At 6/15/13 05:51 PM, seel wrote: Dear octoberthirty1st, please be a tiny bit more specific in your inquiry. What sort of games are you planning on developing exactly and for what platform(s)? I'm just going to assume that you have little experience with game programming since you're asking a question like this in the first place. I suggest that you pick one and get crackin'.
It's hard to pick a bad language when you're just starting out. Performance will be of no concern for a while anyway, and by the time it becomes relevant you should be educated enough to make your own decisions.

I was planning on making pixel games, mainly 2d, or 3d if it comes to that. They would be for the PC. Also I am familiar with Python.

PMMurphy
PMMurphy
  • Member since: May. 27, 2012
  • Offline.
Forum Stats
Member
Level 01
Artist
Response to C# or Java 2013-06-16 10:11:15 Reply

At 6/15/13 05:51 PM, seel wrote: stuff

Yea man, honestly even stackoverflow and people in industry have myths going around that is not 100% accurate. I have come across stackoverflow solutions that aren't the best in the world. But stackoverflow is "professionals". Not saying stackoverflow isn't a good resource, i am just stating its not the best.

PandaexpressMan
PandaexpressMan
  • Member since: Apr. 10, 2011
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to C# or Java 2013-06-24 14:07:47 Reply

C# is not used for apple dev!?!

everette00
everette00
  • Member since: Nov. 13, 2008
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to C# or Java 2013-06-24 18:09:30 Reply

Phew, it's been a long, long time since I've posted anything here on Newgrounds programming forum. I don't often see anything that intrigues me as much as this thread. I come from a C# background, in the respects that it was my first language and the language I've spent the most time in. While I do not work in Java or have used it for anything, the post by Steel that linked to a Stackoverflow question has some great information on the subject. However, I'd like to provide my own insight, while picking at a few things that weren't touched on in this thread.

The differences between C# and Java are far-and-wide, and this goes beyond syntax; yes, the syntax is different such as how you override a method. There are also developer conventions that differ between the two languages - in Java, I've read that developers are encouraged to implement interfaces for object abstraction instead of parent-child class relationships. That is completely optional, however. No one forces you to utilize this convention, but if what I read is true, then that's something you'll see quite frequently in a large number of projects, and if you maintain one, then you'll have to abide by those conventions. C# doesn't have a similar convention as far as I remember, so you're going to see many applications written with parent-child inheritance. For any real, comprehensive list of differences, please reference Steel's link to Stackoverflow.

Now, here is something that I'm more useful in commenting on for you: which is more useful for making games. The answer begins your platform-targeting desires. For example, if you wish to target Linux, Mac OSX and Windows -- as well as mobile (read: Android) in the future -- then go for Java. Java has its VM just about everywhere. In fact, the JVM is embedded in many, many devices aside from just Android devices (phones or tablets). There are Bluray players, media centers and TVs that use them. Java, for all intents and purposes, is completely cross-platform and is extremely adopted. Because of this adoption/use of Java, Java has a lot of frameworks and libraries available to developers to do just about everything. For reference, Mojang uses Java for Minecraft; Cube World is written in Java; Runescape 2 is written in a modified version of Java.

On-the-other-hand, if you really only care for the Windows market, go for C#. C# has been adopted by Microsoft as if it were the second coming of Jesus. Microsoft implemented a compacted version of their .NET framework on the XBOX 360 for indie developers to play around in (limited and slow sandbox). I believe the .NET Compact Framework is implemented on their Windows 7/8 phones, too. Though, that is to say that games written in C# can't run on Linux or Mac like a game written in Java can, it's just something you don't see wildly done. There is Monogame and OpenTK out there.

The next step is to figure out which type of game you're going to create. You've stated a desire to stay 2D, but are willing to go 3D if necessary. 2D and 3D are agnostic these days. When you create a 2D graphic, you're rarely going to just render a bunch of pixels on screen as-is these days, if at all. Instead, you create a 2D rectangle with vertices and texture it with the image you want to show, complete with alpha blending and any other pixel shader technique you plan on doing (give the texture a brass shine to it). There other techniques that you can use to achieve 2D rendering. While both languages are completely equipped to do this, it's the performance of the language that you must look for. Java is faster than C#, so you might want to use Java. However, I find that the XNA framework is much more easier to dive into than most 3D libraries written in Java, and you can use Java with XNA; it's the same argument people make when picking up Ruby instead of Python because Ruby on Rails is something they connect to much more easily (or understand more) than, say, Django or Flask.

Now is the time I look individual statements post here. PMMurphy, please don't feel like I'm insulting you or picking on you.

At 6/15/13 05:09 PM, PMMurphy wrote: I havn't studied the frameworks of either language. But i do know that java has issues when it comes to game development.

It would be wiser to say that all languages have issues when it comes to game development. C/C++, for example, have problems with being cross platform. CPU architectures such as x86 have tried combating this, but operating systems are still different from one another. C/C++ code compiled for an x86 platform, but ignorant of differences between Mac and Windows (with a focus on one or the other) won't work on both OSes. A developer writing Java can still cause platform dependance issues, but is, by default, going to run on Mac and Windows without separate code bases.

But it is true that Java has it's issues when it comes to game development. Java is slow, but only 10% slower than C++ is for the most part. For most casual games, this isn't a problem because computers are much more adept at rendering graphics today than 10 years ago, even if the underlying code instructing when something should be rendered or where is written in Java. C# is the same way, too, but terribly more so.

The reason most people don't like java video games is because c++ is simply faster at it. Java forces you to create an object everytime you want to make a method call or make functionality. Where as in c++ you don't have to do this. So there are some aspects where if coded correctly you can speed up the process of the game.

Actually, even though the starting point of a Java application is inside of a static class, and its main is a static method, in an OOP language, everything is an object - even in C++. Given the following code sample:

#include <stdio.h>

using namespace std;

int main(int argc, char* argv[])
{
    return 0;
}

Is actually C code. The above only begins to become C++ when you add in things that are C++-specific, like cout or cin. If you want to avoid creating objects in the way that you're implying when writing in Java, you can just start coding like you normally would. Also, you imply that Java is slow because you are forced to create objects every time you want to add functionality. That is patently false. C++ is faster due to its level of compilation prior to the start of the application. Your code-base is completely static each and every time you run your C++-made applications. Java is slower because of the way it was built - Java compiles somewhat during the build process, then the JVM decides what bytecode to compile down to depending on the system it is running on during runtime ("Oh, an x86 architecture? No problem! Wait, now we run on a x64? Great!").

Lastly, there is one more thing that I must point out. There is no "Android Language" as if you're writing applications in Android. And Java certainly is not "encrypted" into the Android Language. Android is an OS built on top of Linux, and Java is the preferred choice of the OS developer to write Android apps; this is because it is logically an easier language to write an application that is deployed to several different types of devices that run the same OS. Unfortunately, the device fracturing has been greatly increased as the years of gone by, and Android did have its rough start (Java was extremely slow in the early days).

Well, since that is over, let me ask this: since Java and C# have issues of their own, as well as their own benefits, is there is there a clear difference? No, not really. It's which ever suits you better personally these days. If you want to get platform independence go for Java. If you find a library or framework that you meld into better, and it is only available to C#, roll with C#. I hope that this wall-o-text has helped anyone reading it.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Online!
Forum Stats
Moderator
Level 13
Programmer
Response to C# or Java 2013-06-24 22:13:00 Reply

At 6/24/13 06:09 PM, everette00 wrote: C# has been adopted by Microsoft as if it were the second coming of Jesus.

They designed and developed it so I don't blame them for doing that. :)

At 6/24/13 06:09 PM, everette00 wrote: #include <stdio.h>

using namespace std;

int main(int argc, char* argv[])
{
return 0;
}

Is actually C code. The above only begins to become C++ when you add in things that are C++-specific

Technically speaking you already added C++ specific code with the using namespace std; line.

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to C# or Java 2013-06-25 06:44:10 Reply

Why is that not in this thread?
http://jz10.java.no/java-4-ever-trailer.html
(not an opinion, just for fun)

@everette: There are APIs based on interfaces in C#, too.

everette00
everette00
  • Member since: Nov. 13, 2008
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to C# or Java 2013-06-25 07:15:10 Reply

At 6/24/13 10:13 PM, Diki wrote:
At 6/24/13 06:09 PM, everette00 wrote: C# has been adopted by Microsoft as if it were the second coming of Jesus.
They designed and developed it so I don't blame them for doing that. :)

True, but the same can be said about VB. Unless Win 7/8 phones already support that too.

At 6/24/13 06:09 PM, everette00 wrote: #include <stdio.h>

using namespace std;

int main(int argc, char* argv[])
{
return 0;
}

Is actually C code. The above only begins to become C++ when you add in things that are C++-specific
Technically speaking you already added C++ specific code with the using namespace std; line.

Ah. Duh. I get a little ahead of myself sometimes. Sorry. For the most part, that is C, however.

At 6/25/13 06:44 AM, milchreis wrote: @everette: There are APIs based on interfaces in C#, too.

I would expect there to be. It's a convention that Java developers apparently use frequently. I'm not surprised that a C# feature like interfaces are utilized. Though, I'll take this mistake like the others because I made it sound like there isn't. Sorry about that.

Btw, I haven't seen that trailer in a long time.

InnerChild548
InnerChild548
  • Member since: Aug. 10, 2007
  • Offline.
Forum Stats
Member
Level 35
Melancholy
Response to C# or Java 2013-06-25 14:55:59 Reply

based everette


BBS Signature
spiderhamm
spiderhamm
  • Member since: Jun. 24, 2013
  • Offline.
Forum Stats
Member
Level 02
Gamer
Response to C# or Java 2013-06-26 11:17:44 Reply

Some really good games are written in C#, For ex. Xbox live indie games are written in C#. But for the java side, Minecraft is a really good game, but you know how buggy it could get sometimes. So I guess if you want to go for a less buggier side you should go with C#.


Your Friendly Neighborhood Spiderham.

everette00
everette00
  • Member since: Nov. 13, 2008
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to C# or Java 2013-06-26 12:17:04 Reply

At 6/25/13 02:55 PM, InnerChild548 wrote: based everette

Huh?

At 6/26/13 11:17 AM, spiderhamm wrote: Some really good games are written in C#, For ex. Xbox live indie games are written in C#. But for the java side, Minecraft is a really good game, but you know how buggy it could get sometimes. So I guess if you want to go for a less buggier side you should go with C#.

Again, huh? That doesn't make sense. Unless there is a general problem with the JVM that is causing underlying bugs in the generated bytecode, then Minecraft wouldn't be buggy because it was written in Java. Minecraft would be buggy because the developers released a buggy build of the game.

PMMurphy
PMMurphy
  • Member since: May. 27, 2012
  • Offline.
Forum Stats
Member
Level 01
Artist
Response to C# or Java 2013-06-26 12:47:38 Reply

lol java can produce fine games. If someone makes a java game and it causes issues its because the game is either too ambitious or the code itself wasn't very well done.

Games are hard to make, your going to have bugs no matter what language. Some just do certain tasks easier thats why people don't use them for certain applications.

spiderhamm
spiderhamm
  • Member since: Jun. 24, 2013
  • Offline.
Forum Stats
Member
Level 02
Gamer
Response to C# or Java 2013-06-26 14:12:50 Reply

At 6/26/13 12:17 PM, everette00 wrote: Again, huh? That doesn't make sense. Unless there is a general problem with the JVM that is causing underlying bugs in the generated bytecode, then Minecraft wouldn't be buggy because it was written in Java. Minecraft would be buggy because the developers released a buggy build of the game.

I don't even know. I'm just basing off what I read and/or hear.


Your Friendly Neighborhood Spiderham.

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to C# or Java 2013-06-26 14:40:28 Reply

At 6/24/13 06:09 PM, everette00 wrote: stuff about java and C++

Woah lots of info there, I agree that java and C# are just tools that should be use accordingly and etc, but there is nothing that can compare to C++ both in terms of speed and portability. First of all, forget about objects in C++, there are no objects in the standard C++ implementation, meaning that there isn't an invariant class from which everything, even primitive types, inherits and there's no boxing and most importantly there is no garbage collector, the JVM might allocate memory on the heap in blocks and stuff, but the object constructor has a lot more work to do than a C++ one. C++ has objects because the compiler generates C structs from your class and whenever it creates an object with the new operator, it appends a vtable (if any) at the beginning of the class pointer (which is why you can't use malloc to allocate non pod types). Member functions are mangled and turned into C-style functions that take the this pointer through a register(I can't remember which one, I think it was ecx/rdx), so yes, allocating an object in java is a lot more expensive.

This allows for some very aggressive optimizations possible because of the context you gain from losing all that abstraction, you can inline the shit out of functions to gain more context enabling even more optimization which is why std::sort runs circles around the standard C implementation of the qsort function for instance. Nothing is treated as an object by default so you gain some speed from pointer aliasing related optimization and not to mention that the compiler that generate machine code from C++ have been around way more then the Java ones, there is no way any decent C++ program is only 10% faster than a Java program.

Here's a simple test that you can make on your own if you want to draw your own conclusions
C++:

#include <vector>
#include <algorithm>
#include <sys/time.h>

class myInt
{
private:
	int m;
public:
	myInt(int a){m = a;}
	bool operator < (const myInt& other) const
	{
		return m < other.m;
	} 	
};

int main()
{
	struct timeval time;
	gettimeofday(&time, NULL);
	srand(time.tv_sec * 1000 + time.tv_usec);
	std::vector<myInt> list;
	
	for(int i = 0; i < 10000000; ++i)
	{
		list.push_back(rand());
	}
	std::sort(list.begin(), list.end());
}

<java>
import java.util.*;

public class test
{
public static void main(String[] args)
{
ArrayList<Integer> list = new ArrayList<Integer>();
Random rand = new Random();
for(int i = 0; i < 10000000; ++i)
{
list.add(rand.nextInt());
}
Collections.sort(list);
}
}
</java>

If you want to see how they compare in terms of raw allocation power change that 1 to a 3 and remove the sort.

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to C# or Java 2013-06-26 14:43:38 Reply

yeah, sorry about that, I should pay more attention

import java.util.*;

public class test 
{
	public static void main(String[] args) 
	{
		ArrayList<Integer> list = new ArrayList<Integer>(30000000);
		Random rand = new Random();
		for(int i = 0; i < 30000000; ++i)
		{
			list.add(rand.nextInt());
		}
	}
}
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to C# or Java 2013-06-26 15:08:23 Reply

I'm starting to miss the edit post functionality in other forums, the previous code was a test I made to see if the ArrayList behaves differently when you give it the whole size in the constructor, this was meant to be the java version to be compared to the c++ code. Last post I promise.

import java.util.*;

public class test 
{
	public static void main(String[] args) 
	{
		ArrayList<Integer> list = new ArrayList<Integer>();
		Random rand = new Random();
		for(int i = 0; i < 10000000; ++i)
		{
			list.add(rand.nextInt());
		}
		Collections.sort(list);
	}
}
everette00
everette00
  • Member since: Nov. 13, 2008
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to C# or Java 2013-06-26 15:09:05 Reply

Whoa. Kiwi-Kiwi, I never implied that C# or Java was faster than C++. The question was which is better for making games between C# and Java, and I provided insight on that. I also never said anything about portability.

Boy, I've made a few mistakes here and there. I'm used to thinking that C++ is entirely OOP, because that's what I'm use to using C++ for. To right that mistake, I'll leave a disclaimer here - C++ is not entirely OOP. I meant to state that when building OOP code using C++, that code is inherently built of objects. Sorry, folks.

Sterance
Sterance
  • Member since: Jul. 24, 2007
  • Offline.
Forum Stats
Member
Level 23
Programmer
Response to C# or Java 2013-06-27 14:09:58 Reply

This is an awesome thread. I haven't been on here in a while and i'm happy to see such a good thread with lots of experienced info. I've worked with java and c# and c/c++ for that matter and i have to agree with everything thats been said. I would add that little languages like blitzbasic can be more fun to get into for purely 2d games. I would also look at c++ with sdl for the more advanced hobbiest. Loki games published a bad ass book about sdl that you can find on amazon.

I feel like we've talked more than the op.


Fear Popo Bawa!!!
John Goodman | ¥
while(<>){chomp;print;}

prabhjot
prabhjot
  • Member since: Jul. 5, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to C# or Java 2013-07-05 17:13:22 Reply

Java and C# are similar programming languages that are statically, strongly, and manifestly typed, both are class-based object-oriented, both are designed with semi-interpretation or runtime compilation in mind, both use garbage-collection, and both are "curly brace languages" like C and C++.

Java
In Java, both the enumeration type and (optionally) the individual enumeration values are Java classes. The only valid values are the ones listed in the enumeration. The enumeration type may declare or override members (such as a dedicated toString() method) that will be inherited by the individual enumerated values, and it can be extended by adding methods, fields or even interfaces can be implemented for it. The individual enumerated values may in turn override members or even define new members only valid for that specific value.
C#
Enumerations in C# are implicitly derived from the Enum type that again is a value type derivative. The value set of a C# enumeration is defined by the underlying type that can be a signed or unsigned integer type of 8, 16, 32 or 64 bits. The enumeration definition defines names for the selected integer values and is syntactic sugar. By default the first name is assigned the value 0 (zero) and the following names are assigned in increments of 1. Any value of the underlying primitive type is a valid value of the enumeration type, though an explicit cast may be needed to assign it.
C# supports bit-mapped enumerations where an actual value may be a combination of enumerated values bitwise ordered together. The formatting and parsing methods implicitly defined by the type will attempt to use these values.


SEO Institute in VikaspuriWant to grow your knowledge in SEO, SEM, SMO, SMM, Website Designing ? For Further information contact SEO Institute in Vikaspuri.

sharpnova
sharpnova
  • Member since: Feb. 19, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to C# or Java 2013-07-07 13:55:11 Reply

At 6/16/13 10:11 AM, PMMurphy wrote:
At 6/15/13 05:51 PM, seel wrote: stuff
Yea man, honestly even stackoverflow and people in industry have myths going around that is not 100% accurate. I have come across stackoverflow solutions that aren't the best in the world. But stackoverflow is "professionals". Not saying stackoverflow isn't a good resource, i am just stating its not the best.

Unfortunately it is the best. Or at least one of them.

The truth of the matter is you can't expect to find "best" solutions for all addressed problems anywhere. Not just because it's too high a standard to hold any resource to, but because "best" depends on context. Best space performance? Time performance? Lines of code performance? Best practices?

I've come across a ton of really elegant algorithms there that then led me to research them further and learn a lot. Stuff as simple as "simulate stack with two queues" or "simulate a queue with two stacks" type stuff.


= + ^ e * i pi 1 0

Diki
Diki
  • Member since: Jan. 31, 2004
  • Online!
Forum Stats
Moderator
Level 13
Programmer
Response to C# or Java 2013-07-07 14:21:29 Reply

At 7/7/13 01:55 PM, sharpnova wrote: Lines of code performance?

What in the world is "lines of code performance"?

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to C# or Java 2013-07-08 11:49:48 Reply

At 7/7/13 02:21 PM, Diki wrote:
At 7/7/13 01:55 PM, sharpnova wrote: Lines of code performance?
What in the world is "lines of code performance"?

readability?

sharpnova
sharpnova
  • Member since: Feb. 19, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to C# or Java 2013-07-08 19:12:43 Reply

At 7/7/13 02:21 PM, Diki wrote:
At 7/7/13 01:55 PM, sharpnova wrote: Lines of code performance?
What in the world is "lines of code performance"?

Sorry I thought I was being clear.

I just meant "performance" as a general metric. "time performance" is execution speed, "space performance" is memory efficiency. "lines of code performance" was just meant to mean something along the lines of "less code to do the same task" or "readability"


= + ^ e * i pi 1 0

64base
64base
  • Member since: Apr. 18, 2012
  • Offline.
Forum Stats
Member
Level 02
Programmer
Response to C# or Java 2013-07-14 04:04:55 Reply

Apple, Google and Microsoft have made it completely apparent that JIT-runtime languages such as C# and Java are the way of the future.

If you have CPU power to tax, why not use it for automated tasks such as garbage collection? Why waste the potential? I mean, computers in general were made to compute and number crunch for a reason. They automate our work. Why waste precious development time worrying about strict memory management when the runtime itself can do 50% of the work for you?

Anyways, in all honesty, I prefer Java, specifically because of compatibility. Imagine theoretically, Intel or AMD release a new "super computer" architecture that could somehow efficiently execute tasks 2x/4x/insert-number-here x of the current x86 architecture. It's a no-brainer that Sun/Oracle will be on the bandwagon to get their JVM interpreter running on the new archt. and rather than worrying about porting your C# code to work on different libraries for say, a Mac or Linux computer, you wouldn't even need to worry about it as Java's libraries are similar and consistent in each platform (thanks to Oracle's JVM and their abstract layer that handles this for us).


.

archont
archont
  • Member since: Sep. 24, 2006
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to C# or Java 2013-07-16 10:22:11 Reply

At 7/14/13 04:04 AM, 64base wrote: Apple, Google and Microsoft have made it completely apparent that JIT-runtime languages such as C# and Java are the way of the future.

If you have CPU power to tax, why not use it for automated tasks such as garbage collection? Why waste the potential? I mean, computers in general were made to compute and number crunch for a reason. They automate our work. Why waste precious development time worrying about strict memory management when the runtime itself can do 50% of the work for you?

This reminds me - there was a series of gamedev articles about building your own game engine, architecture meant to mimic the Source engine. One of the first things implemented was a garbage collector and smart pointers.

And it's safe to assume that the performance of that homebrewed garbage collector would be inferior to the .NET or even Java one.

Seriously, I have enough things to worry about when writing code. Perhaps as much as 95% of the code in a game is not really time-critical. I'm fine with my savegame serializer being 7% slower if it means I don't have to worry about memory leaks. As a bonus C# is plain more fun to work with than C++ - this coming from a guy whose FIRST language (not counting qbasic) was C++, before .NET was a thing.

http://www.codeproject.com/Articles/212856/Head-to-head-benc hmark-Csharp-vs-NET

Inertia and consoles are the reason people stuck to assembly instead of C and now are sticking to unmanaged languages instead of managed ones. I'm never the first to try the kool-aid (see silverlight) but at this point, especially with PS4 and xbone180 supporting C#, I think that's the way to go. The rather unappealing alternative is competing with diehard C++ veterans.

octoberthirty1st
octoberthirty1st
  • Member since: Jun. 9, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to C# or Java 2013-07-23 09:38:17 Reply

This is all great info, if only I could understand what half of it meant.

Thegluestickman
Thegluestickman
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 13
Game Developer
Response to C# or Java 2013-08-04 21:24:07 Reply

At 6/24/13 06:09 PM, everette00 wrote: Now, here is something that I'm more useful in commenting on for you: which is more useful for making games. The answer begins your platform-targeting desires. For example, if you wish to target Linux, Mac OSX and Windows -- as well as mobile (read: Android) in the future -- then go for Java. Java has its VM just about everywhere. In fact, the JVM is embedded in many, many devices aside from just Android devices (phones or tablets). There are Bluray players, media centers and TVs that use them. Java, for all intents and purposes, is completely cross-platform and is extremely adopted.

The only problem is the JVM is the most awful software used as a standard. The Java language is not bad in itself but JVM is so taxing on RAM and CPU and is just bulky. I'm not too knowledgeable on the underlying architecture of JVM but I do know from experience that the JVM likes it's resources. It's too bad they can't use like Dalvik on Windows/Mac/Linux.

Because of this adoption/use of Java, Java has a lot of frameworks and libraries available to developers to do just about everything. For reference, Mojang uses Java for Minecraft; Cube World is written in Java; Runescape 2 is written in a modified version of Java.

Sorry to nitpick but Cube World was C++. I really wish Microsoft wasn't the overprotective parent that won't let C# play with the other kids, if they open-sourced C# it would do more good to the language in terms of adoptability and Mono wouldn't be a step behind all the time.

While both languages are completely equipped to do this, it's the performance of the language that you must look for. Java is faster than C#, so you might want to use Java.

I thought C# was faster than Java, or at least so comparable that it's negligible. Plus C# for sure takes less impact on resources. Look at just adding 2 numbers:

http://ideone.com/aaaIVj
http://ideone.com/NPYJCU

The Java example uses 10x the memory to invoke JVM.

and you can use Java with XNA;

What exactly do you mean by this?


To protect the world from devastation.
kidd25 is the best Newgrounder ever.

BBS Signature