Inspiration
The project was inspired by chess and the Chinese strategy game Go, where advanced AI systems have been used for many years to analyse games and challenge even the strongest players.
My idea is different because the game’s modern AI is not simply a finished opponent trained on a central server. Instead, it trains locally on the player’s own computer using the graphics card.
This allows the player to experience how the digital opponent gradually develops. The AI learns from the games being played, while the player also becomes better at Hnefatafl. In this way, the player and the artificial intelligence improve together and become training partners for each other.
What It Does
Viking Chess, Hnefatafl AI, is a digital version of the historic Norse strategy game Hnefatafl, also known as Viking chess.
The game is asymmetrical. One side defends a king who must escape from the board, while the opposing side has more pieces and must surround and capture him.
The player can face two different types of computer opponent. The first is a traditional rule based AI that evaluates possible moves using programmed strategies. The second is a modern learning AI that uses the computer’s graphics card for local training.
The modern AI learns from its own matches, the player’s actions, and the mistakes made by both sides. The aim is not only to create a strong opponent, but an opponent that continues to develop its playing style as the game is used.
How I Built It
I began developing the project with the help of ChatGPT, which I used to explore ideas, create the initial program structure, and solve specific technical problems. As the project became more complex, I reached the limits of this way of working and continued the development with Codex.
To give the AI a basic understanding of Hnefatafl, I provided it with descriptions of the rules, the game’s strategic principles, and a range of tactical situations.
I also played a series of matches against the game’s AI and commented on every move. These comments worked in much the same way as an experienced chess player analysing a match for a student, explaining why a particular move was good, bad, or strategically interesting.
As additional training material, I used recorded Hnefatafl matches from an existing database. I also played a large number of games myself to identify errors, investigate strategies, and generate further training data.
I began by developing a traditional AI. I then used it as an opponent and training partner for the modern AI model running locally on my graphics card. In this way, the traditional AI could generate a large number of matches for the learning model to analyse and learn from.
Challenges I Ran Into
The project involved a number of technical and strategic challenges.
One of the greatest challenges was that training the AI model was initially very slow. This required a better understanding of how the training data should be structured, how game positions should be evaluated, and how the computer’s resources could be used more efficiently.
I therefore studied newer methods used in the development of AI systems for chess and Go. These methods provided inspiration for self play, position evaluation, and more effective selection of training data.
Another challenge was the asymmetrical nature of Hnefatafl. The two sides have different objectives, different strengths, and different strategic possibilities. It is therefore not enough simply to copy an AI model designed for chess, where both players generally have the same types of pieces and share the same overall objective.
I also had to find a balance between allowing the AI to learn freely and ensuring that it still understood the game’s fundamental strategic principles.
Accomplishments I Am Proud Of
Several digital versions of Hnefatafl already exist, but many of them are limited, difficult to use, or feature computer opponents that quickly become predictable.
I am especially proud to have developed a functional and accessible game with a local AI model that can train and improve on the player’s own computer.
In my view, Hnefatafl has a level of strategic depth comparable to other major classical strategy games such as chess and Go. Despite this, it has not received the same technological attention or the same level of advanced AI development.
The project is therefore more than a digital version of a historical game. It is also an attempt to provide Hnefatafl with a modern AI platform that reflects the game’s complexity and strategic possibilities.
What I Learned
Working on the project has given me a much greater understanding of game theory, strategic evaluation, and artificial intelligence training.
I have learned how an AI can improve through self play, how training data can be refined, and how different forms of feedback affect the development of a model.
I have also gained practical experience in developing software with AI tools. This has taught me how to describe tasks effectively to programs such as ChatGPT and Codex, and when a general description is sufficient.
At the same time, I have learned when it is necessary to be highly specific about program structure, rules, user interface, and expected behaviour. Codex can complete many tasks automatically, but the results improve when the goals, limitations, and overall context are clearly defined.
What Is Next for Viking Chess, Hnefatafl AI
My next goal is to add a decentralised networking feature that will allow friends and other players to compete online without requiring a central game server. This could be achieved through a peer to peer solution where the players connect directly to each other.
I also want to develop an optional cloud based training system. This would allow knowledge from many players’ matches to be collected and used to improve a shared AI model.
Another planned feature is the ability for an AI trained by one player to compete against AI models trained by other players. This would allow users to compete not only as players, but also as trainers of their own digital Hnefatafl opponents.
In the longer term, this could create an environment where different AI models develop their own individual strategies, compete in tournaments, and contribute to a greater understanding of Hnefatafl’s tactical and strategic possibilities.
Log in or sign up for Devpost to join the conversation.