|
| 11 Aug 2016 06:22 AM |
| I'd love to add NPCs walking around my game, I'm just wondering how much lag this would cause? How many do you think I could realistically add considering I'm planning on building a big fairly detailed city for the game too. |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2016 07:14 AM |
No, even an infinite amount of NPC's wouldn't lag if you knew how to do it.
|
|
|
| Report Abuse |
|
|
|
| 11 Aug 2016 09:54 AM |
| Thank you! I'll certainly try and do it efficiently then. You sure now? |
|
|
| Report Abuse |
|
|
Dodeca
|
  |
| Joined: 11 Sep 2011 |
| Total Posts: 13649 |
|
|
| 11 Aug 2016 10:16 AM |
Depends on the person's computer My experience with NPCs is that they don't really lag when theres a lot of them, but they're really slow. Go play Retail Tycoon, you'll notice that when its a full server with big stores that the NPCs will move slowly. |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 11 Aug 2016 10:17 AM |
| Last time I tried, the animations lagged but they moved at the desired walkspeed. I had about 100 going, though |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2016 04:15 PM |
| Hmm, okay thank you very much guys! You've been very helpful! |
|
|
| Report Abuse |
|
|
67high
|
  |
| Joined: 07 Jan 2009 |
| Total Posts: 542 |
|
|
| 11 Aug 2016 04:20 PM |
Yeah at retail tycoon when there's a lot of NPCs on full server with large stores I notice there will be lag spikes where the NPCs keep walking straight without turning and their animations slow down.
|
|
|
| Report Abuse |
|
|
|
| 12 Aug 2016 01:55 AM |
As I said before it's possible to have an infinite amount of NPC's without any lag. All you have to do is just create NPC's in a close proximity to the player instead of having them all over the map. This is how games like GTA do it and it is the best option so far.
|
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 12 Aug 2016 03:28 PM |
^ this
An efficient way would be to create NPCs and put them into the hacky local workspace (workspace.CurrentCamera) and only create them within a certain range |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 12 Aug 2016 03:47 PM |
"even an infinite amount of NPC's wouldn't lag if you knew how to do it." This is pretty misleading.
The short answer to OP's question is yes, a walking NPC will put a certain strain on processing, but so will literally_every_other_component_of_your_game, such as other moving parts, projectiles, animations, all that stuff. The question is not "does it create lag", it's "how can I minimize the lag caused by doing it."
If you control all of your NPCs movements from one designated script, and code (a reasonable number of NPCs) with efficiency in mind, the effect of a couple dozen walking NPCs should be negligible. You can, likewise, proceedurally generate the NPCs as mentioned above.
|
|
|
| Report Abuse |
|
|
jody7777
|
  |
| Joined: 22 Feb 2009 |
| Total Posts: 1343 |
|
|
| 12 Aug 2016 03:56 PM |
well you could always distribute the pathfinding calculations onto the clients pc's :l
FOR THE CAUSE |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2016 05:45 AM |
| Thank you guys! You've been a great help. |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2016 06:02 AM |
yes, actually, it will FPS lag if you are near alot
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2016 06:14 AM |
FPS drop is simple from high number of parts being rendered. The fact they are NPC's doesn't change anything
Since NPC's are almost always visual, do create and animate them on each client, based on an array of positions + states on the server. This way you don't create unnecessary ping/connection issues
|
|
|
| Report Abuse |
|
|