#Client vs server npc anims

1 messages · Page 1 of 1 (latest)

slender tapir
#

Always better to play npc animations on client? What about for combat? Would there be noticeable delay?

stable glacier
#

For combat I personally use a server script set to client run context

cloud lotus
slender tapir
#

not true

cloud lotus
#

dang

stable glacier
slender tapir
#

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

slender tapir
stable glacier
#

Idk much about it

cloud lotus
slender tapir
stable glacier
#

I use it for a sim like combat game where u mostly fight npcs

cloud lotus
slender tapir
#

no, the server is still authoratative

#

client just sends infpo

#

basically what i did for my deer npcs

#

is this:

cloud lotus
#

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

slender tapir
#

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

cloud lotus
slender tapir
#

server runs 30 fps

#

client unlimited fps

#

server has limited power

cloud lotus
slender tapir
#

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

cloud lotus
#

especially if you communicate 3 times

#

to play something that should be responsiv

slender tapir
#

well right now i do it on the server

#

for my enemies that u can fight

cloud lotus
#

Well that is what i would recommend

slender tapir
#

ik but ima have a lot of npcs

#

and i see people recommending this

cloud lotus
#

don't worry about optimization so soon

#

premature optimization is your times worst enemy

slender tapir
#

but thats just the architecture for how npcs work

#

not rlly just optimization

cloud lotus
#

But your already worrying about there beeing many npcs.

#

But well

stable glacier
#

Just finish ur game bro and then maybe improve it later

#

If needed

cloud lotus
#

I'm just recommending something to you, you don't have to listen to me

slender tapir
#

my game is damn near finished, i just want to make imporvements

cloud lotus
slender tapir
#

im gonna test to see if playing the attack anims on client is better

pale krakenBOT
#

studio** You are now Level 7! **studio

slender tapir
#

thanks for ur help guys

#

will read on run context'

civic dust
#

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

civic dust
civic dust
civic dust
civic dust
civic dust
civic dust
#

there's always more than 1 way to do things.

civic dust
stable glacier
#

I have it inside the npc

slender tapir
#

@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

civic dust
slender tapir
# civic dust roblox runs at 60fps, not 30, though networking rates may be subject to throttli...

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?

slender tapir
#

But I’m gonna have a lot of nps

#

It’s a big map

civic dust
#

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

slender tapir
#

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

civic dust
#

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

slender tapir
#

What about custom humanoids though

#

Can you answer my question on that

#

Aren’t regular humanoids like imbedded in studio in c++ or something

civic dust
#

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

slender tapir
#

Wait what? They added more humanoids

civic dust
#

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?

slender tapir
#

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

civic dust
#

ya only way to know is try it out