Browse Source

wip new content generation

Tangent 4 years ago
parent
commit
2f2503b876
3 changed files with 58 additions and 0 deletions
  1. 10
    0
      ecs notes 2.txt
  2. 19
    0
      src/generators/stellar_body.moon
  3. 29
    0
      src/generators/terrestrial_body.moon

+ 10
- 0
ecs notes 2.txt View File

@@ -13,3 +13,13 @@ NO Grabs all position and orbit components with a specific system.
13 13
   - note: L4/L5 positions are stored as their own orbits
14 14
 * id:
15 15
 * x,y,system_id: position in a system
16
+
17
+# Notes
18
+
19
+- Model populations as their own entities.
20
+- Minerals on a body can be mined.
21
+- Minerals on a population have already been mined, and can be used.
22
+- Consider splitting MapDisplay's version of bodies from the reality?
23
+  - Reason A: It will also need to store contacts, and should not always have all info
24
+  - Reason B: Orbital positions should only be updated by an orbital processor when needed
25
+  - Reason C: Reduce duplication by making the orbital processor the only thing that updates positions?

+ 19
- 0
src/generators/stellar_body.moon View File

@@ -0,0 +1,19 @@
1
+-- TODO defined globals need to be created somewhere else
2
+export stefan_boltzmann_constant = 5.670373e-8 -- W / (m^2 * K^4)
3
+
4
+parameters = {
5
+  temperature = love.math.randomNormal 1000, 6000 -- [2000, 1e4] K
6
+}
7
+
8
+parameters.absolute_magnitude = 35.4631241560502 * math.exp(-0.000353006569939 * parameters.temperature) -- Mv
9
+parameters.luminosity = 100 * math.exp -0.943865141164545 * (parameters.absolute_magnitude - 0.99^parameters.absolute_magnitude) -- L(sun)
10
+-- TODO calculate B-V value ? Or color directly? Or spectrum?
11
+
12
+-- TODO this needs to be multiplied by the star's surface area to get its total power emission
13
+parameters.surface_power_emission = stefan_boltzmann_constant * parameters.temperature^4 -- W / m^2
14
+-- NOTE then for measuring power input into a planet, find the surface area of
15
+-- its orbital radius, divide total power by that, then multiply that by the
16
+-- circular cross-section of that planet to get the total power being emitted
17
+-- into that planet, which must equal its emission, allowing you to calculate
18
+-- its surface temperature*
19
+-- * if it had no atmosphere, or albedo

+ 29
- 0
src/generators/terrestrial_body.moon View File

@@ -0,0 +1,29 @@
1
+-- TODO defined globals need to be created somewhere else
2
+export gravitational_constant = 6.6743e-11 -- m^3 / (kg * s^2)
3
+export magic_pressure_constant = 1.1701572e-4 -- s^2 / m^2
4
+
5
+parameters = {
6
+  surface_radius: love.math.randomNormal 1100, 5500 -- [1.1e3, 9.9e3  km]
7
+  solid_density: love.math.randomNormal 0.675, 5.2 -- [2.5, 7.9 g/cm^3]
8
+}
9
+
10
+parameters.solid_volume = 4/3 * math.pi * parameters.surface_radius^3 -- km^3
11
+parameters.solid_mass = parameters.solid_density * parameters.solid_volume * 1e12 -- kg
12
+parameters.surface_gravity = gravitational_constant * parameters.solid_mass / parameters.surface_radius^2 * 1e-6 -- m/s^2
13
+parameters.atmosphere_reduction_rate = parameters.surface_gravity * magic_pressure_constant -- m^-1
14
+parameters.atmosphere_halving_height = math.log(2) / parameters.atmosphere_reduction_rate -- m
15
+-- volume containing the first half of the entire atmosphere is assumed to be
16
+-- half of the volume of the entire atmosphere if it was at surface pressure
17
+parameters.simulated_atmosphere_volume = (4/3 * math.pi * (parameters.surface_radius + parameters.atmosphere_halving_height / 1000)^3 - parameters.solid_volume) * 2 -- km^3
18
+
19
+-- TODO better (based on distance from star / temperature from star)
20
+parameters.surface_atmosphere_pressure = 101325 * math.max 0, love.math.randomNormal 0.125, 0.5 -- [0, 202650 kPa]
21
+-- TODO verify this will generate in meters
22
+parameters.minimum_orbital_height = math.log(1.4e-11 / parameters.surface_atmosphere_pressure) / parameters.atmosphere_reduction_rate -- m
23
+parameters.atmosphere_volume = 4/3 * math.pi * (parameters.surface_radius + parameters.minimum_orbital_height / 1000)^3 - parameters.solid_volume -- km^3
24
+-- TODO atmospheric composition?
25
+-- TODO albedo
26
+-- TODO surface_average_temperature (based on greenhouse gases or lack thereof, albedo, and base temperature from distance to star)
27
+
28
+-- unused at this time?
29
+parameters.surface_area = 4 * math.pi * parameters.surface_radius^2