I ran into some issues attempting to test Facebook Credits with ASP.NET locally during development. I have an MVC3 site that is running in the Azure Development Environment and I wanted to be able to test the credits functionality. I played around with a bunch of settings, etc. and finally got a combination of things working that allows me to test credits locally. Below are the steps I took:
1. Set the web project as the startup project in the Visual Studio solution. Unless you need specific Azure functionality this is much easier since Azure does not want to accept traffic from anything other than localhost and credits testing will not work with localhost.
2. Set your web project to run using IIS or IIS Express bound to http://localhost. (Project Properties -> Web -> Servers) If you want to use IIS Express and have IIS installed you will need to unbind the default web site from port 80. ** I also had to stop the Web Deployment Agent Service as it binds to port 80.
3. I used DynDns.com to provide a host name for my web site and entered this as the domain for both the Canvas Url and Credits Callback Url. The Credits callback will not work with 127.0.0.1 or localhost so you need some external domain. I tried using a made up entry in my HOSTS file but Facebook needs a real address since they initiate the request for the callback.
4. I edited the applicationHost.config file under %userprofile%documentsiisexpress to allow my DynDns name like so (system.applicationHost/sites node):
<site name=”WebAppName” id=”1″>
<application path=”/” applicationPool=”Clr4IntegratedAppPool”>
<virtualDirectory path=”/” physicalPath=”DirToWeb” />
<binding protocol=”http” bindingInformation=”*:80:localhost” />
<binding protocol=”http” bindingInformation=”*:80:dyndnsname” />
5. Do any port forwarding on your router and enable port 80 on your firewall.
6. Setup the callback code according to the Facebook Docs, I even used the JS sample code to test.
Part of the Perenthia re-birth is to get the game running in the cloud on Windows Azure. I started an Azure 1.2 web role project to handle the game. I got some of the basic stuff working like authentication and character creation. With the release of Azure 1.3 SDK I had to install IIS 7.5 components. Since I did not install it previously I had to run “aspnet_regiis –iru” to setup the IIS mappings for .NET 4 and I had to install the “HTTP Redirection” component for IIS 7. After getting all that setup I am up and running with Azure 1.3.
Because I am scaling the game down a bit and restructuring it to run with basic html and a variety of devices I am essentially re-building the game. I have a lot of code to work from and the concepts are already defined but I do have to do some new things. With running in the cloud some of the previous in-memory stuff I was doing has to be setup to store that in-memory data either in the database or in Azure Storage. For instance, when you connect to the game you get a token or session that identifies you. That token contains a reference to an in-memory object that stores the user id and currently selected character of the player. While I could setup and use .NET Sessions with some providers to store the data in Azure Storage I am going to continue to use the existing system I had in place and store in the in-memory data in Azure Table Storage.
I have some additional in-memory data that will either scale back to database driven queries or work the same way as tokens/sessions with table storage.
After many months of not working on Perenthia I find myself once again desiring to see it complete. The last revision I did on Perenthia was some time ago and involved a Silverlight UI with a C#/SQL 2008 backend.
During the course of development on Perenthia I discovered some of the pitfalls of attempting to develop a role playing game by one self. Mainly, the inability to handle content creation on a large enough scale as to appeal to players and have enough interactivity to make the game fun. I have been thinking lately of ways to reduce that load and still keep the game fun. I have some new ideas I want to put into place and re-release Perenthia with these concepts.
Among the changes I plan to implement will be scaling the game down to function solely in an HTML environment. This will enable me to provide a mobile version that works on all phones with a browser and keep the feature set the same for both phone and web.
I have begun to refactor pieces of the code and am making heavy use of jquery for the character creation screen.
With the release of Silverlight 4 RC the Windows Phone 7 developer tools I wanted to take a stab at building a Silverlight application for both the web and phone to see what kind of differences there are between the two. Except for the inability to use the ChildWindow I was able to build out controls and share them between the two applications. The main differences were in the MainPage.xaml that is created, along with the default styles, when you create a new Silverlight application for the web and Windows Phone 7. Of course,
I decided to create a game (called ShapeAttack) to see how it would perform on the phone emulator. Sad to say the performance on the emulator is very poor but I would imagine that it would be better on the physical device but as I do not own a Windows Phone 7 yet the emulator has to do for now. For that reason I would recommend doing this parallel type of development so you can actually test your application.
What I did was create all of the game code in UserControls, including the main game surface, then I linked the files from the standard Silverlight project into the phone project.
Andy Beaulieu has some helpful performance tips for Windows Phone 7 and Silverlight primarily focused on games of course.
Jeff Weber, the guy behind the Farseer Physics Engine, has posted an An Open Letter To Microsoft Regarding The Silverlight Game Development Community. I fully agree and want to add my voice in the request for an XNA-like community site!
From Jeff’s post:
“I hereby request, on behalf of all the future and present Silverlight game developers, an awesome Silverlight game development portal along the lines of what exists for the XNA Creators Club Online community.”