cataclysmbnteam / Cataclysm-BN

Cataclysm: Bright Nights, A fork/variant of Cataclysm:DDA by CleverRaven.
https://docs.cataclysmbn.org
Other
672 stars 265 forks source link

Can't add power grid to Isherwood farm #1867

Open Firestorm01X2 opened 2 years ago

Firestorm01X2 commented 2 years ago

Describe the bug

Can't add powwer grid to Isherwood farms by adding "ELECTRIC_GRID" flag to id "Isherwood Farms" Cataclysm-BN\data\json\overmap\overmap_special\specials.json

Game simply freezes while I closing to Isherwood Farms. Game seems trying to load huge power grid.

Steps To Reproduce

  1. ELECTRIC_GRID" flag to id "Isherwood Farms" Cataclysm-BN\data\json\overmap\overmap_special\specials.json 2) Find Isherwood Farms to teleport to it 3) Get game freeze

Expected behavior

No freeze

Screenshots

No response

Versions and configuration

-

Additional context

No response

leoCottret commented 2 years ago

I tag it as a bug but can it be fixed?

Firestorm01X2 commented 2 years ago

Most likely it require either optimization of electric grid. Or some kind of location rework. Sadly, I can't answer more specifically. Maybe @Coolthulhu can answer.

Coolthulhu commented 2 years ago

I'll have to test this specific farm myself. I don't see why would it hang up completely. I would expect it to have very slow updates, but still load properly.

Grids aren't optimized all that much. To build a grid, the game scans all the submaps covered by the grid to add potential furniture from them. This requires loading the whole location into memory. If something causes the grid to be built more than once, the whole process is repeated.

It could be possible to have the grid-related data kept somewhere on the side, in some cache, so that when the grid is being rebuilt, it doesn't need to grab all the submaps (unless they changed since the cache was built).

I would expect the problem of slow loading to be related to loading the grid more than once in one map load. It shouldn't be this slow otherwise.