SlimNet Public Access

Discussion in 'Multiplayer Networking' started by fholm, Apr 14, 2012.

  1. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    SlimNet Public Access

    As stated in the old "SlimNet 0.2" thread, I have now opened up the source code of SlimNet to the public. I want to make clear that the project is not open source and under a very restrictive license which prohibits any commercial use or distribution of the source code or it's compiled binaries.

    All development will now be done in the public repository which can now be found on github (link in the bottom of this post).

    The code has been made available for the people that want to look at and evaluate SlimNet as a potential networking middle-ware. I do not offer support on the code base at all currently, of course if you have a question or two you can ask it in this thread and I will do my best to answer it.

    The code compiles and runs on both Windows, Linux and OS X. For compilation under mono on a non-windows platform you will need to have mono 2.10.x installed and set up all the references and dependencies manually. Mono 2.10 is also required to run the server outside of Unity. Once compiled the resulting two assemblies will run inside of Unitys own version of Mono.

    License

    Code (csharp):
    1. /*
    2. SlimNet - Networking Middleware For Games
    3. Copyright (C) 2011-2012 Fredrik Holmström
    4.  
    5. This notice may not be removed or altered.
    6.  
    7. This software is provided 'as-is', without any expressed or implied
    8. warranty. In no event will the authors be held liable for any damages
    9. arising from the use of this software.
    10.  
    11. Attribution
    12. The origin of this software must not be misrepresented; you must not
    13. claim that you wrote the original software. For any works using this
    14. software, reasonable acknowledgment is required.
    15.  
    16. Noncommercial
    17. You may not use this software for commercial purposes.
    18.  
    19. Distribution
    20. You are not allowed to distribute or make publicly available the software
    21. itself or its source code in original or modified form.
    22. */
    Setup Instructions

    http://dl.dropbox.com/u/19877504/SetupInstructions.pdf (Requires version 0.2.1.5+)

    Repository Links

    Stable: http://github.com/fholm/SlimNet/tree/0.2.1.5 - This is the latest stable version of SlimNet

    Development: http://github.com/fholm/SlimNet - This is the absolutely latest version of SlimNet under development, the code here is not guaranteed to be stable or even work
    Last edited: May 5, 2012
  2. ant001

    ant001

    Member

    Joined:
    Dec 15, 2010
    Messages:
    114
    awesome! getting now
  3. ant001

    ant001

    Member

    Joined:
    Dec 15, 2010
    Messages:
    114
    namespace slimnet cannot be found in the demo project.
    what would be the best way to setup a project using slimnet? project using the unity.server (i'm on mac).
  4. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    You need to compile the SlimNet.Core and SlimNet.Unity projects and drop the DLLs in the project folder in the demo.
  5. ant001

    ant001

    Member

    Joined:
    Dec 15, 2010
    Messages:
    114
    awesome; connection established!
    [​IMG]
  6. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
  7. Corvidae

    Corvidae

    New Member

    Joined:
    Nov 21, 2010
    Messages:
    1
    Do you have any estimates / information on eventual pricing on this? I'd love to use it, but without any ability to distribute and/or pricing details, I can't really plan on building projects around it at this point.
  8. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    Honestly, I can't say right now. I've been discussing many different options both here on the forums and on IRC, but I have not made a final decision as of now.
  9. Nostre

    Nostre

    Member

    Joined:
    Mar 3, 2012
    Messages:
    31
    Well yeah it’s not evident asking how much money for making networks games communications.

    Charge for a base, I don’t know perhaps $30 $40 $50 or $100.
    After that you continue to update your software and optimize communication making a good and fast reliable server with SQL and MYSQL and so on and you charge another $30 $40 $50 or $100, every 250 thousand user you client got or much more and I think everyone will be happy.

    That only a way you can do it.
  10. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    Been working on integrating this into my game, took a little to figure out how to resolve all the dependencies but I have it working. Any chance you could release the server side collision detection you demoed on youtube so we could see how it works?
  11. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    The CD stuff is already in the current code branch on github, it's under the spatial partitioning stuff. You can look in Behaviours/InterestManager.cs to see a simple example
  12. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    That's what I needed, simple enough. Thanks.
  13. quincunx

    quincunx

    New Member

    Joined:
    Apr 22, 2012
    Messages:
    15
    I downloaded the latest version (0.2.1.0) and have MonoDevelop and SharpDevelop.

    I don't see a main.cs or anything though. How should I go about compiling the projects?
  14. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    You open the main solution (SlimNet/SlimNet.sln) and compile the code, then copy the generated assemblies into the unity project.
  15. quincunx

    quincunx

    New Member

    Joined:
    Apr 22, 2012
    Messages:
    15
    Thanks for the quick reply. However, I do not see the solution committed in the repository.

    Also, the stable link is now a 404. Maybe that is where my solution was hiding :p
  16. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    I have no idea what happened, checked in a new latest stable tag now (0.2.1.1) - also updated the link in my post, it should contain everything you need.
    Last edited: Apr 22, 2012
  17. lucked

    lucked

    Member

    Joined:
    Jul 11, 2010
    Messages:
    109
    i´m geting errors for compile the server :S i need more something ? i only use visual studio need download more something?
  18. pislar

    pislar

    Member

    Joined:
    Sep 3, 2009
    Messages:
    213
    There is a dependency missing from the Visual Studio Project the commandline.dll file cant find it in the folder and there are a duzin commandline.dll on web
  19. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
  20. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    I keep having a problem that I cant figure out, this has happen twice and I cant seem to figure out whats causing. Basically the player spawns and if in unity I click display collier, the collier is halfway across from the map and not around the actor. So inherently the interest management is failing.
  21. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    Could you screenshot this for me?
  22. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    I updated the stable version again to 0.2.1.4, split up the configurations properly so now the Debug and Release builds should work out of the box (assuming you have referenced the UnityEngine.dll correctly in the SlimNet.Unity project). All the development stuff that is used by me only has been moved to it's own configuration called "Dev".

    https://github.com/fholm/SlimNet/tree/0.2.1.4
  23. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    I get off work in about two hours Ill send you a screen shot, anything else you need? I don't have much in the project I can send the whole thing over if needed.

    Thanks for looking into it.
  24. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    Also the collider and actor are so far apart, it is unlikely the will fit in the same screen.
  25. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    I think I figured this out yesterday, had to do with the shared folder in the project being different then the shared folder in the server project, and the fact that the client has a ActorDefinitionExporter. So it was exporting an collier client side but the server didn't have the same .gen file, I assume it was using one from the old viking model with a collider offset that is WAY off of what I needed.

    So my question is, in the previous demo i believe you had the shared imported as a .dll. But in the new version you just have a folder called "Shared" in the client with all the shared events and definitions. What is the easiest way to keep these in sync? Just create a VS project with the "Shared" folder in the client so they use the exact same folder?
  26. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    Not sure what you mean, the server and the client should compile the same Shared folder. When you generate your visual studio project from unity SlimNet should modify the .sln file and generate a specific SlimNet-Server project for you which is injected into the Unity visual studio solution. You should then be able to edit the Shared folder in either the Unity or the SlimNet-Server C# project inside the main Unity solution.

    This has only been tested on Windows, when using OSX you need to keep everything in sync manually.
  27. jake-gr

    jake-gr

    Member

    Joined:
    Oct 27, 2011
    Messages:
    92
    Having issues when trying to get the RPG demo project to run.
    Ive built the libs, and imported SlimNet.dll and SlimNet.Unity.dll into the Unity project.
    Changed the Host in the "Menu" scene to my local IP address.
    Set SlimNet to Standalone and Auto-Start...
    When the project runs, I get this error "DirectoryNotFoundException: Directory 'Server\Assemblies' not found."
    Is there a step or other config that I am missing?
  28. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    I have a question how do i create the sql table for the login ... is it created automatically or...? Thank you!
    Last edited: May 1, 2012
  29. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    Did any of you guys got the database to work ? i've tried all day and nothing. Please help i really would like to try it.
  30. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    No its not automatically created, you will have to create it your self, the queries are in the code so you can see the fields and tables required.

    And if your just wanting to try out Slimnet, you don't need the log-in database.
    Last edited: May 1, 2012
  31. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    Thank you. Well i want to try the login part aswell. Any other settings that i have to make besides the basic Slimnet configuration to run with the sql database ?
  32. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    Well the database code is conditional so you will need to add, #define USE_MYSQL, and add a service reference to the project for the MySql connector.
  33. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    hmm seems to be something wrong. I keep getting this error :
  34. alext

    alext

    New Member

    Joined:
    Apr 26, 2012
    Messages:
    4
    Downloaded this last night,
    Jake-GR - sounds like you didn't specify that directory, I managed to get past that error, but I get another error saying that MySharedGame.dll is not found or such, just wondering if it would be possible to have some quick instructions on settings this up, ie. step 1 compile visual studio solution - slimnet core, step 2 - impot unity dlls, etc. Seems like most of errors above is because people forgot to import required dlls or didn't specify directory for them.

    Also is this going to be an authoritative physics server as well, as its a must have feature imho.

    keep up the good work!
  35. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    Installation instructions:
    1. Open up the main slimnet project ( sln file ) and build it.
    2. Copy SlimNet.dll, SlimNet.Unity.dll to the Demo/RPG/Assets folder
    3.Open up the project in unity, double click one of the .cs files so the sln file for the assemblies will be generated
    4.Go to Visual Studio, open RPG.sln file, resolve all dependencies as you have to set the slimnet.dll i think or maybe both the DLL's specified at step 2.
    5.Build the assemblies ( the build directory is : Demo/RPG/Temp/bin/Debug
    6.Copy the assemblies in : Demo/RPG/Server/Assemblies ( if Assemblies folder doesn't exist create it ).
    7.Go to Unity and in the top menu go to Slimnet under configuration and set a name for your project so the config files will be generated.

    Hope i did not do this the wrong way. If i did something wrong feel free to correct me :)
  36. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    artax: Thanks. I will try to put together a proper installation guide tonight and post it here. It will most likely be for Windows only. If you're on OSX you're on your own.
  37. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    Would it be a bother if i could ask you why am i getting that error i posted in the previous post? i can't get the login to work i have made the database but i still get that error ... did i do something wrong?
  38. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    Probably because the code for the database has been commented out for me for a long time as I ended up not using it, and I have not updated it to the latest API/etc. Surprised it even compiles with that code active.
  39. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    Thanks i figured it out and now it works perfectly :) Keep up the good work, this is an excellent project!
  40. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    Im getting a crash on Context.cs line 190, its a for each loop that updates the actors, its crashing because actors are being spawned while the foreach loop is going on. So an exception is being thrown saying that the collection has been modified.
  41. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    Are you 100% sure it's on line 190? and not the for each above it at 184? I inspected the code that gets executed inside actor.UpdateCollider and I could see no code path that could touch the actors dictionary in the Context.

    However if you're spawning actors inside actor.InternalSimulate I could see how this could be a problem. The quick fix for this is to replace the for each loops at line 184 and line 190 with this:

    Code (csharp):
    1.  
    2.                 // Store current actors in local array so
    3.                 // we can protect ourselves against modifications
    4.                 // of the actors dictionary
    5.                 Actor[] currentActors = actors.Values.ToArray();
    6.  
    7.                 // Call fixed update on all actors
    8.                 foreach (Actor actor in currentActors)
    9.                 {
    10.                     actor.InternalSimulate();
    11.                 }
    12.  
    13.                 // Update actor colliders
    14.                 foreach (Actor actor in currentActors)
    15.                 {
    16.                     actor.UpdateCollider();
    17.                 }
    18.  
    and also line 221 in the same method with this:

    Code (csharp):
    1.  
    2.                     foreach (Actor actor in currentActors)
    3.                     {
    4.                         actor.QueueStateStream();
    5.                     }
    6.  
  42. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    It's also fixed in the latest two commits to the master branch on github, so you can pull from here if you prefer that instead of patching the code yourself: https://github.com/fholm/SlimNet
    Last edited: May 4, 2012
  43. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    Last edited: May 5, 2012
  44. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    Good news, and thanks your fix stopped the crashes I was having.
  45. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    Pushed a new version with a fix to the Transform.Translate method to github.
  46. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    I have a quick question. Why does it say in the console when i connect to it : Not running in realtime: # ...? What does this mean? please help. Thank you!
  47. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    Seems to happen when there is a delay in processing messages. IE loading levels, not having unity focused, etc.
  48. artax

    artax

    New Member

    Joined:
    Apr 30, 2012
    Messages:
    15
    And does anyone know how to repair this problem? Where should i start?
  49. orrTechnologies

    orrTechnologies

    New Member

    Joined:
    Mar 2, 2012
    Messages:
    22
    I dont think its really a problem unless its continuously going on. There is going to be some inherent lag client side when changing levels or any other long running operation that is delaying the message queue. What are you doing when this message is showing up?
    Last edited: May 12, 2012
  50. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,689
    The "not running in real time" message is not a problem, it's just a status message that tells you that your simulation is lagging behind, if this happens only once in a blue moon or when you load a level, etc. it's all fine. If you get this message constantly, then you have a problem.