17.5.20

MOO2 1.50.18 and the nebula fix

The latest 1.5 version does now include nebula related bug fixes. Let me try to explain the bug fixes after a short introduction how nebulae work.

In MOO2, the nebula related calculations are always based on the nebula pics which are used in the huge galaxy size. There are 12 different kinds of nebulae in use and they are stored in STARBG.LBX. Between the MOO2 coordinates and the Nebula picture pixel size is a conversion factor of 3 in use, i.e. that a nebula picture with 80px*80px will cover a 240*240 area in the Galaxy map. A star is considered “in nebula” if the respective pixel value of the nebula picture is greater than 5.

a)    In a first step, it is checked if a galaxy coordinate is within the area covered by the nebula picture.
b)    In a 2nd step, the pixel value is checked.

In both steps we observed bugs. In the following example - where Sutul is considered in nebula – actually both bugs occur:

a)    So far, the first check, if a coordinate is within nebula picture was done after a division with the conversion factor 3. Since results of divisions are truncated in MOO2, it could happen that coordinates slightly outside the nebula picture area (on left or upper edge of the nebula picture) were not excluded from step b. This is fixed now in 1.50.18 - the respective check is done without division (and truncation issue).

b)    After the first check the respective pixel value is determined. Here Alexey pointed out that MOO2 assumes a picture header size of 16 bytes whereas Grig de Griz help files pointed out that it is actually 20 bytes. So the “in nebula” area was actually shifted 4 pixels to the right and this shift could also result in new “in nebula” areas on the left edge of the nebula picture as highlighted here in the 3rd pic "2neb09_bug.bmp":


2nebula09.bmp: nebula picture of nebula09 in the STARBG.LBX
2neb09_18.bmp: the correct 'in nebula area' since 1.50.18
2neb09_bug.bmp: the buggy 'in nebula area' in all previous versions
2neb09_diff.bmp illustrate the differences of this bug fix:
Brown red areas were 'in nebula' in previous versions but are no longer 'in nebula' in 1.50.18.
The light purple areas were 'not in nebula' in previous versions but are now since 1.50.18.
This illustrates that the ‘in nebula area’ is now slightly shifted to the left by the before mentioned 4 pixels. Additionally, the artefacts on the left disappear.

Here is an overview of all the other nebulae:
For a detailed view, check it here: https://photos.app.goo.gl/v98gwapPFinDoY1f8

Maybe, the buggy in nebula calculations of the previous versions were one of the reasons why they disappeared from the standard multiplayer settings. Especially, when one of the players was surprised by the in-nebula result directly in the battle screen - it is pretty unfair. Now they work as intended and I would recommend them for mirror maps. (So far, the nebulae are not exactly mirrored - but this can be modded soon.)

Please note, even in the deepest nebula there are sometimes a few dark pixels (see the detailed overview for examples) - so in rare cases a star which appears deep in the nebula is actually not in nebula. But this was intended by the Devs and is not considered a bug.

No comments: