Building the AI for Athena Crisis

Rate this content
Bookmark
Project website

This talk will dive into how to build an AI for a turn based strategy game from scratch. When I started building Athena Crisis, I had no idea how to build an AI. All the available resources were too complex or confusing, so I just started building it based on how I would play the game. If you would like to learn how to build an AI, check out this talk!

FAQ

Athena Crisis is a video game developed using JavaScript, React, and CSS. It features an AI that can perform actions similar to a human player, including attacking, moving, and capturing buildings.

To build an AI for Athena Crisis, you need strong abstractions, knowledge of search algorithms, and a good understanding of mathematics to make decisions on actions within the game.

Christoph builds AI by setting up basic game abstractions, imagining the actions he would take as a player, and ensuring the AI is fast, stateless, deterministic, and composable.

The AI in Athena Crisis utilizes a set of actions and responses system, where each player action is validated against the game state. The system ensures that AI actions are governed by the same rules as player actions.

The presentation for Athena Crisis was built using React and MDX, utilizing a system called reMDX designed for creating slide decks.

Yes, Nakazawa Tech offers leadership coaching, developer productivity enhancements, and solutions to JavaScript-related problems, helping clients improve their development velocity.

Athena Crisis uses immutable persistent data structures, ensuring that all game state changes are declarative. The architecture supports efficient server-client interactions for online gameplay.

The AI in Athena Crisis takes turns similar to a player, performing actions like building units, moving, and attacking. It is designed to simulate human-like decision-making within the constraints of the game rules.

A stateless AI quickly determines the next action without retaining previous states, which simplifies its design and improves performance by focusing on immediate game circumstances.

For collaboration or inquiries about services, you can reach out to Nakazawa Tech via their website at nakazawa.dev.

Christoph Nakazawa
Christoph Nakazawa
37 min
28 Sep, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Join Christoph from Nakazawa Tech in building the AI for Athena Crisis, a game where the AI performs actions just like a player. Learn about the importance of abstractions, primitives, and search algorithms in building an AI for a video game. Explore the architecture of Athena Crisis, which uses immutable persistent data structures and optimistic updates. Discover how to implement AI behaviors and create a class for the AI. Find out how to analyze units, assign weights, and prioritize actions based on the game state. Consider the next steps in building the AI and explore the possibility of building an AI for a real-time strategy game.

1. Introduction to Building AI for Athena Crisis

Short description:

Hello! Join me for my talk about building the AI for Athena Crisis. I'm Christoph from Nakazawa Tech. If you haven't heard about Athena Crisis before, I recommend watching my previous talk. I have experience managing React Native and JavaScript infrastructure teams at Facebook. We offer leadership coaching and JavaScript problem-solving at Nakazawa Tech. Reach out at nakazawa.dev.

Oh, hello there. I'm just playing Athena Crisis on my Steam deck. Thanks so much for joining me for my talk about building the AI for Athena Crisis. I'm Christoph, and I run a small startup in Tokyo called Nakazawa Tech.

If you haven't heard about Athena Crisis before, recently at React Summit a few months ago, I did a talk that explains how the game is being built, and it's all built with JavaScript, React, and CSS. I highly recommend if you haven't seen it, to go back and watch that talk.

If we go even further back, if you have never worked with me before or if you don't know me, I used to manage the React Native and JavaScript infrastructure teams at Facebook, and I built a JustJavaScript testing framework. We do a lot of stuff at Nakazawa Tech, including building video games, but we do leadership coaching, and we can help you with your JavaScript problems, with developer velocity, productivity, or help you with whatever problems you might run into while building JavaScript-based applications. Please work with us, please reach out at nakazawa.dev.

2. Understanding Athena Crisis and Building an AI

Short description:

Before we dive into building an AI for Athena Crisis, let's understand what Athena Crisis is. In the game, I can jump into a game from the menu and play. After my turn, the AI takes over and performs all the necessary actions, just like a player. It can attack, move, and capture buildings. Now, let's explore how to build such an AI.

First, before we get into building an AI for Athena Crisis, let's spend a bit of time figuring out what Athena Crisis is. I'm just here in the game in the menu, and you can see the overview page right now, and I can jump into a game from right here. And just like that, I can play the game. Not all of the attacks have sounds yet, but some of them do. But the cool thing is, once I finish my turn, let me just build a few units. When I finish my turn, the AI takes over and takes care of their turn. It does attacks, it moves, it can capture buildings, it can do everything that a player can also do. Turn off the music again.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

React Compiler - Understanding Idiomatic React (React Forget)
React Advanced Conference 2023React Advanced Conference 2023
33 min
React Compiler - Understanding Idiomatic React (React Forget)
Top Content
React provides a contract to developers- uphold certain rules, and React can efficiently and correctly update the UI. In this talk we'll explore these rules in depth, understanding the reasoning behind them and how they unlock new directions such as automatic memoization. 
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Too much JavaScript is getting you down? New frameworks promising no JavaScript look interesting, but you have an existing React application to maintain. What if Qwik React is your answer for faster applications startup and better user experience? Qwik React allows you to easily turn your React application into a collection of islands, which can be SSRed and delayed hydrated, and in some instances, hydration skipped altogether. And all of this in an incremental way without a rewrite.
SolidJS: Why All the Suspense?
JSNation 2023JSNation 2023
28 min
SolidJS: Why All the Suspense?
Top Content
Solid caught the eye of the frontend community by re-popularizing reactive programming with its compelling use of Signals to render without re-renders. We've seen them adopted in the past year in everything from Preact to Angular. Signals offer a powerful set of primitives that ensure that your UI is in sync with your state independent of components. A universal language for the frontend user interface.
But what about Async? How do we manage to orchestrate data loading and mutation, server rendering, and streaming? Ryan Carniato, creator of SolidJS, takes a look at a different primitive. One that is often misunderstood but is as powerful in its use. Join him as he shows what all the Suspense is about.
From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
We all love GraphQL, but it can be daunting to get a server up and running and keep your code organized, maintainable, and testable over the long term. No more! Come watch as I go from an empty directory to a fully fledged GraphQL API in minutes flat. Plus, see how easy it is to use and create directives to clean up your code even more. You're gonna love GraphQL even more once you make things Redwood Easy!
Jotai Atoms Are Just Functions
React Day Berlin 2022React Day Berlin 2022
22 min
Jotai Atoms Are Just Functions
Top Content
Jotai is a state management library. We have been developing it primarily for React, but it's conceptually not tied to React. It this talk, we will see how Jotai atoms work and learn about the mental model we should have. Atoms are framework-agnostic abstraction to represent states, and they are basically just functions. Understanding the atom abstraction will help designing and implementing states in your applications with Jotai
A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt.In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.

Workshops on related topic

AI on Demand: Serverless AI
DevOps.js Conf 2024DevOps.js Conf 2024
163 min
AI on Demand: Serverless AI
Top Content
Featured WorkshopFree
Nathan Disidore
Nathan Disidore
In this workshop, we discuss the merits of serverless architecture and how it can be applied to the AI space. We'll explore options around building serverless RAG applications for a more lambda-esque approach to AI. Next, we'll get hands on and build a sample CRUD app that allows you to store information and query it using an LLM with Workers AI, Vectorize, D1, and Cloudflare Workers.
Make a Game With PlayCanvas in 2 Hours
JSNation 2023JSNation 2023
116 min
Make a Game With PlayCanvas in 2 Hours
Top Content
Featured WorkshopFree
Steven Yau
Steven Yau
In this workshop, we’ll build a game using the PlayCanvas WebGL engine from start to finish. From development to publishing, we’ll cover the most crucial features such as scripting, UI creation and much more.
Table of the content:- Introduction- Intro to PlayCanvas- What we will be building- Adding a character model and animation- Making the character move with scripts- 'Fake' running- Adding obstacles- Detecting collisions- Adding a score counter- Game over and restarting- Wrap up!- Questions
Workshop levelFamiliarity with game engines and game development aspects is recommended, but not required.
Working With OpenAI and Prompt Engineering for React Developers
React Advanced Conference 2023React Advanced Conference 2023
98 min
Working With OpenAI and Prompt Engineering for React Developers
Top Content
Workshop
Richard Moss
Richard Moss
In this workshop we'll take a tour of applied AI from the perspective of front end developers, zooming in on the emerging best practices when it comes to working with LLMs to build great products. This workshop is based on learnings from working with the OpenAI API from its debut last November to build out a working MVP which became PowerModeAI (A customer facing ideation and slide creation tool).
In the workshop they'll be a mix of presentation and hands on exercises to cover topics including:
- GPT fundamentals- Pitfalls of LLMs- Prompt engineering best practices and techniques- Using the playground effectively- Installing and configuring the OpenAI SDK- Approaches to working with the API and prompt management- Implementing the API to build an AI powered customer facing application- Fine tuning and embeddings- Emerging best practice on LLMOps
Building a Shopify App with React & Node
React Summit Remote Edition 2021React Summit Remote Edition 2021
87 min
Building a Shopify App with React & Node
Top Content
WorkshopFree
Jennifer Gray
Hanna Chen
2 authors
Shopify merchants have a diverse set of needs, and developers have a unique opportunity to meet those needs building apps. Building an app can be tough work but Shopify has created a set of tools and resources to help you build out a seamless app experience as quickly as possible. Get hands on experience building an embedded Shopify app using the Shopify App CLI, Polaris and Shopify App Bridge.We’ll show you how to create an app that accesses information from a development store and can run in your local environment.
PlayCanvas End-to-End : the quick version
JS GameDev Summit 2022JS GameDev Summit 2022
121 min
PlayCanvas End-to-End : the quick version
Top Content
WorkshopFree
João Ruschel
João Ruschel
In this workshop, we’ll build a complete game using the PlayCanvas engine while learning the best practices for project management. From development to publishing, we’ll cover the most crucial features such as asset management, scripting, audio, debugging, and much more.
Building Your Generative AI Application
React Summit 2024React Summit 2024
82 min
Building Your Generative AI Application
WorkshopFree
Dieter Flick
Dieter Flick
Generative AI is exciting tech enthusiasts and businesses with its vast potential. In this session, we will introduce Retrieval Augmented Generation (RAG), a framework that provides context to Large Language Models (LLMs) without retraining them. We will guide you step-by-step in building your own RAG app, culminating in a fully functional chatbot.
Key Concepts: Generative AI, Retrieval Augmented Generation
Technologies: OpenAI, LangChain, AstraDB Vector Store, Streamlit, Langflow