C# Client  0.0.0.7
C# Library to interface with Corelink
C# Client

This is a C# library modelled after clients/javascript/corelink.lib.js that is designed to work with Unity. The code is borrowed and adapted from the previous example found in examples/unity written by Connor and Zhenyi, but redesigned to allow for more generic use cases

Author: Cindy Bui

Structure

The library files are located in CoreLink. These serve as the library functions and the back end. The function definitions are modelled after the Node JS library. There is another folder located in CorelinkMonobehavior which will contain scripts that you can attach to GameObjects. The files in this folder will be directly used by users. Users should create custom scripts that inherit from MB_ReceiverStream.cs and MB_SenderStream.cs and attach those to their game objects. Users should also create a custom class called ControlCallbacks that inherits from CorelinkWebsocket that will run custom functions when the server updates (ie, a new receiver, a new sender, a stream goes stale).

Demo Scenes

See examples/unity/MinimalBoilerplate for stupidly simple demo code. examples/unity/MultiplayerSandbox has a functional 2 person game

How To Use

  • Create your Unity session
  • Copy CoreLink, CorelinkMonobehavior, and SimpleJSON from examples/csharp into your Unity project's Asset/Scripts folder
  • Create a blank GameObject and add CorelinkMonobehavior/CorelinkControl.cs as a component
  • Enter the login information and server address into the Inspector (the server address should be corelink.hpc.nyu.edu)
  • To attach a sender stream to an object, create a script and inherit from MB_SenderStream.cs. Create a stream and use control.Send(streamid, data)
  • To attach a receiver stream to an object, create a script and inherit from MB_ReceiverStream.cs. Create a stream, specify the types and workspace, and create a custom overriden GetMessage() callback
  • Create custom server callback functions in the mandatory ControlCallbacks.cs file. You can comment out all function declarations if you want to use the standard ones, but the class must exist in the project.

Changelog

  • 0.0.0.7 - Changing data packet protocol
  • 0.0.0.6 - multiplayer demo works with 2 people
  • 0.0.0.5 - First round of testing the multiplayer demo
  • 0.0.0.4 - Adding doxygen documentation
  • 0.0.0.3 - Changing control connection to WebSockets. Adding user defined callbacks
  • 0.0.0.2 - Adding UDP receiving functionality
  • 0.0.0.1 - Adding UDP sending functionality
  • 0.0.0.0 - Initial Commit. Connect() and disconnect() successfully created

Generating Doxygen Documentation

cd clients/csharp
doxygen doxygen.config

This will create an html folder inside clients/csharp that you can copy and serve

Hooray it's easy!