Replace simple width-based drag by asteroid chunk collision drag
Posted: Tue Feb 18, 2025 6:41 pm
TL;DR
Make space ship drag based on asteroid chunk collisions instead of dragWhat?
The acceleration code consists of 2 main factors: the thrust-based factor and the drag-based factor. The complete formula boils down to (thrust-drag)/weight. The thrust computation is fine, no changes needed here. But I'd change the drag computation. I propose the following drag formula (to be balanced)Code: Select all
drag = sqrt((m_ship*v_ship^2-m_out*(v_ship-v_throw)^2)/(m_ship+m_in-m_out))-v_ship,
In essence, this creates a drag that is caused by the collision with asteroids, rather than the imaginary aether that is currently present. I used the correct physics-based formula to compute the difference in speed, but the formula can be tweaked where needed to get it working and balanced in game. At first sight, it does roughly the same as before: the wider your ship is or the faster it flies, the more it collides with asteroids, the more drag you get. And if you fly faster, the slow down is also larger, giving it both a linear and a squared relation to speed (similar to the current formula). But there are a few nice extras:
- The ship slows down automatically as the asteroid density increases. This doubles as the beginner-friendly system that avoids ships from just crashing into asteroid fields head-first. Especially useful as an automatic throttle once you reach denser parts of space.
- You give more design options to the player: they can just take the drag as is (which makes sense for massive haulers where speed is not important), or they can actively catch and throw out asteroids, even if they don't need them, to achieve maximal velocity. Not necessary for normal gameplay, but makes the design challenge for speed competitions more interesting.
- When v_throw>v_ship, you get a fun gimmick where a ship can throw out asteroids faster than they come in, accelerating the ship more than an incoming asteroid slows it down. This enables asteroid-powered space ships with v_throw as their max speed.
- Redundant items can serve a final purpose by giving your ship just a little more oumph
- In very desperate conditions, you can push your ship a bit further by throwing out parts of the inventory/ship. Not a core mechanic, but funny nonetheless.
- (It obeys the laws of physics, which may be a bit more intuitive)