A devlog for developers

This one is purely technical compared to the previous two articles about game design and tooling. The domain is the heart of Tales Of Chaos. This article is clearly aimed at a developer audience: we’re talking design patterns and code here.

If you’ve never touched Java or software architecture, you might get a bit lost. But if the topic interests you, stick around anyway: we’ll try to keep it accessible.

Hexagonal architecture

To ship on Hytale as fast as possible, we absolutely wanted the game’s core written in Java and functional as soon as we could. This time, it’s serious. We can’t afford to vibe code all of this and end up with an unmaintainable codebase.

The solution we found, the compromise between velocity and clean code, is hexagonal architecture.

In practice, hexagonal architecture means creating a module that’s loosely coupled to the outside world. The main advantage: we become technology-agnostic. Our business logic doesn’t depend on Hytale. It doesn’t depend on anything, really.

The principle in practice

In our architecture, we isolate the entire game domain in a core folder. This folder contains all our Tales Of Chaos-specific logic: everything Hytale won’t provide natively.

Then we have gateways. These are interfaces that simulate what Hytale should provide: spawning a player, managing inventories, interacting with the world… These interfaces define the contract between our domain and the outside world.

When Hytale releases, we’ll just need to implement these interfaces to be compatible with the game. Our business logic stays intact.

For game data that constitutes our game design, it’s stored in repositories outside the domain. We access them via JSON files. Typically, that’s where we define class stats, items, Taleweaver events…

The CLI: our fake Hytale

As explained in the previous devlog, the CLI lets us simulate the game without having access to Hytale. In short, it’s a fake Hytale that implements exactly everything the real game should provide to our gamemode.

When we spawn a player, we do a fake spawn in the CLI. When we send a message, we display it in the terminal. When we trigger an event, we log what happens.

That’s it. And it’s enough to test our business logic without waiting for the game’s release.

A risky but deliberate architecture

Let’s be honest: this architecture is quite complex for a mod project. I really wanted to try something new and get ahead of other Hytale RP servers.

Maybe it’s garbage and we should have kept it simpler. But at least I’ll have tried to make Tales Of Chaos one of the first servers to deliver a quality experience at Hytale’s launch.

The bet is that this initial complexity will save us time in the long run. We’ll see.

— Prakkmak