Building an Infinite Craft clone with Tactics

Introduction

InfiniteCraft is a fun game built by Neal Agarwal.

You combine existing elements (words, concepts or idioms) to make new ones. It is a bit of a sandbox game, you can just explore and make fun combinations. Some play it with a more specific goal, such as discovering words that no one discovered, or finding a word as fast as possible.

I love this type of little game, they are fun and simple. This fits my philosophy for app development - simple apps that do one thing well. Unfortunately, the dev-ops involved have in the past discouraged me multiple times from building such things.

With Tactics, fortunately, this is now trivial. Tactics manages the entire backend for me (including LLM calls), and I can focus on building the core logic of my app, as well as the frontend.

Tactics is a platform dedicated to building web backends with first-class AI integration. It is in alpha for now, but I was still able to use it to build Endless Alchemy. You can play it there!

Endless Alchemy is an InfiniteCraft clone where the goal is to reach to word House in as few combinations as possible. It features a leaderboard and cheat prevention, with the data store and authentication fully managed by Tactics.

In this post, I will show how I used Tactics to implement the core logic, caching and an anti-cheat system.

1. Our First Tactic

The core of Infinite Craft is a short program used to combine words. For instance, in Infinite Craft, if you combine “Water” and “Flame”, you get “Steam”.

Screen Recording 2024-12-05 at 17.16.59.mov

In Tactics, each small program is called… a “Tactic”. And a bundle of such programs is called a “Workspace”. So to write the core logic, we’ll create a Workspace, and then a Tactic for it.

I login, and then go to my dashboard. I create a new Workspace. I name it, and create a new Tactic in it.

workspacebasic.mp4

I write a basic prompt, and paste it into the IDE.

combined = $do `You are the engine behind a game. Your job is to combine two words/idioms into a new one

The combinations should look for, something that is semantically "in between" the two inputs.

For instance "fire" + "water" would yield "steam".

Just respond with the output word, no chit-chat, no thoughts, just say the first that comes to your mind and stop.

The inputs are "${first}" and "${second}".` ;

To test it, I set some initial variables. I set the first to “earth” and the second to “wind”. I click run, and I get… “dust”.

combination.mp4