Server / Client asset workflow in a two project setup

Hi all,

I am currently developing a networked game in two seperate Unity projects one being for the client the other for the server. My question may even apply for single client/server projects.

How do you handle shared assets between server and client in a workflow that doesn’t break your neck?

Optimally, a networked entity would on the server only require the most basic representation possible. e.g. transforms, colliders and some behaviours. We are not interested in adding renderers, particles or sound of any sort because there are not going to be an visual or auditory representation on the server.

However, on the client the same entity would require many more assets. Renderers, particles, sounds, colliders, transforms you name it.

How do you create a setup that allows you to seemlessly develope a prefab / entity without having to maintain two seperate prefabs? Is it even possible?

The best thing I have at the moment is a pseudo-workflow that would be something along the line of assuming that the server is a base represenation on what is to be on the client. I would then create a seperate prefab more visual prefab that includes all the visual representation and “Slap” it on top of the base representation.

So in short I would have a prefab that is the base representation of an entity and would be used on the server, would contain:

  • Transforms, colliders

While the client prefab would attach itself to the base representation and contain

  • Renderers, Audio Sources, Particles

However I can already foresee problems such as:

  • Syncing dependencies of the client prefab to the base prefab e.g. If a renders needs to be applied on one of the transforms
  • That there is going to be certain server behaviour that is NOT intended for the client, and then having to lure out all server behaviours so it isn’t applied to the clients.

I am not certain how to approach from here. Anyone here having some good advice or some experience in this field?

We have a similar setup.We have different codebases for Client and server and thus different prefabs all together. We simply create the client version of an object, then we write the client code, then the networkcode for the client and server, and lastly / while writing NetworkCode we create new monobehaviours / prefabs on the server project with only whats needed by our server code.

However, we currently barley use any monobehaviours at all. We represent everything as data structures as we don’t need monobehaviours. Ex:
The inventory is represented as GameObjects on the Client in the form of UI with MonoBehaviours on them that contain data. However, on the server. This is just a object that contains similar info.

The reason we write the NetworkCode after is so we know what we actually need on the server side to not include anything unneeded,

If forexample we fire a bullet. We don’t want to do the smoke effects and stuff on the server. So we do Damage calculations etc. And then, we just tell the clients that somebody shot. And then they apply particles and other things,