Giter VIP home page Giter VIP logo

coderonehq / bomberland Goto Github PK

View Code? Open in Web Editor NEW
99.0 99.0 38.0 18.31 MB

Bomberland: a multi-agent AI competition based on Bomberman. This repository contains both starter / hello world kits + the engine source code

Home Page: https://www.gocoder.one/bomberland

License: MIT License

Dockerfile 0.26% Python 2.05% TypeScript 33.23% Go 1.40% Makefile 0.02% C++ 61.80% Rust 1.20% JavaScript 0.04%
algorithms competition cpp deep-learning go golang javascript machine-learning python reinforcement-learning rust typescript

bomberland's People

Contributors

dtitov avatar garyleecf avatar irsital avatar jfbogusz avatar joooyzee avatar jpeg729 avatar k-jboon avatar thegalah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bomberland's Issues

[8837] Failed to execute script docker-compose

Hi,

I am trying to run with docker-compose and get into this error:
`bomberland$ docker-compose up --abort-on-container-exit --force-recreate
Traceback (most recent call last):
File "urllib3/connectionpool.py", line 677, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "docker/transport/unixconn.py", line 43, in connect
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "requests/adapters.py", line 449, in send
File "urllib3/connectionpool.py", line 727, in urlopen
File "urllib3/util/retry.py", line 403, in increment
File "urllib3/packages/six.py", line 734, in reraise
File "urllib3/connectionpool.py", line 677, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "docker/api/client.py", line 205, in _retrieve_server_version
File "docker/api/daemon.py", line 181, in version
File "docker/utils/decorators.py", line 46, in inner
File "docker/api/client.py", line 228, in _get
File "requests/sessions.py", line 543, in get
File "requests/sessions.py", line 530, in request
File "requests/sessions.py", line 643, in send
File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "bin/docker-compose", line 3, in
File "compose/cli/main.py", line 67, in main
File "compose/cli/main.py", line 123, in perform_command
File "compose/cli/command.py", line 69, in project_from_options
File "compose/cli/command.py", line 132, in get_project
File "compose/cli/docker_client.py", line 43, in get_client
File "compose/cli/docker_client.py", line 170, in docker_client
File "docker/api/client.py", line 188, in init
File "docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', PermissionError(13, 'Permission denied'))
[8837] Failed to execute script docker-compose
`
I have already installed docker and docker-compose and running it inside conda 4.11.0 (Ubuntu 20)

Cheers,
Khuong

Simplifying Json deserialisation

TLDR In some statically typed languages you can deserialize json just by creating a class and calling a method. Unfortunately bomberman's types make it nearly impossible. Here I propose a small modification to your types that would make this easy to achieve.

For example, a ServerPacket has 5 different forms type ServerPacket = GameStatePacket | GameTickPacket | EndGameStatePacket | InfoPacket | NextGameStatePacket.

This could be modeled using inheritance, but polymorphic deserialization of json is very often not supported by the json libraries in statically typed languages.

The alternative is to create a class with all of the possible properties, which can work unless those properties overlap in ways that cannot be expressed. Unfortunately four out of five of the game event types contain a payload property and they are of different types. Again the payload type could be modelled using inheritance, but again polymorphic deserialization is hard.

Suggestion Make each XxPacket type contain only two properties, type and xx_data. That way your typescript code can stay mostly the same, and C# code can represent a server packet as a single class, and deserialization is easy

Typescript definition example

export interface GameTickPacket {
    readonly type: PacketType.Tick;
    readonly game_tick_data: IGameTick;
}
export interface GameStatePacket {
    readonly type: PacketType.GameState;
    readonly game_state_data: IGameState;
}
// etc
export type ServerPacket = GameStatePacket | GameTickPacket // | etc

C# definition example

class ServerPacket
{
    public string Type { get; set; }
    public GameTick GameTickData { get; set; }
    public GameState GameStateData { get; set; }
    // etc
}

Deserialization

var serverPacket = JsonSerializer.Deserialize<ServerPacket>(jsonString);

If you do the same with all your union types, that would greatly reduce the friction for starting with a language like C#.

Default version of agent fails to start due to deprecations in Python 3.10

By default the docker-compose file uses python:3-alpine as the base image for the Python container which in turn uses Python 3.10. However the default code provided in the repo uses functionality that was deprecated in Python 3.10. Replacing the image with python:3.8-bullseye and rebuilding the container means everything works again as intended.

I'd suggest however to update the template code instead. In particular this is the line where it fails

Log output of the failing part:

agent-b_1       | /app/agent.py:18: DeprecationWarning: There is no current event loop
agent-b_1       |   loop = asyncio.get_event_loop()
agent-b_1       | Traceback (most recent call last):
agent-b_1       |   File "/app/agent.py", line 63, in <module>
agent-b_1       |     main()
agent-b_1       |   File "/app/agent.py", line 60, in main
agent-b_1       |     Agent()
agent-b_1       |   File "/app/agent.py", line 19, in __init__
agent-b_1       |     connection = loop.run_until_complete(self._client.connect())
agent-b_1       |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
agent-b_1       |     return future.result()
agent-b_1       |   File "/app/game_state.py", line 18, in connect
agent-b_1       |     self.connection = await websockets.client.connect(self._connection_string)
agent-b_1       |   File "/usr/local/lib/python3.10/site-packages/websockets/client.py", line 535, in __await_impl__
agent-b_1       |     transport, protocol = await self._create_connection()
agent-b_1       |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1080, in create_connection
agent-b_1       |     transport, protocol = await self._create_connection_transport(
agent-b_1       |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1098, in _create_connection_transport
agent-b_1       |     protocol = protocol_factory()
agent-b_1       |   File "/usr/local/lib/python3.10/site-packages/websockets/client.py", line 69, in __init__
agent-b_1       |     super().__init__(**kwargs)
agent-b_1       |   File "/usr/local/lib/python3.10/site-packages/websockets/protocol.py", line 235, in __init__
agent-b_1       |     self._drain_lock = asyncio.Lock(
agent-b_1       |   File "/usr/local/lib/python3.10/asyncio/locks.py", line 77, in __init__
agent-b_1       |     super().__init__(loop=loop)
agent-b_1       |   File "/usr/local/lib/python3.10/asyncio/mixins.py", line 17, in __init__
agent-b_1       |     raise TypeError(
agent-b_1       | TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
bomberland_agent-b_1 exited with code 1

How to train the agent in PC locally?

Dear author: I'm wondering if we are only permitted to train our RL agent by connecting the game server via docker? Then how we check the bugs in our agent.py file? In general, there will be some inevitable errors in setting up program of RL agent for the environment. It can be more convenient for us to debug if we are provided with the environment.py file in the process of developing RL agent file. If we are not permitted to do this, then how we check if our submitted agent.py file has no errors?
Looking forward for your reply!

How to get started with this bomberland environment?

Dear author: Currently I plan to participate the bomberland competition but I fail in the "Getting started" stage. I have downloaded the repo of the environment and installed Docker in my MacPro, then I copy the order "docker-compose up --abort-on-container-exit --force-recreate" into the terminal, but it fails and shows the error: "Can't find a suitable configuration file in this directory or any parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml, compose.yml, compose.yaml"
Can you give me some advices on how to smoothly get started the game? Appreciate!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.