Chris Gomez

Development topics for the indie programmer

The Web Is Ready For Games: ASP.NET Edition

Part 1 – Introduction

I have longed for the web to be ready for high performance games, including multiplayer games.  I believe we are at the point where the technologies you need to build high performance, real time games are here.  The exciting thing is we have a lot of choices now.

I believe we can use Microsoft tools and technologies to deliver the games I am speaking of.  I am going to show you how ASP.NET and many of its pieces such as SignalR can be a foundation, but what will be more exciting is when we explore the options afforded us by OWIN and scaling technologies like the Windows Azure Service Bus.

Getting started is going to involve learning how to develop with ASP.NET SignalR.  You  may be hearing a lot about SignalR lately.  It certainly can be labeled the new hotness.  People are excited about the prospect of real-time applications on the web and breaking the stateless request/response paradigm.

How is that even possible, you may ask?  Well, the fact of the matter is there is no magic going on here… no cheating… it’s still the web.  It’s just that some very clever techniques developed over the years, plus newer features like WebSockets are coming together to enable this.

I don’t think it’s necessary for me to give you the “intro to SignalR” course when there are so many good tutorials.  So instead, I am going to link to them and comment on what you should take away from each one:

Tutorial: Getting Started with SignalR (C#)

This tutorial will create the canonical chat application.  Almost everyone who teaches about SignalR makes a chat application to demonstrate to “server-push” capability you get with SignalR.

Notice that the tutorial doesn’t create an ASP.NET WebForms NOR an ASP.NET MVC application.  It creates an empty application and you create a plain old web page with HTML and JavaScript.  SignalR is a server side technology that lets you use your .NET skills.  It is ALSO a client side technology in that you use the JavaScript API to refer to the hubs you create on the server.

Chat applications demonstrate “server-push”, whereby a chat message from any client is then propogated out to all the listeners as a whole.  This might lead you to believe that SignalR is a server-push technology that is always initiated by a client-side call.  That is NOT the case at all.  We will see how to adapt to games, especially real-time games that need to be constantly running simulations.

Note the dependency on jQuery.

Tutorial: Server Broadcast with ASP.NET SignalR (C#)

What is nice about this tutorial is that it demonstrates what we need for games.  The stock ticker has to keep running its simulation and broadcast when prices change.  This isn’t like the chat application where every server-push was initiated by client action.  This is closer to what we need for games.

Please take a look at the fine work in these and stay tuned as we begin work on our first realtime. multiplayer web game!

blog comments powered by Disqus