TheOpenSpaceProgram / new-ospgl

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

Symmetry #56

Open tatjam opened 1 year ago

tatjam commented 1 year ago

Some thinking into symmetry, which will be implemented in the coming commits:

Types of symmetry

Implementation

Each symmetry mode requires some custom GUI, both as widgets on the editor panel, and as 3D gizmos on the editor. Symmetry is not directly stored in the vehicle, but in VehicleMeta. Finally, wiring and plumbing will properly be duplicated if the user chooses so.

GUI

Symmetry will work by first choosing a symmetry mode, and then clicking an unattached root piece, which will make the symmetry apply to said piece and all children. Unattached root pieces will be highlighted during this editor mode.

Once a piece is affected by symmetry, any modification to it or its children will be mirrored, but if the piece itself is detached the symmetry will break, and all cloned pieces will disappear. Finally, the user may delete a symmetry group, but keep the symmetric pieces, via a button on the GUI.

Symmetry will be handled in the attach editor mode.

tatjam commented 1 year ago

Symmetry mode will be implemented in lua for user customization, although "vanilla" ones are going to be fairly exhaustive of all useful modes.

tatjam commented 1 year ago

Nested symmetry should be implemented by duplicating the symmetry groups. As this is a fairly generic thing, it would be wise to implement some kind of API that allows you to obtain a list of points where an action is needed in symmetry. This would also help implement auto-wiring and auto-plumbing

EDIT: Duplication meaning the application of the symmetry group in the different root pieces, with lua handling the transformation in space?