RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3.07k stars 496 forks source link

Make simple RPC extension. #9

Closed RevenantX closed 7 years ago

NVentimiglia commented 7 years ago

I think one of the nice things is that this library has minimal Unity dependencies internally. Introducing RPCs would require more knowledge of unity inside the library. This aspect is nice if you want to run a non-unity server (ala MMOs). Moreover, you may introduce the need to add serialization to the project to communicate these complex objects. I like being able to use my own better-than-protobuff serializer.

I feel any RPCManager should be written as an extension / addon outside of the core project. Just my 2 cents.

RevenantX commented 7 years ago

I am writing RPC extension that not compatible with Unity3d RPC (based on UNET). It looks like old RPC in unity3d. And will be compatible only with this library (i think :)).

NVentimiglia commented 7 years ago

No doubt. I am not a fan of how the legacy RPC system worked. Heavy use of reflection and use of strings is not a good policy in a networking library.

I`m showing interest because I have my own message routing system that I am using (and would rather keep using). Let me know if you need a second opinion.

NVentimiglia commented 7 years ago

Was taking a look at your RPC extension. https://github.com/RevenantX/LiteNetLib/blob/dev_rpc/LiteNetLib/LiteRPC.cs#L144

I noticed we are serializing a large string into the header of every message. Could we key the RPC methods with a short instead?

RevenantX commented 7 years ago

@NVentimiglia this is "Work In Progress" prototype. Maybe i will create some 64bit hash. I don't know) If you have good working solution - you can suggest)

NVentimiglia commented 7 years ago

@RevenantX What do you think of this draft ?

https://github.com/NVentimiglia/LiteNetLib/commit/7af28415d98b522f686d9581765249d4bc0562bb

RevenantX commented 7 years ago

Added simple and fast packet serializer.