I figured I would write a post with some tips for what has worked (and not worked) for me in climbing the rankings ladder. I will avoid any specific discussion of implementation details or game strategies (other than a note on overkill). The main reason for not going into specifics is that I am a fan of figuring out the implementation details and strategies myself, and I want people with the same mentality to still be able to read and benefit from this post without feeling like I took some of the fun out of the game.
I realize most people don't share this same mentality, and so I would first point you to a fantastic post So you’ve Improved the Random Bot. Now what? that goes into implementation details and strategy. I wouldn't be surprised if the code provided for the OverkillBot will put you close to the Gold Tier right away.
A lot of these tips will come across as common sense, but I still find myself spending a lot of time doing things that aren't actually helping my bot, so this list is as much for new players as it is for myself.
1. Your bot should never error out.
Stop on any new feature you are implementing, fix that bug, resubmit your bot, and carry on.
2. Your bot should not time out.
Yes, there can be rare server issues that will cause your bot to time out, but in general if your bot is timing out it is a problem with your code. If you see you are timing out on more than 5% of your games, you should stop whatever new feature you are implementing and figure out how to fix it.
3. Use source control.
Ok, yes this is pretty much a no brainer for any developer, feel free to skip this section.
I implement any major changes to my strategy or new ideas on a new git branch. If I am struggling to make that strategy work correctly, it is no big deal, I just check it into the branch and then move back to master.
On two different occasions I've figured out why things weren't working well with a strategy several days after I'd given up on that idea. Luckily since I still had the code lying around on the branch I was able to make the changes and watch it work as I had hoped and merge it onto master.
4. Practice against bots locally.
Local matches are essential to testing fixes to your bot. You will want to be able to test specific maps multiple times as you are debugging and modifying your bot. In order to effectively test you will need other bots to test against. One suggestion early on is to take some of the bots from the previously mentioned post. In addition I save a jar file of every version of my bot so that I can test any changes I make against previous versions of my bot.
I also use the local match manager to test for regressions in my bot. It would probably have been better for me to come up with some kind of test suite for regressions, but I never made it around to that.
5. Keep iterating on fixing all clearly bad moves your bot makes, until you are confident that any bugs in your implementation are fixed.
I should probably have made this #1 since this is the most important point to remember early on. Avoiding bad moves and mistakes is the most effective way to quickly climb the ladder.
6. Understand root cause of losses
You should watch a bunch of replays to understand the root cause of most of your bot losses. I know it is much more fun to watch the replays where you win, but it isn't as easy to learn that way. Be careful you are actually getting to the root cause and not just an observed effect. Keep asking "why" until you can't go any deeper, and then work on a solution. The tricky balance here is that you don't want to change something so that you win in this scenario, but suddenly your bot loses a lot of matches it won before. Again my current solution for this is to use the match manager to catch regressions.
7. Make sure you understand overkill.
I thought I understood overkill early on, but it wasn't until V52 of my bot that I actually understood how it worked. I see the documentation is much better now than when I first started so it may not be a problem for new users. I figured I would mention it though since I struggled with it, and I see so few bots that attempt to take overkill into account.
My mistake was that I thought overkill to surrounding sites occurred after reducing the strength of all enemies attacking the same site. It's amazing how many replays I watched without realizing I was wrong. I guess when you think you know how something works you glaze over evidence to the contrary. I finally figured it out by watching an attack in slow motion, which I think is the best advice for making sure you completely understand the overkill rules.
8. Bot ranking != number of lines of code
I believe @erdman posted that he had somewhere in the neighborhood of 100 lines of code with his #1 ranked bot at the time. I'm guilty of writing lots of code, but anecdotally two of my best bot improvements have been when I figured out more general solutions to produce the effect I was going for (and resulted in removing a lot of code).
9. Performance improvements have a snowball effect.
Initially I looked into improving the performance of my bot because I was timing out too much. As I improved the performance I started to realize some side benefits.
a) Obviously not timing out helped my bot ranking quite a bit
b) I could now run local matches faster, resulting in faster feedback while testing changes to my bot.
c) Match manager can run more matches to find regressions quicker.
d) I had leeway to add more calculations where it could further improve my bot.
How did I improve performance? First you have to be able to understand where the time is being spent. Sometimes it may seem obvious where the time is being spent, but it is always good to use a profiler to confirm.
Anyone using a JVM based language should be able to use jvisualvm. I use jvisualvm sampling and a Clojure specific library Criterium to execute the code I want to benchmark. I never managed to get the jvisualvm profiler to work with my code (probably some environment properties I need to set), but sampling was sufficient to understand where I needed to improve performance.
Once you know where the performance problem is you can fix it by improving the performance of the culprit function or finding a way to reduce the number of calls to that function.
It looks like if you are using Python you should definitely use Erdman's starter package to be at a good starting point performance wise.
10. Make use of tools
The community has put together some great tools. You have the match manager from @smiley1983 I mentioned before, the enhanced visualizer from @nmalaguti, and so on. Take advantage of those. Figure out things that you want to measure and build a tool yourself to give you better insight into your bot.
I should probably say that building your own tool is a double-edged sword. A lot of us would end up sinking a lot of time into a tool, which in the end might be great. If your goal is to move up in the rankings though you might be better off not spending time on a tool. There aren't a lot of people like @nmalaguti that are so focused and productive they can build a tool, rewrite the documentation, write a bunch of example bots and tutorials, and become the #1 ranked bot. If you are a mere mortal like me it may be best to sticking to just logging the metrics you want to capture and building something really simple to analyze those logs.
What did not work out well for me
1. Constant tweaking of parameters
I spent way too much time running matches with slightly different parameter settings, changing one in isolation, changing a few together, or revisiting the parameters after implementing a new feature. There is probably a scientific way to go about picking optimal values, but for me it was just a big time sink without any benefit realized. My limited time could have been much better spent.
2. Too many changes at one time
I've learned this too many times as a developer. Focus on one thing at a time. If you watch a match and suddenly have an idea for a new thing you should try, put it on a list of things to implement or explore later. Completely finish your current task first otherwise you are going to be doing too much context switching, be prone to not catching bugs as you are implementing, and having no idea which one of the things you are implementing made your bot better or worse.
Make each change as small as possible and then submit that to see where you rank.
There are several other things that did not work out well for me (I love to experiment with different strategies), but most of them are too closely related to strategy for this post.
I'm sure a lot of people think that watching the top players bots compete is the best way to improve. I would argue against that for a couple of reasons. The first being completely psychological. It can be a little disheartening and overwhelming when you look at the movement of the top players and think there's no way I can implement that behavior. Or you look at certain aspects of those players and try to emulate them only to find that your bot is actually worse. It can make some people just want to give up. The second reason is that none of the top players have the optimal strategy. First @djma looked unbeatable, then @erdman, @timfoden, and now @nmalaguti. Each player that takes over first place has implemented something quite different. It is possible to try and copy the observed behavior of the other top players, but remember it is a moving target. New top players will emerge because they came up with creative new strategies.
Hopefully this helps out some of the players just getting started. If you want to provide more tips in this thread, please try to keep them spoiler free (no tips on specific strategies or example implementations).