Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADR - Ship collision #5

Open
thoraxe opened this issue Jun 21, 2022 · 3 comments
Open

ADR - Ship collision #5

thoraxe opened this issue Jun 21, 2022 · 3 comments

Comments

@thoraxe
Copy link
Contributor

thoraxe commented Jun 21, 2022

ADR Context / Overview

SRT is not using real Godot physics at present and is simply implementing KinematicBody2D. We are using only MoveAndCollide, with the result being simply that the ships kind of grind past one another.

Some form of actual collision mechanics needs to be implemented.

Currently all ships have the same maximum speed and max health and they always travel in the direction that the nose is pointing.

Decision

  • Ship collisions will cause damage to both ships
  • A head-on collision at full speed (the resulting vector is 2x the max speed) for both ships will destroy both ships (always does 100% damage)
  • The amount of damage is proportional to the collision vector. This means that whatever the percentage of 2x the max speed is calculates the resulting damage.
  • The collision vector is the calculated effective strength of the "head on" collision.
  • The effective damage points are calculated based on the starting max health

Examples:
A head-on collision where one ship is stopped and the other ship is traveling at max speed would do 50% damage to both ships.

A collision where one ship is moving "up" at max speed and one ship is moving "left" (t-bone) at max speed would do 50% damage to both ships, because the effective "head on" force is is 1x max -- only one of the ships hit the other at full-speed head-on.

A "glancing" collision where both ships are moving at max speed but they are 179deg oriented towards one another would cause a small fraction of damage to both ships because the effective "head on" velocity is very low.

When ships collide they should both be moved by the collision. Each ship should be immediately rotated in some way relative to their original directions of travel, and then they should be translated some distance in that new direction proportional to their original rate of travel.

Rationale

When things collide, they should take damage.

When non-perfectly-shaped objects collide, they move a bit.

Status

Accepted

Consequences

Implementing the damage without the "bounce"/movement will potentially have a weird effect because Godot tends to "grind" these objects against one another. So they would end up having tons of collisions which would probably have the wrong effect.

Also, if the ships aren't sufficiently rotated and moved away from one another, there is risk that the new travel path will re-collide the ships, which we probably don't want.

Authors

@RoddieKieley
@dudash
Luke Dary
Kaliq Ray
@thoraxe

@thoraxe
Copy link
Contributor Author

thoraxe commented Jun 21, 2022

Since we have yet to implement any kind of ship mass and all ships are identical, it may make sense to start with an extremely rudimentary bounce mechanic. And, as far as I know, the velocity mechanic at present is that the ship always moves in the direction that it is heading (there is no thrust/vector mechanic at present).

Proposal

One simple and kludgy option would be to calculate some kind of collision vector between the two ships, rotate each of them at some fraction of that vector, instantly move them a proportional distance from one another at the point of impact, leave their current velocities, and be done.

Note

Another question is whether or not a physical collision should cause damage to either ship. In this early stage, it could be cute to make a collision cause damage. This could make for an interesting gameplay mechanic in itself when players are at low HP. However, as of right now, you cannot see opponent HP. Visibility of opponent stats is, in and of itself, a design decision to be made.

@dudash
Copy link
Contributor

dudash commented Jun 28, 2022

+1 that it should cause damage. And I agree that the gameplay mechanic will be interesting and add a little more depth. We might try to based the damage amount on the vector alignments and velocity (head on does more damage than glance off side).

Opponent damage status is a tough one, a few ideas:

  • simple option is the "bar" style, gives imprecise view into enemy health
  • show how much damage is done only as damage occurs - have to keep a tally in your head
  • visually degrade enemy ship to represent overall health (harder to implement but might be the coolest option)

@dudash dudash added the ADR label Jun 28, 2022
@RoddieKieley
Copy link

From a live discussion:

  • if the ships collide at 2x the max speed, i.e. a head on collision, then this is considered fatal damage
  • any collision less than directly head on should the calculated value less
  • with a manual collision approach
    • how far do we rotate? how far to do move?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants