Hi!
I want to implement a multi-user editable whiteboard that is sync’d over network. Starting from the unity tutorial multi-player example, I also found an elegant solution by http://codeartist.mx/ to use Render Textures and a canvas camera to “paint” over arbitrary geometries (involving uvmaps). Now, to translate this to a multi-user environment, I would want to instantiate a “canvas” on the server with attached orthographic camera that renders a texture which is then displayed on the clients “whiteboard”.
-
Would that canvas constitute a separate “scene”? Or just a portion of the main scene that can not be seen by the players?
-
Is there a clean way to set up such a server-only “scene” and still transmit the rendered texture as an synchronized object?
-
Does anybody know of a good, clean implementation of such multi-user editing? In principle, this problem must somehow be solved for multi-player games to have e.g. shared bullet-holes in walls etc. Or is such eye-candy in FPS games a waste of network bandwidth and solely rendered on the client?
Thanks in advance for your input!
interesting problem!
if you want to keep bandwidth low, i’d consider just sending mouse input each frame instead of sending an entire bitmap. from there, each client would then draw to their own local canvas based on the mouse input it receives. for example, have the client send ‘mouseDown’ true/false, as well as mouse coordinates. every frame, if the mouseDown bool is true, draw to your local canvas at the coordinates they’ve given you. you could probably also just draw a line from the previous coordinate to the new coordinate to ‘connect the dots’
if that’s not accurate enough or looks bad because of dropped frames or something, i’d look into breaking down their strokes into bezier curve info that’s sent down the wire.
of course, you could always send the bitmap to every user every frame, but i feel like you’d hit limitations with that pretty quick.
i’m curious to see what you end up with!
Thanks for the interest…
Some updates from my side:
- Visual communications across scenes apparently is not intended. I was naively picturing two scenes as two rooms, with a camera looking into scene two and rendering in scene one. Apparently this is a bad idea, but you can solve this by the camera “culling mask” and “layers” and have all objects in one scene.
- I got a “canvas camera” looking on a background canvas through networked sprites working, that provides the “rendering texture” for all clients with shared objects. I will not worry now about bandwidth, so your idea of the mouse input is great, but a fall-back in case I run into problems later.
- Right now I am fighting with the idea of a GameObject container / pool that is shared in the multiplayer scenario. Even though rendering works flawlessly, the sprites I instantiate on the server are cloned to the clients, but don’t end up in the right container. They clog the hierarchy root level, which is annoying…