Page 1 of 1

Messages Between Ships & Make a Ship Disappear?

Posted: Sun Oct 21, 2007 3:13 am
by Muffy St. Bernard
Hi all,

I'm a newcomer to Oolite, and while the game is a blast (I honestly HAVE been searching for a space sim where I get to watch a distant planet get closer for thirty minutes) I'm most interested in the OXPs.

I've found my way through the tangled wiki but there are two things I haven't been able to figure out:

1) Is there an AI message that can make a ship disappear? I do want to completely remove a ship from space, but the best I can manage is to make it explode.

2) Is it possible for one ship to send a custom AI message to another ship? In this case I'd like to have ship "A" search for ship "B," and when it finds it, send a message to ship "B" to notify it that it's been found...without attacking it. It seems that ships and stations can send a broader range of messages back and forth, but ships can only communicate by either searching for (and finding) each other or by attacking each other.

I'm also wondering offhand if there are a list of planets that have been modified by OXPs, or if it's just assumed that people are bound to pick different planets because there are so many of them.

Finally, something I found out the hard way: the wiki articles assume that readers just understand what it means when something is "written to the logfile." I spent forever searching for it on my Mac OS X system, before realizing it could be displayed through the Console application.

Cheers,
Muffy

Re: Messages Between Ships & Make a Ship Disappear?

Posted: Sun Oct 21, 2007 10:50 am
by JensAyton
Muffy St. Bernard wrote:
1) Is there an AI message that can make a ship disappear? I do want to completely remove a ship from space, but the best I can manage is to make it explode.
You can cause it to hyperspace out with performHyperSpaceExit, but this will cause a similar ship to appear at the witchpoint. In 1.70, performHyperSpaceExitWithoutReplacing will be available to do the same thing but without summoning a replacement.
Muffy St. Bernard wrote:
2) Is it possible for one ship to send a custom AI message to another ship? In this case I'd like to have ship "A" search for ship "B," and when it finds it, send a message to ship "B" to notify it that it's been found...without attacking it.
I don’t think so. In 1.70, this type of thing will be possible with ship scripts (in JavaScript). AIs will be able to send messages to their own ship’s script, scripts will be able to fiddle with AI state, and scripts can talk to each other.
Muffy St. Bernard wrote:
Finally, something I found out the hard way: the wiki articles assume that readers just understand what it means when something is "written to the logfile." I spent forever searching for it on my Mac OS X system, before realizing it could be displayed through the Console application.
Yeah, this is something of a problem. An article on basics would probably be useful.

In the current test release, Oolite for OS X logs to its own file rather than the shared console.log. The debug plug-in for 1.70 will provide an “Open Log” menu command.

Posted: Sun Oct 21, 2007 1:02 pm
by Muffy St. Bernard
Thanks! I look forward to the Ship Scripts, and I am grateful for all the information that is already in the Wiki.

Re: Messages Between Ships & Make a Ship Disappear?

Posted: Mon Oct 22, 2007 9:59 am
by Commander McLane
Hi, Muffy St. Bernard, and welcome to the boards and of course to this great game! :D
Muffy St. Bernard wrote:
1) Is there an AI message that can make a ship disappear? I do want to completely remove a ship from space, but the best I can manage is to make it explode.
I think you could also use landOnPlanet to make a ship just disappear. That's what the Generation Ships in genship.oxp do when they are attacked. And although they are in interstellar space, so there is no planet, it works. Haven't tried it in a system, though.

Posted: Mon Oct 22, 2007 11:36 am
by TGHC
Am I missing something here, why not just make it hyperspace?

Posted: Mon Oct 22, 2007 11:47 am
by Commander McLane
TGHC wrote:
Am I missing something here, why not just make it hyperspace?
Because for reasons discussed elsewhere, it would come back (or to be precise: would be replaced) instantly. It also would leave a probably unwanted wormhole.

Posted: Mon Oct 22, 2007 12:31 pm
by TGHC
Commander McLane wrote:
TGHC wrote:
Am I missing something here, why not just make it hyperspace?
Because for reasons discussed elsewhere, it would come back (or to be precise: would be replaced) instantly. It also would leave a probably unwanted wormhole.
Well that's a bug that has been fixed for the next release, and wormholes are only temporary.

Posted: Mon Oct 22, 2007 12:36 pm
by Captain Hesperus
TGHC wrote:
Well that's a bug that has been fixed for the next release, and wormholes are only temporary.
Here's a weird thing. I was just leaving a station to have a 'spirited discussion' with a certain Guild-Sister of the Assassin's Guild when I saw a BCC hyperspace out. It's wormhole remained for approximately 2-3 seconds before disappearing, and yet, when a Cobra Mk. III hyped out it's wormhole remained for a good minute or so. Is there some kind of timer attached to the wormholes or is this an entirely random/unexpected occurance?

Running OOlite V. 1.65 (for Assassins)

Captain Hesperus
..voted 'Most likely to be gunned down in cold blood' by readers of The Fusilist's Digest.

Posted: Mon Oct 22, 2007 1:09 pm
by JensAyton
Every time a ship a wormhole, the wormhole’s “witch_mass” increases by the mass of the ship. The witch_mass decreases by 4000 kg/second. When it reaches 0, the wormhole vanishes. This effectively means that the time the wormhole is open is proportional to the sum of the mass of all the ships that have gone through it. (The mass of a ship is proportional to its volume.)

Posted: Mon Oct 22, 2007 4:27 pm
by Eric Walch
McLane wrote:
I think you could also use landOnPlanet to make a ship just disappear. That's what the Generation Ships in genship.oxp do when they are attacked. And although they are in interstellar space, so there is no planet, it works. Haven't tried it in a system, though.
It will work, but with a small "bug". If it is a bug just depends how principal you are. I just looked through that part of the code last week and discovered that the functioning of that command was wrongly explained on the wiki. (I updated the text last week so the functioning is fresh in my memory)

landOnPlanet looks for the nearest planet. If there is one it increments a counter for shuttles that are on the ground of that nearest planet. Then it removes the ship. So if it works in interstellar space, it will also work with a planet nearby. In the last case as side effect that there will be one shuttle more that takes off from the planet.

But this will probably not be noticed by anybody. On entering a system the populator defines a random number for ships on the ground and than calculates such a launch-spacing, that all shuttles are launched over 1 hour period. Therefor adding a extra shuttle has only effect if one stays much longer than an hour in the system. And maybe never as shuttles are also starting from the station and those landed shuttles are also added to the ground ones. So the counter may never reach zero if one not deliberately shoots at shuttles. (as a "luck" only unexperienced pilots are allowed to fly shuttles. A large percentage will crash during the start so they remove themselves from the system).

Posted: Tue Oct 23, 2007 2:20 pm
by Muffy St. Bernard
During my early (mostly blind) fiddling, I did try hyperspacing the ship out, but that didn't seem to work...I was probably doing something else wrong, but at the time assumed the ship was being prevented from going into hyperspace for some reason.

In any case, landOnPlanet sounds exactly like what I'm looking for! I figured you'd need to be NEAR a planet for it to work, and that it might have some kind of side-effect (like the ship suddenly flying off toward the planet). But if not, that sounds good.

It's difficult to really playtest these things when I'm enjoying the game so much!

Thanks for your help, and also thanks to the person who wrote the "Brickship" tutorial. I'm learning mainly by looking at other OXPs and then cross-referencing with the wiki, and having a tutorial for creating new models was a real blessing.

Muffy.

Posted: Tue Oct 23, 2007 4:43 pm
by Eric Walch
Muffy St. Bernard wrote:
During my early (mostly blind) fiddling, I did try hyperspacing the ship out, but that didn't seem to work...I was probably doing something else wrong, but at the time assumed the ship was being prevented from going into hyperspace for some reason.
landOnPlanet will work, but it is not consistent how things work in the oolite universe. Ships should not just disappear for no reason. Near the planet susface it looks like a landing and in space they should create a wormhole and fly trough to be consistent.

One problem is that a ship with the same role appears at the witchpoint. (This is not a bug, but deliberate to maintain the number of ships in the universe). But there is no problem without a solution.

In the AI script you must use the commands:

ENTER = ("setRoles: trader", performHyperSpaceExit)

First it changes the role of your ship in trader. When you than make a hyperspaceexit the system sees a trader leaving the system and will add a new ship with role trader at the witchspacepoint. And with trader it will automaticaly get a route1TraderAI or sunskim-traderAI. It will also work with setting a role of "pirate". Other roles are not advisable as you want the ship to have a general role.

It will work, I tested it today.

Posted: Tue Oct 23, 2007 5:23 pm
by Muffy St. Bernard
Wow, I didn't know there was a "setRoles" method! It's not in the wiki, which makes me wonder what other good stuff I don't know about.

I did actually have a consistent, logical reason for wanting the ship to literally disappear, and I was even taking into account the desire for a sensible Oolite universe...I know that people don't want crazy things happening without explanation.

Muffy.

Posted: Tue Oct 23, 2007 5:38 pm
by TGHC
Eric Walch wrote:
But there is no problem without a solution.
You've never met my mother-in-law then!

Posted: Tue Oct 23, 2007 10:46 pm
by JensAyton
Muffy St. Bernard wrote:
Wow, I didn't know there was a "setRoles" method! It's not in the wiki, which makes me wonder what other good stuff I don't know about.
That’s because it’s not a documented AI method and as such may disappear at any time. Specifically, it will be gone in 1.70 and onwards. However, there will be a new setPrimaryRole: method actually intended for this sort of use.