Author Topic: Minor changes to entities  (Read 1176 times)

Offline luisc99 (OP)

  • Staff Member | Administrator
  • Cheese
  • *****
  • Posts: 1440
  • Llamas: 60
    • View profile
Minor changes to entities
« on: 27 March 2020, 06:46:28 PM »
Hi all,

Like you probably have, I've noticed the server is lagging a bit. What you might not know is that I ping the server every minute to check it's okay, and if the TPS is less than 10, I get a notification on my phone. Every minute. I just checked, and in the last 7 days I've had 551 notifications. Here's what I've done to try and fix it.

Firstly, I checked to see what was causing the lag. Turns out, unsurprisingly, it's lagging because each tick is taking longer than 50ms to run. In the hour that I timed everything for, ticking entities in the main world and the End took up 98.19% of a tick's time, meaning everything else has to try and squeeze into the other 1.81%, which it can't do. This causes it to spill over into the next tick's timeslot, which dominoes on until it manages to catch up, usually because one or more of you will time out, so it can unload a bunch of chunks and free up time.

To try and solve that, I've changed how entities tick. For starters, entities won't activate until you're closer, and they won't track you as far now. If you want exact numbers, they're in the first reply to this thread. For what it's worth, VC has always had slightly different numbers to Vanilla, so much so that I'm not even sure what Vanilla uses any more. I've also lowered the spawn cap ever so slightly, so less mobs should try and spawn at any one time. Finally, items and XP should merge from slightly further away.

Most of you shouldn't notice any major difference with this in regards to gameplay, except hopefully less lag. If you have any farms or anything that's been broken by these changes, please let me know, and I'll try and work with you to tweak the settings a bit to fix it. I don't want your work to go to waste.

These changes will take effect at the next schedules restart (2020-03-28 05:00:00 GMT)

Let me know if you notice any improvement to the server's performance after tomorrow. My script will continue to monitor it, so I should get a nice chart on the VcStatus page, but I'm interested in hearing what you guys think

- Luis

EDIT 2020-03-31: Minor changes to spawn caps following feedback, see below for specifics
« Last Edit: 31 March 2020, 04:11:16 PM by luisc99 »

Offline luisc99 (OP)

  • Staff Member | Administrator
  • Cheese
  • *****
  • Posts: 1440
  • Llamas: 60
    • View profile
Re: Minor changes to entities
« Reply #1 on: 27 March 2020, 06:49:24 PM »
Specific numbers
Most of you can probably ignore this post, it's just for the curious

Code: [Select]
entity-tracking-range:
  players: 128
  animals: 16
  monsters: 32
  misc: 64
  other: 64

entity-activation-range:
  raiders: 32
  animals: 16
  monsters: 24
  misc: 8

merge-radius:
  item: 4.0
  exp: 6.0

spawn-limits:
  monsters: 48
  animals: 8
  water-animals: 4
  ambient: 2
« Last Edit: 13 April 2020, 04:50:45 PM by luisc99 »