/supremacy

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

supremacy

Supremacy

TL;DR

Get started with:

conda create -n <NAME> -c conda-forge python=3.10
conda activate <NAME>
git clone https://github.com/nvaytet/supremacy.git
cd supremacy/
python -m pip install -e .
cd tests/
python test.py

Send a link to your repository or copy/paste your code at https://forms.gle/Ah3LvH9wvdxLH8xg8

Game preview

Time = 2minTime = 4min

Goal

  • Mine resources to build an army
  • Destroy enemy bases and eliminate other players

Rounds

  • All participants play on the map at the same time
  • Each round lasts 8 minutes
  • The tournament will consist of 8 rounds of 8 minutes

Game map

  • The map is auto-generated every round
  • It has periodic boundary conditions (for example when a vehicle arrives at the right edge of the map, it will re-appear at the left edge)
  • The map size will scale with the number of players (more players = larger map)
  • Coordinate system: lower left corner: (x=0, y=0), upper right corner: (x=nx, y=ny)

Mining

  • Everyone starts with 1 base, housing 1 mine
  • Every timestep, each mine will extract crystal = 2 * number_of_mines
  • Crystal is used to build mines and vehicles
  • Mines too close to other bases compete for resources: crystal = 2 * number_of_mines / number_of_bases_inside_square_of_80px
  • Bases that contain mines that are competing with others will have a “C” label on them:

Screenshot at 2023-07-17 10-07-33

Fights

  • Whenever two or more vehicles or bases from opposing teams come within 5px from each other, they will fight
  • During each time step, every object hits all the others with its attack force, and it takes damage from all other objects

Vehicles

Tank     Ship     Jet    
Speed 10 5 20
Attack 20 10 30
Health 50 200 50
Cost 500 2000 4000
Can travel On land On sea Anywhere
Can turn into base

Additional rules:

  • Mine cost doubles for every new mine on a given base (first mine=1000, second=2000, third=4000, etc…)
  • Base has health = 100, mine has health = 50 (both have 0 attack)
  • Vehicles move at speed * dt (dt = 1/15s)
  • A ship can be turned into a new base, by calling convert_to_base()
  • A conversion to base will only work if there is land in the immediate vicinity
  • A player is eliminated when all his/her bases have been destroyed
  • If a player is eliminated, all his/her vehicles disappear instantly

Scoring

  • +1 point if you destroy a base
  • If a player gets eliminated, they receive a number of points equal to the number of players that were eliminated before them
  • At the end of the round, every player still alive gets a number of points equal to the number of eliminated players

The control center - the AI

  • To play the game, you will have to create a Python program.
  • It should contain a class named PlayerAI and that class should have a method named run.
  • Every time step, the run method will be called, and it will be inside that function that you should control your vehicles, decide what to build, etc...
  • You are provided with a template_ai.py to give you an example.

Look at the comments in the template_ai.py for details on what information is available to you at every time step and what methods can be called.

game_map

  • The game_map is one of the arguments the run function will receive.
  • It is a Numpy array that automatically gets filled when your vehicles or bases visit that region of the map.
  • 1 means land, 0 means sea, -1 means no info.
  • Any visit makes anything in that part of the map permanently visible.
  • This is basically what defines which enemy bases and vehicles you get in your info every time step.

Screenshot at 2023-07-17 14-27-22

Optimizing development

There are 3 ways you can speed up your development.

1. The high contrast mode

Activate high_contrast = True to see the land borders better and competing areas for mines:

Screenshot at 2023-07-17 10-08-09

2. Crystal boost

Waiting for things to develop can be time consuming. You can artificially increase mine yield using crystal_boost=5 (or any number you want, although behavior is untested beyond 10).

3. Use the 'Pause' Luke (experimental)

While the game is running, you can hit P on the keyboard. This will pause the game. You can edit your AI code. When the game resumes (hit P again), it will reload your AI module.