So I am trying to write my own physics engine, with a specific game in mind, these are some design considerations:
- the game is about spaceships, the players build their own ships and find others in space therefore no "Earthly" forces to worry about
- every spaceship is a grid of components (armour blocks, functional blocks, guns etc..) and therefore a compound entity
- the physics needs to be reasonably close to realistic
- there will be a lot of space ships, and they may be very large
- components will get destroyed, space ships might be torn to pieces, and therefore the blocks need to somehow "know" when to split from the main ship,
- ships will participate in realistic looking collisions which may damage or shred them
and with this in mind, I have done some research on physics engines and know how to model the behaviour of simple (made up of one shape) bodies. However I am very uncertain as to how I could effectively join up different "singular" parts of ships in order to model spaceships. I have considered these approaches:
- creating a sort of "Parent" constraint which would transform the child entity every frame in a way to be locked in place relatively to the parent however this would create weird behaviour especially with collisions where i'd have to "pass on" forces to the parent
- creating some sort of spring constraint. However I was trying to avoid having to solve for constraints if possible. This approach seems very unstable to me though, and seems like it would consume a lot of resources
I know many engines do support compound entities but how is it done effectively ? what are the options ? I'd love to avoid complex maths if possible.
Thank you !
EDIT: I've found a very similar game to what i have in mind https://store.steampowered.com/app/569770/StarShip_Constructor/