Announcing Lunaria
6 min read

Announcing Lunaria

Lunaria is an ambitious open source project to create a video game for programmers. Write code to build a base, launch into space, and explore an infinite universe shared with other players.
Announcing Lunaria

A few weeks ago, I wrote a lengthy blog post about why I want to build a video game for programmers. Today, I am happy to announce Lunaria.

Lunaria is a video game for programmers. It is played by writing code that sends commands to the game, and watching the effects of those commands on the game world. As players progress through the game, they unlock new capabilities and have to expand and adapt their programs to solve new and ever increasing challenges.

This post is split into the following sections:

Vision

To create the most engaging platform to practice programming

Let's start by taking a look the motivation to create Lunaria. This section repeats a lot of arguments from the post linked above, and I invite you to check it out for a more in-depth discussion of the following points.

Briefly summarized, I am unhappy with the tools that are available to freely practice programming. Yes, there are plenty of course and tutorials available on the internet. And yes, it has never been easier to start and launch a side project. But neither is what I am looking for. What I want is a sandbox in which I can play around with code. Experiment and learn, without a strict curriculum or the pressure to produce something that would look good on a portfolio.

And I want to combine this sandbox with the mechanics of video games to make it engaging and fun. Give users goals that they can pursue if they want some structure and direction. Create feedback loops that can be used to measure the efficiency and effectiveness of experiments. And provide a bit of a story around the programming so that it is interesting to come back and continue practicing. Mechanics that video games have perfected over the last few decades.

The very ambitious dreams for Lunaria is to become the most engaging platform to practice programming, for beginners and experts alike. Because my theory is that a vast sandbox video game, in which players can pick and choose their own adventures, is generally more interesting than most courses or side projects...

Gameplay

This section is divided into two topics. First, the setting and scenario of Lunaria is introduced. Second, we take a look at the initial design of the programming mechanic inside the game.

Setting and Scenario

Lunaria is heavily inspired by existing video games. It combines mechanics and ideas from strategy, base building, and survival games, and remixes them to work well with its core mechanic: programming.

When starting the game, players find themselves in charge of an expedition to a foreign planet. A rocket has dropped them off on the planets surface, and unloaded some supply and a few drones. The player's first tasks are to set up a rudimentary base that protects against the environment, and to generate some energy so that the base and its drones continue to function.

What happens next still needs to be designed, but the story arc will most likely focus on the following progression:

  • Set up an automated base that produces resources
  • Bring in humans to unlock new capabilities
  • Launch rockets into space to explore the solar system
  • Unlock long-range travel, and explore the galaxy

The long-term vision is that the game takes place in a persistent massive-multiplayer online world. As players progress through the game, they can meet other players and collaborate to tackle the hardest challenges. Building the infrastructure for this is a serious undertaking, so in the beginning development will focus on the singleplayer experience and stand-alone multiplayer servers for a handful of players. Large-scale multiplayer will follow later.

Over the next few weeks, I will publish a series of blog posts about the video games (and books and movies) that inspire Lunaria, and the ideas and mechanics that this game might adopt from them. The sum of these influences will hopefully paint a compelling picture of the game that Lunaria might become...

Programming Mechanic

The most important game mechanic of Lunaria is without a doubt programming. Two technical components will dominate the look & feel of this mechanic:

  1. The runtime that executes the player's code
  2. The API that players use to interact with the game

Certain technical limitations are unavoidable, but I find it very important that the game does not constrain players too much. To this end, I want Lunaria to deliver the following functionality:

  • Support as many programming languages are reasonably possible. Do not require players to use a single language or tech stack.
  • Give players freedom in their software design. Treat their code as a blackbox and interact through a well-defined API.

Runtime

In the beginning, especially as long as there is no multiplayer, the game will run locally on a player's machine. When running locally, no special runtime is required and players can simply run the code in the terminal:

# A Rust player
cargo run

# A Ruby player
ruby lunaria.rb

The long-term vision for the game is to become a massive-multiplayer game, which executes the player's code "in the cloud". For this environment, the idea is to utilize Docker to allow players to upload their own runtimes. Players will package their code in a Docker image and upload it to the server where it will get executed. This enables each player to choose their own runtime and execution environment, even when playing online.

API

The code that players write to play Lunaria interacts with the game through an API. Because of this, the API has a huge influence on how Lunaria feels to play. It should provide a high-level interface that is easy to use, and provide good documentation about the parameters that are passed along requests and responses. It is also important that it is performant, especially in a future MMO scenario. And finally, to not limit the choice of programming language, the API implementation should be as widely supported as possible.

The best fit for these requirements is gRPC. It is widely supported, has low-latency and small message sizes, and supports auto-generated client libraries. I am particular excited about the client libraries, because they provide a well-documented, strongly typed, and high-level interface to interact with the game. By using gRPC and its libraries, players do not need to deal with transport protocols, message formats and encoding, or other low-level details. Instead, they can call a method and focus on the impact they'd like to have.

// Send an asynchronous request to move a drone to a new location.
game.moveUnit(drone.uuid, new Coordinate(1, 1)).await?;

I will write more about this decision in the future.

Roadmap

Shoot for the moon. Even if you miss, you'll land among the stars.

Lunaria as introduced here is an overly ambitious project. I think it is helpful to have the long-term vision as a north start to work towards, but its success is of course not guaranteed. For foreseeable future, I have much more modest plans for the project.

The goal for the next 6 months is to create a playable prototype of the game. The prototype will be limited to singleplayer, and it will only implement a narrow slice of the game mechanics I ultimately want to have in the game. Its purpose is to find a solid foundation for both the game design as well as we technical architecture.

With a prototype in hand, I want to focus the next 6-12 months on building out more game mechanics. The goal is to create something people actually like to play to make sure the concept works. This is also when I want to invest time and effort to foster the community. I expect that it will be much easier to participate in the project when there is something to see, try, and comment on.

Everything beyond the next year is probably too early to pin down, and depends very much on the health of the project by then. If we get there, a focus for the second year could be:

  • Bigger game world, e.g. going from planets to solar systems to galaxies
  • Procedural world generation to add more variety and depth
  • Multiplayer

The biggest risk for the success of the project is me burning out or losing interest before a significant milestone is achieved. If I can get a prototype out, and we can gather as a community around the game, I will feel more optimistic about the long-term sustainability of the project.

Stay in Touch

This post was only able to scratch the surface of what Lunaria is and might become. Therefore, make sure to check in here regularly for updates on the project. I intend to write roughly two posts per months, covering the progress on the project, important design decisions, and games and other content that inspire Lunaria. The following posts are already in the pipeline:

  • A detailed look at gRPC and why it was chosen for Lunaria
  • A discussion about the decision to build Lunaria as open source
  • A bunch of posts of various video games and movies that inspire Lunaria

https://playlunaria.com/blog

You can also join Lunaria's Discord server to chat with me and others. Right now, the server is pretty empty, but I hope that'll change as the project develops.

https://discord.gg/WkgJcsq

And then there is GitHub of course, where you can find Lunaria's source code. This is also where I'll plan to have in-depth technical discussions on new features and game mechanics, probably through an RFC process once there are more contributors than just me.

https://github.com/playlunaria

Thanks for your interest in the project! 👋