Networked Objects

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

jimbobway
Posts: 20
Joined: 26 Oct 2010, 15:57

Networked Objects

Postby jimbobway » 21 Jul 2011, 20:02

I posted this in the Unity SmartFox 1.x thread when it should have been in the 2x thread. Sorry if you read this again.

I've been digging through the forums and I haven't figured this one out yet. I basically want a networked ball that players can move and kick around. But, the answer seems hard to do in SmartFox.

First, to let you know I have successfully integrated the FPS code into our game. Players spawn and can see other players move.

In the SFS demo there are items that are networked that don't really move. If a player gets close to a networked item it will detect it and will inform other clients. However, there is no networked object in the SFS demo that actually moves around (like a soccer ball). How do I implement this?

From reading the forums it seems like I want an authoritive server to control the ball while having players give input to the server and have the server recalculate the ball position. Then smartfox relays this position to the clients. One of the main issues is that we have terrain and buildings, and it seems like SFS will need the collision data of the buildings and terrain to do calculations. There really isn't an example for this and it seems difficult to do with smartfox. Thoughts?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 05 Aug 2011, 06:48

If you want it non-authoritative, you can simply let one client be a "master client" and have it send the position to others.

If you want authoritative server, then you need to write some script that exports all collision geometry from Unity to the server and have a collision detection going on server side in code.

Sending the data itself is trivial - but the collision detection part is not

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 73 guests