Some newbie questions

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

NMHoang05
Posts: 2
Joined: 12 Apr 2021, 03:24

Some newbie questions

Postby NMHoang05 » 12 Apr 2021, 04:30

Hello!
I'm making a mobile game in Unity and hope I can add a "co-op" mode which allow up to 4 players to play together.

I previously tried Photon PUN but this does not work for me as I want server/client model.

I decided to try SmartfoxServer, after reading a bit of documents, I have a few questions:

1. about the license:
let say I have a license of 100 CCU,
if the 101st user try to connect to the server, that user will not be able to connect, is that right?
do I get any kinds of notification when that happen?

2. writing server logics in Java
Java actually is my favorite language, so I don't mind writing server logics in Java.
though... simulating the game world in Java without Unity library would be hard...

2.a> I mean, how do I check for movement collision on the server?
the server stores data about position, collision size/shape of the object
but how do I use Unity's Physics2D function like: Raycast, OverlapArea,... to perform this check? do we have equivalent library for this?

2.b> there are some expensive operations that I would like to perform on the server
example: path-finding
the path-finding library I'm using is written in C# (for Unity), so I can't use it in Java Extension
I have to find an equivalent libary in Java, is that right?

I would be greatly appreciate any pointers for this problem. :D

3. example source code
where can I download the Java source code for extension used in Unity Examples?
I mean this one: http://docs2x.smartfoxserver.com/ExamplesUnity/fps

Thanks in advance,
Hoang.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Some newbie questions

Postby Lapo » 12 Apr 2021, 10:57

Hello,

NMHoang05 wrote:Hello!
1. about the license:
let say I have a license of 100 CCU,
if the 101st user try to connect to the server, that user will not be able to connect, is that right?
do I get any kinds of notification when that happen?

The login attempt of the 101th user will return an error saying that the server is full. The error can be handled from client side via a specific event handler (called LOGIN_ERROR)


2. writing server logics in Java
Java actually is my favorite language, so I don't mind writing server logics in Java.
though... simulating the game world in Java without Unity library would be hard...

It depends how much of the world you have to simulate, but yes if you need most of the data of the world from client side it can be a problem. In those cases you may need an headless Unity server handling the game logic.
We wrote a couple of articles on this subject in our blog, here:
https://smartfoxserver.com/blog/best-of ... -games-p1/
https://smartfoxserver.com/blog/best-of ... -games-p2/

The above should also clarify some of the other related questions. If not, let us know.

3. example source code
where can I download the Java source code for extension used in Unity Examples?
I mean this one: http://docs2x.smartfoxserver.com/ExamplesUnity/fps

In the article you have linked, right after the overview, there's a link to download the source :)

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
NMHoang05
Posts: 2
Joined: 12 Apr 2021, 03:24

Re: Some newbie questions

Postby NMHoang05 » 16 Apr 2021, 03:17

Hi, again!
"SFS2X + server side Unity" is exactly what I want. :mrgreen:

I'm building the game flow step by step and will soon get to "spawn headless Unity instance" step.

I have a few questions:
1> is there a deeper example for "SFS2X + server side Unity" ?
your article mentioned "AirHockeyGame", is source code for this project available to download? (did I miss a link somewhere?)

2> after spawning "headless Unity instance", how do I communicate directly with it?
must I send request to the extension, then the extension send data to this instance? :?

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 60 guests