HomeDownloadsJoin Discord

Hello, DEAR: In-Depth Dynamic Entity Activation Range Explanation & Configuration

By Paul
Published in Airplane
March 03, 2021
2 min read

Dynamic Entity Activation Range (DEAR) is one of the most impactful entity patches that Airplane includes, but there’s a lot of questions about what it changes. As well, the configuration is more difficult due to the numbers correlating more with the internal function of DEAR, so here we’ll explain it!

What does DEAR do?

Put simply, DEAR limits how often a mob decides to do something based on how far away they are from a player. That “something” is a pathfinder goal finding for most mobs, and for newly updated mobs (piglins, villagers) it’s their behavior engine.

An example of how this works is a goal that Blazes have, where they look for a nearby player to target. If they are far away from a player, they won’t check as often for nearby players, which results in a huge performance improvement for blazes!

How It Works Compared to Paper

Paper’s current implementation of this is hard-coded to the activation range. If you have an activation range of 100 blocks, any simple entity further than 100 blocks to a player will only have their pathfinder goals ticked 1 of 4 times. Their implementation doesn’t impact other entities like Villagers or Piglins, while also being unable to optimize entities variably.

How It Prevents Breaking Mechanics

For the most part, you won’t see any breakage of vanilla mechanics with the default settings. Entities will still attempt to move and do normal actions 100% of the time (except if they’re being limited by Paper’s Activation Range), they just choose to make a decision less often if they’re further away. Given Paper’s implementation was to tick these far away entities 1/4th the time, closer entities that end up being ticked 1/2th the time function closer to vanilla on Airplane than Paper does! As well, being able to configure this setting to choose how it’s used is a unique feature offered by Airplane.

Configuration

# Optimizes how entities act when
# they're far away from the player
[activation-range]
  # This value defines how often in ticks, the furthest entity
  # will get their pathfinders and behaviors ticked. 20 = 1s
  max-tick-freq = 20
  # This value defines how much distance modifies an entity's
  # tick frequency. freq = (distanceToPlayer^2) / (2^value)
  # If you want further away entities to tick less often, use 8.
  # If you want further away entities to tick more often, try 10.
  activation-dist-mod = 9

activation-dist-mod (default: 9)

This value represents how often an entity is ticked.

With the default value of 9, ticking would look like this:

Blocks Away from PlayerTicking Frequency
22 or less1/1
321/2
391/3
451/4
641/8
901/16
101 or more1/20

If you would like entities further away to tick more often, try upping the value to 10.

Blocks Away from PlayerTicking Frequency
32 or less1/1
451/2
551/3
641/4
901/8
1281/16
143 or more1/20

If you would like entities further away to tick less often, try lowering the value to 8.

Blocks Away from PlayerTicking Frequency
16 or less1/1
221/2
271/3
321/4
451/8
641/16
71 or more1/20

As you can see, small changes in the modifier result in huge changes to their ticking frequency. This is why only +1 or -1 changes to the modifier are recommended. For example, at a 7 modifier entities as close as 50 blocks get ticked only once a second! Most servers will gain enough performance with the default settings, although with a high amount of entities an 8 may be helpful.

max-tick-freq (default 20)

You may notice that in the tables above, anything above a certain block limit only had the entity ticking every 1/20 ticks. This is to ensure that entities update once in a while. However, if you’d like you can change this value to your liking.

  • If you’d like to have your activation range work similar to Paper’s, setting to 4 would limit the least an entity is ticked to 1/4 ticks (5 times a second.)
  • If you have a large view distance and entities super far away really don’t need to be ticked often, you could raise this to 40.

Otherwise, the default value is advised. If you’ve already tuned your activation-dist-mod, then it’s unlikely you’ll get much more performance out of entity decision making.

Finishing

Thanks for reading through this article! If you have any questions, join the Discord and ask our helpful community! If you need more performance, check out the other articles on our blog for more optimizations!


Tags

#airplane#optimization#configuration
Previous Article
Configuring Bukkit's bukkit.yml Quick and Easy for 1.16

Paul

Lead Developer

Topics

Airplane
Configuration

Related Posts

What is Airplane? A Rundown on Airplane's Unique Features
March 23, 2021
2 min
© Technove LLC 2021, All Rights Reserved.

Legal Stuff

Privacy NoticeCookie PolicyTerms Of Use

Social Media