Question about ship role weights.

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
tsoj
Deadly
Deadly
Posts: 199
Joined: Wed May 18, 2016 8:19 pm
Location: Berlin
Contact:

Question about ship role weights.

Post 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?
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2659
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Question about ship role weights.

Post 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.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Question about ship role weights.

Post 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:
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2659
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Question about ship role weights.

Post 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.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Question about ship role weights.

Post 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
Scars remind us where we've been. They don't have to dictate where we're going.
Post Reply