Skip to content

Commit

Permalink
Merge pull request #22 from lugobots/improving-main
Browse files Browse the repository at this point in the history
Improving main
  • Loading branch information
rubens21 authored Aug 30, 2024
2 parents 010aa46 + 4b12c67 commit e8505c4
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 1,932 deletions.
11 changes: 5 additions & 6 deletions .dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ var lugo4node_1 = require("@lugobots/lugo4node");
var starter = (0, lugo4node_1.NewDefaultStarter)();
// ADVANCED
// the map will help us to see the field in quadrants (called regions) instead of working with coordinates
//
// const config = new EnvVarLoader()
var config = new lugo4node_1.EnvVarLoader();
// the map will help us to see the field in quadrants (called regions) instead of working with coordinates
// const map = new Mapper(10, 6, config.getBotTeamSide())
var map = new lugo4node_1.Mapper(10, 6, config.getBotTeamSide());
// our bot strategy defines our bot initial position based on its number
// import {PLAYER_INITIAL_POSITIONS} from "./settings";
// const initialRegion = map.getRegion( PLAYER_INITIAL_POSITIONS[config.getBotNumber()].Col, PLAYER_INITIAL_POSITIONS[config.getBotNumber()].Row)
starter.run(new my_bot_1.MyBot(starter.getConfig().getBotTeamSide(), starter.getConfig().getBotNumber(), starter.getInitialPosition(), starter.getMapper()));
var settings_1 = require("./settings");
var initialRegion = map.getRegion(settings_1.PLAYER_INITIAL_POSITIONS[config.getBotNumber()].Col, settings_1.PLAYER_INITIAL_POSITIONS[config.getBotNumber()].Row);
starter.run(new my_bot_1.MyBot(starter.getConfig().getBotTeamSide(), starter.getConfig().getBotNumber(), initialRegion.getCenter(), starter.getMapper()));
4 changes: 2 additions & 2 deletions .dist/my_bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ var MyBot = /** @class */ (function () {
moveDestination = ballPosition;
}
var moveOrder = inspector.makeOrderMoveMaxSpeed(moveDestination);
// Try other ways to create a move Oorder
// Try other ways to create a move Order
// const moveOrder = reader.makeOrderMoveByDirection(DIRECTION.BACKWARD)
// we can ALWAYS try to catch the ball it we are not holding it
// we can ALWAYS try to catch the ball if we are not holding it
var catchOrder = inspector.makeOrderCatch();
orders.push(moveOrder, catchOrder);
return orders;
Expand Down
28 changes: 25 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ version: '3.9'
services:
game_server:
image: lugobots/server:${SERVER_VERSION:-latest}
command: play --dev-mode --listening-duration=${LISTENING_DURATION:-50ms} --timer-mode=${TIMER_MODE:-wait}
command: play --dev-mode --listening-duration=${LISTENING_DURATION:-50ms} --grpc-port=${GAME_GRPC_PORT:-5000} --timer-mode=${TIMER_MODE:-wait}
ports:
- "5000:5000"
- "${GAME_GRPC_PORT:-5000}:${GAME_GRPC_PORT:-5000}"
- "8080:8080"
healthcheck:
test: [ "CMD", "grpc-health-probe", "-addr=game_server:5000" ]
test: [ "CMD", "grpc-health-probe", "-addr=game_server:${GAME_GRPC_PORT:-5000}" ]
interval: 2s
timeout: 10s
retries: 3
Expand Down Expand Up @@ -61,6 +61,7 @@ services:
environment:
- BOT_NUMBER=1
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_02:
image: node:18
working_dir: /app
Expand All @@ -76,6 +77,7 @@ services:
environment:
- BOT_NUMBER=2
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_03:
image: node:18
working_dir: /app
Expand All @@ -91,6 +93,7 @@ services:
environment:
- BOT_NUMBER=3
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_04:
image: node:18
working_dir: /app
Expand All @@ -106,6 +109,7 @@ services:
environment:
- BOT_NUMBER=4
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_05:
image: node:18
working_dir: /app
Expand All @@ -121,6 +125,7 @@ services:
environment:
- BOT_NUMBER=5
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_06:
image: node:18
working_dir: /app
Expand All @@ -136,6 +141,7 @@ services:
environment:
- BOT_NUMBER=6
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_07:
image: node:18
working_dir: /app
Expand All @@ -151,6 +157,7 @@ services:
environment:
- BOT_NUMBER=7
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_08:
image: node:18
working_dir: /app
Expand All @@ -166,6 +173,7 @@ services:
environment:
- BOT_NUMBER=8
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_09:
image: node:18
working_dir: /app
Expand All @@ -181,6 +189,7 @@ services:
environment:
- BOT_NUMBER=9
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_10:
image: node:18
working_dir: /app
Expand All @@ -196,6 +205,7 @@ services:
environment:
- BOT_NUMBER=10
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_home_11:
image: node:18
working_dir: /app
Expand All @@ -211,12 +221,14 @@ services:
environment:
- BOT_NUMBER=11
- BOT_TEAM=${PLAYER_SIDE:-home}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
player_away_01:
image: ${AWAY_BOT:-lugobots/level-1:latest}
network_mode: "host"
environment:
- BOT_NUMBER=1
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -228,6 +240,7 @@ services:
environment:
- BOT_NUMBER=2
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -239,6 +252,7 @@ services:
environment:
- BOT_NUMBER=3
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -250,6 +264,7 @@ services:
environment:
- BOT_NUMBER=4
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -261,6 +276,7 @@ services:
environment:
- BOT_NUMBER=5
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -272,6 +288,7 @@ services:
environment:
- BOT_NUMBER=6
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -283,6 +300,7 @@ services:
environment:
- BOT_NUMBER=7
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -294,6 +312,7 @@ services:
environment:
- BOT_NUMBER=8
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -305,6 +324,7 @@ services:
environment:
- BOT_NUMBER=9
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -316,6 +336,7 @@ services:
environment:
- BOT_NUMBER=10
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
restart: unless-stopped
depends_on:
Expand All @@ -327,6 +348,7 @@ services:
environment:
- BOT_NUMBER=11
- BOT_TEAM=${OPPONENT_SIDE:-away}
- BOT_GRPC_URL=localhost:${GAME_GRPC_PORT:-5000}
- MODE=${MODE:-default} # default zombies statues kids defenses
depends_on:
game_server:
Expand Down
Loading

0 comments on commit e8505c4

Please sign in to comment.