开发者

Coding a Game Lobby in ASP.NET

I have an online 3D multiplayer game that uses a plugin to embed itself into a web page and I'm trying to figure out how to make a web based lobby for it without turning to Flash.

The idea is that signed in players choose a game type on a page and are automatically taken to an open Lobby that accepts up to x players. The lobby is a we开发者_运维问答b page where the user can choose their skin and upgrades. As soon as the x'th player joins, the lobby should begin a countdown, which upon it's successful completion redirects all users to another page that loads the embedded game up and takes those users into the same server together.

If a user backs out of the lobby/page before the timer ends, the countdown needs to stop and the lobby must wait for the room to become full again. I'm not sure how to do this part as it seems like I'd need some server side timer object that is aware of when a player leaves. I'm looking at using WebSync to communicate with each user in a lobby page as to how many players are currently in the lobby, and I'm assuming I can also use this to send down a command to boot users to a new page upon successful timer countdown. I also imagine I can use WebSync or something else to let my server know when someone leaves the lobby in order to stop the countdown.

How do I create this server side timer and how do I interact with it? I'm thinking of using Quartz.Net to access the scheduler or something, but I'm not sure yet.

Any Ideas?


Do you have the option of using WebSockets? You'd be able to (more or less instantly) watch for state change and update both the client and server upon events.

You can send down a chunk of data from the server at a predefined time, and run javascript on the client to kick the user to the new page / do something when the timer ends (or a player leaves or joins the game.)

(Plug: a friend and I wrote a C# library, with a working live chat example, found here: https://github.com/Olivine-Labs/Alchemy-Websockets)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜