change 7v7 3v3 FIFA code

This commit is contained in:
2026-03-20 02:33:44 -04:00
parent 3f4ab1c434
commit ba16b75796
8 changed files with 39 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ from typing import Mapping
import numpy as np import numpy as np
from utils.math_ops import MathOps 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 from world.commons.play_mode import PlayModeEnum, PlayModeGroupEnum
@@ -37,6 +37,15 @@ class Agent:
1: (7.0, 0.0, 0), 1: (7.0, 0.0, 0),
2: (2.0, -1.5, 0), 2: (2.0, -1.5, 0),
3: (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)
} }
} }

View File

@@ -17,7 +17,7 @@ class Base_Agent:
number: int = 1, number: int = 1,
host: str = "localhost", host: str = "localhost",
port: int = 60000, port: int = 60000,
field: str = 'fifa' field: str = 'sim3d_7vs7'
): ):
""" """
Initializes the agent and all its main components. Initializes the agent and all its main components.

View File

@@ -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: You can also use a shell script to start the entire team, optionally specifying host and port:
```bash ```bash
./start.sh [host] [port] ./start_7v7.sh [host] [port]
``` ```
Using **Poetry**: Using **Poetry**:
```bash ```bash
poetry run ./start.sh [host] [port] poetry run ./start_7v7.sh [host] [port]
``` ```
CLI parameter: CLI parameter:

View File

@@ -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("-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("--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("--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() args = parser.parse_args()

View File

@@ -4,6 +4,6 @@ export OMP_NUM_THREADS=1
host=${1:-localhost} host=${1:-localhost}
port=${2:-60000} 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 & python3 run_player.py --host $host --port $port -n $i -t SE &
done done

9
start_FIFA.sh Normal file
View File

@@ -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

View File

@@ -48,3 +48,15 @@ class HLAdultField(Field):
@override @override
def get_length(self): def get_length(self):
return 14 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

View File

@@ -1,7 +1,7 @@
from dataclasses import Field from dataclasses import Field
import numpy as np import numpy as np
from world.commons.other_robot import OtherRobot 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 from world.commons.play_mode import PlayModeEnum, PlayModeGroupEnum
@@ -62,5 +62,7 @@ class World:
def __initialize_field(self, field_name: str) -> Field: def __initialize_field(self, field_name: str) -> Field:
if field_name in ('hl_adult', 'hl_adult_2020', 'hl_adult_2019',): if field_name in ('hl_adult', 'hl_adult_2020', 'hl_adult_2019',):
return HLAdultField(world=self) return HLAdultField(world=self)
elif field_name in ('sim3d_7vs7'):
return Soccer7vs7Field(world=self)
else: else:
return FIFAField(world=self) return FIFAField(world=self)