We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Multiplayer games
Page Index Toggle Pages: 1
Multiplayer games (Read 1340 times)
Multiplayer games
Feb 2nd, 2006, 6:38pm
 
As I saw there was a ent library, I thought it wuold be posible to make simple turn by turn multiplayr games in java. Has anybody heard about a such a game made with processing?

This is what I thougth doing, tell me if I'm wrong :

All what you need is a http server that tells you a list of players online. Each java applet is a server waiting for a client. If a java applet wish to play with another java applet it connects to its server. Maybe for this operation, we'll need a signed applet as conecting to another IP than the http server IP might be forbidden for a common applet.

Is this realistic?
Re: Multiplayer games
Reply #1 - Feb 6th, 2006, 1:03pm
 
It is realistic, but you can save the need for signing applets by having the originating server act as a proxy between the two players, they talk to each other via the server, rather than directly.

I've done a few tests to see if it's possible for things like turn based games, and there's no reason it shouldn't work. But I've not actually produced a working demo or anything.
Re: Multiplayer games
Reply #2 - Feb 7th, 2006, 5:16pm
 
Let us know if you release a demo, it would be very interesting.
The interest of not using a proxy is that it makes multiplayer games development available for people who only can only access to an http server. And the server load is an imoprtatn point as dedicated servers are very expensive.
I will try to make a first try too adn will opst here my results.
Re: Multiplayer games
Reply #3 - Feb 7th, 2006, 9:48pm
 
For something as simple as a turn based game there's minimal load on the server, you just need to send the changed things once per turn which should be fairly minimal, unlike an FPS which can easily use over 75K a second of data whilst standing still.

The proxy can still be a webserver with PHP and a database, so there's no need to have a dedicated server or the like.
Re: Multiplayer games
Reply #4 - Feb 8th, 2006, 12:05am
 
Though, if you can, use sockets, not http.  Because HTTP will (theoretically) open a connection for each request (unless you figure out a way to keep the connection open) and have high latency/overhead bandwidth.

For basic stuff it shouldn't matter (after all, that's how AJAX works), but it's worth keeping in mind that ideally you will want to run a threaded socket-based server on the same domain as the web server.

Marcello
Re: Multiplayer games
Reply #5 - Feb 8th, 2006, 11:10pm
 
So all of you advice to use a proxy server?
As my server is overloaded these days, I was very upset about this matter. This is true, a turn based game is not consuming very much, but if you plan a popular game, it can bring a lot of users. Do you know a reliable proxy server runing on linux?
Re: Multiplayer games
Reply #6 - Feb 9th, 2006, 12:50am
 
I was more meaning that you just write some PHP not an actual proxy server, just some PHP that accepts data from both players, sticks it in a file/database for a little bit, and sends it to the other next time it asks.

You can sign an applet for free.. but people will see a big box with lots of warnings and advice not to accept it.

If your server can't handle the data proxying, it won't be able to get popular as you say.. but then, if people have to click on a security box saying "AWOOGA! Are you sure you trust this?!?!" you may also have problems with it not getting popular...

Neither solution is ideal, the proxy one saves the poblems with signing, but adds load to your server, the signing one means people have to trust you.

So basicly.. erm.. dunno... up to you, which best matches your needs/resources... the final decision is yours, I was just giving the detaisl for how a HTTP based solution would work.
Re: Multiplayer games
Reply #7 - Feb 11th, 2006, 11:46am
 
Thanks a lot john that is very clear for me now.
Re: Multiplayer games
Reply #8 - Apr 18th, 2006, 8:26pm
 
Or you could use MySQL (using the MySQL Library)Tongue I'm currently doing that, and it runs close to real time (8fps). I have the network stuff running in a separate thread though so that the graphics don't get bogged down when the connection does.

I have also used the Net library in conjunction with a C server, although there were some small problems. This method is far faster.

I have some code you might want to look at using purely the Processing Net library. It was fast enough to do a semi-functional two way webcam chat program. www.staronesw.com/WebCam2.zip

For turn based stuff a PHP based proxy program will work just fine (see my highscores code from Bermuda Triangle, www.staronesw.com/BT/ )
Page Index Toggle Pages: 1