Linear Space Program
79 subscribers
167 photos
16 videos
11 files
50 links
Побочные эффекты игростроения на хаскеле.

https://icrbow.itch.io/

Чатик: @HaskellGameDev
Дискорд: https://discord.gg/vxpWtBA
Download Telegram
Linear Space Program
Photo
This media is not supported in the widget
VIEW IN TELEGRAM
AST debugging be like...

HStack ()
[ Frame () (vec2 100 50) Alignment.center $
View () "Fixed 100x50"
, Spacer ()
, View () "Flexible 310x600"
, Frame () (vec2 80 80) Alignment.
center $ View () "Fixed 80x80"
]
And this is how we do ECS, STM, type-safe quantities, FRP, and imgui in Haskell...

DearImGui.withWindowOpen "Orbit" do
stuff <- atomically . Apecs.runWith rsOrbitSim.sWorld $ Apecs.collect Just
for_ stuff \(o@Orbiter.Orbiter{}, Orbiter.MeanAnomaly ma, entity@Apecs.Entity{}) -> do
DearImGui.text $ textShower o
inputDouble "MA" (ma # Radian) (τ/60) (τ/4) "%f rad" \ma' -> do
atomically . Apecs.runWith rsOrbitSim.sWorld $ do
-- XXX: unlikely, but the value may be updated between collecting and UI handling
let change = (ma' % Radian) |-| ma
Apecs.modify entity \(Orbiter.MeanAnomaly current) ->
Orbiter.MeanAnomaly $ current |+| change
1😢1
Linear Space Program
And this is how we do ECS, STM, type-safe quantities, FRP, and imgui in Haskell... DearImGui.withWindowOpen "Orbit" do stuff <- atomically . Apecs.runWith rsOrbitSim.sWorld $ Apecs.collect Just for_ stuff \(o@Orbiter.Orbiter{}, Orbiter.MeanAnomaly ma…
And, after a few passes at sweeping it under a rug...

inputOrbitElem rsOrbitSim entity "Eccentricity" (o.orbit.eccentricity # Number) (1/256) (1/8) "%.5f" \ecc' ->
Orbiter.eccentricity .~ (ecc' % Number)

inputOrbitElem rsOrbitSim entity "Periapsis" ((o.orbit.periapsis # Meter) / 1000) 1 10 "%.1f km" \p' ->
Orbiter.periapsis .~ ((p' * 1000) % Meter)

-- ...
Your orbit evolution when you burn anti-tangent for a while
🔥1
The Moon rises!

After an unscheduled rewrite of the rendering components I can now put arbitrary models on arbitrary local orbits. This also opens up a way to do LODs, daily rotation, and backscatter lighting.
Ah, and crashing into distant surfaces.
🔥31👍1