Page 29 of 63

..

Posted: Tue Oct 06, 2009 9:26 pm
by Lestradae
Hi pmw57,

Yep, all your assumptions are correct and I think your FTZ suggestion is a good one :D

I suggest taking the Behemoths out as I have created an individual script for them that is essentially a clone of Eric's upgrade to this, and do as you say concerning the FTZ.

The rest as I said in the above posting "All the stuff you listed should simply always be there, once, unduplicated, irrelevant if you launch from a station the first or umpteenth time or if you come in from a jump."

Reason being, these are simply objects that should not change in a system simply because you dock or launch or whatever, especially not multiply - that was a SNAFU on my part, overlooking this :oops:

Cheers & cool that you are on it 'till the end 8)

L

Re: ...

Posted: Wed Oct 07, 2009 1:47 am
by pmw57
Thargoid wrote:
There is planning to depreciate (remove) this.reset in the future and have the scripts reloaded when a save game loading/death occurs, which will mean that this.startUp will trigger instead in those cases.[/color]
I would like to suggest an up to the code then, to reflect this plan and prepare it for the eventual retirement of the reset event, by effectively switching the contents of this.startUp and this.reset on
http://wiki.alioth.net/index.php/OXP_mission_offering

to something like this code:

Code: Select all

// startUp only runs once at startup before the demoscreen shows up, and for a new Jameson.
this.startUp = function()
{
   this.mustPopulate = true;
   /* used for adding ships after a first launch.
   This way you don't have to time consuming check every launch if a ship was already there.
   */
}

// this runs after loading a saved game. Plans are to combine it with this.startUp()
this.reset = function()
{
    this.startUp();
}
It would make future code easier to modify. When game has the startUp event occurring on all occasions, The reset event can just be there for compatibility with older versions of the game, and eventually be removed completely.

Re: ...

Posted: Wed Oct 07, 2009 3:02 am
by pmw57
Lestradae wrote:
These here should appear in interstellar space:

this.addMissionaryShips();
this.addDredgerShip();
this.addHardPirateShips();
this.addBehemothShips();
this.pimpMySystem();
this.addNavyPatrolShips();
The existing plist code checks that the system government and tech level meet certain conditions before some of those ships are added.
  • Dredgers check that the tech level is 9 or more
  • Hard Pirates check varying levels of the economy
  • Anarchy - 10 ships at 30%, 30%, 20%, 20%, 10%, 10%, 5%, 5%, 4% and 3%
  • Feudal - 9 ships at 25%, 20%, 15%, 10%, 10%, 5%, 5%, 3% and 3%
  • Multi-Government - 6 ships at 10%, 10%, 8%, 6%, 5% and 3%
  • Dictatorship - 5 ships at 10%, 8%, 6%, 5% and 3%
  • Communist - 4 ships at 10%, 8%, 6% and 3%
  • Confederacy - 4 ships at 10%, 8%, 6% and 3%
  • Democracy - 5 ships at 10%, 5%, 4%, 3% and 3%
  • Corporate State - 4 ships at 5%, 4%, 3% and 3%
When hard pirates are being added to interstellar space, am I to presume that the these are only the ships that these interstellar pirates are those that would turn up in an Anarchy government (without the pirate cove?)

Also, many of the pirates are added using the 'swu' coordinate susyem (sun-witchspace-units). How does this affect ships that are spawned in interstellar space?

Posted: Wed Oct 07, 2009 5:43 am
by Commander McLane
System specs of Interstellar Space:

Off the top of my head I think that Oolite uses the system specs (TL, government, etc) of your destination system for Interstellar Space. Therefore hardpirates would be spawned like in the system you wanted to jump to.

Coordinate systems:

In interstellar space all coordinate systems are treated as equal. The player gets spawned at (0, 0, 0), facing the z-direction. And an NPC spawned via addShipsAt("xym", [0, 0, 0]) will be next to the player, regardless which points "x" and "y" represent. However, I have no idea how the "p", "s", and "u" units are handled in that case. My advice: tinker with the values, and go misjump a couple of times to find out. It could be a good idea, though, to only use meters as a unit for spawning things in interstellar space. That would at least make clear to every reader where to expect the thing to get spawned.

..

Posted: Wed Oct 07, 2009 6:28 am
by Lestradae
@Commander McLane:

Perhaps for spawning ships in the interstellar medium, using the "abs" quasi-absolute coordinate system might make sense? Then there should be no need to worry about coordinate systems that should/might depend on the existence of a main planet or a sun ...

@pmw57:

Interstellar spawn suggestions/imaginations:

* this.addMissionaryShips(): A single one, on arrival point. This guy is lost, but desperately clings to his mission.
Chance to appear: 5%

* this.addDredgerShip(): A single one, perhaps two scanner ranges in the distance so that it can still be seen/reached, but is not immediately involved in eventual witchspace battles. Here on some purpose.
Chance to appear: 5%

* this.addHardPirateShips(): Add a little fleet as if in an anarchy. In my imagination, these guys are definitely not lost. They are ultra-tough bastards with the idea to gain stuff by doing battle with the thargoids on their home turf and if a little three-way battle with the galactic navy should ensue, well perhaps some military equipment can be salvaged :twisted:
Chance to appear: 10%

* this.addBehemothShips(): As said above, ignore. Already used Eric's update for that.

* this.pimpMySystem(): Add three on arrival point. These, too, are supposed to be super-hard nuts who have hacked and pimped their own ships beyond any reasonable safety regulations ... they forced a misjump to get here!
Chance to appear: 5%

* this.addNavyPatrolShips(): Here on obvious purpose. I suggest adding 2 militarycarrier, 4 militarybig and 8 militarymedium ships, perhaps at 1,5 scanner range distance from arrival point - that way, the moment they detect thargoids (if any) they would come sailing in and on the fireworks ...
Chance to appear: 25% militarycarrier, 10% militarybig & 5% militarymedium

Does that at all sound sensible?

:idea:

L

Re: ..

Posted: Wed Oct 07, 2009 7:16 am
by Commander McLane
Lestradae wrote:
Perhaps for spawning ships in the interstellar medium, using the "abs" quasi-absolute coordinate system might make sense?
Or use "pwm", because that's the one displayed on your screen with SHIFT-F.

@ pmw57: Forget the complicated method of tinkering with the script and misjump time and again. Use the JS-console instead. Much easier.

(1) Misjump.

(2) Type: system.allShips.forEach(function(ship){ship.remove()}). This will give you a "clean canvas".

(3) If there is still something left (like debris): repeat once.

(4) Spawn ships by typing system.legacy_addShipsAtPrecisely("asteroid", 1, "abc", [x, y, z]). "abc" being the coordinate system you want to test, and "x", "y", and "z" being the coordinates according to the system. I wouldn't be surprised if all "z"s would interpreted as meters, regardless of what the "c" is.


EDIT: Or just don't do it, because I've just done it myself with system.legacy_addShipsAtPrecisely("asteroid", 1, "pwu", [1, 1, 1]). And, what shall I tell you, the asteroid was added at precisely "abs", [1 ,1, 1]. Which proves to my satisfaction that the coordinate system entry is completely ignored in interstellar space, and the coordinates are treated as if they were in meters.

Note that this means that ships spawned per "swu" like in your example will appear completely elsewhere from where the script would intend them to be within a system. For instance, one unit of "u" measures hundreds of thousands of meters, so e.g. "swu", [5, 5, 5] will be extremely far away from the origin (the place where the player is). In interstellar space, however, using the same coordinates, the ship will appear right on top of the player, mere meters away from the origin.

Re: ...

Posted: Wed Oct 07, 2009 7:28 am
by Eric Walch
pmw57 wrote:
I would like to suggest an up to the code then, to reflect this plan and prepare it for the eventual retirement of the reset event, by effectively switching the contents of this.startUp and this.reset on
http://wiki.alioth.net/index.php/OXP_mission_offering
No, the way it is written is the best as we still live in the 1.73 century. It was well thought when I wrote it up. It will work as good with 1.73 as well with 1.74., without limitations for either version. There is no need to change code between versions.

When you have code that only needs to run at startup for 1.73, you cant add that in your configuration.

Re: ..

Posted: Wed Oct 07, 2009 7:39 am
by Thargoid
Commander McLane wrote:
EDIT: Or just don't do it, because I've just done it myself with system.legacy_addShipsAtPrecisely("asteroid", 1, "pwu", [1, 1, 1]). And, what shall I tell you, the asteroid was added at precisely "abs", [1 ,1, 1]. Which proves to my satisfaction that the coordinate system entry is completely ignored in interstellar space, and the coordinates are treated as if they were in meters.

Note that this means that ships spawned per "swu" like in your example will appear completely elsewhere from where the script would intend them to be within a system. For instance, one unit of "u" measures hundreds of thousands of meters, so e.g. "swu", [5, 5, 5] will be extremely far away from the origin (the place where the player is). In interstellar space, however, using the same coordinates, the ship will appear right on top of the player, mere meters away from the origin.
Or to quote the relevant wiki page:
On the page about Oolite co-ordinate systems, Eric wrote:
in witchspace (== no sun) coordinates are absolute irrespective of the system used
and "abs" always uses metres as the units, as there's nothing else to use (planetary radii, solar radii and distance between planets/suns/witchpoint are all nonsensical in witchspace as they don't exist).

Re: ..

Posted: Wed Oct 07, 2009 8:14 am
by Eric Walch
Thargoid wrote:
Or to quote the relevant wiki page:
On the page about Oolite co-ordinate systems, Eric wrote:
in witchspace (== no sun) coordinates are absolute irrespective of the system used
Did I write that? Can't believe that are wordings I use. Looked it up, it seems that I was the only editor of that page. Looking further I noticed i shamelessly copied that part from the methods page. Although I assume that "abs" is the only working method in witchspace.

Posted: Wed Oct 07, 2009 8:45 am
by Commander McLane
Oops! Didn't know that page. I guess that's because it's not categorized. Oh, and instead of "witchspace" it should of course be "interstellar space".

Fixed both for you! :wink:

Re: ..

Posted: Wed Oct 07, 2009 9:40 am
by pmw57
Lestradae wrote:
Interstellar spawn suggestions/imaginations:

* this.addMissionaryShips(): A single one, on arrival point. This guy is lost, but desperately clings to his mission.
Chance to appear: 5%
The existing missionary ships are as follows:

Code: Select all

this.addMissionaryShips = function () {
	if (player.ship.fuel >= 5 && Math.random() < 0.90) {
		system.legacy_addSystemShips('missionary', 1, 0.3);
		system.legacy_addSystemShips('missionary', 1, 0.7);
	}
};
To add your suggestion, you would add a separate if condition.

Code: Select all

this.addMissionaryShips = function () {
	if (player.ship.fuel >= 5 && Math.random() < 0.90) {
		system.legacy_addSystemShips('missionary', 1, 0.3);
		system.legacy_addSystemShips('missionary', 1, 0.7);
	}
	if (Math.random() < 0.05) {
		system.legacy_addSystemShips('missionary', 1, 0.5);
	}
};
We can try out different ideas after the existing lot is working properly. You will find that more ships appear with the existing one, now that they are appearing as originally intended.

Posted: Wed Oct 07, 2009 10:02 am
by pmw57
This 0.71 version of ose.js is now reworked, from its plist heritage, to be in line with the example code from http://wiki.alioth.net/index.php/OXP_mi ... ne_with_JS

No longer do ships pile up with repeat visits to the station.
No more do ships fail to appear from a save game.
Interspace is a place only for its intended.

The 0.71 version of ose.js is found at http://www.box.net/shared/l3g4bkyn0c

..

Posted: Wed Oct 07, 2009 12:39 pm
by Lestradae
Hi pmw57,

all looks fine with one probable bug I found (some copy-and-paste typo?), which seems to have been here for some time now (also found it in an older version of this script):

Code: Select all

this.addInraPatrolShips = function () {
        if (system.techLevel === 15) {
                system.legacy_addShipsAt('INRA', 1, 'pwu', [0, 0, 0.7]);
                system.legacy_addShipsAt('Auction-Station-Node2', 1, 'pwu', [0, 0, 0.3]);
        }
};
First, the INRA patrol ships should be there in all systems above tech level 15 (14 in the code) - they are border patrols in the special systems, which can be TL 16, 17 or 18. "system.techLevel === 15", if I'm not mistaken, means only TL 16 (ingame, 15 in the code), yes?

So that should be changed.

Besides that, instead of adding two INRA patrols to such systems, it adds another auction station node somewhere!

I assume that part of the script should say instead:

Code: Select all

this.addInraPatrolShips = function () {
        if (system.techLevel >= 15) {
                system.legacy_addShipsAt('INRA', 1, 'pwu', [0, 0, 0.7]);
                system.legacy_addShipsAt('INRA', 1, 'pwu', [0, 0, 0.3]);
        }
};
Does that look OK to you?

Cheers

L

Re: ..

Posted: Wed Oct 07, 2009 1:04 pm
by pmw57
Lestradae wrote:
I assume that part of the script should say instead:

Code: Select all

this.addInraPatrolShips = function () {
        if (system.techLevel >= 15) {
                system.legacy_addShipsAt('INRA', 1, 'pwu', [0, 0, 0.7]);
                system.legacy_addShipsAt('INRA', 1, 'pwu', [0, 0, 0.3]);
        }
};
Does that look OK to you?
That looks like just the ticket. The code from the above link has been updated to reflect this.

It's amazing how much easier it is to read the intention of the code now that it's in javascript, as compared to xml

...

Posted: Wed Oct 07, 2009 1:09 pm
by Lestradae
The most amazing thing to me is that I slowly start to understand how this all works together at all!

Though, imho it is less the java script and more your examplary comments that, together with the few similarities with legacy script-ish parts, make a picture of the process emerge in my head :D

Cheers

L