Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[NO CCU LIMIT] Forge Networking now OPEN SOURCE

Discussion in 'Assets and Asset Store' started by Brent_Farris, Dec 22, 2014.

  1. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Haha, awesome! Glad you got it figured out. Let us know if you need any further help or need access to the chat channel or anything else :)
     
  2. AlexJBoyd

    AlexJBoyd

    Joined:
    Dec 6, 2012
    Posts:
    8
    Well actually we are having some issues with performance. We are experiencing a lot of lag that was not present when we had the old unity networking solution (4.6) int he project. Not sure if it is Forge overhead or what.
     
  3. Keith90

    Keith90

    Joined:
    Sep 27, 2013
    Posts:
    116
    I didn't notice that my browser was blocking the pop-up. Haha.

    Thanks. :D
     
  4. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    This is the first that we have heard of performance issues. You don't have the network latency simulator turned on do you? Also, if you are having performance issues in the game, it is unlikely to be Forge because the system runs on a completely separate thread. If you don't mind, could you describe what is happening in an email to support@beardedmangames.com? It will be easier for us to follow up directly through that :)
     
  5. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    :0 Yeah... browsers are suppose to allow popups that happen from a button click on the page, but I guess they are getting more strict on that :p
     
  6. Keith90

    Keith90

    Joined:
    Sep 27, 2013
    Posts:
    116
    Will there be a project or a video walkthrough of how to set up a basic online game? That goes from setting up a server, to syncing players, syncing variables, functions, proper online code, etc. It'd be great to follow along to get the basics down. Maybe make a simple platformer walkthrough that incorporates everything?

    This would be awesome for people like me that prefer visual learning and seeing what we're learning being used in action.
     
    chiapet1021 likes this.
  7. Cranick

    Cranick

    Joined:
    Nov 20, 2011
    Posts:
    310
    We definitely want to have more video walkthroughs of best practice and a simple demo of how to set things up on a basic level that is already done on many different videos. Just if we keep adding every new feature to be part of that walkthrough it might take up to an hour or so. So we have broken down most of the elements that can make up a game to each individual video as well as their own example scenes here and there.

    I'll definitely have another video demonstration to do what you asked as that seems like a great idea to at least give a basic walkthrough down for people who are more visual learners as well. :)

    Thanks and feel free to ask any other questions you may have.
     
  8. Keith90

    Keith90

    Joined:
    Sep 27, 2013
    Posts:
    116
    Ah makes sense.

    I've completed the Starting From Scratch video. Where do you recommend I go next to getting online working? I'm 100% new to networking so all these terms and everything is foreign to me.

    I managed to find example scenes. I opened up the cube example and looked at the make a player script. It had this:


    Code (CSharp):
    1. if (Networking.PrimarySocket.Connected)
    2.                 Networking.Instantiate(objectToSpawn, NetworkReceivers.AllBuffered, PlayerSpawned);
    3.             else
    4.             {
    5.                 Networking.PrimarySocket.connected += delegate()
    6.                 {
    7.                     Networking.Instantiate(objectToSpawn, NetworkReceivers.AllBuffered, PlayerSpawned);
    8.                 };
    9.             }
    A) How do I know what it does? I assume it means that if it's properly connected then make the player and if it isn't then something else?

    B) I see this and I have an idea of what it's suppose to do, but I'm a person that likes to ask why a lot. So when I first seen this, I wondered why it had to be done like this. When someone goes over things and explains what they are and why, I pick it up a lot faster, as oppose to looking at something and just assuming/figuring that it's the correct way but without the why. Makes sense?
     
  9. Cranick

    Cranick

    Joined:
    Nov 20, 2011
    Posts:
    310
    I recommend going through all the documentation/tutorial videos to just get a feel for the system and what you can do. There is a bit to cover and what you specifically need for you game can be found in some of those videos as well.

    A/B) Thanks for asking, basically we are telling the client/host/user who is holding that object to instantiate it on the Network for everyone else that joins (AllBuffered) when it itself is connected to the socket/host. So if it isn't connected to a host just yet, it waits until the socket connection is complete and then proceeds to call the following code in the delegate() as you see above. If it is connected it just runs the code immediately and creates it for everyone.

    Hopefully that makes sense and helps other people who are new too. :p

    Ps: Also talking to you on Slack so I will continue to do so there haha.
     
  10. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Version 11.62 Released

    Hello again sorry (not sorry) for all of the updates in a row! We have made yet another update as well as 2 new authoritative with client side prediction and floating point input tutorials! :D Enjoy!
    • Fixed issue with multiple scripts on single object with authoritative and non-authoritative
    • Fixed rigidbody issues with mixed NetworkedMonoBehaviors on same object
    • Fixed collider issues on mixed NetworkedMonoBehaviors on the same object
    • Added new floating poin input scripts for authoritative model
    Authoritative Sync Thresholds Tutorial
    Authoritative Working with Floating Point Inputs Tutorial
     
  11. Alexanderansoft

    Alexanderansoft

    Joined:
    Jan 5, 2015
    Posts:
    26
    Hi! I bought Forge Networking. How can I buy Unity Independent Master Server? I don't have Pay Pal:(:(:(
     
    Last edited: Aug 14, 2015
  12. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    Do you guys have any games that's out there using this? I really want to move from uLink to this, but as company direction wise it seems to be a big move, I just wanted to know if it is worth it...
     
  13. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hi there :)

    You can actually use a credit cart through the PayPal portal. So when you click on the Buy button you should have the option to input an alternative payment method other than a paypal account. Please let me know if this is working :)
     
  14. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    We currently have 2 users in green light that are adding Forge Networking to their games and a large number of users currently building their games using it. We have tons of developers who came from Photon, Bolt, UNET, uLink, etc. in our community. If you would like, you can send me a message with your email and I can add you to the slack channel for a day or two so you can talk to the community using the system to hear their thoughts :). You can also send us an email to support@beardedmangames.com if you would rather do that then a PM here.
     
  15. Alexanderansoft

    Alexanderansoft

    Joined:
    Jan 5, 2015
    Posts:
    26
    I was banned in the Pay Pal. In my country, problems with Pay Pal. Maybe there are other ways to pay. I have VISA card.
     
    Last edited: Aug 15, 2015
  16. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    I will waiting this when the author sale this asset, because i do not money to bought this now :(. I really love this and want to try one time.
     
  17. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    1.I am starting to mess around with Forge network and hopefully by the end of the mess around period, I can switch from uLink to Forge, Currently I am at the step where just looking at the Connection between a sever and a client, where server only establish a connection and listening to whatever client is connecting, I find that everything does what it says(event wise OnPlayerDisconnect(NetworkingPlayer player) is called is fine, but when I run server actually says parameter is NetworkPlayer, although nothing really happens), is this a bug?

    2. However I find that what if somebody emulate the connection to the network, how can I verify if this connection is a bot or actual player, there must be some kind of way to estalish that.
    So basically I am saying about encrypted login, encrypted in-game network traffic(i am sure you guys already did that) and finally secure server identification by using a public key in the client.


    3. I also like to know if there is an Authorative toggle, which when toggles, it sorta prevent developers coding something that is non-Authorative, or it won't execute:
    This enables some important restrictions on the server:
    • Clients are prevented from sending RPCs to other clients (no RPCs will be relayed via the server). All RPCs sent from clients must have the server as their destination.

    • The server does not accept state-sync from clients. When a client wants to tell the server that one game object has moved, for example the player's avatar, it has to send an RPC and ask for permission to move it.

    • Clients can not call uLink.Network.Instantiate(). Only the server is allowed to create new objects that should be instantiated on all connected computers.
     
    Last edited: Aug 15, 2015
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Is there a way to integrate a separate pooling plugin (such as comes with Core GameKit) with Forge? Bolt had that...

    We are pretty sure we won't get a smooth frame rate doing a lot of Network Instantiate and Destroy calls.

    Photon says we'd have to modify the source code to do so (seems suspect for such a mature product).

    Thanks!
     
  19. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hmmm, we currently do not have an alternative solution to this. We will work on providing one in the near future.
     
  20. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Thanks for the request! :D We will definitely consider going on sale sometime in the future. I can not give a date and I know it takes quite a bit of time for Unity to accept sales sometimes. So hopefully we will be able to :D until then we are currently the most affordable networking solution compared to any others who sell on the Asset Store :)
     
  21. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Awesome! Hopefully you are having a lot of fun in the process! :D

    I am not exactly sure what is going on here, it would be (nearly) impossible through the C# compilation process to send a "NetworkPlayer" object as a valid data type through this parameter. We will probably need more information on this matter but we will try to reproduce.

    You can create a custom login process or validation process as you see fit if you wish. Often bots are not able to be stopped in any case because it will use completely valid information for the login of a user. The real trick to stopping bots is to do pattern analysis and cheat prevention on your base code, this is not a networking related task. Even if we enforced a type of authentication on the network level, it would be a trivial task for the client to use their current valid client or to recompile and send an authenticated request.

    You are looking for the "Server Is Authority" checkbox on the NetworkedMonoBehavior :).

    If you are a part of the slack channel we will be able to help you in a much more streamline way (though us and the community). Please let us know if you have any further questions! :D
     
  22. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hello there @jerotas !

    So, being that the networking system resides on Unity (outside of bare metal) you can use any plugins that work with Unity with Forge :D.

    The long and short of it is that Photon is not a Unity specific networking solution. It is a generalistic networking solution that brands Unity a lot. From my limited knowledge in Photon I gather that the actual server is not a unity instance so it is unable to run any Unity Asset Store addons (server side). I could be wrong on this so don't quote me.

    Essentially since we run in a Unity instance, that means that any addons you choose to use from the store gets compiled in with the server, which means that you can serialize any data about that system across the network easily and it can be replicated on both clients and server :D
     
  23. Alexanderansoft

    Alexanderansoft

    Joined:
    Jan 5, 2015
    Posts:
    26
    New video on youtube in quality 360p. Please make video in HD quality.
     
  24. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    282
    Hey, how about host migration in forge ?
     
  25. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    This is a known issue on Firefox with the HTML5 player. You will need to either enable the Flash player or watch the video in a different browser. We uploaded the videos in MP4 format and I believe that is the issue, we will be uploading in a different format from now on
     
  26. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    We support multiple connections in one instance of the game so yes, you have the ability to do host migration since all of the servers can communicate with each other on a separate connection :)
     
  27. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    94
    Can you give a bit more clarity on this topic? This is pretty important to be in and so far the only people who openly easily support it is Photon due to all the data being driven through their servers.

    Do we need to have the games hosted in the cloud or is this possible somehow through LAN/WAN play through a master server somehow that stores necessary data to do the migration handoff? I'm unsure if we have to properly design all data to be always on every client or if there is something you guys do in your tool that doesn't require very custom logic per game.
     
    Last edited: Aug 16, 2015
  28. Alexanderansoft

    Alexanderansoft

    Joined:
    Jan 5, 2015
    Posts:
    26
    On Chrom everything is working! Thank you very much!:):):)
     
    Last edited: Aug 16, 2015
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'm not sure if you really answered my question. I assume that Forge uses things like Network Instantiate and Network Destroy to create and destroy objects by default. My question is: how difficult is it (or is it even possible) to modify the Forge code so it will isntead use already-instantiated (pooled) objects like Core GameKit / PoolManager does. So that we don't destroy or instantiate objects at all, since the overhead is quite large sometimes. This is HUGE concern for performance, probably the #1 concern of all in that respect.
     
  30. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    I am very sorry that I misinterpreted your question. :(

    Yes, so we use network instantiate and network destroy to create and remove objects. However if all of the objects already are in the scene then (networked or not) they will work as normal. You can use RPC calls to enable and disable objects (or other game logic) to enable and disable these objects. I am not familiar with the object pool manager system you use, however if the objects are already in the scene, it will work as normal. If they get instantiated in, then you will instantiate them across the network accordingly (can easily be done with an RPC). Object pools will not use the destroy method so there is no reason for it to conform to the network destroy method. You can simply use an RPC that turns the object on or off, or uses the default pool method to manage the object :). The actual work on the network level should be extremely minimal due to my previous answer.
     
    jerotas likes this.
  31. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    :D Awesome, no problem. I think maybe if we upload in a format other than .mp4 we may be able to avoid this strange Firefox bug
     
  32. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Basically the concept is that since you can open up multiple connections on one instance you are able to have alternative servers up and running and then use a connection between the current server and the next server to migrate the users. It can get a bit complex because Photon is not actually a unity instance, so since they don't support every plugin from the asset store on the server as well as Unity Physics and so forth (which we completely support both) then they don't have to worry about how to transfer all of that data from one server to the other. We will be developing our own algorithms to do this in a simple way, however if you are wanting the ability to jump players from one room to another without all of the various Unity complexities, then it is as simple as making a connection between the two servers and transferring the players from one to another with a forwarding command.

    This goes into my previous statements (which could have been in reply to this quote instead of the other). Yes, if you have simplified logic where current trajectories and so forth are not going to be transferred in real time it would be a matter of one server connecting to the other one, getting its information then forwarding it to the clients and having the clients then connect to the new server :).
     
  33. hMark

    hMark

    Joined:
    Oct 16, 2013
    Posts:
    16
    Hello again,

    we ran into another issue with Forge. When e.g. 10 players are trying to instantiate their player objects on game startup then they are successfully created on server but only some of them are created/synced on clients. We partially fixed the issue with sequential instantianting on clients which is controlled authoritatively from server with 2 seconds delay but the issue still happens randomly.

    It looks like the Forge has problem with instantianting many objects in one time.

    Could you point us to right direction?

    Thanks for your response.
     
  34. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hi there! :D

    I'm sorry to hear about this issue, we would be more than happy to fix any bug that may be related to this. There have been quite a few changes as of late; are you using the latest version 11.65? We will try to reproduce the issue on our end, however it may go faster if you can provide a sample for us via email.

    We have not seen this issue on our end or have heard of it from our other developers. If you can create a controlled sample that features this bug to support@beardedmangames.com we will be much faster at finding the root of this. :) This test has been queued up for testing and we will look for your emailed response if you are able to :)
     
  35. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    228
    Hello again! I am still having the master server issue and have not yet figured out what I am doing wrong. Might you know what could cause the master server registration to fail upon re-registration? As in when I connect to the master server, it is fine, but if I close the server, and try to re-register, nothing happens. I have tried waiting a minute - 10 minutes. The only way it works again is to close the master server exe and relaunch it. Using 11.6 and Master server executable included in release 4. Both clean projects and untouched.

    I've also had some spotty issues in general with the master server. Sometimes it registers, sometimes it doesn't. This was also the case on previous versions of 11.x cycle.

    Unity 5.1.2. Windows 8.1.

    Here is a video to illustrate the issue.

    http://screencast.com/t/Kqhe9hraw
     
  36. Cranick

    Cranick

    Joined:
    Nov 20, 2011
    Posts:
    310
    Definitely seems like an issue. Will take a look at this tonight and get back to you on it, thank you very much for the sample video.
     
  37. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Version 12 Released

    Hello all! Welcome to another edition of here's an update! We have been listening to everybody on our Slack channel that has reported some bugs and so we have now fixed them :D. Also, stop by the website to get Unity Independent Master Server Version 5! :D
    • Fixed disconnect and reconnect bug so that the host/clients can now disconnect and reconnect
    • Updated static variables to reset in SimpleNetworkedMonoBehavior
    • Fixed issue where NetworkingManager.Instance becomes null on disconnect
    • Fixed issue where player (isPlayer object) was not being destroyed on disconnect
    • Fixed desync with instantiates and destroys, tested with 34 players and 30 "zombies"
     
  38. Trung-Hieu

    Trung-Hieu

    Joined:
    Feb 18, 2013
    Posts:
    37
    Hi,

    I am running into a little trouble with Forge. Basically I have set up 2 clean projects on the same machine (one acts as a server while the other's as a client, both only have Forge and UnityVS).

    On the server project, I added this little code and add to a random object in an empty scene:
    Code (CSharp):
    1. using UnityEngine;
    2. using BeardedManStudios.Network;
    3.  
    4. public class NetworkHost : MonoBehaviour {
    5.     private void Start () {
    6.         Networking.Host (11000, Networking.TransportationProtocolType.UDP, 31);
    7.  
    8.         Networking.Sockets[11000].playerConnected += delegate (NetworkingPlayer player) {
    9.             Debug.Log ("Hey! A client just connect to this server\n" + "This player is: " + player.Ip);
    10.         };
    11.         Networking.Sockets[11000].playerDisconnected += delegate (NetworkingPlayer player) {
    12.             Debug.Log ("Urgh! A client has just diconnected!\n" + "This player is " + player.Ip);
    13.         };
    14.     }
    15. }
    16.  
    On the client project, I did the same thing and add this code instead:
    Code (CSharp):
    1. using UnityEngine;
    2. using BeardedManStudios.Network;
    3.  
    4. public class NetworkClient : MonoBehaviour {
    5.     private NetWorker netWorker;
    6.     public void Connect () {
    7.         if (netWorker == null || !netWorker.Connected) {
    8.             netWorker = Networking.Connect ("127.0.0.1", 11000, Networking.TransportationProtocolType.UDP);
    9.             netWorker.connected += delegate {
    10.                 Debug.Log ("Yay I just connect to this server");
    11.             };
    12.             netWorker.disconnected += delegate {
    13.                 Debug.Log ("Urgh disconnected");
    14.             };
    15.         }
    16.     }
    17.     public void Disconnect () {
    18.         if (netWorker != null && netWorker.Connected) {
    19.             Networking.Disconnect (netWorker);
    20.         }
    21.     }
    22. }
    I had 2 UI Buttons on the scene to trigger Connect () and Disconnect () upon click.

    I ran the server project first (on Editor), then ran the client project. I triggered the Connect () method, which both projects sent out Debug message as intended. However, when clicking Disconnect, the client project showed 1 "Urgh disconnected" message while server project showed 2 "Urgh! A client has just diconnected!\nThis player is 127.0.0.1+11001"

    Is there something wrong with the setup?
     
  39. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hello there! :D

    We actually just updated how connections and disconnections work in Version 12 for other reasons. Have you tried your code in this new version? :) We will try out the code ourselves to see if we can replicate the issue as well. Thanks for the report! :D
     
  40. Cranick

    Cranick

    Joined:
    Nov 20, 2011
    Posts:
    310
    Please update to Master Server v5 and use the latest Forge Networking v12 and let me know if these issues still persist.

    Thanks!
     
    Ghosthowl likes this.
  41. Trung-Hieu

    Trung-Hieu

    Joined:
    Feb 18, 2013
    Posts:
    37
    Yes I just re-download the package. The problem is still here.

    The client project setting is actually set to Android though (server project is still standalone). Maybe that is the problem?

    P.s: Just test with 2 Standalone projects instead of 1 Standalone + 1 Android. Same thing happens
     
    Last edited: Aug 18, 2015
  42. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hello! :D

    This problem is now resolved in version 12.01 :) please give it a try and let me know if it resolves the issue. It is 2am here so if it is still happening we may have to take care of it tomorrow :)
     
  43. Litwin

    Litwin

    Joined:
    Aug 15, 2013
    Posts:
    70
    @farrisarts
    Hello,

    Can you compare Forge vs Bolt and Photon? Why should I use Forge rather than the other frameworks?
    Other question, Forge have lobby done like Photon? It saves a lot of time.

    Cheers.
     
  44. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hello there! :D Thanks for this awesome question publicly; we often get it in an email or other forms of private communication haha.

    Forge vs Bolt:
    • Supports iOS
    • Has full source code (Bolt no longer has support)
    • Developers work 7 days a week, Bolt developer is missing or only works 1-2 days
    • Has a large, very active community helping each other learn Forge, helping new developers, making tutorials, adding wiki pages, testing each others code and helping others get their games to green light and everywhere else
    • Community is extremely positive and helpful
    • Has a user base on the chat in 14 timezones so there is always someone on to answer questions
    • Works out of the box on import, no need for extra installation, restart of unity or any other strange things found in Bolt
    • Has support for TCP connections (which are now being re-worked)
    • Developed by a team of developers and not just one person
    • Not owned by Exitgames
    • WinRT code is integrated into source code and is not a plugin
    • Made for both advanced network developers and new never before programmed networking type users - Not ONLY advanced users (Exitgames claims that Bolt is only for advanced users)
    • The list goes on but i should go to comparing Photon
    Forge vs Photon:
    • No CCU limitation
    • Support for Unity instances as servers
    • Support for servers to use any Asset Store addons, (Photon servers are not Unity instances so they can NOT support asset store addons with little to no modification [or at all] like Forge does)
    • Support for Unity Physics
    • Supports server as client
    • Support for Headless Linux builds
    • Faster support
    • Faster updates
    • Built and optimized for Unity and not as some generic networking system
    • Support for addon extensions with full source code
    • Self hosting without limitations
    • Better bandwidth performance
    • Does not suggest 4-8 players max on server, we've successfully tested 64 active (constantly updating) network objects (players) next tests will be 128 then 256 with better machines
    • Direct developer communication through chats and channels other than email
    • No external server software needed
    • Start a server and connect clients out of the box in seconds without installing extra server software, or setting up cloud accounts, or running external software and such
    • The list goes on but I should go onto comparing against both Photon and Bolt
    Forge vs Photon + Bolt:
    • Extremely fanatically active developers
    • Has developers who never touched a line of network code learn networking (a user posted a funny gif about this in chat)
    • Fully open source
    • You can put breakpoints anywhere in the network code and run from unity editor to debug any network code (built into Forge)
    • Extremely extendable and easy to use. We have developers who have given sample projects with Forge integration to the community, created chat code and donated it to the community and so forth
    • When users request features that are not currently a part of Forge but are a part of other systems, those features are created as soon as possible (usually a maximum 2 week turn around minimum 1 day turn around)
    • Addons (such as unity independent master server and bare metal) are all fully open source
    • Gets somewhere between 1-3 updates per week
    • Has no need for external plugins, which makes Forge 100% compatible with Unity and any future developments of Unity.
    We have a lobby out of the box with the Master Server (comes with Forge Networking). I am not familiar with Photon's lobby, BUT if you have any suggestions on how to make ours better we would be more than happy to upgrade our system to suit it! :D

    If you would like I could invite you to our slack channel for a day or so, so that you can ask the Forge community what they think. The majority of all of the developer community have come from Photon, Bolt and UNET. :)

    I like this list, I'll probably be editing it in the future with some more stuff as they come to mind :D
     
    Last edited: Aug 18, 2015
    elias_t, Cranick and Litwin like this.
  45. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I've tried photon before, bolt, UNET, I couldn't get it, I had given up hope on having my game online. Then I found forge and within 1 hour of messing with Forge and this tutorial I got the core mechanics of my game working networked.

    This gif is exactly how this experience felt:


    - Edit -
    Talked a little bit more about my experience working with it on my devlog, with some actual code I used :D
    http://snddev.tumblr.com/post/127022701314/networking-at-the-forge-part-1
     
    Last edited: Aug 19, 2015
  46. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    228
    Thanks! I did a quick test and it is working just fine now. I had another question. I remember you saying you were putting in NAT-Punchthrough into this and or there may be some experimental use of this already in. What is the current status of this? It is the last thing I want / need :)

    Also @farrisarts 'Not owned by Exitgames' ROFL! I nearly spit out my drink when I read this.
     
    Cranick likes this.
  47. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Awesome! :D

    This is still in its experimental state as we haven't tested it with IPv6 or super extensively. We and others have had instances of a successful connection using NAT hole punching. That being said, we are working on it as we get some time progressively, being that it is not industry standard we are making sure to focus on some more of the critical features/bugs.

    You can actually fire it up and give it a test run. You basically need to:
    1) Run the Master Server with an open port
    2) Set the Master Server IP address (as seen on StartGame script)
    3) Check on Use Nat Hole Punching

    Note that the Master Server does not user NAT hole punching as it is acting as the NAT router. :)

    XD Sorry, not sorry
     
  48. Trung-Hieu

    Trung-Hieu

    Joined:
    Feb 18, 2013
    Posts:
    37
    Hi,

    Thanks, the double disconnection problem seems solved.

    However, I ran into some other problems. I just implemented 2 small features: the first one is server would disconnect player if inactive for long, second one is the client would send an object (right now is an int) to server upon UI button click. The source code for both client and server are here:

    Code (CSharp):
    1. using UnityEngine;
    2. using BeardedManStudios.Network;
    3.  
    4. public class NetworkClient : MonoBehaviour {
    5.     private NetWorker client;
    6.     public void Connect () {
    7.         if (client == null || !client.Connected) {
    8.             client = Networking.Connect ("127.0.0.1", 11000, Networking.TransportationProtocolType.UDP);
    9.             client.connected += delegate {
    10.                 Debug.Log ("Yay I just connect to this server");
    11.             };
    12.             client.disconnected += delegate {
    13.                 Debug.Log ("Urgh disconnected");
    14.             };
    15.             client.serverDisconnected += delegate (string reason) {
    16.                 Debug.Log ("Urgh! Server kicked me out because: " + reason);
    17.             };
    18.         }
    19.     }
    20.  
    21.     public void Disconnect () {
    22.         if (client != null && client.Connected) {
    23.             Networking.Disconnect (client);
    24.         }
    25.     }
    26.  
    27.     public void SendInt () {
    28.         if (client != null && client.Connected) {
    29.             string id = "SendInt";
    30.  
    31.             // Bind the id so that it wont crash
    32.             client.AddCustomDataReadEvent (id, delegate (NetworkingPlayer player, NetworkingStream s) { });
    33.  
    34.             int randomInt = (int) Random.Range (0, 10);
    35.             BMSByte stream = new BMSByte ();
    36.             ObjectMapper.MapBytes (stream, randomInt);
    37.        
    38.             Networking.WriteCustom (id, client, stream, true);
    39.  
    40.             Debug.Log ("Just send: " + randomInt);
    41.         }
    42.     }
    43. }
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using BeardedManStudios.Network;
    5. using System;
    6.  
    7. public class NetworkServer : MonoBehaviour {
    8.  
    9.     private NetWorker host;
    10.     private Dictionary<NetworkingPlayer, Coroutine> playerTimeouts = new Dictionary<NetworkingPlayer, Coroutine> ();
    11.  
    12.     private void Start () {
    13.  
    14.         // Start a host with an well-known port
    15.         host = Networking.Host (11000, Networking.TransportationProtocolType.UDP, 31);
    16.  
    17.         // Bind events
    18.         host.playerConnected += OnPlayerConnect;
    19.         host.playerDisconnected += OnPlayerDisconnect;
    20.     }
    21.  
    22.     private void OnPlayerConnect (NetworkingPlayer player) {
    23.         host.AddCustomDataReadEvent ("SendInt", OnIntArrive);
    24.  
    25.         // Set time out for the player
    26.         TimeoutPlayer (player);
    27.    
    28.         // Reports
    29.         Debug.Log ("Player " + player.Ip + " has just joined the game. Total players: " + host.Connections);
    30.     }
    31.  
    32.     private void OnPlayerDisconnect (NetworkingPlayer player) {
    33.         Debug.Log ("Player " + player.Ip + " has just left. Total players: " + host.Connections);
    34.     }
    35.  
    36.     private void OnIntArrive (NetworkingPlayer player, NetworkingStream data) {
    37.         int randomInt = ObjectMapper.Map<int> (data);
    38.         Debug.Log ("Player " + player.Ip + " just send " + randomInt);
    39.  
    40.         // Reset time out for the player
    41.         TimeoutPlayer (player);
    42.     }
    43.  
    44.     private void TimeoutPlayer (NetworkingPlayer player, float duration = 5F) {
    45.         // Stop any ongoing timeout coroutine
    46.         Coroutine currentTimeout;
    47.         if (playerTimeouts.TryGetValue (player, out currentTimeout)) {
    48.             StopCoroutine (currentTimeout);
    49.             playerTimeouts.Remove (player);
    50.         }
    51.  
    52.         if (duration > 0) {
    53.             // Start coroutine to count down timer
    54.             currentTimeout = StartCoroutine (StartCoutingTimeout (player, duration));
    55.             playerTimeouts.Add (player, currentTimeout);
    56.  
    57.         } else {
    58.             // Immediately disconnect player
    59.             Networking.Disconnect (host, player);
    60.         }
    61.     }
    62.  
    63.     private IEnumerator StartCoutingTimeout (NetworkingPlayer player, float duration) {
    64.         yield return new WaitForSeconds (duration);
    65.         TimeoutPlayer (player, -1F);
    66.     }
    67. }
    68.  
    Same as previous problem, I actually have 2 different projects open at the same time, on a same machine. Both projects start clean with Forge 12.01 and UnityVS. The server project has the NetworkServer script attached to a random game object whereas the client project has the NetworkClient script wired with a bunch of UI.Button to trigger its public methods. Both scripts communicate with each other within the same machine.

    First problem I encounter is that: server upon timeout the client (for inactive for too long) would call Networking.Disconnect (). However, no serverDisconnected event fired on the client ? serverDisconnected event is fired when the server is forcefully close though (I click the Player button on UnityEditor to close).

    Second problem is: when client connects to the server. If I were to spam click Disconnect button on the client, high chances are the server will report its total players to be -1 (or even -2 rarely)

    Third problem is: the server can receive client's random integer just fine. However, the client needs to register for the "SendInt" custom read event just set up the event beforehand (otherwise, crash at NetworkingStream:238, due to Dictionary retrieval attempt with invalid key). Seems that the registration of "SendInt" is redundant ?

    :(

    P.s: problem 1 maybe is due to Disconnection is called on Coroutine?
     
    Last edited: Aug 19, 2015
  49. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hello again! :D Glad that problem is solved

    So in order for that event to fire, the following function needs to be called on the server to disconnect a player:
    http://forgepowered.com/ForgeNetworkingAPI/html/0f2a22e0-855e-a2a6-f3ba-29eedd2cb7df.htm

    Hmm, we have not seen this before, we will try to replicate this asap!

    You need to match the method signature registration on both the client and the server so that they know how to match up the method request. We do not send strings over the network for these kinds of things, rather we send identities which require both sides to match up.

    Please let me know if you need any further information on any of this :)
     
  50. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Version 12.2 Released

    Us again! We got some feedback from Bolt users today and many said they want to see the Bolt event in the system. So we went ahead and created that :D. We also were working on our UFPS package and found that we wanted the ability to spawn "Remote" objects so we added that to the system too. :D Enjoy!
    • Now remote objects can be specified to be spawned for other users (Tutorial)
    • Now support for Forge Transport Object (Tutorial)