Page 1 of 1

Question about ship role weights.

Posted: Tue Feb 16, 2021 12:39 am
by tsoj
Take a shipdata.plist like this:

Code: Select all

{
	"MyShip_template" = 
	{
		...
		roles = "
			player
			pirate(0.1)
		";
	};	

	"MyShip_blue" =
	{
		like_ship = "MyShip_template";

		materials =
		{...};
	};

	"MyShip_green" =
	{
		like_ship = "MyShip_template";

		materials =
		{...};
	};
}
Does this mean that the weight for a "MyShip_green" pirate is 0.1 and the weight for a "MyShip_blue" pirate is also 0.1, meaning that the total weight for something based on "MyShip_template" for being a pirate is 0.2?

Re: Question about ship role weights.

Posted: Tue Feb 16, 2021 12:36 pm
by Redspear
Er... I think so.

As I understand it the 'like_ship' reference exists to both facilitate shortcuts in typing and also to keep the original ship unchanged if so desired. To do the latter in particular would suggest an independant ship.

Re: Question about ship role weights.

Posted: Tue Feb 16, 2021 1:04 pm
by montana05
Redspear wrote: Tue Feb 16, 2021 12:36 pm
Er... I think so.

As I understand it the 'like_ship' reference exists to both facilitate shortcuts in typing and also to keep the original ship unchanged if so desired. To do the latter in particular would suggest an independant ship.
"like_ship" is basically creating a copy, there are some problems (subentities for example) but in general it's working. You can use it and change some details for the new entity, if most of the details are the same I personally think a template and/or "like_ship" make much sense. However, 2 ships with 10% role isn't automatically 20%, it just raises the chances to be spawned more often in the "lower" level. Like usually, if I didn't understand it correct please correct me, I am always happy to learn. :wink:

Re: Question about ship role weights.

Posted: Tue Feb 16, 2021 4:23 pm
by Redspear
montana05 wrote: Tue Feb 16, 2021 1:04 pm
However, 2 ships with 10% role isn't automatically 20%, it just raises the chances to be spawned more often in the "lower" level. Like usually, if I didn't understand it correct please correct me, I am always happy to learn.
As I understand it, 0.1 isn't a 10% chance of appearing but rather a 10% chance of a 'share' in appearing. If they were the only ships with the pirate role in the game then they would appear 100% of the time whenever the game spawned a pirate.

The more ships there are however (through oxps for example) then the more that chance gets diluted. In order to accurately calculate its chance of appearing then you need to have the role weights of all the other ships with that role.
So if you have a total of 100 ships (and no others), each with role 'pirate (0.1)' then each ship would have a 1% chance of appearing, just as it would if they were all pirate (0.5).

However, the fraction listed is relevant for having some ships be rarer or more common than others. So for example, tsoj could wish to make the green ship rarer than the blue ship by giving it a role of pirate '0.05' rather than 0.1. This proportional difference would be accurate regardless of what other oxps were installed but how rare they were in relation to other ships would depend not only on the role weight of other ships but also the number of other ships installed.

When we make a new ship, we're increasing the number of lottery tickets for their role(s). Some ships come with more tickets than others but each time we add more tickets we reduce the chance of those with a ticket having one of their numbers come up.

Re: Question about ship role weights.

Posted: Thu Feb 18, 2021 12:55 am
by montana05
Redspear wrote: Tue Feb 16, 2021 4:23 pm
montana05 wrote: Tue Feb 16, 2021 1:04 pm
However, 2 ships with 10% role isn't automatically 20%, it just raises the chances to be spawned more often in the "lower" level. Like usually, if I didn't understand it correct please correct me, I am always happy to learn.
As I understand it, 0.1 isn't a 10% chance of appearing but rather a 10% chance of a 'share' in appearing. If they were the only ships with the pirate role in the game then they would appear 100% of the time whenever the game spawned a pirate.

The more ships there are however (through oxps for example) then the more that chance gets diluted. In order to accurately calculate its chance of appearing then you need to have the role weights of all the other ships with that role.
So if you have a total of 100 ships (and no others), each with role 'pirate (0.1)' then each ship would have a 1% chance of appearing, just as it would if they were all pirate (0.5).

However, the fraction listed is relevant for having some ships be rarer or more common than others. So for example, tsoj could wish to make the green ship rarer than the blue ship by giving it a role of pirate '0.05' rather than 0.1. This proportional difference would be accurate regardless of what other oxps were installed but how rare they were in relation to other ships would depend not only on the role weight of other ships but also the number of other ships installed.

When we make a new ship, we're increasing the number of lottery tickets for their role(s). Some ships come with more tickets than others but each time we add more tickets we reduce the chance of those with a ticket having one of their numbers come up.
Thank you Redspear,
same conclusio but much better explanation. :D