ALiVEOS / ALiVE.OS

ALiVE Open Source GPL v2
http://alivemod.com/
Other
160 stars 80 forks source link

Indexing Kujari generates civilian power clusters with no center or size #812

Open Briggybros opened 6 months ago

Briggybros commented 6 months ago

Prerequisites

Description

Map indexing fails on Kujari with a zero divisor error in auto_appendClustersCiv.sqf

 1:07:50 Error in expression <elect 0;
private _positionY = _position select 1;

private _gridPosition = [_log>
 1:07:50   Error position: <select 1;

private _gridPosition = [_log>
 1:07:50   Error Zero divisor
 1:07:50 File x\alive\addons\fnc_analysis\fnc_sectorGrid.sqf..., line 331
 1:07:50 Error in expression <t["%1_%2",_sectorID select 0, _sectorID select 1];

if(_sectorID in (_gridData s>
 1:07:50   Error position: <select 1];

if(_sectorID in (_gridData s>
 1:07:50   Error Zero divisor
 1:07:50 File E:\grego\Documents\Arma 3 - Other Profiles\117Briggy\scripts\x\alive\addons\fnc_analysis\tests\auto_appendClustersCiv.sqf..., line 127

Steps to Reproduce

  1. Follow steps on http://alivemod.com/wiki/index.php/Map_Indexing with Kujari map
  2. Check staticData (+ .txt because github doesn't like sqf): tem_kujari_staticData.sqf.txt
  3. Continue with process
  4. Test indexing based on wiki steps

arma3_x64_2024-02-05_00-47-16.rpt.txt

Expected behavior: [What you expected to happen] Map index completes and testing the index (with the same wiki steps) shows civilian clusters around the map

Actual behavior: [What actually happened] Map index errors in log, but completes in game. Testing the index only shows civilian clusters around Marwey, Mourimadi, and Samari

marceldev89 commented 6 months ago

If you have any issues, re-index the map, set the Map Bounds (in the Indexer Module settings) to the size of the map rounded up to the nearest 1000, i.e. 5120 = 6000. Make sure you delete everything under the @ALiVE\indexing\mapname\x\ folder EXCEPT for your @ALiVE\indexing\mapname\x\alive\addons\main\static\mapname_staticData.sqf file. Edit your static data file where the ALIVE_MapBounds value is set. Ensure you select No to object categorisation (in the Indexer Module settings).

It's been a loooooong while since I did some indexing so I'm not quite sure if this error was related to it but I think so. Judging by the errors it seems like it wants to index something that's outside the actual map bounds causing the error. Setting the map bound in the module should fix that.

Briggybros commented 6 months ago

Setting the map bounds leads to the same error:

17:54:47 Error in expression <elect 0;
private _positionY = _position select 1;

private _gridPosition = [_log>
17:54:47   Error position: <select 1;

private _gridPosition = [_log>
17:54:47   Error Zero divisor
17:54:47 File x\alive\addons\fnc_analysis\fnc_sectorGrid.sqf..., line 331
17:54:47 Error in expression <t["%1_%2",_sectorID select 0, _sectorID select 1];

if(_sectorID in (_gridData s>
17:54:47   Error position: <select 1];

if(_sectorID in (_gridData s>
17:54:47   Error Zero divisor
17:54:47 File E:\grego\Documents\Arma 3 - Other Profiles\117Briggy\scripts\x\alive\addons\fnc_analysis\tests\auto_appendClustersCiv.sqf..., line 127

From the map view at least it doesn't look like there are any points outside of the sectors 20240206175619_1

marceldev89 commented 6 months ago

Can you try reducing the map bounds by 1000? Judging by the screenshot the sectors 16_* and *_16 or partly outside the playable area or something?

Briggybros commented 6 months ago

A size of 16000 gives the same error, and looks to be the size it was running at when no size was specified.

20240207222944_1

This size does have some points outside of the sectors though

20240207223011_1 20240207223018_1

Briggybros commented 6 months ago

Dig a bit more digging and the issue is caused by a sector not having a center point:

ALIVE_clustersCivPower is has a single cluster with an empty center:

[
    "#CBA_HASH#",
    ["c_105"],
    [
        [
            "#CBA_HASH#",
            ["nodes","center","size","clusterID","type","priority","debugColor"],
            [[143206: solarpanel_3_f.p3d,143207: solarpanel_3_f.p3d,143055: spp_panel_f.p3d,143054: spp_panel_f.p3d,142933: spp_panel_f.p3d],[],0,"c_105","CIV",40,"ColorYellow"],
            any
        ]
    ],
    any
]

From an outside perspective it feels like a cluster should always have a center and size?

marceldev89 commented 6 months ago

Hmm yes it seems like it. The center is literally just the center point of the sector so in theory all of them should have a center. 😅

Maybe try reducing it another 1000 or maybe try the original map bounds and then + 1000? I don't know, kinda out of ideas 😛

marceldev89 commented 6 months ago

By the way, did you fully delete the indexing folders when trying again? The only file that's ok to keep is the one with the building categories (tem_kujari_staticData.sqf.txt)

Briggybros commented 6 months ago

By the way, did you fully delete the indexing folders when trying again? The only file that's ok to keep is the one with the building categories (tem_kujari_staticData.sqf.txt)

Yeah, started with a clean index