Skip to content

Seaquest-MinAtar

MinSeaquest

MinSeaquest(use_minimal_action_set: bool = True)

Bases: Environment[EnvState, EnvParams]

Rescue divers with a submarine while fighting off fish and enemy submarines.

JAX port of the MinAtar Seaquest environment. The player controls a submarine in a 10x10 grid whose top row is the surface. It moves in rows 0 to 8 and fires bullets in the direction it is facing. Enemy fish and submarines spawn at the left and right edges of rows 1 to 8 and cross the grid horizontally; enemy submarines also shoot. Divers spawn in the same way and are picked up on contact, up to six at a time. The submarine uses one unit of oxygen for every step below the surface. Surfacing refills the oxygen and removes one carried diver, or all of them for a reward when six are carried. If params.ramping is set, the difficulty increases each time the player surfaces: enemies spawn and move faster.

The transition order and the ten observation channels follow the MinAtar reference implementation. Entity lists are represented by fixed-capacity arrays so that the environment remains compatible with jax.jit and jax.vmap.

  • Observation: Box of shape (10, 10, 10) with binary channels: 0 player submarine, 1 cell behind the player submarine (indicating its orientation), 2 friendly bullet, 3 trail (the cell behind each fish, enemy submarine and diver, indicating its direction), 4 enemy bullet, 5 enemy fish, 6 enemy submarine, 7 oxygen gauge, 8 diver gauge, 9 diver. Both gauges are drawn in the bottom row: the oxygen gauge fills oxygen * 10 // params.max_oxygen cells from the left and the diver gauge marks one cell for each carried diver.
  • Actions: Discrete(6): 0 no-op, 1 left, 2 up, 3 right, 4 down, 5 fire. The minimal and the full action set are identical.
  • Reward: +1 for each enemy fish or submarine shot, and oxygen * 10 // params.max_oxygen for surfacing with six divers.
  • Termination: the player's submarine is hit by an enemy fish, submarine or bullet, runs out of oxygen, or surfaces while state.diver_count is 0.
  • Truncation: after params.max_steps_in_episode steps (1000 by default).

Parameters:

  • use_minimal_action_set (bool, default: True ) –

    Whether to use the minimal instead of the full action set. Has no effect in Seaquest, since both sets contain all six actions.

References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the Seaquest environment.

Attributes:

  • ramping (bool) –

    Whether the difficulty increases each time the player surfaces.

  • ramp_interval (int) –

    Unused.

  • init_spawn_speed (int) –

    Initial number of steps between enemy spawns.

  • init_move_interval (int) –

    Initial move interval of the enemies; a fish or enemy submarine moves one cell every init_move_interval + 1 steps.

  • max_oxygen (int) –

    Oxygen of the player's submarine after a reset or after surfacing.

  • diver_spawn_speed (int) –

    Number of steps between diver spawns.

  • shot_cool_down (int) –

    Number of steps between two shots of the player.

  • enemy_shot_interval (int) –

    Shot interval of the enemy submarines; each of them shoots every enemy_shot_interval + 1 steps.

  • enemy_move_interval (int) –

    Unused.

  • diver_move_interval (int) –

    Move interval of the divers; a diver moves one cell every diver_move_interval + 1 steps.

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the Seaquest environment.

Entities are stored in buffers with MAX_ENTITIES rows. Only the leading rows of a buffer are active; their number is stored in the matching count field. In every buffer, direction is nonzero for entities moving right and zero for entities moving left.

Attributes:

  • oxygen (Array) –

    Remaining oxygen of the player's submarine.

  • sub_x (Array) –

    Column of the player's submarine.

  • sub_y (Array) –

    Row of the player's submarine; row 0 is the surface.

  • sub_or (Array) –

    Orientation of the player's submarine: True facing right, False facing left.

  • f_bullet_count (Array) –

    Number of active rows in f_bullets.

  • f_bullets (Array) –

    Bullets of the player, with columns [x, y, direction].

  • e_bullet_count (Array) –

    Number of active rows in e_bullets.

  • e_bullets (Array) –

    Bullets of the enemy submarines, with columns [x, y, direction].

  • e_fish_count (Array) –

    Number of active rows in e_fish.

  • e_fish (Array) –

    Enemy fish, with columns [x, y, direction, move_timer].

  • e_subs_count (Array) –

    Number of active rows in e_subs.

  • e_subs (Array) –

    Enemy submarines, with columns [x, y, direction, move_timer, shot_timer].

  • diver_count (Array) –

    Counter of divers carried by the player's submarine, at most 6. Set to -1, not 0, after surfacing with six divers; from then on it is one less than the number of divers actually carried.

  • divers_count (Array) –

    Number of active rows in divers.

  • divers (Array) –

    Divers in the water, with columns [x, y, direction, move_timer].

  • e_spawn_speed (Array) –

    Current number of steps between enemy spawns.

  • e_spawn_timer (Array) –

    Steps left until the next enemy spawns.

  • d_spawn_timer (Array) –

    Steps left until the next diver spawns.

  • move_speed (Array) –

    Current move interval of the enemies; a fish or enemy submarine moves one cell every move_speed + 1 steps.

  • ramp_index (Array) –

    Number of difficulty increases so far.

  • shot_timer (Array) –

    Steps left until the player can fire again.

  • surface (Array) –

    Whether the player's submarine was at the surface after the previous step.

  • time (Array) –

    Number of steps taken in the current episode.

  • terminal (Array) –

    Whether the episode has terminated.