Desour 6df61ad401 Fix lag explosion and secondary lag spikes
After a lag spike, the dtime is unproportionally high. We don't want to
overcompensate if that happens.

* If it's lavaplop itself that caused the lag spike, the next step would cause
  even more lag, and dtime would monotonically increase (lag explosion).
* If the lag spike was caused by another mod, and we'd just make a wave of
  plops, which is ugly, and won't help.
  And we might cause the current step to take a little longer. Together with
  other mods doing the same, or if the lavaplop settings are cranked up, this
  would cause a secondary lag spike. In the end, the spike would be enlonged
  and only die down slowly.
2024-08-14 21:41:57 +02:00
2024-08-13 01:30:02 +02:00
2024-08-13 00:40:03 +02:00
2024-08-13 00:40:03 +02:00
2024-08-13 00:40:03 +02:00
2024-08-13 00:40:03 +02:00
2024-08-13 01:47:12 +02:00
2024-08-13 01:30:02 +02:00
2024-08-13 01:30:02 +02:00
2024-08-13 00:40:03 +02:00

Lavaplop

Make your lava plop!

Supported games

The following subgames are explicitly supported:

  • devtest
  • Minetest Game (MTG)
  • Minetest Classic
  • Hades Revisited (and also Hades I guess)
  • mineclone like games (VoxeLibre, Mineclonia)

More can be added easily, see game_support.lua. PRs welcome!

Mods can also use the API (see below) to make their own nodes plop.

API

To register your node as a plopper (ploppers are nodes that plop), add the following to your node definition:

groups = {..., lavaplop_plopper = 1}, -- (unused yet, but good to have anyways)
_lavaplop = {
	plopper = {
		-- the plop sound.
		-- if `nil`, the provided sound will be used
		sound = SimpleSoundSpec,
	},
}

Settings

There are several settings, please consult the mainmenu.

If you're a layman, please note that if you crank up the settings too much, and the game seems to still be responsive, the server thread might already be overloaded, ruining your playing experience in other ways. Check your max_lag value in /status. If you're not a layman, uncomment the line print_perf() line.

Implementation details

The mod does not use abms or node timers. Instead, it randomly picks nodes around the players on each globalstep, and checks if the node is relevant. The main reason why I made this mod is because I wanted to try out how good this works.

The result are, roughly, on average, with default settings if not mentioned otherwise, for a single player in singleplayer (60Hz (17 ms) server steps):

`check_radius` | number of checks (s^-1) | time used per step (ms)
---------------|-------------------------|------------------------
10             | 64                      | 0.05
20 (default)   | 780                     | 0.09
30             | 2900                    | 0.15

Sounds sources

The sounds were generated using sfxr. The parameters for the sounds can be found in sounds_src/. They were exported on a machine where sizeof(int)=4, sizeof(float)=4, and sizeof(bool)=1.

Licensing

The project uses REUSE.

See also LICENSE.md.

Description
No description provided
Readme 142 KiB
Languages
Lua 100%