Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Minimum weighting for role

For test results, bug reports, announcements of new builds etc.

Moderators: another_commander, winston, Getafix

Post Reply
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Minimum weighting for role

Post by Thargoid »

Not sure if this classes as a question or a bug report, so I'll put it here.

Just been trialling some updates for Planetfall in 1.77.5348 and I notice that an entity with a role weight of (0.005) spawns correctly, but if the role weight is reduced to (0.001) then it doesn't. This used to work in 1.76.1 with either role weight.

So has a minimum role weight been introduced (aside from (0)), and if so what is it? Or is this an accidental bug, as it may be an OXP-breaker.
Last edited by Thargoid on Thu Sep 27, 2012 4:10 pm, edited 1 time in total.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: Minimum weighting for role

Post by Switeck »

It could be the case that very low roles get rounded down to 0 if/when there's other ships using roles of (99) or more.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Minimum weighting for role

Post by Thargoid »

This is the example where the OXP can spawn a role from a second external OXP, but has the role also built into itself at a very low probability to ensure that at least one candidate is present (but will extremely rarely be used if the second OXP is present). Specifically for this one it's the external location role in Planetfall, but something similar is also used in bigShips and probably a few others.

I specifically checked last night and it works fine in 1.76.1, but fails in 1.77.5348. If the role weight is 0.005 the entity spawns fine, but if it is 0.001 then nothing gets spawned. And that is with the specific entity being the only entity in the role pool so this one should always be selected.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Minimum weighting for role

Post by Kaks »

After rev4951(may 2012) all roles starting with '[' are ignored. Apart from that there doesn't seem to be any substantial change...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Minimum weighting for role

Post by Thargoid »

This is a normal role, but with a low weight (as a catch-all role for an external OXP if no other suitable OXP is installed).

For PF and my other OXPs I can work around it as 0.001 should be a low enough weighting. But it's a change from 1.76.1 which may break other OXPs if authors aren't aware of it (or are no longer supporting them).

To be clearer, I'm referring to a unique role which has a low weight assigned to it. So that even with the weight, if it is called and no external OXPs are installed which give a higher weighted role, then it will always spawn. It's designed as a catch-all to prevent script/log errors if it tries to spawn something that doesn't exist by that role.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Minimum weighting for role

Post by Eric Walch »

I cann't reproduce it. I created testship with a role weight of 0.0001 and it just spawned. The console returns

Code: Select all

> PS.target.roleWeights
{
    "[testship]": 1,
    testship: 1
}
for that ship.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Minimum weighting for role

Post by Thargoid »

I just updated to the latest trunk adn tried again, and it seems to work now. So either there was something weird in my installation or I did something wrong last time.

I'll do some more checking to be sure, but for now it seems to be OK and we can close this one off.
Post Reply