So aswell as being able to move, the only other thing the AI can now do is ECO.
I must say I'm really enjoying this! Writing AI is so much fun..
I'm doing quite a good job programming it too imo.
Overall its kind of a hodgepodge of different AI programming techniques specific to this game.
This game, is kinda like chess, in that you have to plan out moves and make several moves in succession in order for them to make sense.. Eg you have to build a pgen, and then build walls to connect it. But *also* its a realtime game where the enemy action can interrupt or spoil your plans.
Before writing any code on this I had a good old think + sketched out some ideas, and also
re-read this page.
I actually think that page is great, its remedial, but imo if you are familiar with, and 100% understand, everything on that page, you will be able to begin tackling writing AI for most games.
Theres definitely a behaviour tree of sorts in my code, but also planning is baked in. So a node on the tree can have a sequence of subnodes that need to complete one after another in order for that node to complete. If a node 'fails' then, its parent fails too.
I've been following my own good coding practices and so far this has been a very enjoyable experience. The code seems very solid and so far is eminently maintainable. Theres tonnes of flexibility to add whatever features I feel like to the system.
For me good coding practice is..
1. The fundamentals. Tiny classes, tiny methods.
2. Bottom up approach. Start off writing useful little utilities and then compose them to form higher level elements. Then compose those to form even higher level elements. The best software architecture imo is no architecture.. Sometimes you'll end up needing to choose a software architecture, and when that happens the choice is super important, but that choice also locks you in to a certain pattern, so if You can avoid it, do.
So, my AI code is made up of.
1. Static reusable 'Tool' classes where all the hard stuff / meaty calculations are done.
2. Lots of tiny classes like the one below that make up my behaviour tree..
