Page 2 of 2

Posted: Tue Nov 23, 2010 8:23 pm
by Switeck
Commander McLane wrote:
The only thing you have to add below is an additional return after each adding-command:

Code: Select all

   { 
      system.addShipsToRoute("casinoship", 1, 0.995); 
      return;
   }
This way you make sure that the code execution stops after successfully adding any one of the stations. No need to further evaluate the odds for the other stations.
For what it's worth, the Hoopy Casino is special...I expect it to be in ADDITION to other stations since it's not a "general" purpose station and has very few items for sale or buy. It's not as big as the others and only sees specialty traffic. But for the rest, yes return; would work.

I would however have to add the first_launched = true before that return, more for consistency than anything else...a station might be destroyed and I wouldn't want it coming back just due to a relaunch. Come to think of it...how much more work would it be to give a system or individual stations a "station destroyed" status, so if the OXP station/s get destroyed they won't be there when you come back?

Posted: Tue Nov 23, 2010 9:04 pm
by Eric Walch
Switeck wrote:
how much more work would it be to give a system or individual stations a "station destroyed" status, so if the OXP station/s get destroyed they won't be there when you come back?
Ahruman published once code to store such info in mission variables here. Each station would need its own set of mission variables.

Posted: Wed Nov 24, 2010 9:13 am
by Commander McLane
Switeck wrote:
Commander McLane wrote:
The only thing you have to add below is an additional return after each adding-command:

Code: Select all

   { 
      system.addShipsToRoute("casinoship", 1, 0.995); 
      return;
   }
This way you make sure that the code execution stops after successfully adding any one of the stations. No need to further evaluate the odds for the other stations.
For what it's worth, the Hoopy Casino is special...I expect it to be in ADDITION to other stations since it's not a "general" purpose station and has very few items for sale or buy. It's not as big as the others and only sees specialty traffic. But for the rest, yes return; would work.
Of course you can do that. I just meant it as an example. If there are more stations that shall co-exist with other stations, just let them be the first to be spawned in the script.

By the way: the Biosphere is another randomly added station in the aegis, and could be included in the mix. I wanted to link it, but I notice that it doesn't even seem to be on the Wiki.
Switeck wrote:
I would however have to add the first_launched = true before that return, more for consistency than anything else...a station might be destroyed and I wouldn't want it coming back just due to a relaunch.
I guess you mean the this.firstLaunch = false; at the bottom of your code. You can put that in the beginning as well, to make sure that it's executed regardless of any in-between returns.

Code: Select all

   if(system.sun.isGoingNova || system.sun.hasGoneNova || system.isInterstellarSpace || !this.firstLaunch) 
      { 
      return; 
      }
   this.firstLaunch = false;
Switeck wrote:
Come to think of it...how much more work would it be to give a system or individual stations a "station destroyed" status, so if the OXP station/s get destroyed they won't be there when you come back?
I like the idea. Seeing some consistency, and also making the player's actions having some impact (like, if you destroyed a station, it's gone) would definitely be an improvement.

If you want to add another layer of work: A destroyed station may get replaced in the long run. A simple way of achieving that would be to clear all status variables on leaving the galaxy. So if the player goes full circle, all stations would be there again (chances are, he wouldn't remember anyway). I think it would also not be practical to store the status outside the current galaxy.

Posted: Wed Nov 24, 2010 9:36 am
by Commander McLane
Commander McLane wrote:
By the way: the Biosphere is another randomly added station in the aegis, and could be included in the mix. I wanted to link it, but I notice that it doesn't even seem to be on the Wiki.
Okay, one google search later:

The Biosphere seems to be one of Sabre's OXPs, and its available together with his other OXPs here. Most of his works are not currently included in the OXP list on the Wiki, which means that they must be quite apocryphic these days.

Posted: Wed Nov 24, 2010 9:53 am
by Kaks
Commander McLane wrote:
I like the idea. Seeing some consistency, and also making the player's actions having some impact (like, if you destroyed a station, it's gone) would definitely be an improvement.
IIRC, the idea behind making main stations indestructible was related to them being the only 'saving points' - yes, there's saving anywhere, but without a main station saving anywhere won't work...

To get round that problem, we could create damaged stations (at least retexture them on the fly with a damaged texture) in 1.74 and - not tried that yet - I think we can play with conditions & system variables in planetinfo.plist to make sure that 'myDamagedStation' always appears in system X if mission variable 'damageXStation' is set to 1 (and use 'myUndamagedStation' if that variable is set to 0).

Posted: Wed Nov 24, 2010 10:08 am
by Commander McLane
Kaks wrote:
Commander McLane wrote:
I like the idea. Seeing some consistency, and also making the player's actions having some impact (like, if you destroyed a station, it's gone) would definitely be an improvement.
IIRC, the idea behind making main stations indestructible was related to them being the only 'saving points' - yes, there's saving anywhere, but without a main station saving anywhere won't work...

To get round that problem, we could create damaged stations (at least retexture them on the fly with a damaged texture) in 1.74 and - not tried that yet - I think we can play with conditions & system variables in planetinfo.plist to make sure that 'myDamagedStation' always appears in system X if mission variable 'damageXStation' is set to 1 (and use 'myUndamagedStation' if that variable is set to 0).
I understood the suggestion as only applicable to non-main stations. For instance, if you (or some freak accident) have managed to destroy the Superhub next to the main station, it shouldn't be re-created when you jump into the system again after just a couple of hours, and much less if you simply dock with the main station and launch again.

I wasn't thinking of destroying main stations. I am all for them to be indestructible. (But I can't speak for Switeck, of course.)

Posted: Wed Nov 24, 2010 10:11 am
by Kaks
I see, shouldn't comment on stuff while still clearly sleepy/in skim through posts mode! :)

Posted: Wed Nov 24, 2010 10:54 am
by Switeck
Commander McLane wrote:
I wasn't thinking of destroying main stations. I am all for them to be indestructible. (But I can't speak for Switeck, of course.)
I'm ok with main stations being "relatively" indestructible. They are after all at least equal to tech level 15 if not 16, while all the other stations would be lower tech and thus much lower shielding.

Nuit Station in my mind is the next highest tech station...so high in fact we can't even complete it yet so its docking arms actually work.

Only keeping track of destroyed stations in 1 galaxy is perfectly good enough...the savegame's going to be huge as-is. :P

On to the whole point of this little endeavor:
The main reason for keeping secondary stations to a minimum in a single system is game balance. Each additional station that has a full commodities menu (meaning nothing for "sale" for 0 credits) means you get a shot at finding the most expensive station and the cheapest station for items and swap them. More stations = more profit. With just 1 station, whatever prices they are...you're stuck with them! Beyond the main station, if you don't like the prices/amounts at secondary stations...you can just save game and reload. Bingo -- new prices and fully restocked! And limited time change beyond the launching/docking/traveling time between the possibly very close stations. In theory, with enough stations you could afford the most expensive ship ever released as an OXP doing this...without ever leaving the system. In practice, each extra station probably represents about 1k profits...though unless you're in a Boa 2 or larger (and/or using HyperCargo) you'll likely need more than 1 round trip to do it.

While it's true the game revolves around trading, it originally only had trading between different star systems. This doesn't just make it quicker...it takes away much of the risk, especially when secondary stations are really near the main station. (Then again, bad docking was always my primary cause of death...probably why I like Superhub so much -- it only kills me about 1/4th as often.)

In-universe, there's usually not much NEED for there to be more than 1 secondary "general" station. Ships can dock pretty fast, and even the busiest system seems to not have new ships arriving faster than about 1 per minute. My testing of traders in my mod at least let me see the traffic jams that happen at the main station if there were huge numbers of traders arriving per hour. Ships were backed up so far at one point that a Q-bomb could chain react ships around the station for over 3 minutes straight...easily in excess of 200 ships.

Having a secondary station that gets traffic like the main one would alleviate that considerably, so ironically it could reduce total NPC ship counts some...but ONLY if NPC ships were smart enough to take advantage of it. Most are programmed to only go to the main station. This is one of the things I'm trying to change that in my mod. It's easy enough to tell some of them to instead dock with the "nearest" station...but then they're likely to dock at Your Ad Here Constores (which are rather near the witchpoint), or Black Monks Monasteries, Free Trade Zones, or Rock Hermits. But it even gets sillier than that! They might dock at hostile Pirate Coves, Renegade Stations, or any carrier ship that happens to come along...be it a Behemoth, Dredger, or Thargoid Carrier! About the one place they *WON'T* go...is a secondary station in orbit around the planet...because chances are there's at least 1 closer station of some kind (friendly or otherwise) for them to dock with instead.

The simplest solution I've seen is the suggestion of setting a role for all secondary stations so there's only 1 (or 0) per system. Then ai's in AI.plist files could choose to dock with whatever that role is, regardless of where it is...and even fall back to the main station or nearest station if not found.

Posted: Wed Nov 24, 2010 12:05 pm
by Commander McLane
Switeck wrote:
About the one place they *WON'T* go...is a secondary station in orbit around the planet...because chances are there's at least 1 closer station of some kind (friendly or otherwise) for them to dock with instead.
That's true. In the current trunk route1traderAI the switch to dock with a secondary station happens only if the ship gets close to a secondary planet.

I think that could be modified, so that at the end of HEAD_FOR_PLANET there is a random chance to go to the nearest station instead of the main station. If the main station is also the nearest, or there is no other station in the aegis, nothing would change. But if there is another station in the aegis, and it is a little closer to the ship's current position, the ship would dock there instead.

@ Eric: Does that seem viable to you?

Posted: Wed Nov 24, 2010 10:23 pm
by Eric Walch
Commander McLane wrote:
I think that could be modified, so that at the end of HEAD_FOR_PLANET there is a random chance to go to the nearest station instead of the main station. If the main station is also the nearest, or there is no other station in the aegis, nothing would change. But if there is another station in the aegis, and it is a little closer to the ship's current position, the ship would dock there instead.

@ Eric: Does that seem viable to you?
It could, but probably not wise. The pre- 1.65 traders also docked at any station. In 1.65 it was changed to only dock at main stations. I assume that change was for a good reason. Some oxp's just add stations around the planet, like military stations, that are not intended for trader traffic. And seeing traders docking at hoopy casinos does not look good. For a cassino would I only expect small shuttles to bring a but of food or luxury items in rather small quantities.

The only thing that would work is creating a new command that looks for the nearest station that allows npc-traffic. (UPS contains a trader that can dock everywhere on the route. But than is the station selection controlled by a JS script.)

Differentiating between main and secondary planets was added in 1.73. With all those added planets it would just seem stupid when the trader would first fly to the nearest planet, but than go tho the main station. When extra planets have a station and a trader is added closer to that planet than the main planet, the current trader AI should dock him to that station.

Posted: Wed Nov 24, 2010 10:49 pm
by Commander McLane
Eric Walch wrote:
Differentiating between main and secondary planets was added in 1.73. With all those added planets it would just seem stupid when the trader would first fly to the nearest planet, but than go tho the main station. When extra planets have a station and a trader is added closer to that planet than the main planet, the current trader AI should dock him to that station.
I actually wondered how the trader gets to the secondary planet in the first place. The ship only enters the GO_TO_SUB_STATION state when it receives the CLOSE_TO_SECONDARY_PLANET message. But for this it has to pass by the secondary planet while in state HEAD_FOR_PLANET. In other words: if the secondary planet isn't close to the corridor (less than 3 radii), the ship will never get there. Just to be closer than the main planet isn't enough, if the secondary planet isn't in the same direction. How many additional planets fulfill this criterion? (And some of the additional planets added for instance by Assassins are actually moons. Is CLOSE_TO_SECONDARY_PLANET also sent when the ship passes by a moon? Or should there be an additional CLOSE_TO_MOON message in the AI?)

If I remember from gameplay, the only ships I have ever seen heading for a secondary planet station (or coming from it) are Woma Fuel Tankers, and I have the strong suspicion that you explicitly scripted them to do so. So maybe the whole GO_TO_SUB_STATION isn't really working like planned?
Eric Walch wrote:
The only thing that would work is creating a new command that looks for the nearest station that allows npc-traffic.
That seems a sensible change to me. Setting has_npc_traffic to false should not only result in no traders launching, but also in no traders docking. So perhaps, instead of adding another command, could a check for has_npc_traffic be added to the existing command?

Posted: Wed Nov 24, 2010 10:50 pm
by Switeck
Switeck wrote:
The simplest solution I've seen is the suggestion of setting a role for all secondary stations so there's only 1 (or 0) per system. Then ai's in AI.plist files could choose to dock with whatever that role is, regardless of where it is...and even fall back to the main station or nearest station if not found.
Or randomize the results with a roll:

Code: Select all

		"AEGIS_CLOSE_TO_MAIN_PLANET" = ("rollD: 4");
		"ROLL_1" = ("setStateTo: GO_TO_SECONDARY_STATION");
		"ROLL_2" = ("setStateTo: GO_TO_MAIN_STATION");
		"ROLL_3" = ("setStateTo: GO_TO_MAIN_STATION");
		"ROLL_4" = ("setStateTo: GO_TO_MAIN_STATION");
And secondary stations would ONLY be stations with the secondary role, so there would only be 0 or 1 in a system. Hoopy Casino, being a specialty station, wouldn't qualify...but it could accidentally be a fallback go-to-nearest-station if no secondary station is found.

...SO, to keep the role name short and consistent for secondary stations...what's a good role name for it?

Posted: Thu Nov 25, 2010 8:52 am
by Eric Walch
Commander McLane wrote:
I actually wondered how the trader gets to the secondary planet in the first place. The ship only enters the GO_TO_SUB_STATION state when it receives the CLOSE_TO_SECONDARY_PLANET message. But for this it has to pass by the secondary planet while in state HEAD_FOR_PLANET. In other words: if the secondary planet isn't close to the corridor (less than 3 radii), the ship will never get there.
You are correct. In a normal setup traders will never go to a planet other than the main one. But a scripts might add a trader near another planet. route1traderAI.plist is currently prepared for that situation. (Although the name "route1..." isn't correct in that case).
It is the command setCourseToPlanet that selects the closest planet. Moons are excluded.

Re: Station spawning oxps...

Posted: Tue Jul 30, 2013 10:56 pm
by Mauiby de Fug
Well, I decide to full-on restart Oolite, and so begin the more-thought-provoking-than-anticipated task of trawling through the OXP list to decide which OXPs fit how I currently view the Ooniverse. I get as far as the "dockables", and wonder how to organise the station spawning in what seems to be a consistent manner. So, I, with the aid of the ever useful Oolite BB search plugin, go digging about, and discover a thread that I started with similar aims in mind, and, more importantly, a whole host of useful answers.

My thanks to all who have helped me once again attempt to manipulate the fabric of the 'verse!

Re: Station spawning oxps...

Posted: Wed Jul 31, 2013 1:44 am
by Diziet Sma
Mauiby de Fug wrote:
So, I, with the aid of the ever useful Oolite BB search plugin, go digging about
...
My thanks to all who have helped me once again attempt to manipulate the fabric of the 'verse!
<chuckles>
You're most welcome.. I'm glad my little plugin made your task easier! 8)

(interesting bit of thread necromancy too.. thanks for a fascinating read!)