Search Unity

  1. 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
    Luckily the operating system on the IP level automatically rejects packets that fail the checksum. :) This could be another reason for a packet "drop".
     
    jpthek9 likes this.
  2. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I have a feature request.

    I am planning to build a plug-in for the Bare Metal server. This will manage a list of sites hosting my game. It will allow hosts to register and clients to find the hosts. i.e. When a player chooses to join an online game, they are presented with a list of hosts.

    A key piece of information I need to display is the ping time between the player and the host. This ping needs to go directly between these two systems and not bounced through the Bare Metal server.

    I am using the word "ping" loosely. I am not talking about a ICMP ping, but a custom ping that operates on the host port.

    Glossary:
    Master - The bare metal server that keeps a register of all hosts
    Host - An instance of the game that a player has started in Host mode.
    Player - An instance of the game that a player has started and is attempting to find a Host.

    I'll run through the logic:
    1. A host creates a connection to the Master
    2. Host registers with Master
    3. Client Connects to master
    4. Client requests/gets sent list of hosts
    5. Client pings each host to display latency. (repeated every x seconds)

    Obviously the client shouldn't create a connection to every host, just to check latency. Does Forge have a Ping function or could you build one?

    Required features would be:
    Client Pinging a Host using ip/port
    Client Event called on Ping response with ip/port and response time

    The host requires no event or methods. It just automatically responds to pings.

    Edit: I was looking through the Forge Documentation and came across the HostInfo class.
    If I instantiate an instance of this and set the ip/port properties. Will the ping method work?
    If it does, then this is close to what I need. The only missing component is the ping time. I can't see a property for this on the class.
    Edit 2: I tried using the HostInfo class, but I don't think there is any network logic built into it?
     
    Last edited: Feb 20, 2015
  3. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    Authoritative Movement Help Please!

    I have a movement script on a cube and I want to take keyboard input from the owner, pass it to the server which will move the player's rigidbody.

    In the Awake() I assign a networked variable to pass the keyboard input as x and y floats.
    Code (CSharp):
    1. AddNetworkVariable(() => keyboardInput, x => keyboardInput = (Vector2)x);
    The owner/movement handling is in FixedUpdate() of the player script.
    Note: The "MovePlayer()" method actually manipulates the rigidbody velocity and rotation.
    Code (CSharp):
    1. void FixedUpdate() {
    2.          if (IsOwner) {
    3.             keyboardInput.x = Input.GetAxis("Horizontal");
    4.             keyboardInput.y = Input.GetAxis("Vertical");
    5.  
    6.             if(OwningNetWorker.IsServer)
    7.                 MovePlayer(keyboardInput.x, keyboardInput.y);
    8.         } else {
    9.             MovePlayer(keyboardInput.x, keyboardInput.y);
    10.         }
    11.     }
    12.  
    This works for the player who is on the server, but I get no movement for the player on the client.
    I may be using the networked variables wrong or my owner/server logic is flawed, but I got nothing.

    Can someone please give me some guidance?
    (I'm sure I am making this harder than it is.)

    Thanks.
    -- Paul
     
    Last edited: Feb 19, 2015
  4. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Great to see how well it all moves along. Sadly i don't have time to test it all at the moment, but hopefully i will again soon enough!
     
  5. Cranick

    Cranick

    Joined:
    Nov 20, 2011
    Posts:
    310
    Glad to keep you guys posted, let us know if there is anything in particular you would also like to see in the future development if it hasn't already been said.
     
  6. Cranick

    Cranick

    Joined:
    Nov 20, 2011
    Posts:
    310
    Are you setting the position on the client when the server updates it? Also is the server sending the information it receives back to the client of it's new position? I'm just curious if the input is simply being sent to the server and then not being sent back to the client. If so you can just make a simple function call that will send it back to the calling player to do an 'Update' for it's new position with the new values the server says it should be.
     
  7. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    The code I posted is really, pretty much, everything.
    My player script is a NetworkMonoBehavior with the code I posted.
    I was trying to use a networked variable to pass the keyboard input to the "server-side" of the player object script, the server would update the rigidbodies and the clients would be moved automatically with replication (I'd hoped).

    This is not reinventing the wheel, but I am out of my depth of understanding about how to properly do authoritative movement. (Sample code would be great!)

    Thanks.
    -- Paul
     
    Last edited: Feb 20, 2015
  8. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,741
    Probably a very beginners question here but is there a way to test if a port is already being used to host a game, or is a case of trying to host on the port and if I get an error increasing the port number and trying again?

    Also is there a quick way to disable the network stuff on objects, want to be able to test things in the game scene without having to have start servers etc, currently getting ArguementNull Exception from the NetworkedMonoBehaviour components when starting the game scene without starting a host up, can a check be put on that exception so the scene will run with no host running.

    I also added a delegate to the socket.disconnected event expecting that to be called when I as the host exit a the game but a Debug.Log in the delegate shows it is being called at the game start, is that right? If so which event should I be using when the host terminates a game?

    Every now and then when starting my game the networking just throws out a non stop stream of errors

    Code (csharp):
    1.  
    2. KeyNotFoundException: The given key was not present in the dictionary.
    3. System.Collections.Generic.Dictionary`2[System.UInt16,BeardedManStudios.Network.NetWorker].get_Item (UInt16 key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
    4. BeardedManStudios.Network.Networking+<>c__DisplayClass1.<Host>b__0 ()
    5. BeardedManStudios.Network.NetWorker.<OnConnected>b__0 ()
    6. BeardedManStudios.Network.Unity.NetWorkerKiller.Update ()
    7.  
    Quitting play mode and starting again will stop the error messages but it is annoying that you have to stop and start to get it to work, usually happens after editing a script.

    And final question, can a hosting session be started from the scene one is already in?
     
    Last edited: Feb 20, 2015
  9. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    The way that is usual is to try to host on that port and if you get an error then you can do port++. I would recommend using a ushort since it fits the port number scheme best. We actually do this for hosting multiple clients on the same machine. If the port is already in use (via try/catch on connect) then the client will ++ its port number and try the next one.

    We are actually about to do another release with some bug fixes on RPC's. If you would like we can write in an "offline mode" :). Then you won't have to worry about doing it yourself. Until then, hosting a server with no clients is basically an offline mode since it doesn't require internet to do and no messages are sent across the wire if there are no clients.

    This seems like a bug. We have some checking and connecting happening on start, I wondering if this is triggering it somehow. Thanks for the report, I haven't seen this yet and we do use the disconnect internally. I will let you know if we can replicate it tonight! If so we will be sure to drop that fix in with the next build (which should be tonight).

    Edit: We just received a second report on this so it has to be a bug that we introduced recently. We will fix this asap!

    This we have never seen and haven't had a report on. Which events are you registering for the socket, also what are some of the other networking things you are doing so that we can replicate? It looks like it is having trouble finding an object in the lookup. Are you running any Specific RPC methods or anything like that?

    I'm sorry about that :(. This is a pretty good hint for us to be able to track it down tonight though. Very odd that it would work on second run, nothing should be persisting. If any it should replicate the error over and over each time you start.

    Yes :). If you check out the start script on the built in menu, basically you would do the same hosting call and just not do the "Go" method on the complete. You can place any of your startup host code inside of the connect event or just replace the "Go" code with your code :). If you would like a sample for this then we can create one as well.

    Thanks for the feedback, we will track down and fix those issues tonight!
     
    Last edited: Feb 20, 2015
  10. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    We actually have a ticket open to create a custom Ping method of our own. Technically you do have to "connect" to each host to find the ping. That being said, it would be best to do it via UDP which is connection-less, so a better term is that it would need to send a packet to the server and get a response for that packet then check the time sent and time received. We can pull this feature request towards the top as it probably will be a simple task.

    It will probably look something like "Networking.Ping(host, port);" and before that you can register the event "Networking.pingResponse += delegate(host, port)"

    There is no logic built into this class for anything network specific. It is the class we use to show the list of servers in our example server browser scene. We will be adding the ping to this class as well. If you would like we could do something like this instead of the above suggestion:
    Networking.pingResponse += delegate(HostInfo host);
    Networking.Ping(HostInfo host);

    Sorry for the late response by the way!
     
    Zaddo67 likes this.
  11. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    No problem, you are still considered a valuable ally in our battle for networking :). We can't wait to have you back in the system! :)
     
  12. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hi there! Sorry for the late reply. So there are a few things. Starting with the code it all looks good, I will run through the logic when I can test it tonight and see if there is just something hidden that I am not seeing at the moment.

    On a design note, having the inputs delegated to every client may actually cause some issues. For instance, if one client collides with an object but another one does not, then the simulations for the positions will be off. Over time this will cause a large de-sync between what all of the clients think that position is. For this reason, you normally do not want to sync inputs for position/rotation or real time data that can be manipulated. It is best to sync the end result of those inputs. Basically what you are wanting to do is actually synchronize the position and rotations of those objects rather than the inputs. Then on the server side you will validate the new positions. So possibly on the server you will track the previous position and new position or the previous velocity and the new velocity. If they do not look right then authoritatively set the values to what they should be.

    A second method if you really need to serialize the inputs would be that you would serialize the inputs to the server, and then the server should serialize the positions/rotations to all of the clients based off of those inputs rather than sending the inputs to them. The suggestion about the server just checking the variables that were sent in the other suggestion may be best though as it keeps the network update loop consistent on all fronts.
     
  13. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    Thanks for the reply.

    That first sentence is EXACTLY what I am looking to do.
    I am not sure what the "suggestion" in the second sentence actually was but, let's ignore that for now.

    So, what should the code look like to serialize the keyboard inputs to the server and let the server move the rigidbodies based on those inputs?

    Also, I should not need to manipulate the objects on the clients at all should I? The positions/rotations should flow through to the cube objects on the clients automatically via the NetworkMonoBehavior script on the cube objects, correct?

    -- Paul
     
  14. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    A connectionless ping like this would be perfect. Thx.

    This saves the overhead of creating a connection just to check ping. And avoids the issue of a connection being established, when you don't actually want to connect to the game host, just check it's speed.
     
  15. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    Can I get a list of events that I can hook into?
    I'm curious what is available since using events is highly touted for Forge.
     
  16. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Yes, we will compile the list asap so there is no need to browse the code or the code docs to find events.
     
  17. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    Thank you.

    -- Paul
     
  18. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Sorry for being vague, I was referring to the following:
    If you are going to serialize the inputs then what you provided looks correct. I can double check it tonight.
     
  19. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    Wow I missed a lot. For some reason I wasn't getting any alerts. Anyways...

    That sounds great! Makes things a lot simpler because the data won't have to pass through my OCD standards to get over the network.

    I'm ready to do a small test but I'm missing 1 crucial piece: controlled sends. When will specific WriteRaw receivers be implemented or if it already is, how do I do so? The main thing I need right now is sending data only to the server so I can test out the aggregated packet send-outs.
     
  20. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Version 13 is uploaded and should fix this issue :)

    http://developers.forgearcade.com/Profile
     
  21. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hello everyone, I just sent out an email about the 13.1 update. Sorry about 2 update emails in such a short time span but this bug was really... bugging us... >.>; Also we owed it to @Meltdown :)
     
    Meltdown likes this.
  22. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I tried to post this on the new forge forum but I got an Invalid Access error....

    I have some more feature requests. I feel a bit greedy asking for all these features. But hopefully they help make Forge a bit better :)

    I have been polishing connections/disconnections in my game. I could use a couple features in forge and It would be great if these could be added. Both are low priority. Except perhaps the unhandled exception should be managed with defensive code.

    1. Elegant way to handle server disconnects
    ===========================================
    Feature request: A client event that fires when the Host is no longer available

    Scenario: Shudown Host Game
    Client does not get a serverDisconnected or Disconnected event
    Edit: This was poor coding on my side. If you call Networker.Disconnect() on the host, the client disconnected events fire. I wasn't trapping the game shutdown using OnAplicationQuit() correctly and shutting down the Networker using this method.

    Scenario: Kill Host game Process
    Client Gets this unhandled exception. Doesn't fire serverDisconnected event.

    SocketException: An existing connection was forcibly closed by the remote host.

    System.Net.Sockets.Socket.ReceiveFrom_nochecks_exc (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint& remote_end, Boolean throwOnError, System.Int32& error)
    System.Net.Sockets.Socket.ReceiveFrom_nochecks (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint& remote_end)
    System.Net.Sockets.Socket.ReceiveFrom (System.Byte[] buffer, System.Net.EndPoint& remoteEP)
    BeardedManStudios.Network.CachedUdpClient.Receive (System.Net.IPEndPoint& remoteEP, System.String& endpoint)
    BeardedManStudios.Network.CrossPlatformUDP.ReadAsync (System.Object eventSender, System.ComponentModel.DoWorkEventArgs e)
    UnityEngine.Debug:LogException(Exception)
    BeardedManStudios.Network.CrossPlatformUDP:ReadAsync(Object, DoWorkEventArgs)
    System.ComponentModel.BackgroundWorker:processWorker(Object, AsyncOperation, SendOrPostCallback)

    2. Kick Player
    =============================================
    Feature Request: A method on the Host to forcibly kick a player.
    This should trigger an event on the client.

    Edit: After posting this, I found from doco that Networker.Disconnect has a dual purpose, stop the socket or, if you pass the NetworkingPlayer as an argument, it will kick that player.
    I tested and works perfectly.

    You Forge guys are so good, you solve problems, before they even exist :)


    Edit: Found another one.

    3. Start and Stop host on same port
    =============================================
    Feature Request: Allow host to be restarted on same port

    Scenario:
    I stop host using, Networker.Disconnect()
    Using TCPView I can see that the socket has been shutdown successfully.
    When I try to start host again on same port, I get the following error:

    NetworkException: Socket has already been initialized on that port
    BeardedManStudios.Network.Networking.Host (UInt16 port, TransportationProtocolType comType, Int32 maxConnections, Boolean winRT, System.String overrideIP, Boolean allowWebplayerConnection, Boolean relayToAll)
    ZoneOfFun.Network.ForgeNetwork.zofHost (UInt16 port, ProtocolType protocol) (at Assets/Server/Networking/ForgeNetwork.cs:86)
    NetworkManager.StartHost (Int32 port) (at Assets/VersionOne/Game/Scripts/NetworkManagement/NetworkManager.cs:225)
    SmartConsole.Host (System.String parameters) (at Assets/Zone/Scripts/SmartConsoleHandlers/SmartConsoleZone.cs:141)
    SmartConsole.ExecuteLine (System.String inputLine) (at Assets/SmartConsole/Code/SmartConsole.cs:286)
    SmartConsole.ExecuteCurrentLine () (at Assets/SmartConsole/Code/SmartConsole.cs:653)
    SmartConsole.HandleTextInput () (at Assets/SmartConsole/Code/SmartConsole.cs:639)
    SmartConsole.HandleInput () (at Assets/SmartConsole/Code/SmartConsole.cs:561)
    SmartConsole.Update () (at Assets/SmartConsole/Code/SmartConsole.cs:186)
     
    Last edited: Feb 22, 2015
  23. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,741
    Got a small, got a simple scene with just a cube with a Networked Mono Behavior component added, I build and run that, then in the editor I check the 'Is Player' option and start the scene, and I get a console full of the error:
    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. BeardedManStudios.Network.NetworkedMonoBehavior.Update ()
    If the built version isn't running then I dont get the error, the built version is not connected to the editor one, they are both in host mode on different ports. Am I doing something wrong, I cant see how another copy of the game running on my machine which is not connected should effect what happens in the editor when play is pushed. What is it that 'Is Player' does, and any ideas why it is spewing out the exception above? Tried posting on your forums but just get some Access error.

    Also does Forge work with Unity 5?
     
    Last edited: Feb 21, 2015
  24. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,741
    Another beginners question :) When I connect to a scene what is the recommended way to send the scene objects to a player joining the scene, loading a scene is one thing but that scene could have numerous new players in it and objects could have been added and changed etc, component values changed and so on, is it up to the host to create say a text file of all the scene contents and values and then send that out or is there another way, sorry for such basic questions but after many years writing games this is my first venture into multiplayer coding apart from messing with DirectPlay many many years ago.
     
  25. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    RPC Question:
    In standard Unity, you can call an RPC the way your online code sample does where the RPC call and the RPC method reside inside the same script.

    Supposedly, with Unity, you can also send an RPC to a script on an entirely different object using the NetworkView of the object you want to call the RPC on.

    Let's say I have a setup like so:
    GameObject-A has a networkview attached as well as a script called Script-A.
    GameObject-B has a networkview attached as well as a script called Script-B.

    If my code in Script-A wants to invoke an RPC in Script-B, it can do so like this:
    Code (CSharp):
    1. GameObject-B.networkView.RPC("rpc_name")
    How can I achieve this same functionality in Forge?

    Thanks.
    -- Paul
     
  26. zapoutix

    zapoutix

    Joined:
    Jan 2, 2015
    Posts:
    44
    Hi guys,

    When i try to connect with TCP protocol on a server i go this exception (UDP works well)

    Code (CSharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. BeardedManStudios.Network.NetworkingStream.Read (System.Byte[]& readBytes, Int32 count)
    3. BeardedManStudios.Network.ObjectMapper.MapBasicType (System.Type type, BeardedManStudios.Network.NetworkingStream stream)
    4. BeardedManStudios.Network.ObjectMapper.Map[UInt64] (BeardedManStudios.Network.NetworkingStream stream)
    5. BeardedManStudios.Network.NetworkingStream.Consume (BeardedManStudios.Network.NetWorker socket, BeardedManStudios.Network.NetworkingPlayer sender, BeardedManStudios.Network.BMSByte message)
    6. BeardedManStudios.Network.DefaultClientTCP.StreamReceived (BeardedManStudios.Network.StreamRead obj)
    7. BeardedManStudios.Network.DefaultClientTCP.ReadAsync ()
    8. UnityEngine.Debug:LogException(Exception)
    9. BeardedManStudios.Network.DefaultClientTCP:ReadAsync()
    Regards,
     
  27. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,741
    Just been playing around with the Serializing Entire Classes example but it is given me exceptions. in the Awake method you check for the PrimarySocket being null and if so adding the Setup method to the connected event, but then in the Setup method you use the PrimarySocket value but when I run my scene the PrimarySocket seems to stay null so it is throwing an exception. The hosting is working so I am not sure why PrimarySocket is staying null. Can you let me know what I am doing wrong.

    And on the Serialize Class system, the id value, is it ok to just set that to the Object instace id in the awake method such as:
    Code (csharp):
    1. id = GetInstanceID().ToString();
    And if so could not an int be used for the id instead of a string?
     
    Last edited: Feb 21, 2015
  28. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    I too am getting "Invalid access for this action" on the Forge forums so I guess I'll ask here. If a player hosts the game, how can he differentiate the server's sends from his own standard player sends using WriteRaw? Should I add a unique header or is there a better method?
     
  29. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    When I host or connect with Forge, a second http TCP connection is always opened to 162.209.72.54. This is the IP for the Forge website.

    Why is this connection created? And, can we turn this off? Is it a debugging feature for the Beta, will it always be part of Forge networking?

    (... Just in case you couldn't guess from the quick fire questions, I am hypersensitive to big-brother monitoring ;) ... )

    Edit: Another concern is that if I hitch my wagon to Forge, this is a large time investment for me. What happens if this site is unavailable, will it stop Forge from working? Despite your current plans, you can never guarantee what the situation will be in 2-3 years.
     
    Last edited: Feb 22, 2015
    jpthek9 likes this.
  30. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    That reminds me. How will we be able to use Forge's server hosting? Is it going to be a 'dumb' server like Photon's or can we upload a script that's automatically integrated into the server? Or maybe uploading a headless linux build?
     
  31. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hey everyone, sorry for my lack of responses today! I was at the Unity/Microsoft event down in OC helping out Microsoft with their porting lab. Then of course some dinner with the Unity and Microsoft reps :). It was pretty funny, all the MS guys on one side of the table and all the Unity guys on the other. It was a blast. If you guys get a chance to go to any of the Unity/Microsoft events I would recommend it!

    Okay! Let's begin the responses!
     
  32. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    I don't like "dumb" servers. You will be able to upload your headless linux build. I am going to be talking my my Microsoft rep about getting some Azure space going as well so you will be able to run on both Windows and Linux servers :).
     
  33. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Are you using the Arbiter object in your game? This is used to register the host for the host list for your game.

    No big brother monitoring here :). We do also have a debugging feature for the beta that does a http web request so that we can get if the beta version being used is valid. Since we have a high volume of beta's going out we implemented a miss-use protection feature. This does not collect any data from you, it purely does a check on our servers. Also if you watch that TCP connection you should notice that it is just an HTTP request (should die after getting the result). If this connection stays open, please let me know because it could be a bug with our HTTP setup.

    This is true and is a concern for many who wish to go big. I personally wouldn't consider it an issue. Our servers are going to be distributed and if a node fails it will direct to another node, it will be nearly impossible for all nodes to fail unless the world blows up as our nodes are in different areas of the planet.

    So a couple of things to go with this. We are planning to license our Arbiter source so if being completely self reliant is important, that will be available which means you have no ties to our servers at all. With that being said, it is not likely that self hosting will be more reliable than us hosting the data or servers as we can bounce to backups or different regions to process data. It would require you as a developer to host many nodes yourself to achieve that same benefit.

    First I would like to state that is is highly un-likely that we would kill this proejct because our games are running on it. However, just for comfort, if we were to kill it then we will release full source code to the using developers. Also, since you all have full access to the databases we provide, that means you can download them at any time and put them on your own servers. :)

    EDIT: I would like to note that we are completely against tracking without permissions. If we ever have a feature (even in the beta) to track anything on our side, even if it is to improve the system, we will always ask for permission and if not allowed we will not do any. The only tracking that we have planned for Forge is the tracking that you as a developer does for your applications. The only other thing (which we will ask permission for) is to keep a count of running servers on Forge for our own curiosity and so that we can say something like "NNN Servers currently running with Forge". However we will ask before that. Note: We will not ask for permission to do any tracking that you as the developer setup yourself as we consider you setting it up as permission (such as having your hosted servers being used on the Arbiter for our current server browsing feature).
     
    Last edited: Feb 22, 2015
    Zaddo67 likes this.
  34. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Interesting, I'll have this fixed asap! I must have some bug where posts are only working my admin accounts.

    Since the WriteRaw now sends the sending player, if the sending player is the server then you know it is their own :) Let me know if you need some sample code for this.
     
    jpthek9 likes this.
  35. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Thank you! All of the changes we have added to UDP must not have been successfully ported to TCP well. I will create a ticket for fixing this now!
     
  36. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Spawning in an object that is marked as a player is working fine on my end. Normally you will want to not have an object marked as "Is Player" in the saved scene as you would want to spawn them in. Unless your making a game where the server is the only ones that has a player in the scene (The server owns all objects that are in the scene at start). However that is not a proper solution to the bug. I will make sure that the latest build didn't mess up anything with the player being in the scene at the start, I did have to mess with that code in particular when fixing the spawning collisions issue.

    Woah! Just got to this part... They should not effect each other at all! D: This is very strange. I will make a test case myself and do some heavy debugging. Thank you for providing the steps to reproducing this.

    I have been developing in Unity 5 version 20. Others had an issue with version 18 but it may have just been that version as it resolved in any version after that. I never tested it in 18 though. If you are using Good Ol' Sockets, then I am not sure if their plugin works with Unity 5 yet though.
     
  37. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Oh! Good question :), I wouldn't call it basic. I am quite happy that you are giving multiplayer a shot and am honored that you are trying it out through Forge! :D

    So what you are wanting to look into are Buffered RPC calls. These calls can be used to create players and then have them spawn on clients who join at a later time. It can also be used to call destroy methods on objects that are already in the scene and so on. As for updating the variables on a script, something that you can do is register to the player connected event on the server and when they do, have the server serialize all of the properties that have changed that you need to.

    The easiest one to do will be to use Buffered RPC calls in most cases. We will be releasing our Angry Bots multiplayer project soon. You will see these elements in play, we buffer the destruction of enemies that are already dead (we made them explode and everything, though they don't need to). You also can connect many players at once and see how the previous player spawns are buffered.

    I use a buffered instantiate in this video tutorial: http://developers.forgearcade.com/Tutorials/MasterClassBeginner/Buffered-Networking-Instantiate

    Please let me know if you need more information or an added tutorial (maybe on destroy objects) and I would be happy to help out! :)
     
  38. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hey! No problem. So since our networking system allows for multiple network connections from one instance, you actually have to tell it which socket that you created is a primary socket. For an example of this check out the StartGame.cs script in the update method you should see:

    Code (CSharp):
    1. Networking.SetPrimarySocket(socket);
    If you are already doing this, please let me know and I'll check to see if there is some-kind of bug with the setting of the primary socket :)

    Edit:

    Yes, this should work just fine :)

    When this message is being sent across the network, it is actually converted to an int so that strings are not being sent across the wire (as it is wasteful). Would you like to be able to just identify this as an int?
     
  39. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    It is just as easy if not easier in forge and using your same example would look like the following:
    Code (CSharp):
    1. NetworkingObject-B.RPC("rpc_name")
    So all you would need is a reference to the SimpleNetworkedMonoBehavior/NetworkedMonoBehavior then just call its "RPC" method.
     
  40. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    This has been fixed, sorry about that!

    Woo!!!!

    Interesting, maybe like a server timeout event? :)

    Hehe, this seems like a bug, I will wrap this up nicely!

    Hehe :) Yes, you can also pass a message to the client on why they are being disconnected too!

    Hmmmm, this one seems like a bug too. I'll look into this one!

    Thanks for the feedback! :D
     
    Zaddo67 likes this.
  41. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    Did you get a chance to?
    -- Paul
     
  42. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hello all, I have added your bugs to the bug list via the developer portal. You can review them to make sure I got them all here: http://developers.forgearcade.com/Feedback

    I have also fixed the forums so that you are able to post.

    Going to check now, I had to go to bed early for the Unity/Microsoft meetup. :)
     
  43. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    I must be doing something wrong.
    I'm using a modified version of a V13.1 scene.
    I put a BRPC method in the StartGame class which is attached to a Canvas (called "Canvas") in the scene.
    In a script on my instantiated gameobject, when I press "R", I do this (only when IsOwner == true):
    Code (CSharp):
    1. GameObject GO = GameObject.Find("Canvas");
    2. GO.GetComponent<StartGame_Modified>().RPC("TestRPCOnServer",
    3.       NetworkReceivers.All, this.NetworkedId);
    No errors are triggered, there's no null objects, but the RPC is never executed when triggered from the client.
    When the RPC is triggered from the server, the RPC is executed.

    Help Mr. Wizard!
    -- Paul
     
  44. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I am not using Arbiter Object. I Just call Networking.Host or Networking.Connect. This then automatically (by Forge) creates a gameobject called "Networker Manger" with the NetWorkerKiller component.

    The tcp connection to 192.209.72.54 only sends 1 packet and recieves one packet. Packet sent is 85 bytes and the received packet is 259 bytes.


    That would be perfect. As a stop gap measure that is kind of what I have done. I have a TimeManager that polls the host for the server time. If this doesn't get a response after X tries, then I raise a server disconnected event.

    Thx.

    PS: I just want to say Forge is an awesome networking solution for Unity and you guys are amazing how quickly your turn around fixes and add new features.
     
    Last edited: Feb 22, 2015
  45. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    I played around with NetworkingPlayer but couldn't find the solution. How do I identify the NetworkingPlayer as the server? Thanks a lot.
     
  46. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Okay, then this should be the beta verification HTTP request

    Are you positive that this is the correct IP? We do not own this server... This is a server in Colorado, US. Our servers are only on the coasts.

    Do you mind sending me your trace of this IP via email? I will check it on my side too.
     
  47. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hey, just looking through our source, I now remembered that the server shouldn't be sending a WriteRaw to itself as you should already have the raw data on the server. It should only be reading from clients. Could this pose a problem with your design?
     
  48. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    That's cool :)

    Ooops. Typo. 162.209.72.54

    Sorry about that :oops: tcpview.jpg
     
    Last edited: Feb 22, 2015
  49. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Ah! Okay, yes this is our beta verification. That is on our Bearded Man Studios page. Here is the link that it is pinging for your reference http://162.209.72.54/forge-beta.php or http://beardedmanstudios.com/forge-beta.php is actually the URL that is being requested

    Edit: This will not happen in final release, only in Beta versions. The only bytes being sent are the headers for the HTTP request.

    Here is our exact function call, it is a flat request with no other data being sent :)

    Code (CSharp):
    1. protected void CheckBetaNetwork()
    2. {
    3.     if (CurrentBetaCheckState == CheckingStates.None ||
    4.         CurrentBetaCheckState == CheckingStates.Failed)
    5.     {
    6.         CurrentBetaCheckState = CheckingStates.Checking;
    7.         HTTP temp = new HTTP(BetaCheckUrl);
    8.         temp.Get(NetworkingCheckRecievedResponse);
    9.     }
    10. }
     
    Last edited: Feb 22, 2015
    Zaddo67 likes this.
  50. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Sounds good, I have added it to the feature requests on the site :)

    :) Thank you very much. We couldn't do any of this without the help of you guys, so a thank you is in order as well! You guys find important bugs and come up with some pretty awesome feature requests! I think that it doesn't hurt that we have a passion for multiplayer and that use this system too. :D