Skip to content

How to handle NPCs #382

Answered by elementbound
rcorre asked this question in Q&A
Jan 18, 2025 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

You've perfectly described the two strategies I'm aware of 😄

I've personally used the latter, where I've moved the NPC simulation to the tick loop on the server, so state is completely owned and simulated by the host, and then synchronized via StateSynchronizer. That was the original motivation for adding that node.

If for whatever reason you want to make NPC simulation part of rollback ( e.g. it needs to interact with something that needs to be in rollback ), you can treat it as a player avatar controlled by the server as you've described. In this case, you could even experiment with input prediction, so NPCs don't always have to wait for the server before updating.

In my opinion, neithe…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rcorre
Comment options

@elementbound
Comment options

Answer selected by rcorre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants