Skip to main content
GameDev.net gamedev.net
🔒 Locked

Query on Online Game Development

Started by nuvin May 12, 2005 at 8:59 PM 2 replies 2.1k views
Original Post
nuvin
nuvin
I am writing an online game (2 player), using Flash, ASP, COM, IIS. The way I am doing is that in order to refresh and get the latest information, the Flash Game will call the server every “X” seconds (e.g. 5 seconds). But I think this might kill my IIS when there are too many requests. I would like to know if there is any way other way for refreshing both clients when one of them has played instead of requesting every “X” seconds. Can it be that one player calls the server and at the same time sends a request to the other player that he/she needs to request from server? What technologies can I use to overcome this?
falkone
falkone
What if the server notifies the client that information has changed, and then sends the information itself?
Disclaimer: "I am in no way qualified to present advice n any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)" o
nuvin
nuvin
yes, this is exactly what i want to do. how does the server notifies the client about the change? (from i know, the client requests from the server but can the server send notification to the client (how?).
markr
markr
You can't easily to "Server push" over HTTP in a way that isn't an incredibly bad kludge.

What I've seen people do, use abuse the HTTP protocol thus:

- Client requests a URL (http://mygame.example.com/getnextturn)
- Client waits for server response
- The server thread processing this request SLEEPS while nothing is happening, up to a maximum time (30s or something)
- If something happened, the server sends back a message about what happened immediately.
- If nothing happened for the maximum time, the server send back a message "nothing happened"
- The client, upon receipt of the response, immediately opens another request for /getnextturn


---
This has been used successfully by &#106avascript chat programs etc. It is however, very hacky:<br/>- Each client constantly has one pending request<br/>- The web server has to keep a large number of threads (one per client) blocking waiting on some event<br/>- Proxies don't like it much - that's why you need the 30s timeout - so proxies don't get bored and give up<br/>- It is a terrible abuse of HTTP<br/><br/>Essentially it works in most cases but is extremely dodgy. It uses up more resources on the server than it strictly should. Web servers aren't designed to have a large number of outstanding requests blocking (Web server might need to be detuned to do this).<br/><br/>If using ASP, there are a number of significant issues you have to bear in mind:<br/>- There aren't really any native ASP primitives to "sleep" waiting for something<br/>- ASP has a timeout on script processign which you might hit<br/>- ASP has various shared structures, for example application and session variables which could easily cause deadlock if you use this approach - make sure they're disabled and you don't use them<br/><br/>Of course if using COM, you could implement these functions inside a COM class.<br/><br/>However, IMHO you shouldn't be using ASP/COM for any new application - Microsoft do no longer recommend it. If you must use Windows for web server stuff, use ASP.NET instead.<br/><br/>Mark

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.