#loading npcs on the client side

1 messages · Page 1 of 1 (latest)

glossy heart
#

So there is a game "Restaurant tycoon" and there can be over 10000 customers/NPCs and obviously they are client sided but for a game like this how do they store and load them? Like they are saved in an array and when a client gets close to a restaurant it loads them? But ye, how to achieve that?

violet stag
#

There are many ways you can do this

#

One way is each store has a attribute saying how many customers it has then you clone them all when you get close to the store

#

Another way is to use invisible parts and when you get close to that invisible part you spawn the NPC

glossy heart
#

Or can i like have state property or something like that, so when they are spawned to know what they are doing?

#

Or position

#

I asked because mainly because for the "states" of the npc (not humanoid states) like the position, the task he is doing, how to save them, so when i load them they know what they are doing

#

I watched your tutorial on client npc with pathfinding and I don't know if i should have a position attribute and like a state attribute and change them from the server

#

And I don't really know how efficient will be for prob over 100k npcs in a game, every npcs with different position/state

#

Sorry if my English isn't good, isn't my native language

violet stag
#

its hard to say without knowing what the npcs will be doing and what their purpose is

glossy heart
#

Like if i have 2 players and 1 of them is in the restaurant and the other one is outside, the npcs will be spawned for the first player for the second - they won't be. But if the second player enters the restaurant he should see them the way the first player sees them. Like if they have moved while the second player is outside, when he comes inside they should be with the changed position

violet stag
#

you would have to use time to sync them

#

i dont think you could sync 10,000 objects using the network

#

so time would be your only option

glossy heart
#

Alvinblox has live streams on creating a game like Restaurant Tycoon so ig i will just wait till he goes to replicating the npcs on the client