when ship is in a system

This is the location for all mods to collaborate. Anyone making or planning their own mod should post help requests, screen shots and news here.

Moderators: Omega, tillias, Mod Contributor

Post Reply
dagg
Bounty Hunter
Bounty Hunter
Posts: 138
Joined: Thu May 22, 2008 8:53 am

when ship is in a system

Post by dagg »

will this be right?

Code: Select all

un->Position()==SystemLocation(_Universe->activeStarSystem()->getFileName())
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Re: when ship is in a system

Post by ace123 »

Not at all!
Notice that you are losing information when you do "_Universe->activeStarSystem()", so anything that is true there will only be true for the whole system--and all units within the system.

The un->Position() is a 3d coordinate with double values (QVector) of the 3d position within the system, usually units relative to the sun and some predetermined axes.

System Location is a 3d vector from the center of the galaxy, in relative units (usually a much smaller scale, I think they might be in light years or something like that). These are not as accurate and only used for the Navigation Computer map, so they are inaccurate floating point values (Vector). So you aren't even allowed to interchange the two.

May I ask why it would be useful to have those two values be equal?
dagg
Bounty Hunter
Bounty Hunter
Posts: 138
Joined: Thu May 22, 2008 8:53 am

Re: when ship is in a system

Post by dagg »

has mentioned in another topic, I'm working on adding support to custom distance between systems (depending on system xyz values and a value from the config file), now I've got the system to system working but I want to add the ability to retrieve the position of the unit in the galaxy (let say I went from one planet to another and halfway I want to go to a third planet) so I need to calculate the the distance from that position to the new destination system.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Re: when ship is in a system

Post by ace123 »

ah-- In that case, you have to decide how big you want the gap between systems to be, call it GalaxyScale.

I take it you are trying to do something like (player->Position - target->Position() + (SystemLocation(player->activeSystem) - SystemLocation(target->activeSystem)) * GalaxyScale)

You need to make sure to do the subtractions in the right order so that you lose the smallest amount of significant digits.
dagg
Bounty Hunter
Bounty Hunter
Posts: 138
Joined: Thu May 22, 2008 8:53 am

Re: when ship is in a system

Post by dagg »

here is what I'm trying to do:
I've generated a new galaxy based on distances. the distances are calculated using the euler formula, moreover, I read from the config file the ratio of the map.
then I multiply the distance I got with the ratio and I have the distances already in km (the map is generated from light year base scale)
not sure how it is helping me in that situation?
dagg
Bounty Hunter
Bounty Hunter
Posts: 138
Joined: Thu May 22, 2008 8:53 am

Re: when ship is in a system

Post by dagg »

still don't understand how this formula helps me...
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Re: when ship is in a system

Post by ace123 »

I probably don't understand your question.
I think the issue is that VS does not take into account accurate distances when in transit between systems.

The problem is that there is no real concept of the distance from your ship to a system. Either you are in a system, or you are not in a system. The whole thing about being able to travel far from the sun to teleport to another system is really a hack, so it doesn't take into account anything other than how far you are from the sun. I like to think of it more like a sort of autopilot--where you just kind of go to sleep while traveling between systems.

The way things used to work for jumping between systems, before the recent change, is that there would be a crosshair and you go need to be traveling in that direction. If you choose to change to a different target system then the crosshair will move.

If you want everything to work right, the only way will be to combine everything into one system, but then there are obvious performance considerations.
dagg
Bounty Hunter
Bounty Hunter
Posts: 138
Joined: Thu May 22, 2008 8:53 am

Re: when ship is in a system

Post by dagg »

so why not use the external coordinates? e.g. the xyz from milkey_way.xml?

will you consider changing this?
Post Reply