Solarnet is a work-in-progress game engine for the amazing board game Terraforming Mars.
It's not really for playing the game; for that see the excellent and unrelated open-source app.
It's a standalone library. Its only job is to know the rules of the game -- which means "who can do what when, and what happens if they do?" It covers the "pure logic part" of the game. You can set up game situations and see what happens (example).
The unique behavior of a card, milestone, map area, colony tile, etc. is written in a language called Pets. These strings are ALL the game engine needs to know about a card (etc.) in order to play it correctly. Some examples:
Class | Example Pets syntax |
---|---|
LargeConvoy |
This: OceanTile, 2 ProjectCard, 5 Plant OR 4 Animal |
ElectroCatapult |
Plant OR Steel -> 7 |
ArcticAlgae |
OceanTile BY Anyone: 2 Plant |
Insulation |
This: PROD[X Megacredit FROM Heat] |
EarthCatapult |
PlayCard: -2 Owed<Megacredit> |
CitySP |
25 -> CityTile, PROD[1] |
TerraformRating |
ProductionPhase: 1 ; End: VictoryPoint |
CityTile |
End: VictoryPoint / Adjacency<This, GreeneryTile<Anyone>> |
This means you can add your own fan cards to it pretty easily and without actual "programming" -- so long as the cards don't introduce entirely new game mechanics.
It has a crappy command-line UI (a "REPL") you can use to interact with it (see demo video below). Or you can write what you want to do as a unit test (very long example that plays through an entire game).
If you play a game IRL or on the app, you can sort of "log" it in Solarnet, and then be able to ask questions like "How much money did Advanced Alloys actually save me that game?" fairly easily. (But so far this requires writing actual code.)
It works! See the Issues tab for exceptions. I have just about 400 cards working -- all except these ones.
It's not polished enough for anyone to "just use" -- not even close! But if you're intrepid I could really use your help to get it into that state. If you're not in a "roll up your sleeves, dig in, ask questions" mode, you will find it frustrating. Sorry!
You totally can, but note: you will have a MUCH better time if you jump on the discord and ask lots of questions. Almost no one but me has tried to do much with it yet. It won't be self-explanatory (sorry).
It is supposed to be as simple to get going as:
git clone https://github.com/MartianZoo/solarnet.git
cd solarnet
./rego
help
But in these early days, you're unlikely to get far on your own. I want to improve that, but the best chance for that to happen is if YOU give things a try and tell me how it goes! Again, please do join the discord.
Please do. This invite should work...
None of this is polished or anything.
I haven't written too much yet. There are too many things I could write down next, so it would really help to hear which topics you most want to know about and then I could just write about those (and eventually get around to everything).
Want to just browse through how the game components are defined?
The cards are also here in spreadsheet form which can be easier to read.
Just breeze past all the things that don't make sense. Some of it will!
If you can generate the docs (clone, ./gradlew dokkaHtmlMultiModule
, then look at docs/api/index.html
) that would be the ideal way to start.
I wrote it in Kotlin, which should make the whole thing usable from Java, JavaScript, and some other environments as well. Getting those working might not be trivial (?) but at least won't require a port.
I'd be more than glad to hear from you at kevinb9n@gmail.com.