Open CaptainMegavolt opened 8 years ago
This is fairly expensive computation wise and assume we've realistic environment which far from true here (moons are way too small and let's not talk about planet or suns).
For the record, the WarpDrive gravity was the first to actually simulate momentum in space and gravity relative to environment.
I know, I just figured it might be possible to have some fairly simple system for causing entities to gravitate towards the nearest large cluster of blocks from any direction. I admit the gravity generator is a little farfetched though. And yes, the momentum physics are already quite good, don't intent to criticize or alter those at all.
gotcha
Gravity can now be adjusted per celestial object (dimension). Proximity fields will come later.
Currently, space boots are considered magnetic, vertical only, towards any full block (including stone). Here are a gameplay aspects to consider:
Coding wise, we also need to consider:
Free rotation could be very problematic, and unnecessary considering ships would likely not be able to freely rotate (many modded multiblocks can only 'rotate' on the Y axis, for example).
As for caching, it might be better to asynchronously iterate over loaded gravity sources, rather than recalculating mass every time a structure is changed. This way the workload is more consistent, and less likely to spike if many gravity-producing structures are being updated at once.
I had an idea regarding gravity in space: Have gravity function such that entities in space will move in whatever direction their last momentum was (so for example thrown items will fly in the direction they were thrown), that is until they reach a gravity well. Gravity wells are caused by large concentrations of blocks. The more blocks, the larger and stronger the gravity well will be. Any entity entering a gravity well will slowly begin to move towards the source of the gravity well, at a speed dictated by A: The entity's proximity to the source of the well, and B: The strength of the well (dictated by the amount of blocks in its source). This means spaceships do not automatically have gravity. For a ship to have gravity, it must be added with a Gravity Adjuster block. This block uses electricity to generate a localized gravity field. Like everything else in WarpDrive, it is controlled with a CC or OC computer. You can use the computer to dictate the direction of the gravity (up, down, left, right, or whatever), the strength of the gravity, and the size of the gravity field (configured much like how you configure the dimensions of your ship). The Gravity Adjuster consumes energy based upon the size of the gravity field and the difference between the dimension the Gravity Adjuster is in's normal gravity and the gravity field it is emitting (so for example, if the Gravity Adjuster were in the Overworld generating a null gravity zone of 5x5x5 meters, it would consume energy for the 5x5x5 size of the field, and for the gravity adjustment which is changing the gravity from Overworld norm to null gravity). And yes, the Gravity Adjuster works in any dimension.