Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baret/colsurtechtree
A Techtree DSL and visualization for Colony Survival
https://github.com/baret/colsurtechtree
kotlin
Last synced: about 1 month ago
JSON representation
A Techtree DSL and visualization for Colony Survival
- Host: GitHub
- URL: https://github.com/baret/colsurtechtree
- Owner: Baret
- Created: 2018-04-08T10:17:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-04T17:49:17.000Z (8 months ago)
- Last Synced: 2024-10-14T03:42:59.115Z (3 months ago)
- Topics: kotlin
- Language: Kotlin
- Size: 32.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DSL to define techtree and production lines
This project is written in Kotlin. This offers the possibility to create a simple DSL that describes production dependencies of the game Colony Survival.
**Example:**
```
job("Berry Farmer") {
worksIn("Berryfarm") {
produces("Berry Seed")
produces("Berries") {
needs("Berry Seed")
}
}
}job("Forester") {
worksIn("Forest") {
produces(2, "Log") {
needs("Sapling")
}
produces("Sapling")
}
}science("Bread Production") {
unlocksJobs("Farmer", "Miller", "Baker")
}
```This snippet creates *buildings*, *jobs*, *products* and *science*. These are all entities saved in a singleton *techtree* object. It can be written to the console via `println(Techtree)`. The output would be:
```
Full techtree:
Jobs (5):
Job Baker (assignable buildings: [])
Job Berry Farmer (assignable buildings: [Building Berryfarm produces [1 Berry Seed, 1 Berries (needs [1 Berry Seed])]])
Job Farmer (assignable buildings: [])
Job Forester (assignable buildings: [Building Forest produces [2 Log (needs [1 Sapling]), 1 Sapling]])
Job Miller (assignable buildings: [])
Buildings (2):
Building Berryfarm produces [1 Berry Seed, 1 Berries (needs [1 Berry Seed])]
Building Forest produces [2 Log (needs [1 Sapling]), 1 Sapling]
Products (4):
Product Berries
Product Berry Seed
Product Log
Product Sapling
Science (1):
Science Bread Production requires nothing, unlocks [Job Farmer (assignable buildings: []), Job Miller (assignable buildings: []), Job Baker (assignable buildings: [])]
```# Visualization of the tree (coming soon)
After defining production lines and dependencies between jobs and products (the full techtree the game currently has or just a portion of that) you can display an interactive diagram of this tree to see for example how many colonists you need to produce a specific item or how much you will need to produce to unlock a science.