Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Arrivals and departures

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Arrivals and departures

Post by Smivs »

'roles' (plural) is correct, although it should be 'role' in the array.
From the core Boa

Code: Select all

		escort_roles = (
			{ "role" = "escort"; min = 1; max = 3; },
			{ "role" = "escort-medium"; min = -2; max = 2; },
			{ "role" = "escort-heavy"; min = -3; max = 1; },
			{ "role" = ""; min = 0; max = 2; },
		);
Might be worth a look at the brackets - I think the missing '(' and ')' might be playing a part here.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Arrivals and departures

Post by cim »

Smivs wrote:
'roles' (plural) is correct, although it should be 'role' in the array.
From the core Boa

Code: Select all

		escort_roles = (
			{ "role" = "escort"; min = 1; max = 3; },
			{ "role" = "escort-medium"; min = -2; max = 2; },
			{ "role" = "escort-heavy"; min = -3; max = 1; },
			{ "role" = ""; min = 0; max = 2; },
		);
Might be worth a look at the brackets - I think the missing '(' and ')' might be playing a part here.
Yes - definitely needs "role" rather than "roles" in the array, and the outer ()s on it. Once that's fixed, go back to min = 16, too - or you may find your code only works reliably in Anarchy systems.

The other thing to look at may be to make sure that if the mothership is clean, so are the escorts.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4667
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Arrivals and departures

Post by phkb »

Getting weird now...

Mostly I'm just getting "false" for every attempt to execute "offerToEscort". However, every now and then, it works! I thought this would lead me to figure out what might be going wrong, but it's got me completely bamboozled. Here's what I've got.

Code: Select all

	"dock_anaconda" = {
		like_ship = "oolite_template_anaconda";
		escort_roles = (
			{role = ""; min = 16; max = 16;}
		);
		roles = "dockonly";
	};
	"dock_griff_boa_MK2_alt-NPC" = {
		like_ship = "griff_boa_MK2_alt-NPC";
		escort_roles = (
			{role = ""; min = 16; max = 16;}
		);
		roles = "dockonly";
		is_external_dependency = yes;
	};
Both of these ships were created, and escorts were successfully attached to them. For the record, the "anaconda" ship had these escorts: griff_sidewinder_escort-NPC, griff_cobra_Mk1_alt-NPC, griff_sidewinder_escort6-NPC and krait, and the boa had noshaders_missingcoreships_gecko_normal, noshaders_cobra_mk1_alt_tex3_npc_scuffed, noshaders_cobra_mk1_alt_tex2_npc, griff_gecko_alt-NPC, griff_mamba_escort_alt-NPC, mamba-escort. Nothing I can see is consistent there. All the bounties were zero. All the scanClasses were "CLASS_NEUTRAL".

The thing is, I also have examples, in the same session, where an "anaconda" and a "griff_boa_MK2_alt-NPC" were created with escorts, but the escorts didn't attach. Same code was running. The only difference I could make out between the two was that the one that worked was launched from a Rock Hermit, while the ones that didn't were launched from a Con store and an RRS waystation. Can the launch station have anything to do with the offerToEscort function? I have other examples of launching escorts from a Rock Hermit that fail to attach, so I guess there's no link.

Any suggestions, anyone?

EDIT: Should note, in case it's important, doing this in G5 Issodien, Corp State, Avg Industrial, Tech level 11.
EDIT 2: Just had another session where the escorts linked up OK. Maybe I'm just going crazy...
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4667
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Arrivals and departures

Post by phkb »

After a night's sleep I thought I'd found the answer. Maybe the ships were rejecting escorts because of their destination systems? So I tried forcing the mothership's destination to be a dangerous system just before doing the offer to escort, but still it rejected it.

It was a nice idea, anyway. I felt, for a brief moment, like I was beginning to understand the system. :? Sigh. Oh well. Back to the drawing board...
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Arrivals and departures

Post by Smivs »

phkb wrote:

Code: Select all

	"dock_anaconda" = {
		like_ship = "oolite_template_anaconda";
		escort_roles = (
			{role = ""; min = 16; max = 16;}
		);
		roles = "dockonly";
	};

You might be missing a comma. I think perhaps

Code: Select all

{role = ""; min = 16; max = 16;}
should be

Code: Select all

{role = ""; min = 16; max = 16;},
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4667
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Arrivals and departures

Post by phkb »

Thanks Smivs, I'll give it a shot!

Edit: OK, that didn't work, but I think I discovered the issue. I had a look in the Oolite source, and noticed that there is a condition for "offerToEscort" that the status of the mothership has to be "STATUS_IN_FLIGHT". I'm doing this update as part of the "launchShipWithRole" function. I'm guessing (because I can't test this at the moment), but I think I'm doing the offerToEscort too soon. In the examples where the offer to escort worked there was a delay between launching the mothership and the escorts. That delay gave the mothership's status time to change to be "STATUS_IN_FLIGHT", and thereby allowed the "offerToEscort" to work. That's my new theory. I'll report back later on how it goes.

Edit: I am very happy to report that I solved it! It was, indeed, due to the state of the mother ship. A beta package is not far away...
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Arrivals and departures

Post by Zireael »

A beta package is not far away...
That's amazing, phkb!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4667
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Arrivals and departures

Post by phkb »

I'm very happy to announce the beta release of the Station Dock Control, version 0.1. In short, this OXP attempts to simulate the arrivals and departures of a space station, and give the player full view of most ships docked at a station. Ships will launch according to the scheduled departure time, docked ships will move through a number of statuses, and pilots will sometimes change their minds or hide their destinations from the player.

Download link for OXP: https://app.box.com/s/nqzefpnlhnk9gx51erxsowbg752zw1uh.

Screenshot 1: Example of a page from the Station Traffic control
Image

Screenshot 2: Example of ship detail page
Image

Screenshot 3: Example of Traffic Control MFD
Image

The readme.txt file contains a lot more information, so I encourage you to read that file.

This OXP is quite a bit more than just a list of ships or a slightly more complex system populator. One path I could have taken is to just create a fake list of ships, and have items disappear when ships "launch", and add items to the list when ships "dock". When you're docked it's not like you have a view port to see what ships are actually docking or launching, and when you're in space, who cares whats going on inside? But I didn't want to create a dummy list that had no relation to the actual game world. I wanted to have a real list of ships that launch real ships. I wanted to see a whole group of ships dock with a station, see them in the dock, and see them launch again. Achieving that level of detail and complexity requires quite a bit of code, I discovered, which is why the OXP is quite large for a package with no graphical elements.

So, while I'm really happy to be sharing this, I'm also fairly nervous - I'm playing with things way above my pay grade here! I hope you understand that what I'm saying is that I need help to make sure I haven't broken something horribly, but that the core game of Oolite still continues to play in a satisfactory way. With this much code the potential for unforeseen conflicts and breakages is huge, so I need some feedback from some willing testers on a few issues. Testers will need to pay close attention to their actions as they will have a big impact on the dock list.

1. Empty dock lists: Do you ever get to a point where there are no ships in the list, particularly at main stations? Where were you and what did you do to make that happen?
2. Launching/docking frequency: Does the number of ships launching and docking feel right? The idea is that traffic volume should match the system tech level, station type and system busyness.
3. Changing data: Do ships change their departure time or destination too often or too infrequently? Did you even notice this happening?
4. Performance issues: Do you notice any slow downs or regular hiccups on your system? Do you notice when this OXP is installed?

I'm outputting a lot (and I mean, a *lot*) of data into the log file, so hopefully that can provide answers to any issues that arise.

If someone is willing I'd also appreciate feedback on the code, particularly for ways to improve the speed of various sections. I really need some help with the code that puts ships directly into the system (as opposed to launching them through a station). The code, at present, seems to put ships in the launch corridor, despite my best efforts (and help from others) to position ships away from it. There's also a pretty good chance that some code could be cut, so suggestions along those lines would be appreciated as well. Any suggestions that can help make this better would be great.

For the moment, I'm just releasing this as an OXP, rather than OXZ, the reason being it's a lot easier to see and change things in an OXP, and I'd like to encourage people to look inside as much as possible. An OXZ will follow once the code is stable.

There's more information about what is going on in the "readme.txt" file, and the code itself has a few comments explaining the reasoning behind, and logic for, a number of core parts. I'm happy to explain anything I've missed, or change things whenever improvements can be made. Nothing is set in stone!

I hope you enjoy using this OXP and that it deepens the Oolite world on your PC.
Last edited by phkb on Thu May 21, 2015 3:28 pm, edited 1 time in total.
Layne
---- E L I T E ----
---- E L I T E ----
Posts: 355
Joined: Sat Mar 28, 2015 11:14 pm

Re: Arrivals and departures

Post by Layne »

The whole idea of this is such a remarkable piece of immersion that I have to give this a try, even as a beta. I'll let you know what I see!

EDIT:
Ok, a couple of first impressions right off the bat.

The interface where you have to back up to the screen and select each ship individually is a bit clunky. It might be smoother to allow scrolling through each selection without returning to the main docking bay screen.

Listing the arrivals/departures for Rock Hermits seems a bit out-of-place, given those would seem to be places pilots would go to /avoid/ scrutiny by GalCop. Readme says this is likely just there for testing purposes and I agree it's something to remove in the final version.

I noticed the display for a worker's commuter in a communist system didn't show a graphic of the ship-- that may just be because I'm still using 1.80 though, and I noted you mentioned that as a possible limitation on running it without 1.82. Just mentioning it in case that's not the cause.

I like the addition of your own ship as something to see docked, it's a nice touch!
Reports of my death have been greatly underestimated.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4667
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Arrivals and departures

Post by phkb »

Layne wrote:
The interface where you have to back up to the screen and select each ship individually is a bit clunky.
So, a "Next ship" and "Previous ship" menu when you're viewing ship details, that sort of thing?
Layne wrote:
Listing the arrivals/departures for Rock Hermits seems a bit out-of-place, given those would seem to be places pilots would go to /avoid/ scrutiny by GalCop. If you want to include them, I'd make it only readable when you are actually docked at that particular Rock Hermit, and not remotely from the main station.
The ability to look at the dock list of other stations is purely a debug/testing function. It saves you having to fly to the station to view it. I doubt this feature will be in the official release.
Layne wrote:
Listing the formal in-game roles for each ship in the entry also seems out of character.
Again, this is visible only for the beta period. It will be hidden in the official release.
Layne wrote:
I noticed the display for a worker's commuter in a communist system didn't show a graphic of the ship
It should show images for all ships. Can you do a "Write details to log" and send me the result?

Thanks for the quick feedback!
Layne
---- E L I T E ----
---- E L I T E ----
Posts: 355
Joined: Sat Mar 28, 2015 11:14 pm

Re: Arrivals and departures

Post by Layne »

phkb wrote:
So, a "Next ship" and "Previous ship" menu when you're viewing ship details, that sort of thing?
Just so, just so. That would be helpful for ease of use.

And a couple of error message that I noted in the log when when I was reviewing:
21:51:31.554 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (StationDockControl 0.1.0): TypeError: shipKeys is null
21:51:31.554 [script.javaScript.exception.unexpectedType]: ../AddOns/StationDockControl.oxp/Scripts/stationdockcontrol.js, line 317.

21:51:35.607 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (StationDockControl 0.1.0): TypeError: this._shipPlist is null
21:51:35.608 [script.javaScript.exception.unexpectedType]: ../AddOns/StationDockControl.oxp/Scripts/stationdockcontrol.js, line 1836.
The log for the commuter has been sent as a private note.
Reports of my death have been greatly underestimated.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4667
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Arrivals and departures

Post by phkb »

Layne wrote:
And a couple of error message that I noted in the log when when I was reviewing:
21:51:31.554 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (StationDockControl 0.1.0): TypeError: shipKeys is null
21:51:31.554 [script.javaScript.exception.unexpectedType]: ../AddOns/StationDockControl.oxp/Scripts/stationdockcontrol.js, line 317.

21:51:35.607 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (StationDockControl 0.1.0): TypeError: this._shipPlist is null
21:51:35.608 [script.javaScript.exception.unexpectedType]: ../AddOns/StationDockControl.oxp/Scripts/stationdockcontrol.js, line 1836.
OK, not sure what happened there. shipKeys should have been returned for the standard ship roles. Oh well, I've added code to cater for that scenario and if it happens again a message will appear in the log. Because this error would cause large parts of the code to fail, I've uploaded a new version with the fix, version 0.2.0. That version also happens to have the "Next ship"/"Previous ship" functions as well.

Still not sure why the commies ships aren't showing up. I'm seeing the same on my system, but I don't normally have "Commies" installed. I'll keep researching.

Thanks again.
Layne
---- E L I T E ----
---- E L I T E ----
Posts: 355
Joined: Sat Mar 28, 2015 11:14 pm

Re: Arrivals and departures

Post by Layne »

phkb wrote:
Still not sure why the commies ships aren't showing up.
Because the Red Menace lurks just out of sight of peaceful citizens!
Reports of my death have been greatly underestimated.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4667
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Arrivals and departures

Post by phkb »

Layne wrote:
Because the Red Menace lurks just out of sight of peaceful citizens!
:lol:
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2290
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: Arrivals and departures

Post by Wildeblood »

This same [expletive] code that annoys me in email system...

Code: Select all

	// set up the interface screen, if required
	var p = player.ship;
	if(p && p.isValid) {
		if (p.dockedStation.hasNPCTraffic && this.$checkStationRoleForView(p.dockedStation)) {
			this._selectedStation = p.dockedStation;
			this.$initInterface(p.dockedStation);
		}
	}
Seriously, where did you learn this bad habit? (Don' answer, I'm sure I know.)
HELLO, MODERATOR!? Put this in a sticky topic, put this in a FAQ, please:-
You're playing the game, aren't you? So you know there's a player.ship. You don't need to check for the existence of player.ship! Why don't you young people understand that every conditional check in JS wastes time, and every one is a PPoF (potential point of failure) if you happen to slip up with the syntax.

Then, just to annoy me and cause me to SHOUT AT YOU, you don' bother to check for the thing you should be checking. You just casually assume (payer.ship.docked).

Code: Select all

	// set up the interface screen, if required
	var p = player.ship;
	if (p.docked) {
		if (p.dockedStation.hasNPCTraffic && this.$checkStationRoleForView(p.dockedStation)) {
			this._selectedStation = p.dockedStation;
			this.$initInterface(p.dockedStation);
		}
	}
That's as far as I got. I just can't even look further. Wow, just wow. Bad code just because #copyingOtherPeoplesBadHabits

So outraged.
Post Reply