
Generals.io Bot API: Build bots to play against humans - vzhou842
http://dev.generals.io
======
mninm
Do bots watch ads?

For the last several weeks I've been an avid generals player. For awhile I was
even ranked #7 on the FFA ladder. And I have to say that this is the second
change in about a week that has left me confused about who generals is trying
to appeal to. Maybe the bots will be fun for humans to play against but I
doubt it. Maybe this will be a benign change and the quality of the bots that
play generals on the non-bot servers won't improve much from what they are
now. But either way why is an ad-supported game encouraging bots to try and
take it over? What happens when the bots become so good and so prevalent that
humans can't hope to compete? Why would anyone want to play?

Though I guess in the end I don't really care all that much as the recent
changes to the movement scheme have really put me off the game. High level
play used to be about feints and visibility, cutting off your opponents
tendrils whilst building your own, pulling their forces away from your king
while trying to find theirs. It really had a nice balance. Now, not so much.

I don't want to seem too sour. I had a lot of fun with generals [thanks devs]
but now I'm in search of a new favorite game.

PWG

~~~
popey456963
I think I'd like to point out two very important points you may be missing:

1\. This was implemented directly to combat the prevalence of bots on the EU &
NA servers (and the annoyance some players were facing when they were just
playing AIs all the time), where you're now not allowed to bot on. Players
have the _option_ of choosing whether or not they wish to play against bots,
but if they wish not to they can still play on the NA and EU servers.

2\. We're supported by ads, but that doesn't mean we want to stop people
enjoying the game in their own ways. We still have tens of thousands of
players daily on the other servers, so a few tens of pounds on a bot server
for people to compete in programming against one another doesn't seem too
problematic.

And, to address your movement concern, it was a tough decision to make. But we
wanted to allow everyone to enjoy the game, even people with lag or on mobile
devices (where control is significantly harder). If you dislike the new
movement settings, you are able to disable them in the options menu.

~~~
mninm
I debated whether to respond to your comment at all. Let me first say that I
wish you all the best and hope for your continued success. However, some of
what you said feels like you're asserting that "up" is in fact "down". So let
me first establish my bona fides with this screenshot that was taken on the 25
of last month:

[http://imgur.com/a/uv1C6](http://imgur.com/a/uv1C6)

so you can believe me when I say that I was a pretty good player that spent a
lot of time playing your game.

> This was implemented directly to combat the prevalence of bots on the EU &
> NA servers (and the annoyance some players were facing when they were just
> playing AIs all the time), where you're now not allowed to bot on. Players
> have the option of choosing whether or not they wish to play against bots,
> but if they wish not to they can still play on the NA and EU servers.

Respectfully, yours is not the first game to have these types of problems.
People grief and cheat in every online game where it's possible. Creating bot-
only servers will not curtail bot use on non-bot servers. It will instead give
people who grief and cheat stronger bots that they can pull down from github
or wherever and adapt to play on non-bot servers.

They only thing that will stop people from using bots in bot free zones are
technological countermeasures. Captchas being the classic example of such
technology.

> If you dislike the new movement settings, you are able to disable them in
> the options menu.

That fact that you suggest this as a way to address my concerns makes me
wonder if you actually play your game outside of testing it to see if a new
feature works.

When you changed the way players can move you not only changed how I play the
game but how everyone else plays against me. Essentially, with this latest
revision you've created a substantially different game. Using the option to
limit how I move without it changing how my opponent's move would only serve
to put me at a disadvantage. It would not roll back the clock to the make the
game be like the old game I liked.

All of the tactical nuance that the game used to have was based on timing and
multitasking. High level gameplay steamed from getting inside your opponent's
head and trying to force them into mistakes. The key to doing that was to
realize that if an opponent is trying one thing they most likely aren't doing
something else. If you could get them to focus on the wrong thing you gained
the advantage. In my opinion the old game had a great balance between strategy
and execution. If you weren't good at both you couldn't win. The new control
scheme throws that particular balance out window. It's hard to describe in
words because it's a million little differences that add up to a whole but
suffice it to say that games now to me feel less like a sword fight and more
like people running at each other with pots on their heads.

~~~
connor4312
Another avid player here, also ranked in the top 10 for a decent amount of
time, now in the mid one hundreds.

I think the primary difference is now that moves can be infinitely queued,
whereas in the past moving into an enemy's territory took time and
concentration. Now, if I know where enemy cities are, I can order them to be
attacked within a few seconds. Previously players were required to constantly
expend time and concentration on each move, making multitasking and balancing
a much more fine dance.

The new system tends to favor troop numbers above all, prioritizing strength
over strategy. Before the update, if I had 2/3rds the troops of an average
opponent by the time an 8v8 was down to a 1v1, I had about a 50% chance of
winning. Now it's _maybe_ a 10% chance.

~~~
arcticfox
I don't play the game, but this is an interesting discussion to hear you
players cover. Are you sure it's not emphasizing strength over APM and not
strength over strategy? (The description you give makes it seem like that)

~~~
popey456963
This is really what the argument boils down to. Whether being able to move
only once at a time could really be considered strategy or just mechanical
skill.

Personally, I feel that this falls under the category of mechanical skill,
because you can play just as well with this movement style as you can in the
previous style, it just requires less ability to click and press a key exactly
every 500ms.

------
conflagration
This will be super interesting. I think this game makes very much sense as an
intermediate frontier on the road to a StarCraft AI. Here are my reasons:

* The playing field is relatively limited, just a little larger than Go. This makes it much more approachable than StarCraft as you will not need a server farm to get started.

* It has a fog of war, so a bot needs to handle uncertainty and have a memory.

* It's controlled through a web API and allows total freedom for the bot implementation by that.

* There are very competitive humans players.

* There is already a very huge dump of replays to train on.

I really hope this will get traction and establish as an ongoing AI
competition. Also it will be very interesting, when the first bots will be
better than the top humans here.

------
m00x
[https://halite.io](https://halite.io) is pretty similar if you'd like to play
against bots only. Plus it has a great forum that has a few posts on creating
a bot using ML.

~~~
conflagration
Halite also looks interesting, but I think with generals bot-makers will have
much more possibilities, because there are no limitations for your
implementation. The game mechanics might also a little more challenging in
generals, especially the fog of war makes a huge difference imo.

~~~
Analog24
You'd be surprised how many implementation options there are in halite. People
have come up with starter packages for just about every language you would
ever want to use.

------
juancampa
This is very interesting and I'd love to play with it. As a player though, the
thought of being matched against a bot sucks in the sense that it makes the
game less enjoyable. I enjoy winning (mostly losing) against flesh and bone
humans. I wonder if the folks of generals.io would implement a different
"league" where bots are somehow not allowed.

~~~
conflagration
That is already there :) Only one of the three servers allows bots.

------
crisopolis
Fix the paragraph on the Bot API page... "Your bot will be self-hosted,
meaning you don't upload anything to your servers (we never see your code)."

~~~
popey456963
Oooh, nice catch! Made the fix, will be updated next time we release.

EDIT: Well, I tried, Vzhou beat me to fixing it.

------
aevitis
This is going to add a great new dimension to the game, especially in terms of
being able to 2v2 with a bot for a partner.

------
qwertyuiop924
This might revive my interest in Generals, as I found it a mixture of boring
and excitingly stressful when I played by hand.

However, because Generals is an RTS, bots might have a pretty steep advantage
(although movements take a good bit of time, so it's not as bad as it could
be). Does anybody know how bad this is in real play?

~~~
popey456963
Although we haven't had many bots on bot.generals.io yet (early days), my
experience of playing against bots on the main leagues show that although we
had several dozen bots built, all of them were no match for a competent human
being. The only one that comes close is called "Sora AI", but that AI can be
easily beaten by anyone in the top fifty odd.

I'd be interested to see if a bot will be able to always defeat players,
waiting for what will happen with this latest release.

~~~
reitzensteinm
The bots were all pretty incompetent, but it was INFURIATING to play against a
dumb bot that does nothing but attack you.

Unlike a player, where you have a decent chance to juke their stack and cap
them (and then have a great chance to win), many dumb bot implementations
would just aggressively trade 1:1, basically guaranteeing that you're both
screwed.

I got up to rank #3 on the FFA US server, and spawning next to Simple Bot
would mess me up more than spawning next to an 80+ (back when it topped out at
~86).

That, and the terrible latency handling (if your internet is acting up a tiny
but, you basically have no chance to win), was what made me stop playing
eventually.

~~~
popey456963
Well, then I'm glad I think we've fixed both of these issues! Bots now can
only play on one server, so people have the choice of playing against them.

Also we've significantly reduced the impact of lag by allowing you to queue up
moves, even in enemy territory. Although all real-time games need a certain
amount of reliability in your internet connection to work, I think we've
recently reduced it significantly. Although, of course, any suggestions you
have for improvement would still be useful!

~~~
reitzensteinm
No, that's perfect. Certainly there's always going to be a limit to lag
compensation, but it was very frustrating when you could no longer double
move, but your opponent could.

------
pfista
This is great, I'm glad the developers are officially supporting this now. I
had started building a simple bot before this was released
[https://github.com/pfista/generals](https://github.com/pfista/generals)

------
phanone2017
Are all game replays since inception stored in a database? It would be great
if you could release one grand zip file to the public that could then be
hosted on S3. Even a subset of say all games of the top 200 FFA players would
make an interesting training data set!

~~~
popey456963
Already released! You can see the page explaining it here:

[http://dev.generals.io/replays](http://dev.generals.io/replays)

It contains 200,000 games of varying levels, so should hopefully make good
training data.

~~~
joelthelion
One thing that's missing is a tool to reconstruct a bot's input at a
particular turn from the replays (they don't have fog of war).

------
dnautics
I know this could be a bit of a big ask because obviously it would be too easy
to clone the website, but is there any chance of a headless game server that
would let us do adversarial training?

------
jjshanks
I started making a bot last night but it keep getting disconnected in the
first 10ish rounds. Anyone else see this and resolve it?

~~~
popey456963
Could you give us some details on this? Like which web socket library you
used, the technology you used, etc?

If you copy & paste the example bot verbatim, does that work for over 10
rounds? As far as I know we've got tens of bots working at the moment and I
haven't heard this strange problem from anyone else.

~~~
jjshanks
I don't have the code handy at the moment but I was using ruby with this
socket.io gem 'socket.io-client-simple'

I was able to connect, join a game, send chat messages, just couldn't stay
connected.

I basically just converted the JS tutorial on the site to ruby style.

------
adoos
Awesome stuff. I think a bot server is a logical choice and a good one. It
will be neat to see what people can come up with.

