minetest/games/devtest
HybridDog cda112493a
Faster blit_with_alpha() (#14448)
* Add test nodes for alpha compositing and the fill texture modifier

Texture test nodes can be helpful to test if `blit_with_alpha` works correctly.

The alpha compositing test node covers different cases where pixel colors are mixed with each other.
The test currently fails because `blitPixel` does not work correctly if a semi-transparent color
is drawn on top of another semi-transparent color.
The test nodes for the fill texture modifier show if the size and position arguments of the modifier work correctly.
They do not cover special cases such as very large or negative position or size values.

* Faster blit_with_alpha()

The `blit_with_alpha` function has a noticeable effect on the time it takes to join a game.

To reduce the join times, I replace the `blit_with_alpha` function with a new one:
* It does not uses floating-point numbers.
* It directly operates on the raw pixel data instead of using the comparatively
  slow `setPixel` and `getPixel` functions from Irrlicht.
  Only ECF_A8R8G8B8 base images are supported now.
  If the top image does not have the ECF_A8R8G8B8 color format, it is converted;
  I assume that this happens rarely.
* There are case distinctions for fully opaque, fully transparent and semi-transparent pixels.
  This empirically increases the performance since the mixing between two semi-transparent happens rarely.
* The new function no longer has the `src_pos` argument since it was always the zero vector.
* The function is only documented once where it is declared.

For backwards compatibility, `blit_with_alpha` still mixes colors without gamma correction.
`blit_with_alpha` nonetheless behaves slightly different than before:
If a semi-transparent pixel is drawn on top of another semi-transparent pixel,
the color is mixed in a way which we can consider to be more correct now.
2024-03-19 19:56:47 +01:00
..
menu Optimize PNG files (#13509) 2023-10-09 17:13:44 +02:00
mods Faster blit_with_alpha() (#14448) 2024-03-19 19:56:47 +01:00
.luacheckrc Add API for restoring PseudoRandom and PcgRandom state (#14123) 2024-01-16 23:20:52 +01:00
LICENSE.txt Rename “Minimal development test” to “Development Test” (#9928) 2020-05-26 00:17:52 +02:00
README.md DevTest: Remove experimental mod 2022-10-23 21:58:56 +02:00
game.conf Deprecate game.conf name, use title instead (#12030) 2022-05-21 16:23:30 +01:00
screenshot.png Rename “Minimal development test” to “Development Test” (#9928) 2020-05-26 00:17:52 +02:00
settingtypes.txt Devtest: Remove testnodes_show_fallback_image 2021-04-05 13:37:58 +02:00

README.md

Development Test (devtest)

This is a basic testing environment that contains a bunch of things to test the engine, but it could also be used as a minimal testbed for testing out mods.

Features

  • Basic nodes for mapgen
  • Basic, minimal map generator
  • Lots of example nodes for testing drawtypes, param2, light level, and many other node properties
  • Example entities
  • Other example items
  • Formspec test (via /test_formspec command)
  • Automated unit tests (disabled by default)
  • Tools for manipulating nodes and entities, like the "Param2 Tool"

Getting started

Basically, just create a world and start. A few important things to note:

  • Items are gotten from the “Chest of Everything” (chest_of_everything:chest)
  • When you lost your initial items, type in /stuff command to get them back
  • By default, Creative Mode activates infinite node placement. This behavior can be changed with the devtest_infplace setting
  • Use the /infplace command to toggle infinite node placement in-game
  • Use the Param2 Tool to change the param2 of nodes; it's useful to experiment with the various drawtype test nodes
  • Check out the game settings and server commands for additional tests and features

Confused by a certain node or item? Check out for inline code comments. The usages of most tools are explained in their tooltips.

Example tests

  • You can use this to test what happens if a player is simultaneously in 2 nodes with damage_per_second but with a different value.
  • Or use the Falling Node Tool on various test nodes to see how they behave when falling.
  • You could also use this as a testbed for dependency-free mods, e.g. to test out how your formspecs behave without theming.

Random notes

  • Textures of drawtype test nodes have a red dot at the top left corner. This is to see whether the textures are oriented properly

Design philosophy

This should loosely follow the following principles:

  • Engine testing: The main focus of this is to aid testing of engine features, such as mapgen or node drawtypes
  • Mod testing: The secondary focus is to help modders as well, either as a minimal testbed for mods or even as a code example
  • Minimal interference: Under default settings, it shall not interfere with APIs except on explicit user wish. Non-trivial tests and features need to be enabled by a setting first
  • Convenience: Have various tools to make usage easier and more convenient
  • Reproducing engine bugs: When an engine bug was found, consider creating a test case
  • Clarity: Textures and names need to be designed to keep different things clearly visually apart at a glance
  • Low loading time: It must load blazing-fast so stuff can be tested quickly