Pages: [1]
|
|
|
Author
|
Topic: Star Control physics? (Read 2295 times)
|
Lachie Dazdarian
Zebranky food
Offline
Gender:
Posts: 35
|
Is there anywhere an overview of Star Control physics available? If not, I would appreciate one of the devs of The Ur-Quan Masters to help me in this.
You see, I'm making this Star Control Melee type of game (got the basic engine working – camera zooming + smart map edges), and I would like to know how the SC physics actually work (in concept). It doesn't appear to be simple inertia based movement without friction to me, but I might be wrong. Also, I'm not sure if projectiles speed is affected by the speed of the ship that deploys them (I know Mycon can crash into its own projectiles so…). And what about ship collision? Is ship individual mass present in these formulae.
I do hope you won't make me dig through the game source code, as non-FreeBASIC source code (the programming language I use) and such complex ones as SC2 source code are a conundrum to me.
Anything regarding this issue is much appreciated. Thanks.
BTW, if you think I would be a waste of time, I should inform you that I've been completing games since 2002. If curious about my abilities check my later work on my website (currently down).
Some of you might remember me making this (not so proud of it today):
Also, I got my latest game reviewed at Reloaded.org: http://www.reloaded.org/download/Barren/395/
|
|
« Last Edit: July 01, 2008, 12:51:42 am by Lachie Dazdarian »
|
Logged
|
|
|
|
Elvish Pillager
Enlightened
Offline
Posts: 625
|
Is there anywhere an overview of Star Control physics available? If not, I would appreciate one of the devs of The Ur-Quan Masters to help me in this.
You see, I'm making this Star Control Melee type of game (got the basic engine working – camera zooming + smart map edges), and I would like to know how the SC physics actually work (in concept). It doesn't appear to be simple inertia based movement without friction to me, but I might be wrong. Also, I'm not sure if projectiles speed is affected by the speed of the ship that deploys them (I know Mycon can crash into its own projectiles so…). And what about ship collision? Is ship individual mass present in these formulae. SC physics are a hodgepodge of all kinds of different rules for different situations. Here's a brief overview though (I'm not a dev, but I've messed around with the physics code a lot):
Up to a ship's max speed, it does use frictionless inertia-based movement. Once max speed is reached, however, things change. In general, trying to accelerate while above max speed also decelerates you at a rate somewhat greater than your normal rate of acceleration. If you're above max speed and you don't accelerate, you keep moving without friction - "max speed" only affects what happens when you try to accelerate.
Most ships' shots start at a speed that completely ignores the speed of the firing ship, and travel at the same speed in absolute space. (The exceptions are Ilwrath and Pkunk.) Some shots can collide with the ship that fired them, others pass through - there's a flag that's set individually for each shot.
That pretty much covers what you asked for. If that's all you're interested in you don't have to read the rest (I went back after writing this description and sorted the more relevant stuff to the top)
Shots also have hitpoints: when a shot hits a ship, it does its damage and is destroyed, but when a shot hits another shot, they both pause in mid-flight for a frame while each shot deals its damage to the other, and neither is destroyed until the damage makes one of them run out of hitpoints.
The planet exerts a small amount of gravity on things near it. IIRC it really is inverse-squared gravity, but as the minimum distance from its center is a significant fraction of the distance at which it is low enough that it rounds to zero, it's not important in practice. The more tactically significant effect of the planet is that whenever a ship is close enough to experience at least 1 unit of gravity, that ship's max speed is set to a high value (the same value for any ship; very fast ships normally have almost that value) - effectively negating the max speed restriction for slow ships.
The ships turn in 1/16-of-a-circle steps. The game keeps a "turn wait" counter for each ship which is set to the ship's base turn_wait when it turns by one step (so the turn_wait value is basically the reciprocal of its turning speed (minus one.)) Thrusting works similarly (there's a thrust_wait) although the game also sets separately for each ship the impulse applied each time the ship thrusts.
When permanent objects (ships, asteroids, and the planet) collide with each other, bizarre things happen.
|
|
|
Logged
|
My team of four Androsynth and three Chmmr is the most unfair team ever! My mod
|
|
|
Lachie Dazdarian
Zebranky food
Offline
Gender:
Posts: 35
|
Thanks. This answers most of my question, and I suspected on some of them. I did however expected a more „cleaner“ engine, with some magic formula, but since FF tweaked it so much, so can I tweak my engine.
Only, I don’t understand what you mean with inverse-squared gravity, and with the last comment on collision. Do game objects feature mass?
|
|
|
Logged
|
|
|
|
Elvish Pillager
Enlightened
Offline
Posts: 625
|
Only, I don’t understand what you mean with inverse-squared gravity, Just that I don't remember what the formula is for how strongly the gravity affects a ship, based on distance from the planet. Also, there's a maximum acceleration due to gravity, and I think you hit that before you start intersecting the planet (so all rules are kind of off)
and with the last comment on collision. Do game objects feature mass? Aaaah...
Objects do have mass. In theory, when two (permanent) objects collide, the collision is pretty realistic - partially elastic, conservation of momentum, and so on. The collision detection is pixel-perfect though, and somehow that makes it so that ships can sometimes get stuck to each other, or to asteroids, or the planet. Stuck objects collide with each other once per frame or more, which if they're both mobile, means for some reason that they build up huge velocities and fly apart at high speeds a few seconds later, or if it's a ship-to-planet collision, the ship takes huge amounts of damage in a very short time (I've seen ships knocked from full crew to about 1/3 of capacity from one collision.)
(Ship mass is also used to determine the strength of the Chmmr tractor beam effect, and not much else. Notably, the knockback effect from a Druuge shot is the same regardless of the victim's mass.)
Even when there's only a single collision, it's not always predictable how the objects will bounce off each other. 180-degree reversal as a result of just barely touching the edge of the planet is common. The only reliable bounce is if you hit the planet head-on, so bouncing off the planet can be an effective (albeit costly and rare) way to execute a surprise attack.
Furthermore, when an object's graphics change, the change doesn't take effect if the new image would intersect another object. This sounds fairly innocuous, but graphics-change includes turning, so if you're in contact with another ship, you can't turn until you bounce away (which can be really bad, if your opponent's weapons are facing you but yours aren't facing them. And of course there's Androsynth comet wedging, and an Earthling turned on its side against the planet can be stuck there until it dies.) Asteroids appear to spin in space, which, oddly enough, has a small effect on the gameplay (since their shape changes), and an asteroid that's touching a ship will stop 'spinning' for the duration (for the same reason stated above.)
The worst effect is Slylandro colliding with things. The game assumes that the ship's graphics will directly correspond to the way it's facing, which isn't true for Slylandro. Whenever the ship collides with anything solid, its facing is reset to an effectively random direction. Chenjesu DOGIs are also weird - they collide like ships, but their speed is constant, so they keep colliding until you're going faster than they are. The catch is that sometimes they don't manage to speed you up that much, even if you don't slow down by thrusting - I have no idea why.
|
|
|
Logged
|
My team of four Androsynth and three Chmmr is the most unfair team ever! My mod
|
|
|
Pages: [1]
|
|
|
|
|