Page 1 of 1

Role Weights and System Populator Run Times

Posted: Sat Sep 23, 2023 8:41 pm
by Nite Owl
Had a good long look at the Role Weights of the core ships, Griff's ships, and the many OXZ/OXP ships that inhabit my Ooniverse. Been doing this because many of the particularly nice looking OXZ/OXP ships have not been showing up with enough regularity to satisfy me. Fairly sure my understanding of how the Role Weights work is correct. As an example of where my current thoughts have lead me. If my Ooniverse has 10 ships with the variable role = "pirate"; (note lack of any weight numbers in parenthesis) then each of these ships has a 1 out of 10 chance of being called by the System Populator to create a Pirate Ship when a system is created. If role = "pirate (#)"; is used then the number in the parenthesis would change that 1 out 10 chance based on the positive (>1) or negative (<1) effect of that number.

Would giving all of the ships in my Ooniverse a Role Weight of role = [whatever role]; with no additional numbered weight in parenthesis cause the System Populator Run Times to increase by any significant amount? Currently this takes about 1 second with the very large amount of OXZ/OXP's that my Ooniverse consists of.

Thank You in advance for any and all answers.

Re: Role Weights and System Populator Run Times

Posted: Sun Sep 24, 2023 12:54 am
by Switeck
It could be a relative weight instead of absolute -- you have to consider ALL other ships' role weights before determining the odds of a particular ship appearing.

Re: Role Weights and System Populator Run Times

Posted: Sun Sep 24, 2023 11:28 am
by Alnivel
It shouldn't affect a populator run time significantly (or even at all) - if a role has no explicitly specified weight, it has an implicit 1.0 weight.

When the game loads ships, it creates probability sets for each role - essentially a list of shipkeys and their weights. When the game tries to create a ship in the role it rolls a random number in the range [0; total sum of all weights in the set), and searches in the list shipkey with the lowest commutative weight (weight of shipkey in the role plus sum of weights of previous shipkeys) that is greater than the random number.

There is no special treatment for roles with explicit or implicit weights and whether all ships have the same weight or not doesn't matter too.


What can significantly affect a populator run time is a lot of ships with conditions/condition scripts that often forbid spawning - if the first rolled ship cannot be used the game creates a copy of the probability set and starts to reroll ships and remove them from the set, if it can't be used too, until the game finds one that pass conditions or the set run out of candidates.

Re: Role Weights and System Populator Run Times

Posted: Sun Sep 24, 2023 6:05 pm
by cbr
Alnivel wrote: Sun Sep 24, 2023 11:28 am
What can significantly affect a populator run time is a lot of ships with conditions/condition scripts that often forbid spawning - if the first rolled ship cannot be used the game creates a copy of the probability set and starts to reroll ships and remove them from the set, if it can't be used too, until the game finds one that pass conditions or the set run out of candidates.
Which oxp (with populator and/or condition scripts ) will then take precedence?

Re: Role Weights and System Populator Run Times

Posted: Sun Sep 24, 2023 6:39 pm
by Alnivel
cbr wrote: Sun Sep 24, 2023 6:05 pm
Alnivel wrote: Sun Sep 24, 2023 11:28 am
What can significantly affect a populator run time is a lot of ships with conditions/condition scripts that often forbid spawning - if the first rolled ship cannot be used the game creates a copy of the probability set and starts to reroll ships and remove them from the set, if it can't be used too, until the game finds one that pass conditions or the set run out of candidates.
Which oxp (with populator and/or condition scripts ) will then take precedence?
Sorry, I don't understand the question, could you please elaborate?

Re: Role Weights and System Populator Run Times

Posted: Sun Sep 24, 2023 6:40 pm
by cbr
If you have many oxp/oxz installed with ships and conditions and populators,

which script will be eh dominant?

Re: Role Weights and System Populator Run Times

Posted: Sun Sep 24, 2023 7:24 pm
by Alnivel
It's not like there is the one and only condition script for all ships, each shipdata entry can have its own condition script. If there are multiple overrides for one entry, the latest loaded wins. And you can have multiple scripts with a populator function, if they set the same populator key, one that sets the latest will prevail, but otherwise they not meddle with each other.