ThalesGroup / kessler-game

Kessler is a simulation environment loosely modeled after our internal project PsiBee and the external project Fuzzy Asteroids. The game has ships that shoot bullets at asteroids to gain score. Ships can collide with asteroids and other ships and lose lives.
https://github.com/ThalesGroup/kessler-game
Apache License 2.0
8 stars 5 forks source link

stop_if_no_ammo stop condition doesn't consider mines + other issues #60

Closed Jie-F closed 2 months ago

Jie-F commented 5 months ago

Currently the way stop_if_no_ammo is implemented is:

image

The main problem is that this doesn't consider mines, so a ship may be out of bullets but still have mines remaining, but this will still cut them off. Unfortunately this affected XFC 2024 in a few scenarios, but luckily after a review of the footage, my conclusion is that the scores should either be unchanged or would be very similar (less than 10 points off per scenario, if not 0 points off and exactly the same).

A second subtle problem is that -1 bullets or -1 mines means unlimited, however in the (unrealistic but theoretically possible) case where Ship1 has -1 bullets/mines but the other Ship2 has 1 bullet/mine, then the sum statement will cancel out to 0 (because -1+1=0), stopping the scenario. So we should handle -1 separately.

Finally, a third problem I think exists, is that this doesn't differentiate between alive and dead ships. A dead ship can still have nonzero ammo, so this stop condition fails to trigger if the alive ship is out of ammo but the dead ship still has ammo.

TimArnettThales commented 5 months ago

A second subtle problem is that -1 bullets or -1 mines means unlimited, however in the (unrealistic but theoretically possible) case where Ship1 has -1 bullets/mines but the other Ship2 has 1 bullet/mine, then the sum statement will cancel out to 0 (because -1+1=0), stopping the scenario. So we should handle -1 separately.

Currently this cannot happen due to how bullets_remaining is assigned. Currently all ships are assigned the same number of bullets_remaining on instantiation based on the ammo_limit_multiplier that is passed to the Scenario object. So either all ships will have -1 bullets_remaining in which case the sum will be < 0, or they will all have >= 0 bullets_remaining. However, it should be changed to be if not sum > 0 as negative values still render this condition as true.