Skip to content

XBattleFan/Blobbot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generals.io - Automated Client

Generals.IO Gameplay Image

Synopsis

Generals.io is a multiplayer web game where the goal is to protect your general and capture the enemy generals.

This is a collection of various automated clients (bots) for playing Generals.io.

Project available on GitHub.

Setup

  • Install Dependencies: pip install -r requirements.txt
  • Edit bot_*.py: At bottom set bot name and game type in bot_base.GeneralsBot(...)

Usage

  • Blob Bot: python bot_blob.py
  • Path Bot: python bot_path_collect.py

Features

Bots

  • bot_blob.py
    • Run largest army to nearest priority target
    • Move Border Armies Outward
  • bot_path_collect.py
    • Primary Path Routine: Run path from largest city to primary target
      • Continue running after reaching primary target
    • Collect Troops Routine (Run largest army toward nearest path tile)
    • Move Border Armies Outward
    • Proximity Targeting

Sample Code

  • samples/nearest.py: Run largest army to nearest priority target

Bot Base

  • Bot Base
    • find_largest_tile(ofType, notInPath, includeGeneral): Returns largest tile ofType, notInPath, optionally includeGeneral
    • find_city(ofType, notOfType, findLargest, includeGeneral): Finds largest/smallest city ofType (or notOfType), optionally includeGenerals
    • find_closest_in_path(source_tile, path): Returns dest_tile in path nearest to source_tile
    • find_closest_target(source): Returns closest tile to target given a source
      • Do not target unreachable tiles
    • find_primary_target(target): Returns primary tile to target, optionally given an previous unobtained target to consider
      • Do not target unreachable tiles
    • find_path(source, dest): Finds optimal path from source to dest
      • Improve Pathfinding
        • Correctly collect max chains and run shortest paths
    • path_forward_moves(path): Returns (from_tile, to_tile) to move next given the current state of a path.
    • toward_dest_moves(source, dest): Returns DIRECTIONS array with first directions toward dest
    • away_king_moves(source): Returns DIRECTIONS array with first directions away from general
    • moves_random(): Returns DIRECTION array shuffled
    • distance(source, dest): Returns Manhattan distance between source and dest
    • place_move(source, dest, moveHalf=False): Place move from source to dest
      • Only permit 1 move/turn
    • validPosition(x,y): Returns boolean if x,y is valid tile in grid

Client/Viewer

  • Client
    • Join Game
    • Receive Map Updates
      • Maintain Map of tiles, with memory (remembers previously visited tiles).
    • Make Moves
    • Send/Receive Chat
  • Viewer
    • View Grid (Color tiles w/ army count, circles for cities/generals)
      • Uniquely identify generals
    • View Leaderboard (Sorted, colored boxes w/ player name, army count, and # tiles)
      • Add player ratings estimated # cities

Contributors

@harrischristiansen HarrisChristiansen.com (harris@harrischristiansen.com)

About

Automated Client for generals.io

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%