Menu

1 / 2

Fast simulation code is slow to write, so generators write it

DEV Community: go·Marius-Florin Cristian·9 days ago
#OlSYshXv
#devtogo#devto#dev#world#level
Reading 0:00
15s threshold

I want to talk about code generators, domain specific languages (DSL), and simulating interactions.

Me personally, I am a fan of games like Dwarf Fortress, Age of Empires and Might and Magic, and Role Playing Games in the broader sense. Now, no matter how you look at them, they all boil down to having a "state" (like a chess board), some "actors" (the little ants you interact with), and "the rules and relationship" they form to each other.

Initially this idea started being explored by looking into cache optimized Go data structures after reading a blog post by Serge Skoredin, and trying to encode them as annotations for generating code out of them. I like meta programming, not gonna lie.

Ecclesia is an isometric pilgrimage through a world of countries drawn as Orthodox icons. It is written as annotations on Go structs, about ten lines per entity.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.