Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411488 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 03:34:48 AM

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



View Profile
« on: September 02, 2008, 02:02:17 AM »

Hey all.
I was thinking of learning Java as my next language. But I was wondering what are its capabilities network-wise?
Would it be possible to create an action based multi-player game (similar to Soldat)?

Thanks.
Logged
muku
Level 10
*****


View Profile
« Reply #1 on: September 02, 2008, 02:32:37 AM »

That would certainly be possible, although definitely not easy. Network programming, in particular, is one of the more difficult branches of game development.

Why exactly did you choose Java? What languages do you already know, and how much programming have you done?
Logged
Ciardhubh
Level 1
*


View Profile
« Reply #2 on: September 02, 2008, 02:51:38 AM »

Java supports networking from basic TCP or UDP to higher level protocols like HTTP, SSL, TCP, SOAP and whatnot. I've never done anything below (in the OSI model) TCP/UDP but I guess there are libraries for that too. Java is one of the most prominent languages for backend systems and servers, so its networking capabilities are ... vast Wink

Sun has good tutorials on most basic topics. A starting point for you might be:
http://java.sun.com/docs/books/tutorial/networking/TOC.html
Logged
Jesseyay
Level 0
***



View Profile
« Reply #3 on: September 02, 2008, 04:16:30 AM »

Ah thanks for the link. Good to know Java has great networking abilities.

I know C# and C++ at the moment and have dabbled in Delphi(Pascal). Java seems like a good choice because its cross platform, easily distributable and can be run form a web page. It also has very similar syntax to C++.

Been programming for 2-3 years, just a hobby at the moment though.

Thanks for the info.
Logged
muku
Level 10
*****


View Profile
« Reply #4 on: September 02, 2008, 04:20:29 AM »

If you already know C#, I think there's little reason to learn Java. C# is the more powerful language all around, it has a solid standard library and good networking capabilities too, and with Mono it's also cross-platform.
Logged
Al King
Level 1
*


Nobody expects...


View Profile
« Reply #5 on: September 02, 2008, 10:42:49 PM »

Also, it's, uh, Java. DON'T DO IT! D:
Logged
Ciardhubh
Level 1
*


View Profile
« Reply #6 on: September 03, 2008, 01:00:39 AM »

... C# is the more powerful language all around, ...

That is the somewhat religious part of the discussion. I disagree and considering the widespread use of Java (not so much in games but in business software), there are probably a few other people who disagree, too. C++ for high-end games is another issue but C#/.Net is more or less Microsoft's Java copy in my opinion (which also means that Java is more like C# than C++).

You could use Mono to run .Net applications cross-platform but it's much less widespread than Java. You'll have to ask yourself if people will install Mono to play your games.

If you want to run Java programs from a web page, look at applets (embedded into web pages) and Java Web Start (automatic download, installation, execution and update of stand-alone Java apps).
Logged
muku
Level 10
*****


View Profile
« Reply #7 on: September 03, 2008, 01:27:27 AM »

... C# is the more powerful language all around, ...

That is the somewhat religious part of the discussion. I disagree and considering the widespread use of Java (not so much in games but in business software), there are probably a few other people who disagree, too.

I should have made myself more clear probably. I'm not talking about the community or the libraries here, I'm talking purely about the language itself. And you just can't deny that C# has a lot of very useful features which Java simply doesn't have: anonymous functions, non-broken generics, LINQ, implicitly typed variables, anonymous types, partial classes, and so on. So, this is not religious at all, this is fact.

Now, things get more difficult when we consider the community, that's for sure. But at least on this forum I see way more C# games than Java games.
Logged
Ciardhubh
Level 1
*


View Profile
« Reply #8 on: September 03, 2008, 03:30:34 AM »

And you just can't deny that C# has a lot of very useful features which Java simply doesn't have: anonymous functions, non-broken generics, LINQ, implicitly typed variables, anonymous types, partial classes, and so on. So, this is not religious at all, this is fact.

On the contrary, this is very religious. Additional features do not make a language better. For example I consider implicit types or anonymous types detrimental to the maintainability of the code. One extreme of this is duck-typing which Ruby uses. These features are convenient when you write code but it makes understanding it harder. Software design shouldn't be about coding something as fast as possible, but about having a good design and a maintainable code-base that can easily be understood by others (or yourself in a few months).

Now, things get more difficult when we consider the community, that's for sure. But at least on this forum I see way more C# games than Java games.

I agree, the community here is C- and Gamemaker-heavy.
Logged
muku
Level 10
*****


View Profile
« Reply #9 on: September 03, 2008, 04:04:14 AM »

On the contrary, this is very religious. Additional features do not make a language better.

I didn't say better, I said more powerful. In C#, some things can be done in much fewer lines than in Java, and you can use coding styles which simply are impossible in Java. It allows more abstraction. To me, that's the definition of a powerful language.

Maintainability is a different issue. But still I think that code which is shorter and expresses the author's intent better is easier to maintain, and that is the case when features which allow abstraction are used responsively.
Logged
moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #10 on: September 03, 2008, 10:19:19 AM »

Don't listen to the little microsoft drones.
Java is an excellent language.
Else microsoft wouldn't have copied it to create C#
You can make damn fine Java games, There are many commercial games using jave (see Princec games) and I don't see many (if at all) C# games solds.
The only superiority of C# to java is for 3D engines because there seems to be many 3D engines being done for C# (I haven't checked their real capacities) while I don't know a lot of 3D engines for java (the engines I know stick to using OpenGl just for 2d-in-3d)
 Gentleman

[EDIT]
Also you can pack a compact custom version of the virtual machine with your game, you  don't need to download tons of stuff to play a java game, unlike a certain language.

Here's a link to a great community for java devellopers
http://www.javagaming.org/
« Last Edit: September 03, 2008, 10:25:41 AM by moi » Logged

subsystems   subsystems   subsystems
bateleur
Level 10
*****



View Profile
« Reply #11 on: September 04, 2008, 09:38:21 AM »

Much depends on what level you program each language at and how experienced you are as a programmer.

C# is a modern language and consequently has all kinds of lovely features. Java was way ahead of its time in including many of these same features ages ago. Objectively, C# probably comes out very slightly ahead, but that doesn't matter at all because...

...as soon as you do non-trivial things it starts to matter not just what language you're using but what libraries you have access to. Java libraries were historically absolutely terrible. That's not an exaggeration. Things have improved dramatically over the last ten years, but still not to the point where I'd feel comfortable using Java for a graphics-intensive project.

However, if you want portability there aren't any good options really.

If it's less about the specific project and more about learning programming techniques then Java might be a good choice since it's similar enough to C# that you'll pick it up quite easily.
Logged

dustin
Level 6
*


View Profile
« Reply #12 on: September 04, 2008, 10:20:25 AM »

for java 2d stuff I find slick amazing.  It's opengl accelerated 2d that was easy to set up and super nice to work with.  it's also blazing fast and runs on windows, osx, and linux.

http://slick.cokeandcode.com/
Logged
Ciardhubh
Level 1
*


View Profile
« Reply #13 on: September 05, 2008, 12:35:40 AM »

C# is a modern language and consequently has all kinds of lovely features. Java was way ahead of its time in including many of these same features ages ago. Objectively, C# probably comes out very slightly ahead, but that doesn't matter at all because...

...as soon as you do non-trivial things it starts to matter not just what language you're using but what libraries you have access to. Java libraries were historically absolutely terrible. That's not an exaggeration. Things have improved dramatically over the last ten years, but still not to the point where I'd feel comfortable using Java for a graphics-intensive project.

Java is constantly evolving. It's not like the Java today is the same as Java 10 years ago.

As for the documentation, it really depends on what libraries you are talking about. The standard Java API from Sun is the best documented API I've ever seen. When I had to work with C#, I was very disappointed about the .Net API. It merely tells you in one sentences what a method does - but not how - which forced me to search various MSDN and external sites frequently.

3rd party libraries on the other hand are often badly documented, though that is a language independent "feature" and depends on the authors Smiley
Logged
Zaknafein
Level 4
****



View Profile WWW
« Reply #14 on: September 05, 2008, 01:35:49 PM »

I have very mixed feelings about Java as a language...

Whenever I work with C# for a long time then switch to Java, I curse about Java's wierd generics support (can't do a typeof-style operation on a generic type, arrays and generics = clusterfuck, etc.), its peculiar object-oriented enums (sometimes all you want is an integer and a bitfield), and absence of cool C# features like delegates/events, or the new LINQ extension methods, anonymous typing, all this. Also Visual Studio's debugger is so much better than anything else I've seen.

But when I come back to C# after working with Java for a while, I hate that enums are so simple in C# and I find that I'd use enum classes pretty often if it were supported, and the "wildcard" generic constraints in Java are also pretty sweet once you get them (like <? extends SomeClass>). And Eclipse is pretty much the best IDE ever,... except the debugger.

But on the whole C# feels like a much cleaner and more mature language, especially v3.5. And it evolves much faster. Why the heck doesn't Java 6 bring any improvement to the language syntax?
Logged

Ryan
Level 1
*



View Profile
« Reply #15 on: September 06, 2008, 01:08:16 PM »

As I see it now, use Java for cross-platform, and C# if you only want to target Windows. In my opinion, C# is improving much more rapidly and is the overall better / more thought-out language, but at their cores Java and C# are very similar.

So, my suggestion. If you are on OS X or Linux, use Java (and the Eclipse IDE, makes it so much easier to use the language). If you don't mind having things windows only, C# would be the superior choice (with Visual Studio C# Express).

As for your questions, would you be able to make a Soldat-esque game in Java? Absolutely. Java is chock full of networking API stuff, and also you can get an OpenGL context up and running rather quickly as well.

Good luck!
Beer!

Logged
Dacke
Level 10
*****



View Profile
« Reply #16 on: September 06, 2008, 01:27:02 PM »

Why would one use a VM-dependent language when only targeting Windows? Java may have flaws (though I have yet to find them) but C# is too dependent on Microsoft to be a serious choice for pretty much anything except small, short-lived things. In a way C# is even more system dependent than C/C++, it's libraries aren't even fully supported outside of Windows.
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Ryan
Level 1
*



View Profile
« Reply #17 on: September 06, 2008, 04:36:38 PM »

Why would one use a VM-dependent language when only targeting Windows?

Because the language is on a VM for different reasons than portability. Garbage collection, for one. Two, the CLR allows different languages for that VM (C#, F#, those "Iron" languages such as IronPython) to use all the .NET libraries.

The Mono runtime is awesome so far and they are making great strides to get everything compatible. The downside is deploying these applications on other systems is cumbersome.
Logged
muku
Level 10
*****


View Profile
« Reply #18 on: September 06, 2008, 04:40:06 PM »

Because the language is on a VM for different reasons than portability. Garbage collection, for one.

Though you don't need a VM for that.
Logged
Ciardhubh
Level 1
*


View Profile
« Reply #19 on: September 08, 2008, 07:31:05 AM »

And Eclipse is pretty much the best IDE ever,... except the debugger.

Maybe Sun's Netbeans is more to your liking. I have to admit though, that I don't know much about the Visual Studio debugger and cannot compare it. However the Netbeans debugger is nice and switching from Eclipse to Netbeans was nothing short of an epiphany for me :D (not necessarily debugger-wise but generally)

Why the heck doesn't Java 6 bring any improvement to the language syntax?

That is a problem for many applications, languages, etc. People always expect changes, additions, new features and whatnot. Ultimately that is what kills something, excessive featuritis. On top of that, Java has to stay backward compatible to some extent. It is less focused on throw-away applications like games or one-shot desktop apps. On the other hand, Java 6 added a few useful libraries to the core JSE, e.g. the Desktop class, JAXB, etc (most, if not all of which can be supplied as seperate libraries to run on previous versions). I prefer a useful "standard" library over new syntax candy that allows for nifty coding stunts Wink
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic