TheOpenSpaceProgram / new-ospgl

A space exploration game in OpenGL. Devblog: https://tatjam.github.io/index.html
MIT License
43 stars 6 forks source link

Wiring panel #38

Open tatjam opened 1 year ago

tatjam commented 1 year ago

Here's a to-do list on how to build the wiring panel before release. This should allow very complex wire setups to be built relatively effortlessly.

Auto wiring

Wiring everything manually can be really boring, so we must allow an automatic wiring function. This can be implemented using a series of toggle-able auto-wiring modes, implemented as lua scripts. By default, we offer a simple auto-wiring mode:

Each added machine is checked against a condition, for example, whether it belongs to a certain group or contains a certain machine interface. If it does, it's wired with all of the following which are present:

Wires can be created bidirectionally by the wiring system, or in a certain direction (ie from added machine to target, or from target to the added machine).

To implement more advanced wiring functionality, the user can "stack" multiple scripts, all of which are run and the total wires added together. Furthermore, "auto wiring presets", which consist of a series of scripts and their configurations can be saved and loaded. Some defaults could be provided. Finally, complex auto-wiring stuff could be implemented as a lua script with more complex logic.

Idea for a default wiring setup

Everything works within groups, so there should be only one capsule and staging controller per group. Maybe it's interesting to allow auto-wires to give warnings to the user?

The wiring preset used should be controllable using a keyboard shortcut, and should be visible at all times in the attach and plumbing modes. (Plumbing is needed because machines can be created there too!)

Batch wiring

This allow working with many wires all at once, when auto-wiring is not practical / was forgotten to be enabled:

Symmetry wiring

(Naming is not final!) Eventually, symmetry will be implemented in the editor. There needs to be a way to control how are symmetric parts wired.