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?
#oop help
1 messages · Page 1 of 1 (latest)
Both works. Its competly up to you honestly.
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
Thanks, but should I use a method for the dash or create a separate object for the client?
I know it's pretty late, but wdym with 'method' for dashes?
I’m pretty sure methods are when you use the “:” for functions
usually to reference self
no this was hypothetical
hmm
ive used oop before
what did you felt?
functions are better for this type of system
ya
honestly I think it could be either
With methods you need to have two objects but you can make cleaner code
'cause it's just a simple action
the method I mentioned before is pretty good, but sometimes it gets boring
Thanks for the help btw
at least in the beggining of my game, I moved everything to client side and I'll make the server side later