Jump to content
  • Advertisement
Sign in to follow this  
rouncer

web based game in asp.net?

This topic is 2555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

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.




You can use JavaScript to have the client ask the server if an update is available and update whatever is needed, If you don't mind skipping support for older browsers you can use websockets to establish a persistent connection (Which allows the server to push updates)

Share this post


Link to post
Share on other sites
cool! I was wondering if it was possible.

What does the javascript version look like? (the one that asks for the update, does it work on a thread? cause it would need to be continually updated would it not?)


just updating the view window whenever something changes in his view, thats all i would need.

Share this post


Link to post
Share on other sites

cool! I was wondering if it was possible.

What does the javascript version look like? (the one that asks for the update, does it work on a thread? cause it would need to be continually updated would it not?)


just updating the view window whenever something changes in his view, thats all i would need.


It depends on how bandwidth efficient you want to do it:

The easy way is to have 1 asp script that simply prints a json object (1 if an update is needed, 0 if it isn't), or that returns a 404 or something if no update is needed and then use jquery to load that asp script repeatedly and act on the result.

something like:

<script>
function update() {
$.get("updatecheck.asp", function(data){
if (data=="1") {
$('#view').load("updateview.asp");
}
});
}
window.setInterval(update,2000);
</script>

should do the trick, if updatecheck.asp prints 1 (plain text) then whatever content updateview.asp prints out will be loaded and placed inside the element with the id "view" (This could be as simple as a <div id="view"></div> that you position wherever you want it using CSS. (Everything runs in the backgound)
More complex polling and update schemes can be used aswell (You can google long polling and you could also load xml or json data and update individual elements rather (Thus rather than sending the entire HTML for the new view you just send a list of changes to the view, the code for this would be highly game specific though) than reloading the entire view aswell to greatly reduce bandwidth usage).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!