i'm going wiki crazy i think, but

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
phonebook
Deadly
Deadly
Posts: 229
Joined: Sat Aug 15, 2009 10:28 pm

i'm going wiki crazy i think, but

Post by phonebook »

why are there more boas than anacondas, by and large- or am i imagining it?

also i seem to have gone through every script there is, but the system populator seems to be very well hidden.

i apologize in advance if I am foolish

sorry I ought to provide more info- Anacondas and Boas, according to the the shipdata plist perform exactly the same roles, so i would have thought they would turn up just as frequently- but they don't.

Dont get me wrong- this is right and proper, anacondas are big beasts and boas are a third of the size so they ought to be more numerous- but i want to know why!

does anyone know?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: i'm going wiki crazy i think, but

Post by cim »

phonebook wrote:
why are there more boas than anacondas, by and large- or am i imagining it?
In the core game only, you're probably imagining it. They have the same roles, as you say, so should show up equally often (and they do for me, I think...). Do you have any OXPs that might change their roles installed?
phonebook wrote:
also i seem to have gone through every script there is, but the system populator seems to be very well hidden.
The system populator is not managed by Javascript (and won't be for a while yet). It's in some functions in Universe.m in the core Oolite code.
phonebook
Deadly
Deadly
Posts: 229
Joined: Sat Aug 15, 2009 10:28 pm

Re: i'm going wiki crazy i think, but

Post by phonebook »

i did a fresh install of oolite - no oxp- and always press shift on opening

yes you may be right, perhaps because there are more types of boas- marks 2s etc, i'm imagining the lowly numbers of anacondas

i might dig around in some oxps and see what they do- had a brief look at commies, and they plop extra ships in their systems- its all very complicated! to me at least

thanks for replying by the way
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: i'm going wiki crazy i think, but

Post by Pleb »

cim wrote:
system populator is not managed by Javascript (and won't be for a while yet). It's in some functions in Universe.m in the core Oolite code.
The code could be modified to make these functions editable in the planetinfo.plist file. Using the source code from version 1.76.1, the original code in the Universe.m file from line 9079 reads like this:

Code: Select all

	// traders
	// TODO: consider using floating point for this stuff, giving a greater variety of possible results while maintaining the same range.
	unsigned trading_parties = (9 - economy);			// 2 .. 9
	if (government == 0) trading_parties *= 1.25;	// 25% more trade where there are no laws!
	if (trading_parties > 0)
		trading_parties = 1 + trading_parties * (randf()+randf());   // randomize 0..2
	while (trading_parties > 15)
		trading_parties = 1 + (Ranrot() % trading_parties);   // reduce
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@trading vessels", trading_parties, @"");
	
	unsigned skim_trading_parties = (Ranrot() & 3) + trading_parties * (Ranrot() & 31) / 120;	// about 12%
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@trading vessels", skim_trading_parties, @"sun skim ");
	
	// pirates
	int anarchy = (8 - government);
	unsigned raiding_parties = (Ranrot() % anarchy) + (Ranrot() % anarchy) + anarchy * trading_parties / 3;	// boosted
	raiding_parties *= randf() + randf();   // randomize
	while (raiding_parties > 25)
		raiding_parties = 12 + (Ranrot() % raiding_parties);   // reduce
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@pirate vessels", raiding_parties, @"");
	
	unsigned skim_raiding_parties = ((randf() < 0.14 * economy)? 1:0) + raiding_parties * (Ranrot() & 31) / 120;	// about 12%
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@pirate vessels", skim_raiding_parties, @"sun skim ");
	
	// bounty-hunters and the law
	unsigned hunting_parties = (1 + government) * trading_parties / 8;
	if (government == 0) hunting_parties *= 1.25;   // 25% more bounty hunters in an anarchy
	hunting_parties *= (randf()+randf());   // randomize
	while (hunting_parties > 15)
		hunting_parties = 5 + (Ranrot() % hunting_parties);   // reduce
	
	//debug
	if (hunting_parties < 1)
		hunting_parties = 1;
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@law/bounty-hunter vessels", hunting_parties, @"");
	
	unsigned skim_hunting_parties = ((randf() < 0.14 * government)? 1:0) + hunting_parties * (Ranrot() & 31) / 160;	// about 10%
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@law/bounty-hunter vessels", skim_hunting_parties, @"sun skim ");
	
	unsigned thargoid_parties = 0;
	while ((Ranrot() % 100) < thargoidChance && thargoid_parties < 16)
		thargoid_parties++;
	
	OOLog(kOOLogUniversePopulate, @"... adding %d Thargoid warships", thargoid_parties);
	
	unsigned rockClusters = Ranrot() % 3;
	if (trading_parties + raiding_parties + hunting_parties < 10)
		rockClusters += 1 + (Ranrot() % 3);
	
	rockClusters *= 2;
But if the previous code is changed with the following code:

Code: Select all

	// traders
	// TODO: consider using floating point for this stuff, giving a greater variety of possible results while maintaining the same range.
	unsigned trading_parties = (9 - economy);			// 2 .. 9
	if (government == 0) trading_parties *= 1.25;	// 25% more trade where there are no laws!
	if (trading_parties > 0)
		trading_parties = 1 + trading_parties * (randf()+randf());   // randomize 0..2
	while (trading_parties > 15)
		trading_parties = 1 + (Ranrot() % trading_parties);   // reduce
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_trading_parties = trading_parties;
	trading_parties = [systeminfo oo_unsignedIntForKey:@"trading_parties" defaultValue:backup_trading_parties];
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@trading vessels", trading_parties, @"");
	
	unsigned skim_trading_parties = (Ranrot() & 3) + trading_parties * (Ranrot() & 31) / 120;	// about 12%
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_skim_trading_parties = skim_trading_parties;
	skim_trading_parties = [systeminfo oo_unsignedIntForKey:@"skim_trading_parties" defaultValue:backup_skim_trading_parties];
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@trading vessels", skim_trading_parties, @"sun skim ");
	
	// pirates
	int anarchy = (8 - government);
	unsigned raiding_parties = (Ranrot() % anarchy) + (Ranrot() % anarchy) + anarchy * trading_parties / 3;	// boosted
	raiding_parties *= randf() + randf();   // randomize
	while (raiding_parties > 25)
		raiding_parties = 12 + (Ranrot() % raiding_parties);   // reduce
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_raiding_parties = raiding_parties;
	raiding_parties = [systeminfo oo_unsignedIntForKey:@"raiding_parties" defaultValue:backup_raiding_parties];
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@pirate vessels", raiding_parties, @"");
	
	unsigned skim_raiding_parties = ((randf() < 0.14 * economy)? 1:0) + raiding_parties * (Ranrot() & 31) / 120;	// about 12%
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_skim_raiding_parties = skim_raiding_parties;
	skim_raiding_parties = [systeminfo oo_unsignedIntForKey:@"skim_raiding_parties" defaultValue:backup_skim_raiding_parties];
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@pirate vessels", skim_raiding_parties, @"sun skim ");
	
	// bounty-hunters and the law
	unsigned hunting_parties = (1 + government) * trading_parties / 8;
	if (government == 0) hunting_parties *= 1.25;   // 25% more bounty hunters in an anarchy
	hunting_parties *= (randf()+randf());   // randomize
	while (hunting_parties > 15)
		hunting_parties = 5 + (Ranrot() % hunting_parties);   // reduce
	
	//debug
	if (hunting_parties < 1)
		hunting_parties = 1;
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_hunting_parties = hunting_parties;
	hunting_parties = [systeminfo oo_unsignedIntForKey:@"hunting_parties" defaultValue:backup_hunting_parties];
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@law/bounty-hunter vessels", hunting_parties, @"");
	
	unsigned skim_hunting_parties = ((randf() < 0.14 * government)? 1:0) + hunting_parties * (Ranrot() & 31) / 160;	// about 10%
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_skim_hunting_parties = skim_hunting_parties;
	skim_hunting_parties = [systeminfo oo_unsignedIntForKey:@"skim_hunting_parties" defaultValue:backup_skim_hunting_parties];
	
	OOLog(kOOLogUniversePopulate, @"... adding %d %@law/bounty-hunter vessels", skim_hunting_parties, @"sun skim ");
	
	unsigned thargoid_parties = 0;
	while ((Ranrot() % 100) < thargoidChance && thargoid_parties < 16)
		thargoid_parties++;
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_thargoid_parties = thargoid_parties;
	thargoid_parties = [systeminfo oo_unsignedIntForKey:@"thargoid_parties" defaultValue:backup_thargoid_parties];
	
	OOLog(kOOLogUniversePopulate, @"... adding %d Thargoid warships", thargoid_parties);
	
	unsigned rockClusters = Ranrot() % 3;
	if (trading_parties + raiding_parties + hunting_parties < 10)
		rockClusters += 1 + (Ranrot() % 3);
		
	// Check whether there is an entry in planetinfo.plist for party:
	unsigned backup_rockClusters = rockClusters;
	rockClusters = [systeminfo oo_unsignedIntForKey:@"rockClusters" defaultValue:backup_rockClusters];
	
	rockClusters *= 2;
	
	OOLog(kOOLogUniversePopulate, @"... adding %d asteroid clusters", rockClusters);
Now the game will check whether there is an entry in the planetinfo.list file that can overide the number of ships in each category that are generated in that system. So if an entry was added to the planetinfo.plist file that reads:

Code: Select all

"0 7" =
	{
		thargoid_parties = 100;
	};
Now every time the player enters the Lave system in Galaxy 1 there will be 100 Thargoid Warships in that system. This could also be used to always ensure that there are no police in a system, as the code will currently always make sure there is at least 1 police/bounty hunter in a system (see code above under the //debug comment).

Of course getting this editable in Javascript is a different matter altogether... :roll:
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: i'm going wiki crazy i think, but

Post by Commander McLane »

Pleb wrote:
Of course getting this editable in Javascript is a different matter altogether... :roll:
But it's the only alternative. The rather unflexible plist-approach is certainly not the way forward.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: i'm going wiki crazy i think, but

Post by Wildeblood »

I've tried Pleb's mod, it seems to work fine from javascript.
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: i'm going wiki crazy i think, but

Post by Pleb »

Commander McLane wrote:
Pleb wrote:
Of course getting this editable in Javascript is a different matter altogether... :roll:
But it's the only alternative. The rather unflexible plist-approach is certainly not the way forward.
Agreed that's why I hoped this could be expanded upon...
Wildeblood wrote:
I've tried Pleb's mod, it seems to work fine from javascript.
It does? Can I ask how...?

EDIT: Never mind I saw your other post!
Last edited by Pleb on Sun Dec 09, 2012 5:01 pm, edited 1 time in total.
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: i'm going wiki crazy i think, but

Post by cim »

Yes, or use system.addShips and ship.remove to modify the number of ships in the system shortly after the system populator runs. So in that sense it can already be modified by script.

I have some more ambitious plans for after 1.77/8 which I'll post more about nearer the time (i.e. when I've had time to write them up properly)
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: i'm going wiki crazy i think, but

Post by Pleb »

cim wrote:
Yes, or use system.addShips and ship.remove to modify the number of ships in the system shortly after the system populator runs. So in that sense it can already be modified by script.
So its already possible to remove all police/bounty hunters anyway then? Okay thought I'd discovered something new lol!
cim wrote:
I have some more ambitious plans for after 1.77/8 which I'll post more about nearer the time (i.e. when I've had time to write them up properly)
Sounds good, can't wait! 8)
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: i'm going wiki crazy i think, but

Post by cim »

Pleb wrote:
So its already possible to remove all police/bounty hunters anyway then?
Use system.shipsWithPrimaryRole() to get a list of all ships with role "police" or "hunter", then call ship.remove() on each member of that list.
Post Reply