Search Unity

SmartFoxServer Multiplayer Games Engine

Discussion in 'Multiplayer' started by g_a_p, Oct 12, 2018.

  1. Desert-Tiger-Games

    Desert-Tiger-Games

    Joined:
    Sep 20, 2015
    Posts:
    15
    Thanks for the answer.
     
  2. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    We have just released SmartFoxServer 2X 2.17.0, codenamed “Flash Farewell” as we have cut the remaining ties with the old Flash-based Administration Tool.

    It seems that many users forgot about the termination of Adobe Flash on Jan. 12th 2021 and have found themselves unable to reach their servers with the legacy Admin Tool. This release is particularly targeted at those users, as it packs all the recent updates in one installer.

    Read more about installation and migration to SFS2X 2.17.0 in our support forum post.

    Download and release notes.
     
  3. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    40
  4. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
  5. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    That demo wasn't created by us, so no, we don't have it, sorry. Anyway, from a SFS2X point of view, it uses the same logic described in the example linked above.
     
  6. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    40
    Good day

    1)

    The PhotonServer does not allow you to unite a large number of players in one room for example 500+
    SmartFoxServer 2X will give me the ability to combine 500+ in one room?
    My game is made in Unity 3D, WebGL
    I am currently using ObjectMovement from example

    2)
    How to sync character animation ?
    I did not find this in any of the examples, only movement.
     
    Last edited: Mar 2, 2021
  7. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    Hello,
    Yes, SFS2X provides MMORooms which are a special type of Room that can handle thousands of players via an AoI (Area of Interest) mechanism. Players in these Room will not listen for every other player's updates, but only for those whose current position falls within the AoI.

    More details here:
    http://docs2x.smartfoxserver.com/AdvancedTopics/mmo-rooms

    There isn't a pre-baked mechanism for syncing animations. Typically what you need to do is adding the animation id/data to the movement data you're sending from client to server and vice-versa.

    The MMODemo and SpaceWar game examples demonstrate two real-life use-cases for the MMORoom:
    http://docs2x.smartfoxserver.com/ExamplesUnity/mmo-demo
    http://docs2x.smartfoxserver.com/ExamplesUnity/spacewar

    The relative code can be downloaded from our website or through the relative example pack in the asset store.
    ( https://assetstore.unity.com/packages/tools/network/smartfoxserver2x-multiplayer-sdk-17261 )

    Cheers
     
  8. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    40
    Good day
    A lot of mistakes FirstPersonShooter

    Unity 2018.2.2f1 (64-bit)
    1) Unloading broken assembly Assets/Plugins/UWP/SmartFox2X_UWP.dll, this assembly can cause crashes in the runtime
    2) Assets/Game/Scripts/NetworkManager.cs(26,10): error CS0433: The imported type `Sfs2X.SmartFox' is defined multiple times
    3) Assets/Game/Scripts/NetworkManager.cs(134,32): error CS0433: The imported type `Sfs2X.Core.BaseEvent' is defined multiple times
    4) Assets/Game/Scripts/NetworkManager.cs(194,39): error CS0433: The imported type `Sfs2X.Entities.Data.ISFSObject' is defined multiple times
    5) Assets/Lobby/Scripts/LobbyController.cs(151,32): error CS0433: The imported type `Sfs2X.Entities.User' is defined multiple times

    Unity 2019.4.20f1 (64-bit)



    This is generally treated ?
     
    Last edited: Apr 6, 2021
  9. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    Hello. You need to assign each DLL to the related build target. Please check the "Unity" paragraph on this page: http://docs2x.smartfoxserver.com/GettingStarted/client-api-csharp
     
  10. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    40
    These errors occur on the newly downloaded FirstPersonShooter
    Try to run your own FirstPersonShooter and get a bunch of errors
    your FirstPersonShooter doesn't work for Unity 2019.4.20f1 (64-bit) and higher ?

     
    Last edited: Apr 7, 2021
  11. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    The example works fine in Unity 2019.4.20f1 and higher. You just need to delete the Assets/Plugins/UWP folder if not needed.

    Otherwise you have to assign each DLL (Assets/Plugins/SmartFox2X.dll and Assets/Plugins/UWP/SmartFox2X_UWP.dll) to the appropriate platform in the Inspector panel as in the picture you shared above.

    For example assign the selected SmartFox2X DLL to Editor and Standalone only, then select the SmartFox2X_UWP DLL in the UWP folder and check WSAPlayer only.

    The reason why you need to to the above is that Unity doesn't keep the DLL-platform association when we export the project to create the examples package you got from our website.
     
  12. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    40
    Good day.

    I don't understand how to sync animation over the network (UNITY WEBGL).

    You do not have a single line of code in the Sfs2X documentation for animation, I also did not find information on Google or YouTube, I am very amazed that I did not find anything, it is very strange that no one provides a description of how animation works for UNITY + Sfs2X.

    The FirstPersonShooter examples use an outdated animation system, and it does not suit me, SpaceWar is also incomprehensible to me.
    I made changes to the PlayerController script by adding an animator with one "walk" animation.
    This works for me, but doesn't work for others (they don't see my walking animation).

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerController : MonoBehaviour
    5. {
    6.     public float forwardSpeed = 10;
    7.     public float rotationSpeed = 40;
    8.     static Animator anim;
    9.  
    10.     // Dirty flag for checking if movement was made or not
    11.     public bool MovementDirty {get; set;}
    12.  
    13.     void Start()
    14.     {
    15.         anim = GetComponent<Animator>();
    16.         MovementDirty = false;
    17.     }
    18.  
    19.     void Update ()
    20.     {
    21.         // Forward/backward makes player model move
    22.         float translation = Input.GetAxis("Vertical");
    23.         if (translation != 0)
    24.         {
    25.             this.transform.Translate(0, 0, translation * Time.deltaTime * forwardSpeed);
    26.             anim.SetBool("walk_front", true);
    27.             MovementDirty = true;
    28.         }
    29.         else
    30.         {
    31.             anim.SetBool("walk_front", false);
    32.         }
    33.  
    34.         // Left/right makes player model rotate around own axis
    35.         float rotation = Input.GetAxis("Horizontal");
    36.         if (rotation != 0)
    37.         {
    38.             this.transform.Rotate(Vector3.up, rotation * Time.deltaTime * rotationSpeed);
    39.             MovementDirty = true;
    40.         }
    41.     }
    42. }
    Please write how can I make the animation synchronized over the network for all users.

    1) Without using the .jar server extension (so I can quickly test the application)
    2) Using the .jar server extension (so that I can write something better and correct in the future)

    Also, this information will be very useful to anyone using UNITY + Sfs2X.

    Please write an example in the form of C # scripts for a more accurate and quick understanding of animation synchronization over the network.

    Thank you.
     
    Last edited: Apr 13, 2021
  13. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    First of all it is important to understand that in most cases the animation is just a state of an object, just like its color or its shape (see our Object Movement example). This means that the animation system you use on the client is not related to the networking system (in our case SmartFoxServer). You have to learn how to transfer, for example, the state "walking" to other clients, and when the movement stops, transfer the state "standing" in the same way.

    The most common way to do this in SFS is using User Variables: specifically, when you click the button to make your character move, you have to set a variable (lets say it is called "anim") to a given identifier ("walk", "run", "stand", "crouch" - can be a string, a number, or even a more complex object).

    In the Spacewar example, a User Variable is used to show or hide the engine flame when the up-arrow key is pressed or released. As mentioned before, in the Object Movement example two User Variables are used to set the color and shape to show.

    The FPS example uses a slightly different approach: instead of using a User Variable which is automatically synchronized among clients, the animation state is transferred to the server through an Extension request, and the server-side logic is in charge of sending this back to the other clients (see AnimationSynchronizer.SetAnimationState() which in turn calls Networkmanager.SendAnimationState()).

    Our suggestion is to go through all the tutorials to learn step by step the techniques we discuss. Jumping directly to the more complex examples is very difficult unless you already have a good understanding of networking in games.
     
  14. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    We just released v1.7.14 of the SFS2X C# client API for Unity / .Net / Mono / Universal Windows Platform.

    This new version fixes an issue with Unity's Nintendo Switch build target. Due to the System.Net.Http namespace not being supported by Switch, the connection encryption initialization failed (SmartFox.InitCrypto). We introduced a new API specific to all Unity builds (except WebGL, which still requires its own DLL) which overcomes this issue.

    You can download the API at this url: https://www.smartfoxserver.com/download/sfs2x#p=client
     
  15. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    Overcast dashboard update
    We have recently rolled out a new Overcast update introducing domain name management so that custom domains can be associated with SmartFoxServer instances launched in Overcast.
    You can find all the details about domain name management in our updated documentation.

    What's next in Overcast
    With this new update we have also laid the groundwork for what is coming next, namely SmartFoxServer Clustering. We have now finalized the architecture of the system and most of its API and we are entering the testing phase.
    In the next months and after the summer vacations we'll be working on new AdminTool modules, further integration with the Overcast HQ and documentation. If all goes smoothly we will be ready for an open beta by the end of 2021.
     
  16. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
  17. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
  18. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
    A new article in the Overcast series is available on our blog: how to use a database server alongside SmartFoxServer.

    In this first part of the article we focus on launching the database, populating it with some test data and configuring SmartFoxServer to connect to it. In the upcoming part two and three we will deploy an Extension in SmartFoxServer to test the connection with a query.

    https://smartfoxserver.com/blog/using-a-database-in-overcast-part-1/
     
    Last edited: Jul 28, 2021 at 9:12 AM
  19. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
  20. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    244
unityunity