#I do have another question about structure of game logic.

1 messages · Page 1 of 1 (latest)

placid scaffold
#

honestly, the easiest way is to just not separate them. If you are using RPCs they have to both exist on client and server anyways. I suppose you could use Custom Message Handlers instead of RPCs if you really, really need them separate.

tame gate
#

right

#

I'll send a screenshot of what I've currently done

#

this is my interface between the two

#

when a SeverGameLogic is created on server or host, it sets the serverGameLogic in the interface

#

and a clientlogic when on the client

#

so whenever a serverRpc is executed it has a reference to the server logic

#

and if a clientRpc is executed it has a reference to a client

#

but then the server logic never exists on the client and client never on a server

#

I guess it is a bit bloated, as I basically have to forward any rpcs

#

but I feel like it makes a clear distinction between the sever and client which is helpful and makes sure client only knows what it needs to?

#

This is the clientside where I'm sending a test msg

placid scaffold
#

Clients will need a reference to ServerLogic there

tame gate
#

why?

placid scaffold
#

or the server will need ClientLogic

Where is that ServerRPC defined?

tame gate
#

In the InterfaceGameLogic

tame gate
#

at the bottom

placid scaffold
#

ah ok. that works

tame gate
#

And like that you can send a message to the client

placid scaffold
#

a bit over engineered for my tastes. But if it works, it works

tame gate
#

yeah it probably is lmao

#

Is there an easier way to separate client and server?

placid scaffold
#

not really. even the Unity Boss Room sample kinda gave up on that

tame gate
#

Right

#

I think I'd probably get confused if they were in the same place

#

this is my first multiplayer game

#

So I think keeping them separate, even if over engineered, will probably serve to my advantage

placid scaffold
#

If it helps you out, there are no wrong answers

tame gate
#

kk thanks for the help