Monday, June 28, 2010

Status report

Since all of my reports so far were only about what I was doing and not about how things are done and why. I'm going to write a longer report about this.

MTSec not as documented

When writing my proposal I was expecting that some there will be some bugs in MTSec and that some parts might be implemented different than it said in the wiki, but now I know it's a lot different. Here is a list of things that are different than in the original documentation (I've already updated some parts of it).


  • Armour

    • does not affect combat in any way

    • ships have way different values of armour than you would expect from documentation

  • Resource mining

    • is not implemented

    • resource values never change, no mater how many production points are left unspent

  • Weapon production

    • to produce a weapon you need 1 production point for ever component (1 for hull and 1 for each unit of explosives)

    • this means you can use the strongest explosives in every weapon

  • Combat

    • when taking over a planet the planet is simulated as two scouts (without any weapons), so ships with weak weapons cannot take over planets


Stupid AIs

RushAI, CommandoAI, GreedyAI and BunkerAI all use the same stupid AI base. Because of some bugs there was more development time spend on stupid AI base and it got way more complex than planed. It uses 6 parameters to specify its exact behaviour, but the principle is always the same:

  1. start building an army (ships and weapons for the ships)

  2. colonise other planets but leave ships to defend your planets

  3. when the army is big enough attack the enemy, but leave some ships to defend your planets

  4. ships without weapons return to friendly planets for restock

  5. in case the attack force becomes too small retreat

  6. repeat


WaitingAI

It ends its turn as soon as it downloads all data. Obviously a bad opponent, but useful for testing as there is no need to end turns using tpadmin-cpp.

RandomAI

Randomly chooses orders for fleets and planets that don't have orders. For planets there it chooses from doing nothing, building a fleet form a predefined design or building weapons from a predefined design. For fleets it chooses from doing nothing, colonising (when on an neutral planet and the fleet has the ability to colonise), attack an enemy planet (if the fleet caries any weapons), move to a friendly planet and move to a neutral planet. In case the fleet is on a friendly planet with weapons it load the weapons and doesn't give any other orders. This is not a strong opponent but is very useful for fuzz testing the server and has used to discover 3 bugs, the downside of this kind of testing is that it is hard to find short steps to recreate a bug.

RushAI

Uses the stupid AI base. Uses small ships and weak weapons but a lot of them. An attack wave consists of 10 ships and retreats when there are only 3 ships left. At first this tactic looked promising but for reasons long unknown RushAI wasn't able to take over an enemy planet no matter how many ships it gathered. It turned out that planets have undocumented defences. RushAI was also meant to quickly spread across the galaxy colonising other planets, but since colonisation is not functional this hasn't been tested.

CommandoAI

Uses stupid AI base. Attacks with big strong ships and powerful weapons. It attacks as soon as there is an unit available and doesn't retreat at all. CommandoAI was able to beat all other stupid AI opponents. Colonisation would have been slow and the absence of it was probably a great advantage for CommandoAI.

BunkerAI

Uses stupid AI base. Build big ships and powerful weapons, but doesn't attack at all. It was not meant to win but to prevent the enemy from wining by building an impenetrable defence. Colonisation would have been slow if it worked. I was actually surprised when CommandoAI was able to beat it, since they both used the same ship and weapon designs.

GreedyAI

Uses stupid AI base. Builds small ships with weak weapons. Does not attack but was meant to colonise as fast as it could. It was meant to try to colonise so fast that the enemy wouldn't be able to take over all of its planets. But since the colonisation wasn't working it was useless.

MultipleAI

Randomly chooses every turn to behave like one of the other stupid AIs that use the stupid AI base. This was meant as a smarter version of RandomAI.

SmartAI

It was developed from stupid AI base. It functions mostly in the same way but uses different ship design for colonisation and attack ships. Attack ships are scout fitted with a lot of alpha missile tubes so they can fire a lot of missiles at once. Weapons used are alpha missiles with 1 unit of antimatter explosives. In this configuration one attack ship is capable of destroying up to 20 enemy ships and it's cheap to build. It also makes no sense to send more than one unit at a time to attack. Ship and weapon production has also been optimised so it builds as many units as possible with as little production points going to waste as possible. Only attack ships count as potential guardians of planets. Colonisation of other planets should be rapid if it starts working. SmartAI was able to beat CommandoAI (when there weren't server errors) so it has achieved its goal (in the current state of MTSec).

Weekly report - coding 5

This week a tactic for SmartAI was chosen by analysing stupid AI battles and MTSec implementation. SmartAI was coded and tested a bit. It won all battles against stupid AIs (when there were no server problems). Colonisation is still not in an useful state (can not build on colonised planets), but the SmartAI behaviour code is prepared for when it will work.

This week:
  • analysed stupid AI tactics
  • chose tactics for SmartAI
  • coded SmartAI
  • did battles between SmartAI and stupid AIs
  • wrote a long report on the state of MTSec and my AI decisions so far

Next week:
  • start including heuristics into SmartAI
  • more AI battles
  • general SmartAI improvements
  • hope colonisation gets fixed

Sunday, June 20, 2010

Weekly report - coding 4

This week StupidAI base got separated from RushAI and newly coded CommandoAI now uses the same base. StupidAI base can also be used as a base for SmartAI (latter breaking compatibility). Issue 97 was fixed today (thanks to llnz). First AI battles are now possible. Hopefully bugs won't interfere too much and AI battles will bring some meaningful data. I am currently a bit behind schedule (due to various bugs) but it is nothing to worry about.

This week:
  • Base for SmartAI finished
  • CommandoAI finished
    • attacks with one strong ship at a time
  • Issue 97 fixed (thanks to Lee Begg)
Next week:
  • AI battles (finally)
  • find out if one tactic is superior
  • start coding SmartAI with hardcoded behavior rules

Sunday, June 13, 2010

Weekly report - coding 3

Biggest achievement this week is a workaround for issue 97 and a bugfix for the colonisation module problem. Fixing the colonisation module bug revealed a new bug that causes the server to crash (but should be easy to find). Also a lot of code for helper functions was written. Number and types of weapons a ship can carry can now be calculated from design data. Code was written for loading fleets with the type of weapons they can carry and automatic design of weapons. RushAI can now handle all ship designs and can provide these ships with the right weapons. It can now serve as a base for SmartAI.

This week
  • weapon helper functions
    • a lot of helper functions for designing, loading, identifying and designing weapons
  • RushAI is now able to command ships of all designs (not just the prepared ones)
    • loads all ships with the right amount and type of weapons
  • workaround for issue 97
    • does not fix the issue but so far it looks reliable
  • mentor fixed the colonisation module bug
    • lead to a discovery of a new bug
Next week
  • fix newly found bugs
  • Stupid AI battles
  • finish turning RushAI into a base for SmartAI
  • fuzz test the server a bit

Sunday, June 6, 2010

Weekly report - coding 2

This week the RushAI was made a bit better again. It looks like it will be able to serve as a base for SmartAI. Hope all the unplanned smartness of RushAI won't make SmartAI look bad in battle results.
RandomAI was also started and is almost finished. It chooses its actions randomly from a set of predefined actions. This set depends on the state of the fleet or planet (example: fleet without weapons cannot attack). This AI could also provide a simple stress test for the server and for fuzz testing (let it loose and wait for something to break).
Issue 97 still hasn't been fixed. Also designs with colonisation module cannot be used so no planets can be colonised and enemy planets cannot be defeated. This prevents gathering any data from AI battles.
I am still on schedule but not really ahead of it any more.

This week
  • more unsuccessful bugfixing (issue 97 still there)
  • most of the code for RandomAI done
  • randomly chooses from a set of available actions
    • set of actions depends on state of the fleet or planet
  • RushAI a bit more advanced
    • better choice of fleets to attack with
  • first AI battles
    • only RushAI vs. RushAI
    • showed that it works
    • no real data because of the behavior was limited by the bugs (no colonisation, enemy planets could not be taken over)
Next week
  • incrementally make RushAI smarter so it could server as a base for SmartAI
  • try to fix issue 97 and 108
  • real AI battles (if bugs permit)