Saving At Stations

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Saving At Stations

Post by Killer Wolf »

Why can i not F2/save at my new model? it's a test spawn, has a test role and "station" in the roles, and has the standard station AI.

as a side topic, is there no way so stopping this stupid size-related top of a radar stalk? the trace for my new model literally fills the scanner.


TIA
User avatar
Cholmondely
Archivist
Archivist
Posts: 5364
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Saving At Stations

Post by Cholmondely »

I'm no expert but since nobody else has replied yet, my understanding from these boards is that one can save at any station which is defined as such and which is not moving.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
hiran
Theorethicist
Posts: 2403
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Saving At Stations

Post by hiran »

Cholmondely wrote: Sat Oct 21, 2023 8:38 pm
I'm no expert but since nobody else has replied yet, my understanding from these boards is that one can save at any station which is defined as such and which is not moving.
Then rock hermits seem to be stations, while Galactic Navy's Galcop stations are not.
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Saving At Stations

Post by phkb »

In order to save at a station, the game engine needs to know that the station will be spawned at the same location every time, during system population. So, creating the station during shipWillLaunchFromStation, or shipWillExitWitchspace, is far too late in the process.

This routine should work:

Code: Select all

this.systemWillPopulate = function() {
	// here we establish the position of the station. this needs to be the same every time the system is populated
	// you can use the system.pseudoRandomNumber property to add "randomness" to the location if you want
	// in this instance, we're just going to use the main station position, and put our station 5000m directly in front of it.
	var stationPos = system.mainStation.position.add(system.mainStation.vectorForward.multiply(5000));
	
	// next, we use the system.setPopulator to create the actual station using a callback
	// "create_my_station" is a text string that uniquely identifies this populator function
	system.setPopulator("create_my_station", {
		callback: function(pos) {
			system.addShips("my_station_key", 1, pos, 0); // the "0" parameter at the end is important
		},
		location:"COORDINATES",
		coordinates:stationPos,
		deterministic:true // < this is important
	});
}
"deterministic:true" is the key to allowing you to save at your station. And the "0" parameter is important, because the "addShips" function will not add any random distance to the position when spawned. It will be at the exact coordinates you specify.

As for the issue with your scanner, what zoom setting do you have? if it's currently 1:1, and the station is still filling the scanner, that would indicate the station is *huge*.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5364
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Saving At Stations

Post by Cholmondely »

hiran wrote: Sat Oct 21, 2023 8:52 pm
Cholmondely wrote: Sat Oct 21, 2023 8:38 pm
I'm no expert but since nobody else has replied yet, my understanding from these boards is that one can save at any station which is defined as such and which is not moving.
Then rock hermits seem to be stations, while Galactic Navy's Galcop stations are not.
They are old and date back to the days when saving anywhere outside a main GalCop orbital was impossible. Maybe they move slowly?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Saving At Stations

Post by phkb »

GN’s stations were created before there was even an option of saving at stations in the core game. And no one has gone back to tweak the code to implement the required changes.
User avatar
hiran
Theorethicist
Posts: 2403
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Saving At Stations

Post by hiran »

phkb wrote: Sat Oct 21, 2023 9:41 pm
GN’s stations were created before there was even an option of saving at stations in the core game. And no one has gone back to tweak the code to implement the required changes.
There was a time where you could not save the game at stations? But what I see is that you can just save in stations.
Where did one save the game those days?
Sunshine - Moonlight - Good Times - Oolite
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Saving At Stations

Post by Cody »

I think he means at non-main stations (eg rock hermits). A contrabandista's delight, was saving at rock hermits!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Saving At Stations

Post by phkb »

Sorry, yes. I meant OXP stations
User avatar
hiran
Theorethicist
Posts: 2403
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Saving At Stations

Post by hiran »

phkb wrote: Sat Oct 21, 2023 9:41 pm
GN’s stations were created before there was even an option of saving at stations in the core game. And no one has gone back to tweak the code to implement the required changes.
phkb wrote: Sat Oct 21, 2023 11:04 pm
Sorry, yes. I meant OXP stations
Maybe it is not too bad going back to change something. I assume the necessary tweak is more or less to set a flag, right?
If we knew where/which OXPs define a station it would be a limited list of items to check.

And with OoliteAddonScanner I can run such stunts to produce a list - if only I knew what to look for.
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Saving At Stations

Post by phkb »

hiran wrote: Sun Oct 22, 2023 6:17 am
Maybe it is not too bad going back to change something. I assume the necessary tweak is more or less to set a flag, right?
If we knew where/which OXPs define a station it would be a limited list of items to check.
Usually it's a bit more than just changing a flag. Having just done Cataclysm, the work involved in changing how the stations are spawned requires extracting them from the original logic, creating a new routine (systemWillPopulate), with a new spawning mechansm (system.setPopulator), and then making sure the logic of the original has been transferred into the new routine correctly. It's definitely a one station at a time thing.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Re: Saving At Stations

Post by Killer Wolf »

Thanks for the replies, no biggie at the mo, but when i i come to test properly i'll try @phkb's code snippet [cheers bud] as the station is supposed to be a feature of a particular place.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Re: Saving At Stations

Post by Killer Wolf »

phkb wrote: Sat Oct 21, 2023 9:08 pm
As for the issue with your scanner, what zoom setting do you have? if it's currently 1:1, and the station is still filling the scanner, that would indicate the station is *huge*.
;-)
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Saving At Stations

Post by phkb »

Ah!
That’s no moon. It’s a space station.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Re: Saving At Stations

Post by Killer Wolf »

phkb wrote: Sat Oct 21, 2023 9:08 pm
In order to save at a station, the game engine needs to know that the station will be spawned at the same location every time, during system population. So, creating the station during shipWillLaunchFromStation, or shipWillExitWitchspace, is far too late in the process.

This routine should work:

Code: Select all

this.systemWillPopulate = function() {
	// here we establish the position of the station. this needs to be the same every time the system is populated
	// you can use the system.pseudoRandomNumber property to add "randomness" to the location if you want
	// in this instance, we're just going to use the main station position, and put our station 5000m directly in front of it.
	var stationPos = system.mainStation.position.add(system.mainStation.vectorForward.multiply(5000));
	
	// next, we use the system.setPopulator to create the actual station using a callback
	// "create_my_station" is a text string that uniquely identifies this populator function
	system.setPopulator("create_my_station", {
		callback: function(pos) {
			system.addShips("my_station_key", 1, pos, 0); // the "0" parameter at the end is important
		},
		location:"COORDINATES",
		coordinates:stationPos,
		deterministic:true // < this is important
	});
}
"deterministic:true" is the key to allowing you to save at your station. And the "0" parameter is important, because the "addShips" function will not add any random distance to the position when spawned. It will be at the exact coordinates you specify.

As for the issue with your scanner, what zoom setting do you have? if it's currently 1:1, and the station is still filling the scanner, that would indicate the station is *huge*.
i managed [it seems] to get my system-specific spawn working by using planetinfo.plist, which is

Code: Select all

{
    "0 129" = {
           "script_actions" = (
                "checkForShips: KWii", 					
                {
                     conditions = ("shipsFound_number lessthan 1");
                     do = ( "addSystemShips: KWii 1 1.0" );
                }
          ); 
     }
}
but again it won't let me save. will i be able to stick the above code into the "do" bit of the planetinfo?
TIA
Post Reply