ASPP / pelita

Actor-based Toolkit for Interactive Language Education in Python
https://github.com/ASPP/pelita_template
Other
62 stars 68 forks source link

Add zmq protocol to dispatch multiple players with `--remote` #776

Closed Debilski closed 3 months ago

Debilski commented 11 months ago

tl;dr

instead of

pelita ./my_bot.py remote:tcp://151.11.0.123:12345
pelita ./my_bot.py remote:tcp://151.11.0.123:12346

we want to do

pelita ./my_bot.py pelita://some.server.com/attacker_bots
pelita ./my_bot.py pelita://some.server.com/defender_bots

Context

We want to play remote games but zeroconf is not available.

Problem

Usually, we would have to run pelita-player --remote TEAM ADDRESS on a server, where ADDRESS is usually of the form tcp://151.11.0.123:12345. Now arbitrary many teams can connect to this address using the remote:tcp://... syntax and will get the chance to play a remote game against the code given in TEAM. (See #769 for syntax changes to make this a bit nicer.)

For additional teams that should be run on the remote server, we will have to run pelita-player with a different port in ADDRESS (and a different TEAM of course).

In networks in which zeroconf is possible, this is not much of a problem, as the URL details will be hidden from the user. When this is not possible, however, remembering the different ports for the different teams is a bit tedious and opaque. Additionally, the firewall on the server has to be changed to let through traffic for each additional team/port.

Proposal

Possible implementation

pelita already uses a zmq DEALERROUTER dispatch system in remote games. It should be possible to simply add the path component to the request and have some code on the pelita-player site to have a proper mapping between a path and a TEAM.

As a bonus, there should be a minimal API to see which TEAMs are available and they should optionally be advertised via zeroconf.