# Space collector
Space collector game
## Rules
- Square 20 000 x 20 000 kms
- Random number of planets (between 2 and 8) and positions of planets, central symmetry
so that every team "see" the same map
- Collect your planets with your collector
- Slow speed
- Attack enemies with your five attackers
- Fast speed
- High energy attack < 5 000 kms
- choose angle
- 1 second to wait between fires of an attacker
- Explore with your explorer
- Normal speed
- See its planets and its spaceships
- See enemy spaceships around him < 5 000 kms
- When a unit is touched by a high energy attack
- Must return to its base to be repaired
- Attacker can't attack
- Explorators can't use their radar to see enemy spaceships
- Collectors can't collect planets, they loose the collected planets (left in place)
- When a team has collected all its planets, the game stops
- When the game ran 5 minutes, the game stops
## Commands
### General syntax
`COMMAND {ship_id} {parameters}`
- `{ship_id}`: identifier of the spaceship
- 1, 2, 3, 4, 5: attackers
- 6, 7: explorers
- 8, 9: collectors
- `{parameters}`: parameters of the command
- `{angle}`: integer, degrees, between 0 and 359, counter clockwise, 0 pointing right
- `{speed}`: integer in kms/s
Each command returns a response, made with:
- `{planet_id}` is between 0 and 65535
- `{ship_id}` is between 1 and 9
- `{abscissa}` and `{ordinate}` are between 0 and 19 999 ((0, 0) is the bottom left corner)
### Move
`MOVE {ship_id} {angle} {speed}`
Changes the speed and angle of the spaceship.
Maximum speed:
- 1 000 kms/s for collectors
- 2 000 kms/s for explorers
- 3 000 kms/s for attackers
Response is `OK`.
If a collector is less than 200 kms far from one of its planets, it collects the planet if it is not yet carrying a planet and it is not broken.
If a collector is less than 200 kms far from the base while carrying a planet, the planet is collected. 1000 points are added to player's score.
### Fire
`FIRE {ship_id} {angle}`
Fire a high energy attack, at `{angle}` angle. Length of the attack is 5 000 kms.
Any enemy spaceship less than 200 kms far from the high enery attack is now broken. Some points are added to player's score:
- 15 points for an attacker
- 20 points for an explorer
- 30 points for a collector
This command is only valid for an attacker.
Response is `OK` (even if the fire rate — at most one fire per second per spaceship — is not respected, and in this case the command is ignored).
### Radar
`RADAR {ship_id}`
Starts the radar of an explorer.
Response is a one line string. It is composed of several elements, separated by commas. The elements are:
- `P {planet_id} {abscissa} {ordinate} {ship_id} {saved}`: one of your planets, at a given position, the `ship_id` is the ID of the collector that collected the plane, or -1 if not collected, `saved` is 1 when planet is at base station, otherwise 0
- `S {team} {ship_id} {abscissa} {ordinate} {broken}`: a spaceship, team 0 is yours, team 1 to 3 are opponents, broken is 0 or 1, 1 meaning that the ship was targeted by a high energy attack (your spaceships are always present even if the explorer is broken)
- `B {abscissa} {ordinate}`: your base station's position (always present in radar information)
If an explorer is broken, it can't see enemy spaceships. If not, it can see enemy spaceships less than 5 000 kms far from the explorer.
## Commands
### Installation
```shell
python3.11 -m venv venv
. venv/bin/activate
# to play
pip install --upgrade space_collector
# to get development dependencies and improve the game
pip install --upgrade space_collector[dev]
```
### Launch game
```shell
# In an activated virtual environment
# choose a free port
PORT=12345
# start the server
python -m space_collector.game.server -p $PORT --timeout 10 &
# start the viewer
python -m space_collector.viewer -p $PORT &
# start the viewer on small screens
python -m space_collector.viewer -p $PORT --small-window&
# start players
# using serial port
SERIAL=COM8 # on Windows
SERIAL=/dev/ttyUSB0 # on Linux
python -m space_collector.serial2tcp -p $PORT --serial $SERIAL --team-name "CHANGE ME"
```
### Kill all clients and server
```shell
# For Linux and Mac, in an activated virtual environment
python -m space_collector.killall
```
### Install git hook
```shell
pre-commit install
```
### Lint
```shell
flake8
```
### Launch test
```shell
pytest
```
### Publish
```shell
python -m build
python3 -m twine upload dist/*
```
## Auto-évaluation
Voici un barème pour évaluer le projet :
| Critère | Points |
| ----------------------------------------------------------------- | ------ |
| Utilisation de CMSIS RTOS v2 | 1 |
| Un thread par vaisseau | 1 |
| Communication robuste par liaison série | 1 |
| Communication entre threads | 1 |
| Récupération de planete | 1 |
| Déplacement avec gestion de vitesse max | 1 |
| Attaque avec rayon de haute énergie | 1 |
| Limitation de fréquence de tir | 1 |
| Utilisation de radar | 2 |
| Réparation de vaisseau | 1 |
| Documentation (installation des dépendances, lancement) | 1 |
| Écriture de tests | 4 |
| Qualimétrie | 1 |
| Automatisation avec GitHub action | 2 |
| Refus de pull request / push si baisse de qualité ou tests KO | 1 |
| Classement compétition | 2 |
| Pre-commit en local et intégration continue | 1 |
| Rapport : démarche étape par étape | 3 |
| Rapport : 3 plus grandes difficultés, et solutions mises en place | 6 |
| Rapport : notions apprises, retour d'expérience | 1 |
Raw data
{
"_id": null,
"home_page": null,
"name": "space-collector",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "space, collector, game",
"author": null,
"author_email": "Vincent Poulailleau <vpoulailleau@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/8d/70/faf94ed99c7bace1fc763b6292d089f38715ce84167029b0134d7fad834d/space_collector-1.tar.gz",
"platform": null,
"description": "# Space collector\n\nSpace collector game\n\n## Rules\n\n- Square 20\u00a0000 x 20\u00a0000 kms\n- Random number of planets (between 2 and 8) and positions of planets, central symmetry\n so that every team \"see\" the same map\n- Collect your planets with your collector\n - Slow speed\n- Attack enemies with your five attackers\n - Fast speed\n - High energy attack < 5\u00a0000 kms\n - choose angle\n - 1 second to wait between fires of an attacker\n- Explore with your explorer\n - Normal speed\n - See its planets and its spaceships\n - See enemy spaceships around him < 5\u00a0000 kms\n- When a unit is touched by a high energy attack\n - Must return to its base to be repaired\n - Attacker can't attack\n - Explorators can't use their radar to see enemy spaceships\n - Collectors can't collect planets, they loose the collected planets (left in place)\n- When a team has collected all its planets, the game stops\n- When the game ran 5 minutes, the game stops\n\n## Commands\n\n### General syntax\n\n`COMMAND {ship_id} {parameters}`\n\n- `{ship_id}`: identifier of the spaceship\n - 1, 2, 3, 4, 5: attackers\n - 6, 7: explorers\n - 8, 9: collectors\n- `{parameters}`: parameters of the command\n - `{angle}`: integer, degrees, between 0 and 359, counter clockwise, 0 pointing right\n - `{speed}`: integer in kms/s\n\nEach command returns a response, made with:\n\n- `{planet_id}` is between 0 and 65535\n- `{ship_id}` is between 1 and 9\n- `{abscissa}` and `{ordinate}` are between 0 and 19\u00a0999 ((0, 0) is the bottom left corner)\n\n### Move\n\n`MOVE {ship_id} {angle} {speed}`\n\nChanges the speed and angle of the spaceship.\n\nMaximum speed:\n\n- 1 000 kms/s for collectors\n- 2 000 kms/s for explorers\n- 3 000 kms/s for attackers\n\nResponse is `OK`.\n\nIf a collector is less than 200 kms far from one of its planets, it collects the planet if it is not yet carrying a planet and it is not broken.\n\nIf a collector is less than 200 kms far from the base while carrying a planet, the planet is collected. 1000 points are added to player's score.\n\n### Fire\n\n`FIRE {ship_id} {angle}`\n\nFire a high energy attack, at `{angle}` angle. Length of the attack is 5\u00a0000 kms.\n\nAny enemy spaceship less than 200 kms far from the high enery attack is now broken. Some points are added to player's score:\n\n- 15 points for an attacker\n- 20 points for an explorer\n- 30 points for a collector\n\nThis command is only valid for an attacker.\n\nResponse is `OK` (even if the fire rate \u2014 at most one fire per second per spaceship \u2014 is not respected, and in this case the command is ignored).\n\n### Radar\n\n`RADAR {ship_id}`\n\nStarts the radar of an explorer.\n\nResponse is a one line string. It is composed of several elements, separated by commas. The elements are:\n\n- `P {planet_id} {abscissa} {ordinate} {ship_id} {saved}`: one of your planets, at a given position, the `ship_id` is the ID of the collector that collected the plane, or -1 if not collected, `saved` is 1 when planet is at base station, otherwise 0\n- `S {team} {ship_id} {abscissa} {ordinate} {broken}`: a spaceship, team 0 is yours, team 1 to 3 are opponents, broken is 0 or 1, 1 meaning that the ship was targeted by a high energy attack (your spaceships are always present even if the explorer is broken)\n- `B {abscissa} {ordinate}`: your base station's position (always present in radar information)\n\nIf an explorer is broken, it can't see enemy spaceships. If not, it can see enemy spaceships less than 5\u00a0000 kms far from the explorer.\n\n## Commands\n\n### Installation\n\n```shell\npython3.11 -m venv venv\n. venv/bin/activate\n# to play\npip install --upgrade space_collector\n# to get development dependencies and improve the game\npip install --upgrade space_collector[dev]\n```\n\n### Launch game\n\n```shell\n# In an activated virtual environment\n\n# choose a free port\nPORT=12345\n# start the server\npython -m space_collector.game.server -p $PORT --timeout 10 &\n# start the viewer\npython -m space_collector.viewer -p $PORT &\n# start the viewer on small screens\npython -m space_collector.viewer -p $PORT --small-window&\n# start players\n# using serial port\nSERIAL=COM8 # on Windows\nSERIAL=/dev/ttyUSB0 # on Linux\npython -m space_collector.serial2tcp -p $PORT --serial $SERIAL --team-name \"CHANGE ME\"\n```\n\n### Kill all clients and server\n\n```shell\n# For Linux and Mac, in an activated virtual environment\npython -m space_collector.killall\n```\n\n### Install git hook\n\n```shell\npre-commit install\n```\n\n### Lint\n\n```shell\nflake8\n```\n\n### Launch test\n\n```shell\npytest\n```\n\n### Publish\n\n```shell\npython -m build\npython3 -m twine upload dist/*\n```\n\n## Auto-\u00e9valuation\n\nVoici un bar\u00e8me pour \u00e9valuer le projet\u00a0:\n\n| Crit\u00e8re | Points |\n| ----------------------------------------------------------------- | ------ |\n| Utilisation de CMSIS RTOS v2 | 1 |\n| Un thread par vaisseau | 1 |\n| Communication robuste par liaison s\u00e9rie | 1 |\n| Communication entre threads | 1 |\n| R\u00e9cup\u00e9ration de planete | 1 |\n| D\u00e9placement avec gestion de vitesse max | 1 |\n| Attaque avec rayon de haute \u00e9nergie | 1 |\n| Limitation de fr\u00e9quence de tir | 1 |\n| Utilisation de radar | 2 |\n| R\u00e9paration de vaisseau | 1 |\n| Documentation (installation des d\u00e9pendances, lancement) | 1 |\n| \u00c9criture de tests | 4 |\n| Qualim\u00e9trie | 1 |\n| Automatisation avec GitHub action | 2 |\n| Refus de pull request / push si baisse de qualit\u00e9 ou tests KO | 1 |\n| Classement comp\u00e9tition | 2 |\n| Pre-commit en local et int\u00e9gration continue | 1 |\n| Rapport : d\u00e9marche \u00e9tape par \u00e9tape | 3 |\n| Rapport : 3 plus grandes difficult\u00e9s, et solutions mises en place | 6 |\n| Rapport : notions apprises, retour d'exp\u00e9rience | 1 |\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Space collector programming game",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://github.com/vpoulailleau/space_collector/README.md",
"Repository": "https://github.com/vpoulailleau/space_collector",
"Source code": "https://github.com/vpoulailleau/space_collector"
},
"split_keywords": [
"space",
" collector",
" game"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a36fb1fb2833736294f91b1c9b4ac4e91de33c928e3d9ea180d5ef3a1f43ed43",
"md5": "3142d30d6e1aac2d7ebc6d732c64650a",
"sha256": "f6c6f006da2d213122e96ef4c6d9548b965ac3e74d3c3a5cd93172edadb48125"
},
"downloads": -1,
"filename": "space_collector-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3142d30d6e1aac2d7ebc6d732c64650a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 18869600,
"upload_time": "2024-04-12T16:53:45",
"upload_time_iso_8601": "2024-04-12T16:53:45.728485Z",
"url": "https://files.pythonhosted.org/packages/a3/6f/b1fb2833736294f91b1c9b4ac4e91de33c928e3d9ea180d5ef3a1f43ed43/space_collector-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8d70faf94ed99c7bace1fc763b6292d089f38715ce84167029b0134d7fad834d",
"md5": "4691125f86b01bc43758223bb7dac8c9",
"sha256": "b1bdb7d4c09ee30fef47ccd456449ce153b484d5684034df23a5b05938755f24"
},
"downloads": -1,
"filename": "space_collector-1.tar.gz",
"has_sig": false,
"md5_digest": "4691125f86b01bc43758223bb7dac8c9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 19106808,
"upload_time": "2024-04-12T16:54:03",
"upload_time_iso_8601": "2024-04-12T16:54:03.508267Z",
"url": "https://files.pythonhosted.org/packages/8d/70/faf94ed99c7bace1fc763b6292d089f38715ce84167029b0134d7fad834d/space_collector-1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-12 16:54:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vpoulailleau",
"github_project": "space_collector",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "space-collector"
}