Suggestion - Mass Lock gauge

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Ganelon
---- E L I T E ----
---- E L I T E ----
Posts: 534
Joined: Fri Jul 02, 2010 11:45 am
Location: Around Rabiarce or Lasoce

Post by Ganelon »

Commander McLane wrote:
With navigational compass you mean the Advanced Space Compass? That doesn't show NPCs, except they are carrying a beacon code, or they are your current target. If it's your current target, that means it's within scanner range, so you can see your distance on the scanner. Oh, and everything on the scanner has already masslocked you anyway, so even knowing the exact distance doesn't help you to avoid getting masslocked at all.
It wouldn't be particularly useful for avoiding masslock. Obviously, if you have an ID lock on an object, it already has you masslocked. I was thinking more of the other objects I listed as being useful data to have displayed. One could tell if a rock hermit is a short or long way away compared to other options for refuelling, for example.
Sleep? Who needs sleep? Got game. No need sleep.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Bugbear1973 wrote:
Commander McLane wrote:
Would you really want to constantly monitor the distances to all NPC's in the system? At times there can be more than 200 of them. I guess a constant JS-monitoring could put quite a strain on your playing speed...
Only one way to find out I guess. The game is already tracking these 200 odd objects anyway. What's an extra 200 times a^2 = ( x^2 + y^2 )^0.5 + z^2 calculations per second (hmmm...maybe the polling interval could be adjustable too. Low res = 1 poll per 10 seconds. High res = 10 polls per second)

I take your concerns regarding JS though. Still, there is only one way to find out.
It's not only a concern. I am also not clear what it really is you want to achieve.

Let's say you had a message popping up every five seconds, saying "The closest ship is 54.3 kilometers away." Of what use would that actually be? If the distance is below 25.6 kilometers you see the ship on your scanner anyway, so you get no additional information from the message. If it is out of scanner range, you still don't know its direction, and whether you're approaching it, flying away from it, or are in some perpendicular angle to it. So what would you do with the information? Change your course to avoid it? But change to what, if you don't know the direction it is in? Fly towards it? But again, how would you know the direction?

To me it seems like a useless piece of information, and potentially screen-cluttering as well. Unless you want to create another scanner with a greater range. I don't know if this is possible, though.
User avatar
Bugbear
---- E L I T E ----
---- E L I T E ----
Posts: 415
Joined: Sun Sep 17, 2006 1:30 am

Post by Bugbear »

I originally thought of the mass-lock gauge when I found myself with the station on the opposite side of the planet, meaning that I would have to steer around the planet.

I thought it would be cool to know how close I could 'skim' the gravity radius of the planet without mass locking. Ideally I would have wanted a gauge would be green when no mass lock, yellow when mass lock imminent and red when mass locked (similar to the altimiter).

It was an afterthought that I was considering that this gauge could be extended to detect any mass-lockable objects outside scanner range. Sure, you wouldn't know the direction of the mass locking object, but since this instrument would really only be of use when the torus drive is engaged, odds are the object is somewhere in front of you.

If you're on a schedule and you want to avoid any entanglements (and you've got OXPs included that put ships outside the main ship lanes), knowing that something is ahead of you would be useful to know.

Certainly, the on screen alerts would be too distracting...and I wouldn't want to create a longer range scanner. Somehow that would tend towards unbalancing the game...
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Okay, here's the numbers you need. How you display them is up to yourself:
  • The altimeter has a fixed scale with the following important points above ground:
    • 40.000 meters: the bar starts shrinking;
    • 30.000 meters: the bar is at 3/4 and turns yellow;
    • 10.000 meters: the bar is at 1/4 and turns red;
    • 0 meters: there is no bar; press space, commander.
  • Masslock by planets is not fixed in meters, but relative to the radius of the planet, which makes sense. You get locked when you are as far away from the planet as is its radius, or in other words, if the surface of the planet is exactly in the middle between you and the center of the planet. This is true for planets and moons, but not for the sun, to which you can get much closer than 1 radius before getting masslocked.
The JS code for determining the player's current distance to the main planet's center is

Code: Select all

player.ship.position.distanceTo(system.mainPlanet)
If you want your distance to the planet's surface you have to subtract its radius

Code: Select all

player.ship.position.distanceTo(system.mainPlanet)-system.mainPlanet.radius
If the former is less than double of the latter, you're masslocked.

You can do the same for additional planets and moons in the system. You can even do it for whatever planet is closest to the player at the time. The code gets a little more complicated, because the array of planets created by

Code: Select all

system.planets
doesn't get sorted by proximity to the player. So you have to resort to the system.filteredEntities function.

Code: Select all

function isPlanet(entity)
{
    return entity.isPlanet
}
player.ship.position.distanceTo(system.filteredEntities(this, isPlanet, player.ship)[0])-system.filteredEntities(this, isPlanet, player.ship)[0].radius
You see the basic similarity to the previous, but it has some overhead for sorting the planet list. However, in most cases moons can be disregarded anyway, because they are fully within the masslock distance of their planet. So you get masslocked by the planet long before you get close enough to be masslocked by the moon.

That's basically all you need. :)
User avatar
Bugbear
---- E L I T E ----
---- E L I T E ----
Posts: 415
Joined: Sun Sep 17, 2006 1:30 am

Post by Bugbear »

sweet, thanks for that info. looks like I got me some scripting to do :-)

an aside.. knowing of other ships off scanner could open up mission scenarios where you've got to get from A to B without being ID'd (then again, cloaking does that doesn't it?)
User avatar
Cmd. Cheyd
---- E L I T E ----
---- E L I T E ----
Posts: 934
Joined: Tue Dec 16, 2008 2:52 pm
Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...

Post by Cmd. Cheyd »

@Bugbear
You can do the piloting maneuver you want currently using a combination of side-views, the ASC, and Yaw control. I do it all the time.

Depart from the Rock Hermit and move away from the planet until you can torus. Once you can torus, set the ASC for the main station/nav beacon. Yaw around so that the planet is lined up in the appropriate side view cross hairs. Now, hit the torus and keep steadily yawing to keep the planet centered in the cross hairs. This will allow you to perform an equidistant arc around the planet until the ASC shows the centered in the compass.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Post by Smivs »

I do something similar, only I fly 'over' the planet.
I'll pitch up until the beacon is at the bottom of the ASC, hit the Torus and keep going. Each time the beacon symbol turns from green to red I pitch down a bit. Eventually it seems to be 'permanently' turning red which means you are right over it, so pitch down and watch you don't collide with it!
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Commander McLane wrote:
0 meters: there is no bar; press space, commander.
Unless you have PlanetFall installed, at which point there may well be a bar (or other such places of interest). Buy beer Commander. :wink:
Post Reply