This is a blog article about my experiences diving into Halite for the first time.
First, let me introduce myself. I’m a product manager working for Two Sigma on Halite. I’ve helped with user research (interviews and surveys), website design and development, and product marketing (if you see updates on Twitter and Facebook or you get email newsletters from Halite, chances are I wrote them).
I don’t consider myself the most technical of product managers - some folks at Two Sigma like @harikmenon1 have years of experience as a software developer before switching to product. My background was in project management and business with a dash of fashion (here I am on Twitter if you’re curious: https://twitter.com/juliakastner) .
Getting Set Up
I poked through them all pretty briefly, but I could quickly tell a lot of the elements were more advanced than what I needed right now. All I wanted to do was to check out my own bot. I opened the “MyBot” file and found that it’s almost empty:
But there’s a very clear explanation why this is the case - the JS starter kit separated out the basic “MyBot” file from the strategies used to actually play the game. So the fun stuff will be in the strategies file. I feel pretty confident I know where to go to get started and how to start playing.
Submitting the Basic Bot
To get a baseline and see where the starter bot leaves me, I submitted the starter bot without any changes. My bot was submitted as version 9 in my bot history (I submit bots for QA but to this point have only been submitting starter bots). I got a rank of 658.
Here’s an example of my starter bot winning:
Why did I win? Because I made a whole bunch of ships and then basically stopped moving. I owned the most planets and had produce the most ships by the end of the game.
Here’s an example of my starter bot losing:
Why did I lose? Because one player, kyfantaz, destroyed my ships and I couldn’t defend myself or get out of the way. But defending myself seemed like too complex of a strategy to work on as my first project.
Here’s another example of my starter bot losing:
This time I lost in part because my ships are moving so slowly! And because I keep avoiding objects, which slows me down. This sounds like a nice place to start actually playing.
Updating The Basic Bot
Time to start tweaking. All I decide to do at first is to set ingnoreShips to true, so that my bot can crash into other ships but might move faster. Then I saved and zipped up all my files.
Version 10 started playing. It did a tiny bit better than 9 did.
Here’s a game where I won:
My ships crash into each other like crazy, but I’m moving faster and I’m making tons of ships. So if there’s no clear winner, I win by default for having the most ships produced over the course of the game.
Next, to make another tiny tweak. I notice that I keep destroying my own docked ships, so I decide to comment out the ability to go to a planet that I’ve already docked on. My plan is to go conquer all the empty planets instead of docking on planets I own.
This helped again! I’m up another hundred ranks.
Here’s an example game:
I seem to often be winning by default, because my opponents are timing out:
Writing Some Code
Final change for today - I noticed that after all the planets are occupied, my ships just stand still and wait. This seems like a waste - I want my ships to at least keep moving even if all the planets are occupied. So at last I actually wrote some code and sent my leftover ships to my enemies’ planets.
After submitting this bot, I caught a JS mistake by watching some games - I noticed that my ships were still not moving after all planets were full. Of course, I forgot to that I can’t use the whole list of planets as a destination, I have to find an individual enemy planet. So then I fixed it:
I felt pretty good about this code, so I submitted again, fixed my issue, and then I was at my best rank yet!
I hope this goes to show that with a very small amount of improvement you can do significantly better than the starter bots. If I can do it, you can too!
* I’d like to be able to run my bots locally (I still haven’t figured this part out)
* I’d like to be able to kill docked enemy ships
* I’d like to keep my ships from crashing into each other
Fun beginner challenges for another day. To be continued...
Let me know what you think or if you have any tips for other beginners!