Implementing Web-based RPG fighting?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm in the process of coding what amounts to a Web-based multi-player
RPG. An important feature will be player-versus-player fighting. Since
the players in a fight will never move instantly (or even close to it),
there will need to be a way to inform players when their opponents have
made a move.

The most common implementation I've seen is using the Refresh header
(possibly simulated via http-equiv -- ew!) with a period of around one
refresh per second. When the opponent has moved, the page stops
refreshing and displays the results of the turn along with a form for
the player to make their move.

This approach has a few problems: it's non-standard (although
widely-supported, the Refresh header isn't in any HTTP spec), the
constant reloading can cause high server load, and it takes at least one
second for a player to be notified of their opponent's move (since
that's how long it takes for the page to refresh).

One alternative I've thought of is having keeping the HTTP connection
open until the opponent moves, so that the page would look like this:

<p>Your opponent is moving, please wait...</p>

(The page will stop loading at this point, but the connection will stay
open. When the opponent moves, the loading will continue:)

<p>Your opponent, <strong>Big Meanie</strong>, has kicked you in the
crotch doing 30HP of damage.</p>

Unfortunately, this approach has a few problems of its own: the user
might be confused by the page continuing to load even when nothing
appears to be happening; some proxies would probably only send the user
the page once it has been completely sent by the server (which could
take over a minute in some cases); some browsers might timeout the
request after a while; also, this approach would work with an
asynchronous server, but wouldn't work so well with a multi-threaded or
multi-process server (since the whole thread or process would be tied up
until the opponent moved).

Does anyone have suggestions for approaches I haven't thought of?
Accessibility is a concern, but I recognize that this might be something
that simply can't be done in every environment, so my biggest concern at
the moment is usability in common visual browsers.

Re: Implementing Web-based RPG fighting?

Leif K-Brooks wrote:
Quoted text here. Click to load it

Why would you want to do this when there are so many obviously better
options out there.  I seriously doubt someone who wants to play a RPG on
line is worried about using Flash or Java or (maybe less so) activeX.

I am not trying to be a smart ass, I seriously want to know why you dont
want to use those technologies.  What you are proposing is akin to using
a chisel and rock to send mail.


Site Timeline