#oop help

1 messages · Page 1 of 1 (latest)

little turret
#

I thought about trying to make an oop-based character system. However, some of the actions (like dashing) would be based on the client instead of the server. I’m worried that if I use methods then it will get very messy trying to manage and replicate everything. Should I use methods or try and put functions with the character as a parameter?

dim mirage
#

Both works. Its competly up to you honestly.

gray bobcat
#

I was dealing with it recently, I found out the best solution is to have attributes created by the server on your character, like 'CanDash' and check if you can dash in the client and apply the forces. But, at the same time, tell the server the client is dashing, so it can check your current position (with some tolerance range) and see if you bypassed cooldown or dashed further away than you should

#

Doing that, you get a fast response on the client and a safe approach on the server

#

It's way easier and safe to create everything on the server, but, for high ping players, like me, this is trash

#

my average ping is 160, so the dashes would take a long time to run

#

@little turret

little turret
#

Thanks, but should I use a method for the dash or create a separate object for the client?

gray bobcat
little turret
#

I’m pretty sure methods are when you use the “:” for functions

#

usually to reference self

gray bobcat
#

ah, ya

#

have you created that system?

little turret
#

no this was hypothetical

gray bobcat
#

hmm

little turret
#

ive used oop before

gray bobcat
#

what did you felt?

little turret
#

functions are better for this type of system

gray bobcat
#

ya

little turret
#

honestly I think it could be either

#

With methods you need to have two objects but you can make cleaner code

gray bobcat
#

'cause it's just a simple action

#

the method I mentioned before is pretty good, but sometimes it gets boring

little turret
#

Thanks for the help btw

gray bobcat
#

at least in the beggining of my game, I moved everything to client side and I'll make the server side later