TheOpenSpaceProgram / new-ospgl

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

Proper definition of "wiring" and "plumbing" connections #62

Open tatjam opened 1 year ago

tatjam commented 1 year ago

Logical Connections (Formerly Wiring)

Physical Connections (Formerly Plumbing)

Symmetry is not affected by this, as the same concepts apply. If a physical system is mirrored one way, all the others must be in the same way!

Implementation guide

Once this is done, very complex vehicles may be simulated with OSPGL, which means that designing them will also be pretty complex! This also opens modders to modify these systems if simpler gameplay is desired.

tatjam commented 1 year ago

The new physical connection system is likely going to use an identical procedure to determine flow paths to what's already implemented in fluid simulation, but the "pressure" can be replaced by any suitable potential function.

A big question arises:

Particularly, and more practically:

Now, some stuff that needs to be written down to prevent myself from forgetting:


The nomenclature for ports is going to be active port (previously flow port) and boundary port (the opposite), representing the fact that flow ports are able to somehow act on the potential function, and boundary ports are used to establish the boundary conditions of the system.

The solving process is very similar. In fact, the first step, which determines the direction of flow of the "physical quantity" is identical code. It may seem like the "pressure" function can only represent fluid systems, but I believe it can be used directly for mechanical and electrical systems. At the end of the day, everything that flows in this world can be modeled with a potential function, with flow being determined by its gradient. I can't also come up with any other system that involves flowing inside of a vehicle... Maybe moving of crew-members is not a potential function?

Now, the second step of the process, where the "physical quantity" actually flows, could allow more customization in Lua:

For mechanical systems, the behavior may be slightly different. I'm going to give this a bit more thinking, but I would say that it's important, in this case, for the shaft RPM to be computed per section of the system. This could be influenced by all energy paths within it, so the end result is not simply the result of summing all contributions, as in the other systems.