Unity and Smartfox Server logic sharing

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Henrryparth
Posts: 1
Joined: 24 Dec 2018, 08:07

Unity and Smartfox Server logic sharing

Postby Henrryparth » 24 Dec 2018, 08:12

I'm going to have a singleplayer and multiplayer mode. I want to avoid http://movieseriesworld.com/ having 2 versions of my game logic. What's the best way to do this? My best guess is writing all core game logic in C++ so that it can interface with both Unity (C#) and SFS (Java), but maybe there's a better solution suited for this.
Last edited by Henrryparth on 26 Dec 2018, 05:44, edited 1 time in total.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity and Smartfox Server logic sharing

Postby Lapo » 24 Dec 2018, 08:24

Hi,
I don't know if using C++ is the best of ideas. Interfacing C++ with Java is a tedious job and it makes writing and debugging server side core more complex.
Generally speaking I don't think it's necessary to add C++ in the mix.

What you may want to do is abstract the parts of your game logic with interfaces so that you can swap their implementations with a single player or multiplayer versions, based on which mode is being played.

To give you an example: in single player mode you want your enemies to be controlled by the game's AI, while in multiplayer mode they will be controlled by actual players.
You can abstract these players with an interface and then implement the specific single player and multiplayer versions and activate them at runtime.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 49 guests