Latest Posts

Topic: Remove addon from map

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2498
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2023-03-02, 14:26

Because of some spare time i was working on a new map. Now i have a problem with not used add-on:

Unfortunately i had the Impassable water addon enabled when starting to work on the map. But i don't use any of the terrains of the Impassable water add-on. Since i am close to publishing the map i wanted to remove the reference to that add-on. I removed the entry addons="impassable_water.wad:1.3" in the file elemental but now i get an error when trying to load the map in the editor:

ERROR:   FATAL EXCEPTION in editor: terrain: DescriptionManager::load_description: Object 'water_lily' was not registered

grepping over the map there is another reference in binary/terrain. Because that`s a binary file it can't be fixed easily. Why is there a reference although the map does not use this terrain? And how to fix that?

I remember we talked about such issue, but can't remember where or what the result was.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 17:07
Posts: 2006
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2023-03-02, 18:33

The map terrain packet performs an optimization to significantly reduce packet size and speed up loading and saving. Terrains are identified by name, and it would be extremely inefficient to save a long terrain name for every single triangle. Instead the terrain packet creates a dictionary that maps terrain names to indices and saves only every terrain's index.

In order to further speed up saving, we simply create the dictionary for all known terrains, not just the actually used ones. This is something you cannot manually repair at all, not even with a good binary editor. Checking which terrains are actually used and only writing the mapping for these to the binary would be somewhat slower during saving, but doable, and then resaving a map with such a change would allow you to remove the add-on dependency. We'd just have to pay attention to efficiency – terrain saveloading is fast only because of all these optimizations.


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2498
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2023-03-03, 09:22

Thanks for the explanation.

Hm, that's a pity. Imagine one has several world addons enabled... that means every terrain (something else?) is part of the map. I think this needs overthinking. From my understanding this means if a world add-on gets deleted on the server, each map that refers to this addon (if a terrain is used on the map or not) can't be loaded anymore.

bug report


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote