AI for Warzone 2100

AI for Warzone 2100

Masaryk University Faculty of Informatics AI for Warzone 2100 Bachelor’s Thesis Filip Ďuračka Brno, Spring 2020 Masaryk University Faculty of Informatics AI for Warzone 2100 Bachelor’s Thesis Filip Ďuračka Brno, Spring 2020 This is where a copy of the official signed thesis assignment and a copy ofthe Statement of an Author is located in the printed version of the document. Declaration Hereby I declare that this paper is my original authorial work, which I have worked out on my own. All sources, references, and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Filip Ďuračka Advisor: RNDr. Mgr. Jaroslav Bayer i Acknowledgements I‘d like to thank my advisor Jaroslav Bayer for all the support, and Warzone 2100 community for maintaining this amazing game for all those years. iii Abstract The goal of this work was to design and implement an AI for real- time strategy game Warzone 2100. As part of the design, two new features unique to this AI were implemented. First is creation of a graph representation of any given game map, obtained by analysing terrain and application of image processing algorithms. Second is a neural network, trained on data from 727 matches against other AIs, that guides the AI‘s battle plan. iv Keywords Artificial Intelligence, Game AI, Image Processing, Artificial Neural Networks, Warzone 2100, JavaScript v Contents Introduction 1 1 Warzone 2100 3 1.1 Game mechanics .......................3 1.2 Scripting language used for AIs ...............6 1.3 Existing AIs ..........................6 1.3.1 Nexus AI . .6 1.3.2 NullBot . .7 1.3.3 Bonecrusher . .7 1.3.4 Cobra . .9 2 TenguAI 11 2.1 Map analysis ......................... 11 2.1.1 Terrain analysis . 12 2.1.2 Image thinning . 13 2.1.3 Graph creation . 16 2.1.4 Graph representation and manipulation . 18 2.2 Cores ............................. 20 2.2.1 Macromanagement cores . 21 2.2.2 Micromanagement cores . 24 2.3 Neural network for playstyle selection ............ 27 3 Conclusion 31 A Maps used for neural network training 33 B Statistics of matches before and after the use of neural net- work 37 Bibliography 39 vii List of Tables 2.1 Visualisation of tile neighbourhood [8] 14 2.2 Match statistics during learning process, per opponent. 29 2.3 Match statistics with learned neural network, per opponent. 29 B.1 Match statistics during learning process, per map and game setting. 37 B.2 Match statistics with learned neural network, per map and game setting. 38 ix List of Figures 2.1 ’Picturisation’ of a map. Minimap (left) compared binary picture (right). Red denotes impassable tiles. 14 2.2 Comparison of binary image (left) to its thinned counterpart (right). 15 2.3 Thinned shape with nodes. Starting positions (green), resources (blue), crossroads (brown). 16 2.4 Final graph of the map. Starting positions (green), resources (blue), chokepoints (red), mundane nodes(black). 17 A.1 Small map with tight corridors and perfect early game chokepoint in the middle. 33 A.2 Water-separated continents with varying amounts of players. Ideal for testing analyser and cross-water attacks of the AI. 33 A.3 Sizeable, but tight map with hill-separated pathways. Good for concentrated defenses and macro movement. 34 A.4 Small but spacious map. Good for quick matches that do not require fancy movements. 34 A.5 Personal favourite. Tight, highly asymmetric starting positions. 35 A.6 Similar in concept to Monocot, but with more resources and corridors. 35 xi Introduction The goal of this thesis is to create a new AI for Warzone 2100, that would be both more challenging and fun to play against, and deeper in its decision-making process than the alternatives. This is attempted by two systems no other AI in this game has. Firstly, giving the AI proper knowledge of the playing field by analysing the game map and creating a graph which can then be traversed in an arbitrary fashion. Secondly, equipping it with a neural network trained to select the best playstyle for the current state of the game. The first chapter introduces the game itself, explains the mechan- ics and presents AIs currently in use for multiplayer games, their strengths and weaknesses. The second chapter dissects design and implementation of my AI, what it does better, faster, what it does extra and how it affects an average game session. The end contains analysis of the results of pitting the AIs against each other and discussion about possible causes. 1 1 Warzone 2100 This chapter explains what the game is [1], what sets it apart from most other games in its genre and design of AIs most widely used for play. 1.1 Game mechanics Warzone 2100 is a real-time strategy game set in a post-apocalyptic fu- ture. As such, the goal of the game is to destroy all hostile assets present on the map. To this end, players have to build a base of operations, secure income of resources and produce an army, while defending their own base against enemy attacks [2, 3]. The maps are made of square tiles organised into rectangular grid. Each tile can be occupied by a single player-built structure or environ- mental feature (e.g. trees, houses, miscellaneous ruins), with some structures requiring several tiles. This grid has no effect on units, which can roam freely across tiles. Maps can be up to 250 * 250 tiles in size. Building a base is done via special, defenseless builder unit avail- able since the start of the game. Typical player base would consist of headquarters structure and some amount of factories, research facilities, generators and static defenses(turrets, bunkers and walls) positioned around the perimeter. Resource collection in the game is simplified compared to others in the genre. Instead of sending out defenseless and potentially expensive harvester unit, Warzone 2100 makes the player build a free(and de- fenseless) resource extractor on designated places on the map. These are, upon construction, automatically assigned to a power genera- tor, which generates the game‘s only resource – power – at speed dependent on the amount of extractors assigned. Maximum number of these a single generator can serve is four, so players must take care in reserving enough space and power for multiple generators. Unlike most games in this genre, Warzone 2100 provides the player with an opportunity to design their own units, called droids. After building the headquarters, and only while this building is present on the map, the player gets access to a designer tool. Within this tool, 3 1. Warzone 2100 they can create a droid template by selecting components of three categories: ∙ body, affecting base health, horsepower, thermal and kinetic armour and turret capacity of the droid; ∙ propulsion, affecting speed, general mobility of the droid, type of traversable terrain and resistance(or vulnerability) to certain weapon types; ∙ turret, which is either a weapon, or a utility, i.e. constructor, radar, repair. In this tool, player can design aircraft by selecting a VTOL (Verti- cal Take-off and Landing) propulsion. This changes a lot of proper- ties of the droid. Firstly, and unsurprisingly, it gains the ability to fly over any terrain and becomes untargetable by many ground-based weapons. Secondly, it gains access to special VTOL only variants of droid weapons (and some new weapons of their own) that have lim- ited ammunition supply. Lastly, it needs a special factory to be pro- duced in, and rearming pads to repair and replenish the ever needed ammunition. Role of ground infantry is held by cyborg units. These are, unlike droids or VTOLs, not customisable, instead coming as template ready for production when necessary technology has been researched. Basic cyborg templates are unlocked together with certain droid weapons. Heavier, more durable and damaging variations are available to be re- searched separately after researching several high-tech droid weapons. Cyborgs follow their own armor upgrade research path separate from the droids and require special factory to be produced in. Related to cy- borgs are flying unarmed transports capable of ferrying small amount of cyborgs across otherwise impassable terrain, with heavy cyborgs requiring their larger, more durable variant. Like many contemporary RTS games, Warzone 2100 features re- search opportunities to enhance capabilities of player‘s units. However, unlike most of these games, research here provides much more than upgrading stats. Within the very expansive technology tree, players can unlock new buildings, base defenses and droid components in addition to mentioned damage/armour/speed upgrades for all assets. 4 1. Warzone 2100 It is crucial for player‘s success to properly prioritise which research path to follow, when to keep following it and when to switch to another one [4]. Weapons are possibly the most important research items in the whole tech tree. They are separated into several categories. These de- termine what upgrades apply to the weapon in question, and modify damage to certain propulsions and structure types [5]. Weapons them- selves deal either kinetic or thermal damage that gets mitigated by kinetic or thermal armour, respectively. Accuracy of the weapon also plays a role, with bullets being able to completely miss their target and hit something nearby, or detonate on terrain. Some weapons get mild bonus to accuracy when firing from within half of their maxi- mum range, which combined with possibility of hitting something else makes proper unit placement in battle not negligible. There are multiple parameters that can be set before the start of each game. Aside from choosing a map for the game to take place on, the host can also alter starting power for all players(low, medium, high), starting bases(no base, basic structures only, defended base), structure limits(except defensive structures) and starting technology level(no tech, basic components available, advanced components avail- able, everything researched).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    57 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us