valiafetisov / unity-webgl-multiplayer

Unity WebGL basic multiplayer demo using WebSockets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity WebGL basic multiplayer demo using WebSockets

The project is a basic working example demonstrating the possibility to exchange multiply players positions using websockets. Under the hood it uses slightly modified websockets plugin and small node.js server.

Main code can be found at node/app.js (node.js server), unity/Assets/Multiplayer.cs (Unity C# script) and unity/Assets/Plugins (modified plugin).

Running

  1. Start node.js server from the node directory: npm i && npm start
  2. Open unity folder as Unity project and run the game CMD+P

Developing

If you're willing to develop server code further, you may find useful to use npm run dev instead of npm start as it will start script with nodemon – a monitoring tool that will restart server after every edit.

Credits

About

Unity WebGL basic multiplayer demo using WebSockets

License:MIT License


Languages

Language:C# 98.3%Language:JavaScript 1.0%Language:HTML 0.6%