105 Commits

Author SHA1 Message Date
Aaron Suen
3e262c0a17 Avoid soaking cache collisions
It's possible multiple soaking ABMs are registered
against a single node, and if this happens, make sure
that the qty and time fields in the cache are kept
separate the same way they are in the node meta.
2021-12-07 23:01:14 -05:00
Aaron Suen
25e0219ad8 Desynchronize node ambient sounds
- Removes repeating patterns, creates a richer and
  fuller sound experience
- Larger areas fill sound volume out better instead of
  just repeating more loudly
- Spread network traffic across multiple ticks better
  to reduce packet spikes

Each node position has a set delay, between 0 and 1
second, that's fixed for that pos but varies more or
less randomly between positions.  This ensures that
sounds loop with the same frequency and alignment
for a given single node, but desync across nodes.
2021-12-07 00:57:33 -05:00
Aaron Suen
ca694993c9 Un-delay inverted ABMs
Instead of queueing inverted ABMs and then running
them out-of-band, run them inside the normal ABM
schedule time.  This should:
- Prevent ABM mux lookup problems caused by nodes
  changing after a delayed inverted ABM schedule and
  the action actually running
- Allow the ABM scheduler to better account for the
  time spent running inverted ABM actions, to ensure
  that they properly count against the default 0.2s
  ABM runtime budget and can't spike lag up higher.
2021-12-05 14:11:01 -05:00
Aaron Suen
bf744aab8b Fix excess meta writes in soaking API
It didn't seem to affect many test cases, but avoid
excess calls to meta:set_*() due to 0/nil disagreement.
2021-12-05 09:10:43 -05:00
Aaron Suen
f412b7f570 More extensive ABM statistic reporting 2021-12-05 09:04:17 -05:00
Aaron Suen
8bf23e6f0a Fix DNTs not being reset on node replace
Invalidate DNT cache when nodes are changed and
force it to be re-read from meta, as meta was also
likely cleared during that operation.
2021-12-03 23:02:31 -05:00
Aaron Suen
f7461414d2 Move lazy raycast into playerstep API 2021-08-06 21:33:23 -04:00
Aaron Suen
a0d2abfe3a Fix missed DNTs 2021-08-05 21:09:01 -04:00
Aaron Suen
4f9d756c3f Fix DNTs not firing without nodenames 2021-08-05 20:50:03 -04:00
Aaron Suen
81ef696bce Clear soaking meta cache on node replacement
Ensure that when meta is implicitly cleared by node replacement,
the cache doesn't keep an old copy and fast-forward through
soaking recipes if the old node is re-replaced later
2021-08-05 08:10:42 -04:00
Aaron Suen
6aafecf475 Optimize soaking check for dirt leaching
This was triggering on all dirt nodes everywhere, so optimize the
most common code path, i.e. one where there is no water above
and the soaking data must be reset.
2021-08-05 08:02:48 -04:00
Aaron Suen
0435e6af32 Rewrite core DNT API
- Store next runtime instead of countdown, so metadata always has
  one canonical representation for a given target time, allowing
  us to more easily avoid rewriting the same data with different
  representation.
- Tons of caching and duplicate write avoidance, reduced resetting
  of node timers, and MT API calls in general.
2021-08-05 07:36:14 -04:00
Aaron Suen
ffb25a9162 More exact DNT names
Keep actual name of DNTs distinct and self-describing instead of
relying on modname, which sometimes changes when things are
refactored.
2021-08-05 07:35:20 -04:00
Aaron Suen
dd009343f9 Fix DNT retriggering bug 2021-08-04 17:15:04 -04:00
Aaron Suen
19652c2fe1 Begin major rework of nodenames matching, autostart DNTs
- Unify logic for expanding nodenames/itemnames lists into indexes
  of matching names, and comparing item names/defs to lists,
  with group expansion and deferral.
- Add "autostart" option to DNTs which registers construction traps
  and a patrol ABM automatically, use for some things that are a
  good match.
- Note that some things are doing more complex logic in ABMs, such
  as determining if a node is eligible, or custom timing logic;
  leave these as-is for now.
2021-08-04 07:41:00 -04:00
Aaron Suen
964f2c5044 Make sure glass DNTs are queued 2021-08-03 21:08:57 -04:00
Aaron Suen
00b3dc477a Unified fluid wandering system
- New fluid wandering API, mostly unified logic, only needs
  some parameters, plus the "generation check".
- More sophisticated behavior seeking down-slopes beyond simple
  immediate flowing node reach ("subtle slope" detection).
- More reliable timing using DNTs.
- Set firm movement rate of concrete, molten glass.
- Reduce molten glass generations, since it can now be more
  reliably directed.
2021-08-02 07:17:51 -04:00
Aaron Suen
1f913bf402 Merge branch 'dev' into fluidwander 2021-08-02 07:55:11 -04:00
Aaron Suen
068e9b6995 Remove debugging code 2021-07-11 14:51:35 -04:00
Aaron Suen
e24112a2d9 Fix soaking with cache
Soaking recipe fails will result in a lot of clearing
of old soaking values out of node meta, which is
very slow in the common case of e.g. dirt that's
not near water and thus should not be soaking in
the first place.

Skip node meta writes if the node meta already
contains the correct data, by doing a cached read
and check before writing, instead of blindly
writing.
2021-07-11 14:50:33 -04:00
Aaron Suen
03948cfe0f In-memory cache for soaking
This speeds up performance of soaking API by
quite a lot, especially in the more or less
pathological case of soaking dirt to sand, which
involves clearing the metadata from thousands
of nodes each run.  Knowing that the nodes
had already had their metadata cleared is
very helpful.
2021-07-11 14:36:55 -04:00
Aaron Suen
4be7398ff4 Fix setting interval/chance in soaking 2021-07-11 14:13:04 -04:00
Aaron Suen
cf8364199c Simplify soaking metadata clearing 2021-07-10 11:25:49 -04:00
Aaron Suen
9fb4cf55b2 Deprecate register_limited_abm
This has just been an alias to minetest.register_abm
for a while now, and all ABM enhancement features
have been added directly to the core API.
2021-07-10 11:09:44 -04:00
Aaron Suen
15936859c3 Persist stasis in modstore, not settings 2021-07-10 08:14:08 -04:00
Aaron Suen
3d2f449532 Checkpoint: start work on fluid wandering API
The idea is to unify cement and glass flowing, plus
add additional features: if there is no available
space, try to find the nearest dropoff to wander
toward even if flows can't actually reach it (assume
that the terrain subtly slopes that way).
2021-06-18 18:26:51 -04:00
Aaron Suen
4333c85d47 Fix ABM inversion with multiple candidates
This was apparently causing sand not to cook if it
had another sand node on top of it, because the
inverted cooking ABM would detect the top sand
node only and not process the cook check for the
lower one.
2021-05-28 14:47:32 -04:00
Aaron Suen
c227aa99f5 Fix ABM statistics 2021-03-25 18:28:54 -04:00
Aaron Suen
4b82eb6d56 Small DNT API cleanups
- Auto-remove deprecated DNTs
- Auto clear meta if no DNTs pending
- Remove redundant code
2021-03-24 06:51:07 -04:00
Aaron Suen
c1588a7656 Combined fair inverse ABM queueing 2021-03-23 21:00:25 -04:00
Aaron Suen
7fd51c1a6c ABM "inversion" API
This is useful when we want to perform an
action on a commonly-occuring node (like
sand or item stacks) with a requirement of
a neighbor of a less common node type (like
igniters).  Checking for B with A nearby can
be a lot faster than A with B nearby if B is
less common, so fewer neighbor checks
actually need to happen.

This was already done "manually" for the
flammable/igniter interaction, but now this is
a general API for all ABMs, that allows the
inversion to be done nearly transparently
with just a flag in the definition, and so the
ABM rules can be written more simply, with
the inversion handled elsewhere.

TODO: Rewrite current manual-inversions,
including the ones for flammable/igniter and
lava/stone hardening/softening.
2021-03-21 12:08:08 -04:00
Aaron Suen
abc5dc2cd2 ABM statistics reporting 2021-03-21 12:04:44 -04:00
Aaron Suen
319a3f7480 Fix dynamic lighting staying after torch goes out 2021-03-09 18:29:32 -05:00
Aaron Suen
c10e80ef87 Set name in mod.conf as demanded by 5.5+ 2021-03-01 20:10:27 -05:00
Aaron Suen
51b5aa8b94 Playerstep microoptimization
Avoid calling get_player_name too much
2021-03-01 18:58:34 -05:00
Aaron Suen
32a5f30565 Merge in personal notes 2021-02-26 09:01:54 -05:00
Aaron Suen
dc912f776c Make sure all things have explicit descriptions
This avoids issues with the translation informer
including technical names in the translation source
2020-10-18 11:50:04 -04:00
Aaron Suen
6d39ebb77d Fix dynamic light DNT conversion 2020-09-09 10:15:48 -04:00
Aaron Suen
d95e7bb714 Disable timer-based light check for now 2020-09-09 10:00:13 -04:00
Aaron Suen
0a8583d4a5 Fix on_timer trap hook 2020-09-09 09:56:50 -04:00
Aaron Suen
d18eaf23fb Warn about missing mux for each node name 2020-09-07 23:23:20 -04:00
Aaron Suen
1e11f9d81e Remove compat hacks, bump min ver to 5.2+ 2020-07-14 08:20:46 -04:00
Aaron Suen
51def38621 Falling nodes honor stasis 2020-07-07 08:17:28 -04:00
Aaron Suen
478414385e Fix diagnostic for abm muxing 2020-07-02 00:10:16 -04:00
Aaron Suen
dafc220207 Allow DNTs to recheck
This should hopefully allow the "broken ziprune"
bug that happened on the Community server to
heal itself eventually if it happens again.
2020-07-01 22:17:49 -04:00
Aaron Suen
b5accf9d90 Allow force-resetting DNT timer 2020-06-28 17:15:32 -04:00
Aaron Suen
9b5db81149 Document DNTs 2020-06-28 17:05:53 -04:00
Aaron Suen
0eee06c8ea Officially retire the ABM laundering hack
Never saw any empirical evidence that this
helped one bit.
2020-06-27 21:01:23 -04:00
Aaron Suen
068937c482 Remove ABM laundering
See if this helps smooth out performance
issues in 5.3+.  It was never confirmed to
increase the number of ABMs we were able
to successfully process anyway.
2020-06-27 19:22:00 -04:00
Aaron Suen
085f700982 Fix ABM muxing, maybe?
Results so far are quite good: reduced ABM
total count from 82 to 36 (~60%) and got it
under the magic cache limit of 64.
2020-06-27 17:36:42 -04:00