Friday, March 21, 2014

Unity Networked Game, UP AND RUNNING!

Hey folks!

I am writing this because of several reasons. These reasons are that I wasn't able to post last night (like I had hopped), and because the reason I could not post has been resolved.

So last night, I spent a majority of the time fixing a bunch of issues with my SmartFox logic and Unity Scripts. Most of these issues were due to poor management and assigning of resources.

Let me start at SmartFox first. I was consistently getting java.lang.NullPointerExceptions due to an issue with how I am currently storing games. The way I am doing it right now is through a ConcurrentHashMap. Adding to it works fine, without issue, or so I believe. I will need to attach a remote debugger to see what is really going on. However, I do plan on fixing this by storing ANY persistent information in a SQL database. This is for several reasons. One is less memory is taken up as it no longer needs to have the server cache game data. Secondly, it maintains state. If for some reason the server went down in a the middle of a game, I will be able to pull information from those games and let players continue. I believe this is a good approach to go for.

Secondly in Unity, I had an issue in my script that only allowed the creator of a room to see other players. This is because I was adding players for the game in the GameManager class for only the event that handles users entering a room. I thought that the way SmartFox dealt with this was a little different. Right now I have a small injection of code that alleviates joiners of a game (not creators) from not seeing people in the room. However, it is not the proper way to do it and I will be fixing it. Basically, what I did that is wrong, is check to see if the player receiving the transform event is from a player already registered with the GameManager, if not, then create the player. First off, this should not be the responsibility of event messaging handling during regular updates. It is something that should be done on load. So I am seeking to find a fix for it.

Now, for a list of features that the game has over the network:

  • Public Chat messaging in Lobby and Game
  • Up to 8 players in a single Game
  • Display of player names over their respective "Ship"
  • Programmer Art!


Right, that is a small update. I will be gone for the next week and will not have any new posts until then. However, *HOPEFULLY* tonight I will have videos of both of my projects for everyone to see - to prove that they are real and not a figment of my computer's imagination.

Check back soon!

No comments:

Post a Comment