a java server

a java server

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

monohouse

a java server

Post by monohouse »

since do you use java for real-time applications ?
especially as critical as networking ?

I don't understand the approach, this is not a good idea I think, you should use C for network code as well, make a new tasserver in C, bacause that's really lame. that's the source for all lag.

you don't use the right language for the right purpose.

is there a way to bypass that ? I don't want to do that, can I manually specify command line arguments to spring.exe ?

or does spring.exe has only client code and no server code ?
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Java is more secure then C.

Also, lag is not really important for the Lobby server. Stability and security probably are.

Yes, you can manually specify arguments to spring. That works by making a script.txt and then running spring with one argument, the name of the script:

Code: Select all

spring.exe script.txt
(Start a game through Lobby and look at script.txt)

spring.exe is game server and client. Only the lobby master server is Java.
User avatar
BvDorp
Posts: 439
Joined: 14 Oct 2005, 12:09

Post by BvDorp »

and even if it was a bad decision, go make ur own lobby+svr ;)
patmo98
Posts: 188
Joined: 09 Jan 2006, 17:51

Post by patmo98 »

Tobi wrote:Java is more secure then C.

Also, lag is not really important for the Lobby server. Stability and security probably are.
I would have put portability in that list, and Java has that nailed too.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Hmm C is super portable too. Only it's libs arent 8)

But yeah, I could have added that. Making something portable is probably somewhat easier with Java then with C, especially if it includes windows and/or you don't know autotools.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

I'm not a big fan of Java myself, but Tobi is pretty much right here... The "peformance critical" bits (namely, the actual engine) are already in C++ etc... and Java *is* more secure, at least; it is more secure than C++ for the amount of time that's been devoted to it...


See the way it works is that the server basically atcs as a matchmaker than more or less withdraws fro mthe game completely, and passes the servering on to the actual "game" server.
User avatar
Dr.InfernO
Posts: 223
Joined: 18 Nov 2005, 13:55

Post by Dr.InfernO »

c++ = buffer overun
java = no buffer overun (at least you are not on crack)
Am I right?
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Yeah you're basically right. But with the proper coding style you can prevent buffer overruns in C++ too. The point is just that in Java, it's impossible to make certain mistakes because Java would throw an exception, while in C/C++ if you're unlucky, the program just continues to run but with undefined behaviour if, for example, you dereference a dangling pointer (pointing to garbage) or accidentally overwrite some unrelated part of your process memory.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Yeah but cmon, real servers are written in pure asm for speed, everyone knows that!
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

lol
User avatar
Tim Blokdijk
Posts: 1242
Joined: 29 May 2005, 11:18

Re: a java server

Post by Tim Blokdijk »

I would personally go with a web based asp.net/oracle/iis thing.
With some hacking we could inject the netcode in postdata!
All you would need is a plug-in to load the Spring engine.
I will write a design document and roadmap for it asap.

Anyway,
monohouse I understand you are confused but we have many skilled coders working within the project.
Please take the time to understand the code before you decide to rewrite half of it.
We are in the process of making design documents and roadmaps maybe you could comment on them?
They are intended for people that are new to the project and like to contribute.
patmo98
Posts: 188
Joined: 09 Jan 2006, 17:51

Re: a java server

Post by patmo98 »

monohouse wrote:I don't understand the approach, this is not a good idea I think, you should use C for network code as well, make a new tasserver in C, bacause that's really lame. that's the source for all lag.
Do you realise that there are, in a sense, two diffierent servers?
The one that is written in java is the lobby server. I'm not sure, but I think that the lobby server would almost ever max out someone's CPU before it maxed out their upload connection. I would guess that it is about as CPU intencive as an IRC server with 100-200 users.

The second server is the game server. That one is written in C++ and is part of spring.exe. This is where all the lag that most people complain about takes place, (when it is a server's fault). Aside from Zaphods suggustion, :roll: I don't see how switching languages will help. Although I would like to see uptime and load avreage on the statistics page.
monohouse

Post by monohouse »

.net ? in that case I'd prefer java alone, on top of that you want to involve IIS and some DB ? this is already 6 times worse (.net counts for 3), I'm with the ASM direction.

but would settle for C, I have already read a big part of the code of the java server, it's not the code what I have a problem with, it's the language, if the code was to run so simply as it was written, I would never have commented on anything in the first place, the java VM system itself is at least 4 or 5 times bigger by all means (cpu and memory and overhead) compared to the written code, and that is only the good case, there are bad ones too.......

look at all the recent server down times, and see what I mean, there is a reason java is used for web browsing, and now you know what it is.

I just don't understand the difficulty of the people that wrote the network system of the spring engine, to write the network system of the simple thing as a simple server for text data transfer, some account informations even without encryption it would be ok, there is hardly any information that requires the attention of an encryption algorithms, I mean, the code of the java server does not look anything like being *THAT* hard to port to C, just copy and paste the C++ code from the spring engine that delivers player messages to eachother and continue from there, it is almost as simple as that.

of corse if there is anything I can do I'd be willing to provide my assistance, im sure I can arrange more assitance, I will check on that subject as well.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

ASM was a joke, no one should write a networking server in asm because it is unmaintainable and prone to security errors.
The lobby server is about security and maintainability, so you would always pick a secure language like java or C# to write it in. Performance is not an issue here, it's equivalent to an IRC server with 150 users.

That there are currently some server problems is not because the java server code isn't doing it's job, it's because of other problems.
User avatar
Tim Blokdijk
Posts: 1242
Joined: 29 May 2005, 11:18

Post by Tim Blokdijk »

monohouse wrote:.net ? in that case I'd prefer java alone, on top of that you want to involve IIS and some DB ? this is already 6 times worse (.net counts for 3), I'm with the ASM direction.

...
Sorry, I was not realy clear but I was trying to make a joke.
:wink:
Betalord
Former Engine Dev
Posts: 543
Joined: 29 Jun 2005, 09:31

Post by Betalord »

I don't like java much either due to its slowness, but it has a nice syntax and classes and you can write apps fast withouth worrying about freeing memory and security issues. But the only reason I picked java is because it is easily portable (so far I ran lobby server on windows, linux and freebsd and I didn't have to change a single line of code to make it work) and I guess also because I am familiar with it :)
I don't know how much resources it takes, but according to Fnordia not much (he said something about an hour of CPU time on 500 MHz cpu after running it for 11 days). I never use java for GUI apps but I think it works just fine for console apps. I did use java.nio classes and they claim that they have tested it with 13k clients and it worked fine.

I am no java or c++ expert though, but perhaps you are and can enlighten me on why to use c/c++ rather than java for the server?

And no, it can't be that easily ported to c/c++.
monohouse

Post by monohouse »

yeh I just have these optimistic eyes that see things sometimes, o well you may all know that im trippin and sutch so that happens sometimes, I really need a few IDE's now to do some scriptsacre.
User avatar
BvDorp
Posts: 439
Joined: 14 Oct 2005, 12:09

Post by BvDorp »

Image
monohouse

Post by monohouse »

that's EXACTLY what im talkin about, YHEA duuuuuuudeeeeeeee
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6243
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Betalord wrote:I don't like java much either due to its slowness, but it has a nice syntax and classes and you can write apps fast withouth worrying about freeing memory and security issues. But the only reason I picked java is because it is easily portable (so far I ran lobby server on windows, linux and freebsd and I didn't have to change a single line of code to make it work) and I guess also because I am familiar with it :)
I don't know how much resources it takes, but according to Fnordia not much (he said something about an hour of CPU time on 500 MHz cpu after running it for 11 days). I never use java for GUI apps but I think it works just fine for console apps. I did use java.nio classes and they claim that they have tested it with 13k clients and it worked fine.

I am no java or c++ expert though, but perhaps you are and can enlighten me on why to use c/c++ rather than java for the server?

And no, it can't be that easily ported to c/c++.
Java as a language isn't actually all that slow - its the overhead of the JVM. There were changes in 1.5 to attempt to reduce it somewhat. Java is well suited to the lobby server, imo.
Post Reply

Return to “Help & Bugs”