Noobie Networking System
A downloadable tool
Outdated. If anyone is interested in this, message/comment me. New version uses RakNet for nat punchthrough and has more features.
Note: The download is a UnityPackage.
This is a simple networking system, but is very capable of lots of projects! I made this out of frustration with the lack of documentation for Unity's HLAPI. I built this system on top of Unity's LLAPI. It is as simple as possible while still having necessary features.
- A game instance can turn into a server or client
- The ability to auto launch a server using a shortcut to the .exe with a special argument. (Windows)
- Remote Procedure Calls
- Easy to define, easy to understand.
- Buffered Remote Procedure Calls
- There is an easy to modify method that is called right before a new buffer is added, so, for example: If you have a buffer that defines the game mode and map of a game, you can remove the old 'game data' buffer and replace it with the new one.
- ID based networked object system
- This allows either the server or a single client to own a game object. If it is server owned, the state updates on this object get sent to all clients. If it is owned by a client, the state update data is sent to the server then forwarded to all other clients.
- Built in RPCs to: instantiate networked objects, destroy networked objects, and transfer ownership of networked objects. Also has easy to modify logic methods that allow the server to determine whether or not it will complete the clients request to instantiate, destroy, or transfer ownership.
- Networked object can be in the scene before run-time without issue.
- State Updates
- Specialized RPCs that work with any serialized field, even your own custom classes, etc..
- Easily send transform data (position, rotation, and scale) with tolerances so updates are only sent when needed. The developer can also dictate how many decimals are sent for optimization. This also works when the developer has a state update for a float field.
- You can also state update the component fields of any child of the networked object.
- If you do not want a state update to continuously send: "triggers" are used to state update fields that are not float and part of a transform component. By calling a trigger on the Identity component, it will send the updated information.
- Delegates for basic system information
- OnConnectedToServer, OnFailedToConnectToServer, OnDisconnectedFromServer, OnPlayerJoined, OnPlayerLeft
- Highly Organized!
- I encourage anyone using the system to break it down and figure out how it works! Almost all variables have comments explaining what they are used for. All the variables and methods you would ever need to use are documented. Documentation is included within. Also has tool-tips filled out for all variables and methods that a developer would use.
- Comes with an example scene
- This scene has proper usage and documentation of what is going on. A good tool for understanding the basics. On top of documentation, I also have lots of notes for proper usage, etc..
Downsides to using my system: LAN only, but you can port forward. Unity updates broke the internet server capability. I commented all of the internet based server parts, so if you wanted to get it to work again, it is fully possible. It was made to be used on Unity's servers. I never bothered fixing this, because I only make LAN games. Also, state updates do not interpolate floats for you. You will need to code this, but it will be easy because everything is organized and commented.
Thank you for taking interest in my networking system! It is free for anyone, for use in any way. You may even modify it in any way and upload that, all I ask is that you give me credit where you upload it, and send me a link because I would be very interested to see changes you make! If you are just using it in a game and are not re-uploading it, credit is not needed, but is appreciated! If you use it in a game or demo, I would also appreciate a link so I could see what you've made! It would make me ecstatic to know I've helped someone, and I am very interested in seeing what you've turned this networking foundation into! I would also appreciate it if you keep my name, email, and links in comments at the top of the scripts. And, most importantly: If you have any feedback, ideas, comments, or have found bugs.... please tell me!!!