greenjoe / sergeants Goto Github PK
View Code? Open in Web Editor NEWJava Bot Framework for generals.io [not maintained]
License: MIT License
Java Bot Framework for generals.io [not maintained]
License: MIT License
There are two replay formats, a readable json - .gioreplay and a compressed .gior
There is a utility written by authors to convert compressed one to a non-compressed one
https://github.com/vzhou842/generals.io-Replay-Utils/blob/master/converter.js
There is also a description of fields in .gioreplay here:
http://dev.generals.io/replays
based on that it should be possible to create a utility to create a GameState implementation for a given turn of a given replay. That should make it easy to debug bots on particular game situations seen in replays.
Replays show the whole map - to make things realistic it should be made possible to pass a player name to the function and the function should then take care to find out which fields were visible by the given player (extended (8 - including diagonals, not 4) neighbours of fields owned by team of given player).
When setting up the custom game, QueueConfiguration.customGame(true, "BotName") does that bot forces start, but after some changes (fe. map height/with, cities/mountains density) it has to "click" the force start button again. Is there a possibility to force bot to always force the start?
There is an attack_index
field in game updates coming from server. Generalsio team on reddit said that the field is not needed for bots ( https://www.reddit.com/r/generalsio/comments/5rgmk1/version_130_launch_of_the_official_bot_server_and/ddmnbdi/ ) and the field is also not in the official API documentation.
I've seen on Discord that people are using attackIndex to check if bot's move queue is empty which otherwise is not possible, so it might be a good idea to have attackIndex copied into GameState so that bots can use it if needed.
Sorry, I'm kind of a noob to GitHub and coding. How exactly can I install this so I can use it in-game on the real generals.io?
Thank you!
There should be no need to generate array diffs, Simulator could just generate its own implementation of GameState and pass it directly to the bot.
Not sure why generals socket is sending such a strange update
First update
"map_diff":[0,1146,22,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,-3,-3,-4,-3,-4,-3,-4,-3,-3,-3,-3,-4,-3,-3,-3,-3,-4,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-4,-4,-4,-3,-4,-4,-3,-3,-3,-3,-4,-3,-4,-4,-3,-3,-3,-3,-3,-3,-4,-4,-4,-4,-3,-3,-3,-4,-3,-3,-3,-3,-3,-3,-3,-3,-4,-3,-3,-4,-3,-3,-4,-4,-4,-4,-3,-3,-3,-3,-3,-4,-4,-3,-3,-3,-3,-
3,-3,-3,-3,-3,-3,-3,-4,-4,-3,-4,-3,-4,-3,-4,-3,-3,-3,-3,-3,-3,-4,-4,-3,-4,-4,-3,-3,-3,-3,-3,-3,-3,-4,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-4,-3,-3,-3,-3,-3,-4,-3,-3,-4,-3,-3,-3,-3,-3,-3,-3,-4,-3,-3,-4,-3,-4,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-4,-4,-4,-3,-3,-3
,-3,-3,-4,-4,-3,-3,-3,-3]
Second update:
"map_diff":[1014]
Map array contains 1146 items and the second update says that 1014 should stay the same but it says nothing about the rest, therefore currently the framework just truncates the array, which is obviously bad as the size of this array should stay the same through the whole game.
Probably due to
Arrays.stream(players).forEach(this::sendInitialGameUpdate);
method
onGameStateUpdate
is called two times with GameState for which getTurn()
returns 0.
It should happen only once.
I played around with your framework and it looks great. Do you have any plans for more features? I was thinking of a mock server that would take two or more pl.joegreen.sergeants.framework.Bot and run a game without delays. That means I cloud ran a lot of games very fast. This would be handy if using evolutionary programming.
//Christian
I have done some work on the simulated server and it is not done but it is possible too run a game with two bots and you can view a replay, so it is ready for an initial commit.
Major parts that are not implemented yet are:
And then there is minor issues.
I want your opinion on where to commit. To a separate package, different module or its own repo?
While it is not possible to join queue multiple times with the same userId, it is possible to be playing multiple games.
It has to be done on different socket connections so that the messages are not mixed.
As soon as one game is started, another socket instance can join a queue to start a new game.
User should be able to specify how many games can be played at the same time.
Dijkstra (from or to chosen field) and maybe A* (between chosen fields), allow user to specify cost of different fields in path finding and whether it works only on VisibleField instances or also on non visible fields.
Algorithm should probably also be wise enough to check conquerability of the path if user wants to (it should add bot armies count and subtract enemy armies count and check that it doesn't drop below zero on the path).
Remember interval between turns is 500ms to it has to be quite efficient (<100ms?) even on larger maps such as 30x30.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.