Page 1 of 3

What is your maximum speed

Posted: Tue Apr 05, 2011 6:05 pm
by Okti
I would like to find out maximum speed player ships speed, used by the players.

I may need to edit the post later, because I used the entries used in shipdata.plist.

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 6:07 pm
by another_commander
The Speed of Mind.

Do I win? ;-)

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 6:09 pm
by Okti
another_commander wrote:
The Speed of Mind.

Do I win? ;-)
Good one :D

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 6:12 pm
by Okti
I hope Google [Bot], will not vote :P

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 6:41 pm
by Thargoid
The speed of Dark.

No matter how fast light is, it always gets there first...

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 6:46 pm
by Okti
Thargoid wrote:
The speed of Dark.

No matter how fast light is, it always gets there first...
That's another good one :lol:

By the way I know max speed for a NPC is set in shipdata.plist, but is there a way to set it by JS :?:

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 6:47 pm
by Smivs
The speed of silence...you can't even hear it coming.

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 7:25 pm
by Commander McLane
Okti wrote:
By the way I know max speed for a NPC is set in shipdata.plist, but is there a way to set it by JS :?:
Nope. Most of the hard ship specs are read-only in JS. The documentation tells you so, also for maxSpeed. It tells you also if something is read-write.

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 7:39 pm
by Okti
Commander McLane wrote:
Okti wrote:
By the way I know max speed for a NPC is set in shipdata.plist, but is there a way to set it by JS :?:
Nope. Most of the hard ship specs are read-only in JS. The documentation tells you so, also for maxSpeed. It tells you also if something is read-write.
I knew the reply, but it may be a good thing to set up an npc's speed according to player ships speed.

I know that is possible to set in AI, but is there a way to set percentage of the speed, according to criteria in JS?

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 7:48 pm
by Thargoid
Script-wise you can use desiredSpeed, which works the same way as the AI equivalent.

But of course just because you set it in script doesn't mean that the ship's AI won't then change it again, depending on the AI code. And also the desiredSpeed is of course capped at the maxSpeed.

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 7:52 pm
by Okti
Thanks Thargoid,

I will try that.

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 9:30 pm
by Commander McLane
Okti wrote:
Commander McLane wrote:
Okti wrote:
By the way I know max speed for a NPC is set in shipdata.plist, but is there a way to set it by JS :?:
Nope. Most of the hard ship specs are read-only in JS. The documentation tells you so, also for maxSpeed. It tells you also if something is read-write.
I knew the reply, but it may be a good thing to set up an npc's speed according to player ships speed.

I know that is possible to set in AI, but is there a way to set percentage of the speed, according to criteria in JS?
Thargoid already answered that one. Speed is something else than maximum speed. Just because a car can make 180 km/h doesn't mean that it's going at this maximum speed all the time. Sometimes it goes slower, sometimes it even stops.

The same is true for Oolite. ship.speed is something else than ship.maxSpeed. There is also ship.cruiseSpeed, which is always 80% of ship.maxSpeed. All of these are read-only in JS. If you want to set a ship's speed you have to use ship.desiredSpeed, with the caveat mentioned by Thargoid. NPCs are meant to be flown by AIs, not by scripts. In Oolite 2 these two will perhaps be more integrated than they are now. And even now you could try to give a ship nullAI and fly it only by script commands. I am not sure, however, which advantages that would have. The state machine system has proven itself kind of useful for NPC-flying.

You could also try to experiment with ship.velocity.

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 9:31 pm
by Switeck
If NPC ships have injectors, they can move up to 7x normal max speed until they run out of fuel.
...But you may need to tell them to do so. :P

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 9:44 pm
by JensAyton
Commander McLane wrote:
There is also ship.cruiseSpeed, which is always 80% of ship.maxSpeed.
No, it isn’t (which is why it’s exposed). cruiseSpeed can be lowered to 99 % of the maximum speed of a ship’s slowest escort in order to keep formations together.

Re: What is your maximum speed

Posted: Tue Apr 05, 2011 9:49 pm
by Commander McLane
Ahruman wrote:
Commander McLane wrote:
There is also ship.cruiseSpeed, which is always 80% of ship.maxSpeed.
No, it isn’t (which is why it’s exposed). cruiseSpeed can be lowered to 99 % of the maximum speed of a ship’s slowest escort in order to keep formations together.
Ah yes, I forgot that.

So it would be more correct to say that cruiseSpeed is usually 80% of maxSpeed, especially if the ship in question doesn't have escorts.