wip new content generation
This commit is contained in:
parent
c6eac8eb98
commit
2f2503b876
@ -13,3 +13,13 @@ NO Grabs all position and orbit components with a specific system.
|
||||
- note: L4/L5 positions are stored as their own orbits
|
||||
* id:
|
||||
* x,y,system_id: position in a system
|
||||
|
||||
# Notes
|
||||
|
||||
- Model populations as their own entities.
|
||||
- Minerals on a body can be mined.
|
||||
- Minerals on a population have already been mined, and can be used.
|
||||
- Consider splitting MapDisplay's version of bodies from the reality?
|
||||
- Reason A: It will also need to store contacts, and should not always have all info
|
||||
- Reason B: Orbital positions should only be updated by an orbital processor when needed
|
||||
- Reason C: Reduce duplication by making the orbital processor the only thing that updates positions?
|
||||
|
19
src/generators/stellar_body.moon
Normal file
19
src/generators/stellar_body.moon
Normal file
@ -0,0 +1,19 @@
|
||||
-- TODO defined globals need to be created somewhere else
|
||||
export stefan_boltzmann_constant = 5.670373e-8 -- W / (m^2 * K^4)
|
||||
|
||||
parameters = {
|
||||
temperature = love.math.randomNormal 1000, 6000 -- [2000, 1e4] K
|
||||
}
|
||||
|
||||
parameters.absolute_magnitude = 35.4631241560502 * math.exp(-0.000353006569939 * parameters.temperature) -- Mv
|
||||
parameters.luminosity = 100 * math.exp -0.943865141164545 * (parameters.absolute_magnitude - 0.99^parameters.absolute_magnitude) -- L(sun)
|
||||
-- TODO calculate B-V value ? Or color directly? Or spectrum?
|
||||
|
||||
-- TODO this needs to be multiplied by the star's surface area to get its total power emission
|
||||
parameters.surface_power_emission = stefan_boltzmann_constant * parameters.temperature^4 -- W / m^2
|
||||
-- NOTE then for measuring power input into a planet, find the surface area of
|
||||
-- its orbital radius, divide total power by that, then multiply that by the
|
||||
-- circular cross-section of that planet to get the total power being emitted
|
||||
-- into that planet, which must equal its emission, allowing you to calculate
|
||||
-- its surface temperature*
|
||||
-- * if it had no atmosphere, or albedo
|
29
src/generators/terrestrial_body.moon
Normal file
29
src/generators/terrestrial_body.moon
Normal file
@ -0,0 +1,29 @@
|
||||
-- TODO defined globals need to be created somewhere else
|
||||
export gravitational_constant = 6.6743e-11 -- m^3 / (kg * s^2)
|
||||
export magic_pressure_constant = 1.1701572e-4 -- s^2 / m^2
|
||||
|
||||
parameters = {
|
||||
surface_radius: love.math.randomNormal 1100, 5500 -- [1.1e3, 9.9e3 km]
|
||||
solid_density: love.math.randomNormal 0.675, 5.2 -- [2.5, 7.9 g/cm^3]
|
||||
}
|
||||
|
||||
parameters.solid_volume = 4/3 * math.pi * parameters.surface_radius^3 -- km^3
|
||||
parameters.solid_mass = parameters.solid_density * parameters.solid_volume * 1e12 -- kg
|
||||
parameters.surface_gravity = gravitational_constant * parameters.solid_mass / parameters.surface_radius^2 * 1e-6 -- m/s^2
|
||||
parameters.atmosphere_reduction_rate = parameters.surface_gravity * magic_pressure_constant -- m^-1
|
||||
parameters.atmosphere_halving_height = math.log(2) / parameters.atmosphere_reduction_rate -- m
|
||||
-- volume containing the first half of the entire atmosphere is assumed to be
|
||||
-- half of the volume of the entire atmosphere if it was at surface pressure
|
||||
parameters.simulated_atmosphere_volume = (4/3 * math.pi * (parameters.surface_radius + parameters.atmosphere_halving_height / 1000)^3 - parameters.solid_volume) * 2 -- km^3
|
||||
|
||||
-- TODO better (based on distance from star / temperature from star)
|
||||
parameters.surface_atmosphere_pressure = 101325 * math.max 0, love.math.randomNormal 0.125, 0.5 -- [0, 202650 kPa]
|
||||
-- TODO verify this will generate in meters
|
||||
parameters.minimum_orbital_height = math.log(1.4e-11 / parameters.surface_atmosphere_pressure) / parameters.atmosphere_reduction_rate -- m
|
||||
parameters.atmosphere_volume = 4/3 * math.pi * (parameters.surface_radius + parameters.minimum_orbital_height / 1000)^3 - parameters.solid_volume -- km^3
|
||||
-- TODO atmospheric composition?
|
||||
-- TODO albedo
|
||||
-- TODO surface_average_temperature (based on greenhouse gases or lack thereof, albedo, and base temperature from distance to star)
|
||||
|
||||
-- unused at this time?
|
||||
parameters.surface_area = 4 * math.pi * parameters.surface_radius^2
|
Loading…
Reference in New Issue
Block a user