Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DeveshPandey · Dec 30, 2013 at 12:51 PM · multiplayersyncmmorpgsynchronizesmartfoxserver

How to sync players in multiplayer game

Hello Developers,

I am doing a MMO for web with Unity3d and Smartfox, there is a virtual world in the game, any player can login and he/she can run in the virtual world, this is the basic thing of my game.

I want to know that, how can I sync each login players on other side, suppose, 3 peoples A,B,C are login from different browsers and running in the virtual word in same direction. How can I update the position of player A on B,C side, similarly we need to update position of B on A,C side and so on.

Therefore result will be, position of each player will be same on each side(A,B,C side) on each frame.

I was tried to follow [this][1] tutorial by smartfox but PROXIMITY_LIST_UPDATE never fired.

Please let me know your suggestions and tutorials for that.

Thanks!! [1]: http://docs2x.smartfoxserver.com/AdvancedTopics/mmo-rooms

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DeveshPandey · Dec 31, 2013 at 05:21 AM 0
Share

waiting for your suggestions....

avatar image nastasache · Dec 31, 2013 at 07:48 PM 0
Share

I don't know Smartfox, I am using Unity build-in networking with $$anonymous$$asterServer (RackNet). There (if Smartfox is not a simple holder and manager of connected machines, but taking care also about the players physics logic) have to be something like RPCs from clients to server and server to clients, with current local player positions, or something like NetworkViewID to identify and synchronize the players positions by serialization.

avatar image DeveshPandey · Jan 01, 2014 at 05:15 AM 0
Share

Thanks nastasache, Is your used method scalable to thousands of player online and playing game at a time?

avatar image DeveshPandey · Mar 28, 2014 at 07:33 AM 0
Share

Hi, I have tested many examples provided by Unity and some others, they are working fine with smartfox on local machine, but when I test it on live smartfox server then its lagging and sometimes its hang & crashed.

There are following way to update on other side: - OnUserVariableUpdate - Update via ExtensionResponse - Object$$anonymous$$essageRequest()

All these methods are not working with live smartfox server, its going too slow and crashed.

Please reply with your answer. Thanks!!

avatar image adnirjhar · Mar 28, 2014 at 09:41 AM 0
Share

Did you try using UDP ins$$anonymous$$d of TCP connections. UDP is more stable. http://docs2x.smartfoxserver.com/AdvancedTopics/using-udp-protocol

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by adnirjhar · Jan 01, 2014 at 05:42 AM

I am still a noob at SmartFox but this is what I can suggest-

add an event listener-

 SmartFox smartFox = = SmartFoxConnection.Connection;
 smartFox.AddEventListener(SFSEvent.USER_VARIABLES_UPDATE, OnUserVariableUpdate);

Now in that OnUserVariableUpdate function, check the BaseEvent parameter to check if the SFSUser is smartfox.MySelf. If its not you, then spawn (if its not already spawned) or update the variables- something like this-

 ArrayList changedVars = (ArrayList)evt.Params["changedVars"]; //evt is the BaseEvent Parameter
 SFSUser user = (SFSUser)evt.Params["user"];
 OtherPlayer.transform.position = new Vector3((float)user.GetVariable("x").GetDoubleValue(), (float)user.GetVariable("y").GetDoubleValue(), (float)user.GetVariable("z").GetDoubleValue());

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DeveshPandey · Jan 01, 2014 at 06:07 AM 0
Share

Same question, Is this way stable when thousands of player get online and playing game at a time?

avatar image adnirjhar · Jan 01, 2014 at 08:31 AM 0
Share

I am not sure but I think that depends on the pc where the SmartFox is installed.I didnt try for like thousands of players. But works fine with 100-150 game instances, using my pc as the server.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to sync child objects of a transform in multiplayer 3 Answers

[UNET] Unable to run [Command]s on remote client 1 Answer

Multiplayer syncronisation 1 Answer

How do you sync animations in Photon (free version)?,How do you sync animations in Photon(free version)? 0 Answers

Unet Sync Particle System 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges