Monday, April 7, 2014

Unity Senior Project Update

Over the past two days I have been working on deploying my database to our server and writing code for the client side so that players can register and log in.

The database deployment went smoothly with little hick ups. The code on the server extensions; however, are causing some issues. The SmartFoxServer LoginAssistant and SignUpAssistant are a bit different than I anticipated. Both of these classes expect several parameters when it comes to registering and logging in a user. A lot of these parameters are the database column names and the database column data types. The names are an easy fix by simply calling getConfig() of each of the class instances. The difficulty is that I could not find a reference - in a quick search - to the datatypes each of these columns should be for the Login and SignUp assistant classes. I am going by what the server spews out as errors.

Client side everything has gone smoothly as I can see of right now. The reason I give this little disclaimer is that the client side code can't really be fully tested until the server side code is finished without errors. Right now I have some new GUI code up using the Unity OnGUI event method. I have a new level and script for registration. It is pretty simple, it calls a C# class instance of SmartFox, then calls the SmartFox send() method, finally, it sends the ExtensionRequestion for '$Signup.Submit' server side.

"$SignUp.Submit" is a SignUpAssistant command. The reason it is done this way is that the SignUpAssistant class is treated much in the same way of a multihandler extension class in SmartFoxServer. This is explained in depth here. But in short, a mutlihandler allows you to give it an identifying string for requests to be sent to. Then, there is a period, the second command that the extension will handle. Think of this as a call to a class method.

What I have found out is that the data being sent to the server in the SFSObject on the C# side needs to match the column names set in the SingUpAssitant.getConfig() calls. So, for instance, the SFSObject needs to put in the UtfString with the parameters ("user_name", username) if the SignUpAssistant username field column name is defined as "user_name".

So far, I am having some issues with matching the datatypes that SmartFox's SignUpAssitant expects on my SQL tables. But, I am moving along and soon players will be able to create their own accounts. Then they will be able to log in with those accounts and play.

No comments:

Post a Comment