Page 1 of 1

Offline mode

Posted: 11 Jul 2014, 13:00
by Elzean
I saw within the tutorials that i should build the game logic with Java as an extension in smartfox. The game i build need an offline mode so i need to build the logic with Unity in that case.

Should i build the logic 2 times then ?

If not, and i just make everything in Unity, i am worry to have some troubles with the game running in each Client (it's a turn based game), what do you think ? Do you have a suggestion or an example on how you would build a game in this case ?

Thanks !

Re: Offline mode

Posted: 11 Jul 2014, 14:38
by Lapo
An offline mode means, I suppose, that the user is playing against the AI.
While in multiplayer mode the player, again I suppose, will be playing with real players.

If this is the case, and you should add the details, then these two game logic appears to be pretty different.

Using a client logic for the multiplayer game is not very secure, because clients can cheat. If the logic is on the server side you can make sure that players are not cheating.

Re: Offline mode

Posted: 11 Jul 2014, 15:08
by Elzean
Yes online is against human but AI can be used too. Offline is only AI, so for AI i will try to create only 1 and manage how it perform the action a bit differently when its online (acting like another human on internet sending actions to the server) and offline.
So it seems like i need to create the game logic 2 times one in JAVA and another one in C#. Seems a bit tedious and twice the debugging too, but i guess i don't have much choice.

Thanks for your help!

Re: Offline mode

Posted: 11 Jul 2014, 15:21
by Lapo
There might be a trick worth taking in consideration.
You may be able to reuse the client-side AI code on the server side if you create an head-less (no rendering) C# client that runs on the server side, alongside with SFS2X and connects to it to handle the AI logic.

Some of our clients using Unity have used this "trick" with good success in order to reuse their code.

The ideas is that this special client will use the C# client API to connect to the server, so SFS2X will consider it as a regular client(s) and it will work transparently.