Controlling an OOP object on the server and client?

Hello!
I’m creating a system where I can make zombies using OOP for organization and simplicity. I want to handle zombie effects on the client and logic on the server.

If I create the zombie object on the server, how do I get the same object on the client? I’m not sure how to really phrase this, but essentially I use OOP to create a zombie on the server and want a way to use OOP on the client to handle a zombie’s effects.

For example, I can do on the server:

  • local zombie = zombie.new(), zombie:ChasePlayer(player)

and on the client:

  • zombie:Animate(animation)

Or I’m over-complicating things and should just use a remote to send the zombie model to the client and apply effects and animations etc, but I feel as if I should be using OOP both on the server and client. (I also don’t have much knowledge of OOP so I don’t know if my problem is an actual problem)

OOP is Object Oriented Programming and it’s a method of organizing code you can read more about it here:

Hmm, this question also seems more than just an OOP object question and steps into the realm of client-side prediction, reconciliation, and interpolation since you are asking to put the effects clientside.

These resources I listed can help:

https://www.gabrielgambetta.com/client-server-game-architecture.html

For your question, I believe both the client and server will create its own form of the zombie object and both of these objects will have to communicate with each other to ensure they agree with each other on things like position.

Honestly, it’s pretty confusing. Good luck.

Edit: Found this thread maybe focus on the script first then organize it into an OOP function.

The concepts are similar to what @LuaDeveloped mentioned:

So yeah to translate into OOP code create a zombie object on the client your idea is correct to use OOP on both server and client.

2 Likes