Topic: loading of tribes

Ron_of_Nord
Avatar
Topic Opener
Joined: 2024-04-20, 23:43
Posts: 132
OS: Windows
Version: 1.3
Ranking
At home in WL-forums
Location: Land_down_under
Posted at: 2025-03-17, 07:36

I have a question that I'm unsure of where it should go as it happens both with the game and the map editor, so i' ll put it here.

When the map editor starts, it seems to load all the tribe's graphics ( workers, buildings etc) as it starts, I also have noticed this with some maps in the main game when I know those tribes are not being used, my question is why ? Why does the map editor load tribes graphics when they are not used creating/editing a map ? Why does the game load tribe graphics ( workers etc ) that are not needed ?
Surely if they are not needed they shoildn't be loading which would speed up the start up time. I've been noting this from thr start up display line that reports what's happening.

I know there is more than one question above,but they are all related. I can't understand why such loading should be necessary.
An example from just yesterday, I was starting a two player map barbarians vs atlanteans, and whilst I was waiting ,
I noticed that the game was loading the amazons , empire and the firisians then went on to tidying up after the map loaded. Just out of curiousity, I loaded the map into the editor to check what tribes were set ( it is one of my maps) because I couldn't remember if I had set default tribes for it, and on checking found out that I hadn't.. There seemed to be no reason to load all these tribes when only 2 where used.
Sorry for the long post, I checked all the posts and issues on codeberg but couldn't find where some one else had mentioned it.


The aussies are coming, ya ho! ya ho!

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2106
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2025-03-17, 10:14

If I remember correctly, the tribes are being loaded because the editor already creates the instances for all players in the map. An editor instance is basically a game with some features disabled and others added, so it needs its Players, and each Player needs a Tribe.

Not creating any players and instead treating them as an abstract set of values {name,position,tribename} might be more efficient, yes. However to me this is a case of "it just works; nobody touched it for ages; why change it and risk introducing regressions" …


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

In the game, only the tribes in use are actually loaded.

Note however that if you have any add-ons enabled that modify the existing tribes, these add-ons have no way of knowing which tribes are "needed" and always load all tribes they can modify, so add-ons can possibly load unused tribes.


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2640
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2025-03-17, 15:40

Nordfriese wrote:

Not creating any players and instead treating them as an abstract set of values {name,position,tribename} might be more efficient, yes. However to me this is a case of "it just works; nobody touched it for ages; why change it and risk introducing regressions" …

And maybe, some time, the editor becomes functionality for creating scenario's face-smile.png


Top Quote
Ron_of_Nord
Avatar
Topic Opener
Joined: 2024-04-20, 23:43
Posts: 132
OS: Windows
Version: 1.3
Ranking
At home in WL-forums
Location: Land_down_under
Posted at: 2025-03-17, 21:34

Nordfriese wrote:

If I remember correctly, the tribes are being loaded because the editor already creates the instances for all players in the map. An editor instance is basically a game with some features disabled and others added, so it needs its Players, and each Player needs a Tribe.

Not creating any players and instead treating them as an abstract set of values {name,position,tribename} might be more efficient, yes. However to me this is a case of "it just works; nobody touched it for ages; why change it and risk introducing regressions" …

I wasn't fully aware of how the editor works, I'll have to have a more indepth look into it's code, but as you said, if it works why change it.

Nordfriese wrote:

In the game, only the tribes in use are actually loaded.

Note however that if you have any add-ons enabled that modify the existing tribes, these add-ons have no way of knowing which tribes are "needed" and always load all tribes they can modify, so add-ons can possibly load unused tribes.

I will have a further look at the addon's. I don't have many, so I will have a look at how they modify things.

kaputtnik wrote:

And maybe, some time, the editor becomes functionality for creating scenario's <<face-smile.png>>

Something to look forward to.
I just wanted to understand why the game did these things to have a better understanding of it's mechanic's. I'm not all that good at c and cpp code, having said that I will have to go back and have a further look at the source code.
I don't want the add-ons I am working on to further slow the game's load time down.
Thanks for the notes and your patience, now I know a little bit more.


was edited by janus

Edited: 2025-03-18, 09:22

The aussies are coming, ya ho! ya ho!

Top Quote
Ron_of_Nord
Avatar
Topic Opener
Joined: 2024-04-20, 23:43
Posts: 132
OS: Windows
Version: 1.3
Ranking
At home in WL-forums
Location: Land_down_under
Posted at: Yesterday 01:13

Sorry Janus for the original state of my post , I had to cut and paste a lot. I'll know better next time


The aussies are coming, ya ho! ya ho!

Top Quote