Browser-Multiplayer-Game?

Started by
9 comments, last by VanKurt 19 years, 3 months ago
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 &#106avascript 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!
Advertisement
I've played an online , multiplayer , flash street fighter clone. So pretty much anything is possible(as long as its not too complex or graphics intensive).

EDIT: Stree Fighter Online
Quote:Original post by VanKurt
&#106avascript 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 &#106avascript or an applet <br><!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE--><br><br>Since you are a C++/java guy, you would rather headbutt yourself into unconsciousness than do *anything* in &#106avascript or an applet. It's probably less painful doing the headbutting (and reduces your stress levels a bit because of the sleeping part).<br><br>&#106avascript 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).<br><br>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".<br><br>Just write real java apps and use Webstart...it's the &#79;NLY way to fly! :P
I disagree entirely. &#106avascript 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)

---

&#106avascript is not to be confused with Java applets - they're completely different.<br><br>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.<br><br>Mark
Quote:Original post by markr
I disagree entirely. &#106avascript 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 &#106avascript 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.<br><br>Shrug. Whatever bakes your cookie, I suppose...<br><br><!--QUOTE--><BLOCKQUOTE><span class="smallfont">Quote:</span><table border=0 cellpadding=4 cellspacing=0 width="95%"><tr><td class=quote><!--/QUOTE--><!--STARTQUOTE--><br> that don't have intensive graphics (Until we have native SVG scripting support, anyway).<br><!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE--><br><br>"When all you have is a hammer..."<br><br><!--QUOTE--><BLOCKQUOTE><span class="smallfont">Quote:</span><table border=0 cellpadding=4 cellspacing=0 width="95%"><tr><td class=quote><!--/QUOTE--><!--STARTQUOTE--><br>The &#111;nly obvious snag I can see, is the lack of ability to do "server push". Let me explain:<br><!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE--><br><br>That's rather a big, glaringly obvious, "are you sure this was a good idea, Dave?" level of problem.<br><br><!--QUOTE--><BLOCKQUOTE><span class="smallfont">Quote:</span><table border=0 cellpadding=4 cellspacing=0 width="95%"><tr><td class=quote><!--/QUOTE--><!--STARTQUOTE--><br>I think Mozilla may support server-push for XMLHttpRequests.<br><!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE--><br><br>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 &#111;n most web-browsers (moz is still less than 50% of web browsers) which makes it a waste of time for most people.<br><br><!--QUOTE--><BLOCKQUOTE><span class="smallfont">Quote:</span><table border=0 cellpadding=4 cellspacing=0 width="95%"><tr><td class=quote><!--/QUOTE--><!--STARTQUOTE--><br>Although the Applet API is rather ugly and has some bad cludges in it,<br><!--QUOTE--></td></tr></table></BLOCKQUOTE><!--/QUOTE--><!--ENDQUOTE--><br><br>Look, it doesn't work. Simple as that. Sun has bugs outstanding &#111;n 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.
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 &#106avascript 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.<br><br>Are you a total idiot or what?<br><br>Mark
Most simple browser games are probably written in Flash (although I don't have actual statistics to back that up). Another option is to write an ActiveX control, and screw the Mac/Linux people ;-)
enum Bool { True, False, FileNotFound };
CGI + Procedural C + IIS 5.1 == [cool]

Edit: hplus, you must explain your avatar to me!11 [razz]
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?
My avatar is a small section of the sector map for our main cluster, as of about a year ago.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement