Setting Parent Body for a SpaceLocation
Posted: Sun Nov 17, 2024 12:49 am
TLDR; with images :
The game currently render like that. With the proposal it would render like that.
For now we have :
SpaceLocation:distance :: double : Distance from the location's parent body in map coordinates.
SpaceLocation:orientation :: RealOrientation : Angle in relation to the parent body.
SpaceLocation:draw_orbit :: boolean: If false, the orbital ring around parent SpaceLocation will not be drawn for this location.
It would be interesting to add
SpaceLocation:parent :: string : optional, Name of the parent SpaceLocation,
Implication to current version
we consider that current version SpaceLocation prototype are valid and works the same way because parent is not set
not setting SpaceLocation parent imply parent is universe origin if not set
What will it affect :
- The current space map is fundamentally flat. This proposal introduces hierarchical space locations while remaining fully backward compatible.
- adding another star system with his own set of planets with orbits correctly displaying around their suns
- adding moons to planets with orbits around planets instead of sun
- Ease creation of new SpaceLocation around others
- changing a SpaceLocation distance and orientation would move their child SpaceLocation with them
What other modification is needed in the base game :
The Sun need to be a defined Space Location.
Planets need to have parent="sun"
Related requests :
- Allow to set a space location's parent
- Orbit Line Movement
- Space Connection Curving
- Render planet graphics from lua code
Other works :
- PlanetsLib
The community has been using Planetslib to implement this proposal. They need to fake the orbits by registering a sprite for it, this result in a lot of sprites only for orbits, the rest of the PlanetsLib api has the intent to implements this sugestion.
Example of actual mods that would directly benefit :
- real-starry-universe
- space-exploration
- factorissimo-2-notnotmelon
- intercontinental-rocketry
The game currently render like that. With the proposal it would render like that.
For now we have :
SpaceLocation:distance :: double : Distance from the location's parent body in map coordinates.
SpaceLocation:orientation :: RealOrientation : Angle in relation to the parent body.
SpaceLocation:draw_orbit :: boolean: If false, the orbital ring around parent SpaceLocation will not be drawn for this location.
It would be interesting to add
SpaceLocation:parent :: string : optional, Name of the parent SpaceLocation,
Implication to current version
we consider that current version SpaceLocation prototype are valid and works the same way because parent is not set
not setting SpaceLocation parent imply parent is universe origin if not set
What will it affect :
- Every SpaceLocation has a parent, with the implicit default being the universe origin.
- universe origin would work like current game version.
- distance and orientation are always relative to the parent.
- global SpaceLocation position is obtained with recursed accumulated transforms.
- Orbit rendering:
- SpaceLocation orbit is drawn around the parent SpaceLocation instead of universe origin
- SpaceConnection Arc rendering:
- At game loading, we compute the common SpaceLocation and arc rendering strategy:
- if common SpaceLocation equal origin, straight line strategy is used
- if common SpaceLocation equal one of the SpaceConnection ends, straight line strategy is used
- otherwise arc around common SpaceLocation strategy
- origin/calidus/nauvis & origin/calidus/nauvis/muluna => origin/calidus/nauvis (straight line strategy because b)
- origin/calidus/nauvis/lignumis & origin/calidus/nauvis/muluna => origin/calidus/nauvis (arc around strategy because c)
- origin/calidus/nauvis/lignumis & origin/calidus/fulgora/cerys => origin/calidus (arc around strategy because c)
- origin/sagitarius/polyphemus/pandora & origin/calidus/fulgora/cerys => origin (straight line strategy because a)
- SpaceConnection arc is drawn using common SpaceLocation and rendering strategy
- At game loading, we compute the common SpaceLocation and arc rendering strategy:
- The current space map is fundamentally flat. This proposal introduces hierarchical space locations while remaining fully backward compatible.
- adding another star system with his own set of planets with orbits correctly displaying around their suns
- adding moons to planets with orbits around planets instead of sun
- Ease creation of new SpaceLocation around others
- changing a SpaceLocation distance and orientation would move their child SpaceLocation with them
What other modification is needed in the base game :
The Sun need to be a defined Space Location.
Planets need to have parent="sun"
Code: Select all
{
type="space-location",
name="sun",
distance=0,
orientation=0,
draw_orbit=false,
icon = "__space-age__/graphics/icons/starmap-solar-system-edge.png",
starmap_icon = "__core__/graphics/icons/starmap-star.png",
starmap_icon_size = 512,
},
{
type = "planet",
name = "nauvis",
parent = "sun",
...
}
{
type = "planet",
name = "vulcanus",
parent = "sun",
...
}
{
type = "planet",
name = "gleba",
parent = "sun",
...
}
{
type = "planet",
name = "fulgora",
parent = "sun",
...
}
{
type = "planet",
name = "aquilo",
parent = "sun",
...
}
{
type = "planet",
name = "solar-system-edge",
parent = "sun",
...
}
{
type = "planet",
name = "shattered-planet",
-- parent = "sun", -- does not need it since the shattered planet son't seems to orbit this star
...
}
- Allow to set a space location's parent
- Orbit Line Movement
- Space Connection Curving
- Render planet graphics from lua code
Other works :
- PlanetsLib
The community has been using Planetslib to implement this proposal. They need to fake the orbits by registering a sprite for it, this result in a lot of sprites only for orbits, the rest of the PlanetsLib api has the intent to implements this sugestion.
Example of actual mods that would directly benefit :
- real-starry-universe
- space-exploration
- factorissimo-2-notnotmelon
- intercontinental-rocketry