Sign in to follow this  

Browser-Multiplayer-Game?

This topic is 4716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there! I just wanted to ask what possibilities there are to create (more or less simple) multiplayer-browser games? What I mean are semi-realtime-peer-to-peer games, like chess or card games. I've seen lots of this stuff done in flash but since I'm a C++/Java guy I'd rather do that in javascript or an applet (what's the difference?). But actually I never worked with stuff like that so I don't know if that's even possible? Please tell me about your expreiences! What do you think? Thanks a lot!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by VanKurt
javascript or an applet


Both these things are the spawn of Satan.

Quote:

but since I'm a C++/Java guy I'd rather do that in javascript or an applet


Since you are a C++/java guy, you would rather headbutt yourself into unconsciousness than do *anything* in javascript or an applet. It's probably less painful doing the headbutting (and reduces your stress levels a bit because of the sleeping part).

javascript has *nothing to do with java*, except that gimps from Netscape thought "gee! Let's steal someone else's brand, because what we're doing is so crap no-one will use it otherwise" (this is all slightly tongue-in-cheek, for those that can't tell - but the sentiment is real).

Applets are "java applications that Don't Work (tm) because Sun hates them and hasn't fixed the critical bugs in the Applet API and anyway no-one writes applets any more because they're a PITA and crap and look stupid and piss off the users".

Just write real java apps and use Webstart...it's the ONLY way to fly! :P

Share this post


Link to post
Share on other sites
I disagree entirely. javascript is quite good for writing simple games that don't have intensive graphics (Until we have native SVG scripting support, anyway). Here's one I made earlier.

The only obvious snag I can see, is the lack of ability to do "server push". Let me explain:

Requests can be sent to the server quite easily in client-side script, using the XMLHttpRequest object (which is almost identical between IE and Mozilla; Safari and Opera may also support it). The name is misleading, because it isn't limited to XML - in fact any type of request / response can be used (Although XML responses are slightly easier to process because it can also build a DOM for you).

"Server Push" is where the client makes a connection to the server, and instead of sending a request and expecting an immediate response, it waits for unsolicited information from the server. An example of an application for this would be a turn-based game, while waiting for the other players' turns.

As soon as another player has a turn, the information would come back.

The only way of "faking" this using XMLHttpRequest is to make a persistent / blocking HTTP request, which is rather ugly (and potentially doesn't work nicely with proxies). Most ISPs use transparent HTTP proxies for all port 80 HTTP requests.

So the only way of faking it is to say "Get me something..." and have the server block until something happens, or for a specified amount of time. Then if nothing has happened, the client gets a "nothing has happened" message, and immediately makes a new request again. This is to stop a timeout condition, which would otherwise break at the client / server / proxy level after a while (30s - 1min)

I think Mozilla may support server-push for XMLHttpRequests. But I'm still not convinced about how friendly this is towards HTTP servers or proxies (especially if there is a long delay, they may get bored and timeout)

---

javascript is not to be confused with Java applets - they're completely different.

Although the Applet API is rather ugly and has some bad cludges in it, it is usable and some companies very successfully use it - look at Popcap.com for instance. Their games are all written in Java and they have free versions which play in the browser. They all work and have moderately complex interfaces and nice graphics - this is because they've obviously got their own more sensible API they've layered over AWT.

Mark

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by markr
I disagree entirely. javascript is quite good for writing simple games


In the same sentence as Java and C++ it doesn't even come onto the radar. Obvioulsy blah blah blah any programming language can be used to write some games or other.

The vast majority of games you'd ever want to write it would be very very stupid to use javascript for. You could show off your ability to successfully write a complex game in a language devoid of the features of decades of improvement in language design, but ... for most people that's not a justification for it.

Shrug. Whatever bakes your cookie, I suppose...

Quote:

that don't have intensive graphics (Until we have native SVG scripting support, anyway).


"When all you have is a hammer..."

Quote:

The only obvious snag I can see, is the lack of ability to do "server push". Let me explain:


That's rather a big, glaringly obvious, "are you sure this was a good idea, Dave?" level of problem.

Quote:

I think Mozilla may support server-push for XMLHttpRequests.


Moz is rich enough to get around all the problems there, although the API's are still buggy enough to give you major headaches. I know a lot of people who've done a lot of work with the Moz stuff - but the downside is that it doesn't work on most web-browsers (moz is still less than 50% of web browsers) which makes it a waste of time for most people.

Quote:

Although the Applet API is rather ugly and has some bad cludges in it,


Look, it doesn't work. Simple as that. Sun has bugs outstanding on it from 5 years ago. Basic features Sun could add that would make Applets 5 times as good they haven't bothered to, even after 10 years. Wake up and smell the daisies: they aren't truly supported any more, and aren't encouraged as a distribution system (they'd prefer you to use webstart + apps). Sun won't stop you, and won't tell you to get lost when you file bugs, but they probably won't fix them either.

Share this post


Link to post
Share on other sites
Ok, anonymous coward, what do you think Popcap.com are doing? There is nothing in the applet interface that cannot be worked around.

I was not presenting javascript games as an alternative to native code C++ games, but rather a nice easy way (for the user) to get simple games workingo n the web.

Are you a total idiot or what?

Mark

Share this post


Link to post
Share on other sites
Quote:
Original post by markr
Ok, anonymous coward, what do you think Popcap.com are doing?

Mark


Amongst other things: moving away from applets and into native compiled code or non-java x-platform stuff, last time I looked. Because the applet maintenance and support costs were too high. At least a third of the games I couldn't play because I wasn't running the right OS + plugins.

Maybe they've gone back to 100% applets again by now?

Share this post


Link to post
Share on other sites
Hey, c'mon! We're one community - we're all friends and love each other ;-)
I decided to use JAVA and WebStart. Thank's a lot for your ideas and comments!

Share this post


Link to post
Share on other sites

This topic is 4716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this