Skip to content

Grid cables#5706

Open
Licho1 wants to merge 60 commits intomasterfrom
grid_cables
Open

Grid cables#5706
Licho1 wants to merge 60 commits intomasterfrom
grid_cables

Conversation

@Licho1
Copy link
Copy Markdown
Member

@Licho1 Licho1 commented Apr 30, 2026

Grid cables that grow and wither to connect energy sources in plausible minimal spanning tree. Cables try to find optimal ground path using single turn arc to avoid very steep cliffs.

Purely visual — no gameplay/economy change. All changes live in gfx_overdrive_cables.* (gadget, widget, shaders); no synced code is touched.

Cable thickness represents maximum required capacity. Direction of twigs represents expected energy transfer direction based on capacities.
Twigs flash along the direction of cable every few seconds.

Flow of balls that represent actual power transfers within the grid. Balls colored based on OD status.
Flow speed and density changes based on power amount flowing (also takes into account thickness to a lesser degree)
Responds quickly to grid changes (wind changes, hub building, solars turning off).
Full support for LOS including ghosting. Ghosts are a frozen snapshot of last-seen geometry, kept in their own VBO with a parallel SSBO of LOS coverage bits, not the live tree rendered grayscale.

Lua does the graph and flow handling, including caching, incremental tree updates (two different algos), aggregate wind updates based on stored min values per windmill.

Geometry shader runs per line and adds cable segments and twigs , samples terrain to path and increase density as needed. Limited to 1024 verts per invocation (engine GS output cap).
It also processes LOS and stores information about seen segments as bit flags into SBO. (Mapped via unique ID from cable nodes).
Fragment shader does cylinder shading/smooth normals, ball flow, twig flashes, processes LOS to decide whether to show live cable, nothing or ghost.

Menu lets you turn cables full/noflow/off and also disable/enable ghosting machinery.
In all cases it disables the logic code when possible to conserve performance — with cables off the gadget short-circuits per-frame work, and toggling ghosts off frees the ghost VBO/SSBO and skips the snapshot path entirely.

Very highly performant, most logic runs on shader independent from engine. Has near zero impact on my machine. Tested extensively.

Licho1 added 15 commits April 29, 2026 23:03
- Drop LuaUI/Widgets/dbg_claude_bridge.lua (debug-only TCP harness, kept
  unstaged in master working tree).
- Revert scripts/energywind.lua to master (windmill spin refactor moved
  to its own branch windmill_activate_refactor).
- Restore LuaRules/gadgets.lua and LuaUI/cawidgets.lua to master to drop
  unintentional blank-line additions.
…APACITY_REF

Dedupes the windFrac (0..1 clamped read of WindStrength rules-param) call
across ComputeMaxPotentials, ConsumersOrWindChanged, and SendAll.
Centralizes the rules-param key string in one place.

BUBBLE_CAP_REF now references MAX_CAPACITY_REF directly so the two cannot
drift; the comment "(one singu)" lives on the MAX_CAPACITY_REF declaration
and that is enough.
Leftover texture from an earlier experiment; no code references it (cables
are drawn entirely via shaders, no texture sampling).
@Licho1 Licho1 marked this pull request as ready for review April 30, 2026 16:10
@Licho1 Licho1 marked this pull request as draft April 30, 2026 16:13
Licho1 added 12 commits April 30, 2026 18:42
LOS leak: when the user disabled their LOS overlay (info display = height,
or any non-LOS mode), the FS sampled the overlay texture instead of LOS,
the grayscale heuristic remapped to losState≈1, the enemy ghost gate
never fired, and out-of-LOS enemy cables rendered with full live flow.

$info:los is the actual game-logic LOS texture (single-channel red),
independent of the user's overlay toggle — what infoLOS.lua's bind
chain already uses for the engine's own LOS rendering.
@Licho1 Licho1 marked this pull request as ready for review May 1, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant