diff --git a/agent/agent.py b/agent/agent.py index 7e88752..60ab684 100644 --- a/agent/agent.py +++ b/agent/agent.py @@ -4,7 +4,7 @@ from typing import Mapping import numpy as np from utils.math_ops import MathOps -from world.commons.field import FIFAField, HLAdultField +from world.commons.field import FIFAField, HLAdultField, Soccer7vs7Field from world.commons.play_mode import PlayModeEnum, PlayModeGroupEnum @@ -37,6 +37,15 @@ class Agent: 1: (7.0, 0.0, 0), 2: (2.0, -1.5, 0), 3: (2.0, 1.5, 0), + }, + Soccer7vs7Field: { + 1: (2.1, 0, 0), + 2: (22.0, 12.0, 0), + 3: (22.0, 4.0, 0), + 4: (22.0, -4.0, 0), + 5: (22.0, -12.0, 0), + 6: (15.0, 0.0, 0), + 7: (4.0, 16.0, 0) } } diff --git a/agent/base_agent.py b/agent/base_agent.py index b9ae3c9..c28d9be 100644 --- a/agent/base_agent.py +++ b/agent/base_agent.py @@ -17,7 +17,7 @@ class Base_Agent: number: int = 1, host: str = "localhost", port: int = 60000, - field: str = 'fifa' + field: str = 'sim3d_7vs7' ): """ Initializes the agent and all its main components. diff --git a/readme.md b/readme.md index 281581b..d155647 100644 --- a/readme.md +++ b/readme.md @@ -47,12 +47,12 @@ CLI parameter (a usage help is also available): You can also use a shell script to start the entire team, optionally specifying host and port: ```bash -./start.sh [host] [port] +./start_7v7.sh [host] [port] ``` Using **Poetry**: ```bash -poetry run ./start.sh [host] [port] +poetry run ./start_7v7.sh [host] [port] ``` CLI parameter: diff --git a/run_player.py b/run_player.py index bfea17b..fc14737 100755 --- a/run_player.py +++ b/run_player.py @@ -16,7 +16,7 @@ parser.add_argument("-t", "--team", type=str, default="Default", help="Team name parser.add_argument("-n", "--number", type=int, default=1, help="Player number") parser.add_argument("--host", type=str, default="127.0.0.1", help="Server host") parser.add_argument("--port", type=int, default=60000, help="Server port") -parser.add_argument("-f", "--field", type=str, default='fifa', help="Field to be played") +parser.add_argument("-f", "--field", type=str, default='sim3d_7vs7', help="Field to be played") args = parser.parse_args() diff --git a/start.sh b/start_7v7.sh similarity index 87% rename from start.sh rename to start_7v7.sh index 81f82a5..d95827b 100755 --- a/start.sh +++ b/start_7v7.sh @@ -4,6 +4,6 @@ export OMP_NUM_THREADS=1 host=${1:-localhost} port=${2:-60000} -for i in {1..11}; do +for i in {1..7}; do python3 run_player.py --host $host --port $port -n $i -t SE & done diff --git a/start_FIFA.sh b/start_FIFA.sh new file mode 100644 index 0000000..3fc09c5 --- /dev/null +++ b/start_FIFA.sh @@ -0,0 +1,9 @@ +#!/bin/bash +export OMP_NUM_THREADS=1 + +host=${1:-localhost} +port=${2:-60000} + +for i in {1..11}; do + python3 run_player.py --host $host --port $port -n $i -t SE -f fifa & +done \ No newline at end of file diff --git a/world/commons/field.py b/world/commons/field.py index e541255..26b3e33 100644 --- a/world/commons/field.py +++ b/world/commons/field.py @@ -48,3 +48,15 @@ class HLAdultField(Field): @override def get_length(self): return 14 + +class Soccer7vs7Field(Field): + def __init__(self, world): + super().__init__(world) + + @override + def get_width(self): + return 36 + + @override + def get_length(self): + return 55 diff --git a/world/world.py b/world/world.py index 8968a92..e86a6e9 100644 --- a/world/world.py +++ b/world/world.py @@ -1,7 +1,7 @@ from dataclasses import Field import numpy as np from world.commons.other_robot import OtherRobot -from world.commons.field import FIFAField, HLAdultField +from world.commons.field import FIFAField, HLAdultField, Soccer7vs7Field from world.commons.play_mode import PlayModeEnum, PlayModeGroupEnum @@ -62,5 +62,7 @@ class World: def __initialize_field(self, field_name: str) -> Field: if field_name in ('hl_adult', 'hl_adult_2020', 'hl_adult_2019',): return HLAdultField(world=self) + elif field_name in ('sim3d_7vs7'): + return Soccer7vs7Field(world=self) else: return FIFAField(world=self) \ No newline at end of file