is this a good idea?

ok, so im making a game in Java for a class at school. i need to use clients and servers and stuff like that. I created my game with the clients being applets, but applets cannot connect to any computer other than the one they are run on, so i converted my clients to applications. now, the lag is so bad (im making a fighter) that it would be impossible to play. I did not have lag problems with the applet. My idea to fix this would be to have the game applet connect to an application on the same computer, and then have that application connect to the server. Would that fix my lag problem? is my lag problem even apllication related? If anyone can answer these questions or just point out something blatantly obvious that im missing, i would appreciate it. thank you

[778 byte] By [IIIIIIlla] at [2007-9-28 18:48:06]
# 1

i do not understand why you do not use an applet, that is generally the method that is used. The applet resides on the server and is loaded when the page is requested. you have a good communication path between the client and the server then. You also do not have update issues with clients this way.

Your slowness is not a function of application connecting to server, i've done that on several occasions without any lag and also have played games that support both application clients (in java) and servlets and neither seemed to give an advantage over the other.

morgalra at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 2
well the problem is that there are 2 clients as this is a multi player game so at least one client has to connect to a different computer in order to connect to the server.
IIIIIIlla at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 3

Well, there is a problem. By default, Applets cannot access external files residing on a server. This is so for security reasons. To use a poor example, if you have an applet that needs to load in a GIF image from an external file, the system assumes you don't have permission and locks you out.

You have several options:

1) You can move all of your code to the Applets themselves. In other words, when I go to the web page and click on the link, I download one large .jar file that contains everything I need. Keep in mind you still have to solve the message passing problem.

2) You can developed a "signed applet". This is an Applet that has been explicitly identified with a certificate and is granted permission to access the server. Do a search in the appropriate forms for that phrase and you'll find some instructions on what you'll need to do.

TheDavida at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 4
You do not understand applet and server type of scheme of development. Get out your book and do a little more study on the subject. 100's of applets can connect to the same server--as many as the server will suport.
morgalra at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 5
for an example of applet base game play, take a look at runescape.com, i think the limit is like 1250 users per server.
morgalra at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 6
> You can developed a "signed applet". would my origional idea about an applet connecting to an application connecting to an application not work?
IIIIIIlla at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 7

No.

Your Applet on your web browser cannot directly launch your copy of Microsoft Word (as an example) without you doing a hell of a lot of tweaking, coding, and a little hacking.

Making your Applet launch your Application (on your machine) just so that it can connect to another Application (on a server) is just overkill for what you want to do.

TheDavida at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 8

Ideally, I wouldn't even bother coding a fighting game as an Applet. I would just code it as a stand alone application capable of making connections to a non-httpd-based server application.

Every time you make a move in Quake, it doesn't create a text string describing what you just did, send it to a web server, wait for a string back from the server, strip off the HTML tags, parse the string, and then tell you what just happened. That would be so slow.

TheDavida at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 9

> Every time you make a move in Quake, it doesn't create

> a text string describing what you just did, send it to

> a web server, wait for a string back from the server,

> strip off the HTML tags, parse the string, and then

> tell you what just happened. That would be so slow.

ok, so i get the analogy now... but what does it do then?

IIIIIIlla at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 10

> > Every time you make a move in Quake, it doesn't

> create

> > a text string describing what you just did, send it

> to

> > a web server, wait for a string back from the

> server,

> > strip off the HTML tags, parse the string, and then

> > tell you what just happened. That would be so

> slow.

>

> ok, so i get the analogy now... but what does it do

> then?

>

Sends a Datagram packet.

Abusea at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 11

To clarify, your Quake game is a dedicated client. On some machine, there's a dedicated Quake server application. Your client would send a datagram packet specifically to the Quake application as opposed to the web browser on that machine. The Quake server application computes all the information it needs, then broadcasts datagrams to every connected machine it knows about, informing them of the updates to be made.

It's much harder to set up compared to an http connection, but it allows data to be sent so much faster which is necessary if you want a game where you can react to moves as your opponent makes them.

TheDavida at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...
# 12
*sigh*I should have said, your client sends a datagram specifically to the Quake server application as opposed to the web server, not the web browser.
TheDavida at 2007-7-12 17:03:35 > top of Java-index,Other Topics,Java Game Development...