description |
---|
A collection of tips for developing your best Battlesnake. |
These tips have been suggested and collected by the community over the years. Hopefully, they'll be helpful to new Battlesnake developers playing the game for the first time!
Be creative with your Battlesnake name and description. Names like "test" or "snek-1" are super popular and are easy to confuse with other Battlesnakes. If you really want your Battlesnake to stand out during competitions, best to give it a creative and unique name.
{% hint style="info" %} Tip: The best Battlesnake names are fun, creative, and also abide by our Code of Conduct. Battlesnake and Team names in violation of our Code of Conduct will not be tolerated. {% endhint %}
Web development often means handling multiple requests concurrently, and Battlesnake is no different. It's quite likely your Battlesnake will be playing multiple games at once, and you should develop your web server with that in mind.
Start thinking about this early, and use the Game ID in the Start, Move, and End requests to keep your Battlesnake's brain organized.
{% hint style="info" %} Tip: Not all web servers are built for handling multiple requests concurrently. Most of the Starter Projects are set up for concurrency by default. {% endhint %}
Some hosting services like Heroku, Replit, and even AWS will de-provision or turn off servers when they're at low usage. For example, free Heroku apps will sleep automatically after 30 minutes of inactivity.
Think about strategies you can deploy to make sure your Battlesnake is awake and running at full speed when you need it most.
{% hint style="info" %} Tip: This problem is relevant to all web development, not just Battlesnake. We encourage you to explore ways software developers solve this outside of Battlesnake too. {% endhint %}
The Battlesnake game engine gives each Battlesnake a limited amount of time to respond to API requests - if your Battlesnake takes too long, it could be disqualified from games or the engine could make moves on its behalf.
The amount of time you have to respond is provided in each API request sent. In most cases, it defaults to 500ms, but this value can change in different game modes and tournament divisions.
For most Battlesnake developers this won't be a problem. However top competitors will optimize their Battlesnakes to use as much compute time as possible.
If you're seeing latency from where your Battlesnake is hosted geographically (i.e. far from the main Battlesnake game engine servers), check out engine-regions.mdto optimize how we communicate with your server.
{% hint style="info" %} Tip: Response time includes round-trip latency. The Battlesnake game engine timeouts also include the time it takes to send the request to your server and receive the response back. Consider this extra response time when optimizing your Battlesnake. {% endhint %}
All Battlesnake game logic is open source and available for personal use. If you'd like to run games locally using your own development environment, there's an included CLI.
Install the Battlesnake Rules CLI to get started.
{% hint style="info" %} Tip: Running games locally can speed up your development cycles significantly, but can also be more complex than using the Battlesnake platform. {% endhint %}