#Client vs server npc anims
1 messages · Page 1 of 1 (latest)
For combat I personally use a server script set to client run context
I think for npcs its better to play the animations on the server because if you play the animations on the client. The client would need to own that part if i am not wrong
not true
dang
Depends on how important sync is
i'm wondering this because i have a fast paced ish combat with parrying and im wondering if it would cause a noticable delay to play on client
can you explain client run context? i know a little
Jst try it
Idk much about it
Well depends.ig in the end you would still have to FireAllClients
no, u just have the client play animations for npcs that are loaded in, and in close enough proximity
I use it for a sim like combat game where u mostly fight npcs
So you will just trust the client with all the logic like detecting the parry
no, the server is still authoratative
client just sends infpo
basically what i did for my deer npcs
is this:
but then if the parry is detected on the server you would have to take an extra step just to play the animation
because you would have to send the information to the client again
which will just cause more delay
yeah but u dont want the server to play anims if u can fight it
im pretty sure the client playing the animation might be just as fast
wdym by "can fight it"
well the client has as many fps as the client (the user) has
what i do for my deer npcs is this: server checks if no players are near, then anchors them, to not cause strain on server, and it doesn't play aniomations, just sets the states, idle, run, walk, and the client detects states of npcs near them and loads the animations
and taking the time client and server need to communicate in account is still important
especially if you communicate 3 times
to play something that should be responsiv
Well that is what i would recommend
don't worry about optimization so soon
premature optimization is your times worst enemy
I'm just recommending something to you, you don't have to listen to me
my game is damn near finished, i just want to make imporvements
Then go for it 👍
im gonna test to see if playing the attack anims on client is better
** You are now Level 7! **
...that's just a localscript. generally shouldn't give this particular advice
if newbies start doing this a lot, it will make helping them harder down the line because neither they, nor anyone helping them, would consider this to be a source of a problem, which it very much can be, e.g runcontext=client script in starterpack will run twice.
same for runcontext=server
even less of a good idea when you're telling people to do this when you barely understand it yourself
... thats usually the other way around. clients are very limited fps. servers are practically unlimited
this is still a good idea however; no computer is actually unlimited, and roblox will throttle. best to spend your resources around the player instead of things no one can see
it's true, if you cannot make it once, it doesn't matter how optimized or fast it doesn't work
if you already have it working, great! stick with that.
... but there will always be a noticeable delay. You cannot escape the fact of network latency. You can move it, or try to hide it, but you cannot eliminate it entirely. there is no "always better", it depends on what you're doing.
there's always more than 1 way to do things.
switching to server authority is not an improvement, it is a choice. it is good for some games but not others.
How does this come to what I said?
I have it inside the npc
@civic dust I swear the server was capped at 30 fps and someone made it a point to me to prove this so I believed them, I just looked it up and now it’s saying generally it’s 60?? I’m confused
roblox runs at 60fps, not 30, though networking rates may be subject to throttling
As for my deer method, does this seem performant? I make all clients handle the animations, and the server just handles the deer, if a player isn’t close to a deer it’ll get anchored and stop doing anything, so basically it gets unloaded, and if a client is near, the deer will begin moving again as normal… I was thinking of getting rid of humanoids and making my own custom ones for npcs just using simple body movers n stuff but not sure if that’ll be better or worse seeing as humanoids are built into studio
Ur thoughts?
performance is not the issue
you haven't decided on a way to do it yet, and likely haven't gotten the latency hidden yet
or maybe you have
idk you weren't quite clear on that
There’s not really any latency with playing the anims on client
Even with 50 deer all in the same place
Haven’t done any crazy tests with like 500 Deer
i suggest you do those tests and find out what your limit is
coz it may already be enough
can't optimize past 60fps y'know
What about custom humanoids though
Can you answer my question on that
Aren’t regular humanoids like imbedded in studio in c++ or something
roblox has 3 different types of humanoids at the moment
well 2~3-ish
a few years ago i'd say yeah probably, since humanoid is a bit bloaty
and a bit jank, lacks control etc
it's not something a beginner can feasibly achieve tho
Wait what? They added more humanoids
roblox has the standard humanoid, obv, it also has ControllerManager and has had this for quite a while, and recently they're building up to releasing new humanoid https://devforum.roblox.com/t/studio-beta-avatarabilities-library-for-a-luau-based-character-controller/4403904
see also https://devforum.roblox.com/t/avatar-joint-upgrade-for-physically-simulated-character-movement-is-now-live/4298561
so roblox is doing a fair bit of work on the humanoids already.
so... could you make your own humanoid? yeah you probably could. You could make your own pathfinding algorithm too with A*. But are you going to do better than roblox? ... Prooobably not, at least not without a looot of battletesting in live servers.
much benching, all sorts of work needed
so imo just go with what you have and, when you have a real performance problem, worry about it then
e.g does your game actually need 500 deer, or is 50 more than enough?
I mean, they’re all gonna be spread out, it’s a pretty big map, and the Deer won’t all be around each other
ya only way to know is try it out