42 Commits

Author SHA1 Message Date
Aaron Suen
166cfe5f14 Mitigate excess server block sends
The problem was pointed out by Josh
(gitlab.com/krazy-j) in merge request !22.
Apparently MT is not very smart about marking
mapblocks dirty to send to clients based on
calling mt.set_node(), i.e. it will mark them
dirty presumptively even if you set the node to
the same value it had already been.

This behavior can be confirmed by registering
an ABM against a common node like grass and
setting action = minetest.set_node.  This
causes every mapblock containing that node
to be invalidated every interval, causing a big
spike in the packets received each interval
that you can clearly see on the F5 graph.

Rather than just fixing it for the most easily
observed case (fire checks), add utlity functions
to check this for ALL node change situations,
and apply it more or less universally anywhere
that we are not certain that the node is being
changed and we don't need to worry about the
extra overhead cost of the check.

Note that we don't need a
nodecore.set_loud_check call, as set_loud was
only ever being used already in cases where
we were pretty sure we were actually changing
a node.
2022-08-24 20:44:14 -04:00
Aaron Suen
4d05be735d Make fire ambiance a bit more audible 2022-01-23 17:41:00 -05:00
Aaron Suen
91e5c615c2 ABM delay, prevent "prompt critical" ignition
During processing of the flammable ignition ABM,
nodes could ignite, causing the new ember nodes
created by this ignition to trigger fire propagation
instantly during the same tick by nodes still yet
to be processed for ABM checks during the same
scan.  This often caused large areas of flammable
nodes, like wooden plank skyblocks, to be ignited
instantly in a specific direction from any source
ignition.  This led to some "cheap shots" where
players were ruined by fire far more rapidly than
they should be.

Instead of processing flammability checks in
sync, delay them until the next tick, so that we
find all flammables to check before any new
igniters are created.  This should tame fire
spreading back down to normal levels.
2022-01-22 16:20:10 -05:00
Aaron Suen
a1b2df3941 Begin standardization of unload bounds check
- New near_unloaded API that supports custom
  distance parameter, map bounds check, and
  some optimizations.
- Add area automatic unload check support to ABM
  API and add to applicable ABMs, replacing many
  old manual checks.

Note that the explicit unload check is only strictly
necessary when something will happen due to
a node NOT being present in the area, e.g. something
igniting due to absent coolant, or soaking quantity
being reset due to missing sources.  In simple cases
where the absence of a thing causes the ABM to do
nothing, then the standard check can work because
the default action is to do nothing anyway.
2021-12-18 11:28:14 -05:00
Aaron Suen
fd181833f4 Limit smoke effects, e.g. from concrete cure
Standardize a "fair limiting" mechanism that
limits the items accepted into a queue, and
returns a uniform random sample when flushed.

Pass all cooking/curing smoke effects into fair
limit queue.

Apply fairl limit queue to fire sparks too.

Pliant concrete curing checks still seem to lag
the server somewhat, but at least now they
shouldn't hammer the client with particles and
kill framerate too.
2021-08-19 22:19:27 -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
0b39c6703e Limit and spread out fire spark packets
Before we were generating one spark spawner for
each ABM run, which could run hundreds of nodes for
a large blaze, and bunched them together.  Instead,
push into a limited fair queue, and also spread the
actual spark spawning out across time to spread the
network traffic from fire.
2021-03-23 20:39:54 -04:00
Aaron Suen
4ad14dddba Fix remaining manual ABM inversions
- Fire (longest-standing)
- Stone hardening
- Lava renewal
2021-03-23 20:27:35 -04:00
Aaron Suen
7b6abce986 Fix fire ignition ABM
We were using the igniter's position instead of the
flammable's to check if the flammable had already
been tested, which caused fire not to spread fully
though large blocks of contiguous flammables, and
biased the direction of fire spread where it did.

Thanks to Elon_Satoshi a.k.a. Copenhagen_Bram for
discovering, reporting, and helping to confirm that
this bug had a long history.
2020-09-09 21:59:49 -04:00
Aaron Suen
be3ac536cf Typo 2020-09-09 21:32:20 -04:00
Aaron Suen
46f1682600 Attempted fire ignition rework
- Add debug logging
- Raise the ignition check limit to 250%
- Atomic ignition queue management, to ensure that
  there's no chance of things getting "stuck" in the
  blacklist due to partial queue resets
2020-09-09 21:31:46 -04:00
Aaron Suen
d448a8ae98 Revert a possible broken perf optimization
The use of hash instead of string for pos was causing
a bug in doors some time ago where doors would
randomly fail to fire ... and then now we're seeing
reports of fire that refuses to ignite for some specific
planks...
2020-09-07 23:35:13 -04:00
Aaron Suen
eea966ff5d Fix some fenceposts 2020-09-07 23:32:13 -04:00
Aaron Suen
41e744b0e9 Apply ABM laundering at base level 2020-06-21 10:25:07 -04:00
Aaron Suen
984e87e155 Consistent ABM labeling
- Make sure every ABM has a label
- Use consistent case
- More concise names / consistent voice
2020-06-17 07:09:20 -04:00
Aaron Suen
e0156b4742 Add profiler instrumentation metadata everywhere
N.B. the MT built-in profiler doesn't yet actually support reading
labels from bare-function registrations, so a builtin hack is
needed.
2020-06-15 07:21:39 -04:00
Aaron Suen
55efdfa027 Fire ambiance consolidation
- Fire flame and torch flame use the same ambiance def via
  a new flame_ambiance group.
- Items can now emit ambiance via AISM.
2020-05-26 18:48:03 -04:00
Aaron Suen
25be3b07a8 Small pos key calc optimization. 2020-01-10 21:11:52 -05:00
Aaron Suen
b9e2f822f8 New flexible find_nodes_around api. 2019-11-30 10:28:35 -05:00
Aaron Suen
31bcefd842 Invert flammable/igniter checks.
This should improve game efficiency/smoothness when
a lot of flammable stuff is present but there are no
corresponding massive fires.

This seems to address runtime jitter issues noticed
after placing hundreds of coal nodes inside a forest.
2019-11-28 13:04:35 -05:00
Aaron Suen
0a29fd34e9 Clean up sound handling, fix floating point timers. 2019-10-01 19:24:39 -04:00
Aaron Suen
8aa95d1f61 Merge branch 'dev' into torch 2019-10-01 18:24:39 -04:00
GreenXenith
7647eb547a Add torches 2019-09-14 18:05:29 -07:00
Aaron Suen
8d850980d1 Try removing sparks on collision.
Didn't look right with sparks going through glass, and still
didn't look right having sparks hit glass and go sliding off
to the side at constant velocity.
2019-09-14 19:11:54 -04:00
Aaron Suen
974f0c2672 Having sparks go through solid glass is a bit distracting. 2019-09-14 19:06:22 -04:00
Aaron Suen
afc4d408c7 For now, remove direction bias of fire sparks.
After much discussion about things like wind velocity, it was
concluded that many fires are indoors or underground, and the
check to see if they're out in the open is not worth the cost.
2019-09-14 19:03:40 -04:00
Aaron Suen
9b9b14b173 Standard battery of auto formatting and optimizing. 2019-09-14 18:27:06 -04:00
GreenXenith
da9dea607c Add fire spark particles 2019-09-14 14:42:29 -07:00
Aaron Suen
4b1488ed3f Hints system overhaul.
- Included new content.
- Partially converted to base on recipes instead of just items.
- Added support for group and toolcap checks.

Fixed a number of small bugs elsewhere in the process.
2019-04-03 07:41:27 -04:00
Aaron Suen
fbff15e2fe MAJOR fire api/logic rework.
- Expanded fire api, added "check" varieties of things that also
  perform relevant checks for eligibility.  Standardized testing
  for ventilation.
- Snuff embers to coals as fuel.
- Fuel is consumed randomly by flames.  This means that fuel that
  are surrounded by flame burn out quicker, while flames
  surrounded by fuel consume fuel from each node slower.  This
  adds subtlety to furnace design for efficiency.
2019-03-31 20:54:38 -04:00
Aaron Suen
c09c8777e2 Fire ambiance.
This is the last currently known missing sound, finally.
2019-03-14 22:20:18 -04:00
Aaron Suen
9607bcc6a6 Start working on sounds, plus minor refinements.
- Clean up registered_* usage patterns.
- Reduce tendancy of leaves to create stack nodes.
  Now they tend to stack up properly in-world more often.
- Tweak damage system to create "headroom" where minor
  damage doesn't cost inv slots immediately.
- Make player hand skin color match model skin.
- Cleanup/unify grass abm logic.
- Start installing new sounds by MagikEh

Sound source:
  https://github.com/MagikEh/SoundsOfWarr
2019-03-13 23:51:59 -04:00
Aaron Suen
f893f613c3 API refinements.
- Make node match operate on only one of node or stack, depending
  on whether node defers to stack via is_stack_only.  This should
  hopefully prevent future pummel recipe issues.
- Add new core stack API.  Needs to be deployed in a lot of places.
- Start work on system for allowing flammable containers; they
  eject their potentially non-flammable contents.
2019-02-23 09:44:22 -05:00
Aaron Suen
d67f736ac5 Merge node_is into match. 2019-02-03 12:44:33 -05:00
Aaron Suen
37f5c0a0de Laid the groundwork for metal-working.
- Defined nodes, slabs, and prills of lode.
- Heating lode ore releases hot lode prills.
- Lode things in stack can air-cool to anneal or water-quench to
  harden/temper.  Cooling of placed nodes/slabs is planned.
- Hot items cannot be carried; picking them up causes damage and
  causes player to drop them.
2019-01-27 22:34:53 -05:00
Aaron Suen
aa69bca2b1 Fix fire not going out when completely immersed. 2019-01-23 23:16:03 -05:00
Aaron Suen
d61b50bf91 Lava starts fires, water douses them. 2019-01-23 23:06:06 -05:00
Aaron Suen
464a0e1d89 Finite fire rework.
- There are now 6 degrees of embers.  Better fuel sources will
  make better embers.
- Embers differ only in lifespan; each class lasts twice as long
  as the previous.  Top-grade fuels may last 15 minutes or
  longer.
- Embers decay stochastically.
- Embers decay 16x as fast when smothered, but still go through
  the same lifecycle.

Also:
- Plain ash now reposes.

There are no infinite fuel sources, nor are any specifically
planned at this time.
2019-01-17 00:01:00 -05:00
Aaron Suen
195a6a2f7f Added grass spread/decay.
Not super-important right now, but it was getting annoying.
2019-01-06 15:09:59 -05:00
Aaron Suen
f9abfc5e22 Fire refinements.
- Make some more materials flammable.

- Flammable items in stack form burn up too.

- Some items burn away without converting into fuel.
2019-01-06 14:51:09 -05:00
Aaron Suen
4440e1f0b8 Sticks burn up in presence of fire. 2019-01-06 14:26:27 -05:00
Aaron Suen
62f0db49e0 Fire mod is now basically functional.
"Qualitative" fire now works, spreads, etc.

Rub 2 sticks/staves together to start a fire in nearby flammables.
2019-01-06 13:04:07 -05:00