lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

Remote Procedure Call update proposal #51

Open AgentFire opened 8 years ago

AgentFire commented 8 years ago

Hello.

I have developed a simple RPC library using my beloved Lidgren.Network, and I would like to present what I have achived during the last days.

Here I post link to an image: http://i.snag.gy/EBXXY.jpg (code inside)

Now, I'm not that strong with English language, please excuse me if I'm being not clear at some points and feel free to ask for clarifications.

In short:

  1. The project I made allows the user to transfer procedure calls over the UDP connection. Any side (client or server) can make a call to a method (with parameters, or course) of an interface and the code will be executed on the remote side.
  2. The workflow is pretty straightforward: you create a NetOutgoingMessage, set it as the RPC's wrapper's target, make a call to the RPC's interface (created via dynamic proxy of Castle.Core package), and then you send the message. On a receiver's side you read a NetIncomingMessage, throw it at the RPC's unwrapper and process the method invocation at your defined class.
  3. The RPC library allows you to customize the way an argument wraps into a message (and unwraps out from one).
  4. All the calls are made by open delegates and therefore much faster than the pure reflection invocations.
  5. The wrapper and unwrapper are built only once and can be used as long as it needs to be.
  6. .NET is 3.5 (Unity3D friendly), the Castle.Core NuGet package is referenced inside.
  7. out, ref parameters and non-void return types are not supported, I hope you understand why.
  8. I'm planning to make the RPC library support the interface's properties so that they could be kept up-to-date, creating the binding-over-udp.

My question is, will there be any interest in this? I'm planning to use this in my game, as I see much necessity of it in there. Could this be merged? If not, do you, @lidgren allow me to create a nuget package which would use your library?

jeremieweldin commented 8 years ago

Hey, would you be able to share your RPC code with us? I'm looking at many implementations using Lidgren and would love to see yours.

AgentFire commented 8 years ago

@jeremieweldin here you are: https://www.dropbox.com/sh/c9vtoyeh77h704n/AABBgoskyq3aLZ4ee-yiIlIha?dl=0

henrysipp commented 7 years ago

@AgentFire Link is dead and I would love to see how you did it. Been tearing my hair out trying to come up with good networking for my project

AgentFire commented 7 years ago

@HenrySipp I kinda would love to post my library as a NuGet package, but that would require for @lidgren to have his own library updated. You know, to reference it as a dependency correctly.