rouncer at December 21st, 2011 05:13 — #1
I know a little of asp.net, but one thing is bugging me before I write a simple multiuser dungeon with it, the fact that you can only refresh the html when the user clicks a button to, it cant be automatically triggered from the server... or can it? Does anyone know this?
Or is php or some other language something I should use, cause it enables this "auto resend updated page"
Thats the thing thats bugging me at the moment, without it the game is just about working, but with only a really nasty "click me updated" and you could dead if you dont click it every now and again.... just in case a monster starts eating your toes off, youd never know until you clicked "update" which makes no sense at all.
vrnunes at December 21st, 2011 06:04 — #2
rouncer at December 21st, 2011 07:28 — #3
geon at December 21st, 2011 08:46 — #4
You can absolutely have the server update the page continuously. It is called "Comet". Some languages are not a very good fit for this, though, like PHP. PHP will usually have a execution time limit of 30 seconds or so. It an be configured, but most web hosts won't let you.
Oh! And**learn jQuery**! It will save you hours and hours of pain, and teach you good functional design.
rouncer at December 21st, 2011 09:16 — #5
cheers geon for the advice, I guess it would be more bandwidth hungry than a client server exe setup, where you could compress and decompress messages, and really cut them down, how much extra bandwidth do you waste sending html?
alphadog at December 21st, 2011 13:00 — #6
COMET is a generic term for any asynchronous information fetching. It's also known as HTTP streaming. An HTTP server can be set such that connections do not timeout and keep flushing buffers such that the client can make use of constant flow of info.
It is likely to be upstaged by HTML5's Websockets, so make sure you consider that too.
Of course, what you want to use is a cross-platform, cross-browser framework that abstracts COMET, Websockets and other solutions (like long-polling, which has nothing to do with pron), ex: orbited.
Also, the HTML5 spec has another possible "tool" called Server-Side Events, which is unidirectional push from server to client.
geon at December 22nd, 2011 06:47 — #7
how much extra bandwidth do you waste sending html?
The format is basically
memberName: "some string",
yetAnotherOne: ["an", "array", "of", "strings"]
The wasted bandwidth wouldn't be that bad. Basically HTTP headers + the raw data in text format + whatever member names you use. It would compress pretty well too, if you enable gz compression on the server. I know Apache supports that. It is part of the HTTP protocol.