- Home /
texture in networked game
I've a background texture that keeps changing based on what a person selects. User also uses Drawing object to add changes on the texture.
I've put NetworkView on this object that contains the texture but all I can track over other networked players are its position and rotation. How can I stream this texture over the network. Note that I'm using Unity's built-in networking.
Answer by BerggreenDK · Jan 03, 2011 at 11:53 PM
I agree with @Leepo in networked games, the easiest way of customization is to give everyone every piece of texture and then only share the combination/customization over network to minimize traffic.
BUT - if you really have the need to transfer the texture btween players, I see three ways possible:
1) as @Leepo writes, transfer it low-level, bytewise, but consider when to do the "updating". I've played a lot of FPS where the customization loads all the time... generating annoying lags for everyone. So perhaps you should only transfer parts of the texture from time to time or schedule how much updating is possible this way.
2) another approach would be to share the "drawing commands" so that every client will replicate in memory how the owner made the customization. This would requiere the basic textures + some kinda command structure like: "drawLine", "drawCircle" or whatever possibilities you have provided your user with.
3) a last approach I think I would use myself, would be to let the user customize before getting online and the upload the textures to a central server, eg. a webserver - because you can easily make WWWload of textures from a webserver + you can control the data on the webserver with SQL/XML database structures, so its quite easy to remember who has what customization. Then when you get "close to another player" then you just use this players ID to request the texture for the player. I dont know what limits you have for amount of co-players, but remember to think of texturememory in graphiccards + OS platform (smartphone, browser, standalone etc)
If you use the "paint on texture" for blood/gore etc. then you can "fake" this custom drawing by making a lot of different "patterns/pieces" and the combination of these would be the custom textures.
Answer by Leepo 1 · Nov 18, 2010 at 01:54 PM
You can send over the byte[] of the texture. That's pretty "low level" though; more efficient would be to just send a number of the desired texture if everyone has the texture anyway. Or even the players selections (and then do the texture changing accordingly).