Friday, March 1, 2013

MVC4 JSON Implementation and Bug Hope

News: At my day job, we are learning the MVC 4 C# Server platform.  It's pretty nice and with a few light tweaks  all of its interactions use JSON and GET parameters.

Bug: Chrome (and other browsers) freeze the instant I try running the browser compiled version.  It gets through the initial Unity Loading, and then the unity component freezes, along with the page, and the entire browser as well.  I've done some digging, but yielded nothing helpful.  I can't find any form of debugging info on this, so I'm in the dark to the real problem.  This loads just fine when compiled for Windows.  This occured in IE 9, FireFox Latest, and Chrome.  This was tested on Windows 8 64 and Windows 7 64.

Plan: Without much to go on, my best guess is that it might have to do with the MONO requirements, triggered by using .NET objects like XmlDocument to extract.  I've replaced the server with an MVC 4 implementation using JSON as the communications, and now I'm altering the requests to use LitJson to parse communications, instead of XmlDocument.  I have GetVersion functioning, and now I'm overhauling Login and Register functions.

I'm hoping that with all references to XmlDocument out, that the Web version might execute.  Honestly though, JSON parsing is faster than XML parsing, so this is a good upgrade anyway.

You might ask why I'm using web services/api controllers like this anyway, instead of implementing a UDP client server.  I'm doing this to keep more potential issues out of the mix.  I'm learning Unity 3D with this project, and by using the services, I'll immediately have existing common place protocols, and strong logging built in.  Also, since the project is a City Builder, Real Time responses are not needed.

The city builder will be based off of web services because it does not need any more and web services are easier to farm out than custom built UDP services.

WW Tactics and WW Strategy will require faster connections, and for RT data, I will implement a UDP client server protocol at that time.

Future: If this doesn't fix the browser version, and the Windows version is functioning, I intend to ignore this for the time being, and progress to the Game Play.  I welcome ideas and recommendations on what might be causing the bug or how to get better debug data from the browser.

1 comment:

  1. On GameDev.Net, ( I received a tip about what might be causing the bug. The first thing I'm doing is trying to connect to a web service. If there are any network issues from using the client, then it would probably just freeze there. I'll be adding logging info in the short future to check on this.