https://github.com/thebrubaker/colony
A colony / survival / simulation game written in Go. The game is currently experimental and a work in progress.
https://github.com/thebrubaker/colony
game-server go golang grpc grpc-go
Last synced: 8 months ago
JSON representation
A colony / survival / simulation game written in Go. The game is currently experimental and a work in progress.
- Host: GitHub
- URL: https://github.com/thebrubaker/colony
- Owner: thebrubaker
- License: apache-2.0
- Created: 2020-05-24T06:16:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-28T05:42:56.000Z (about 5 years ago)
- Last Synced: 2024-06-20T01:49:47.812Z (almost 2 years ago)
- Topics: game-server, go, golang, grpc, grpc-go
- Language: Go
- Homepage:
- Size: 732 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Colony
A colony simulation / game written in Go. The game is currently experimental and a work in progress. I use this project to tinker with various golang concepts.
## How to take it for a spin
To start the game but without a server and render the gamestate to the console, run the following command in a tall terminal window:
```script
go run main.go debug
```

## Quick Backstory
Your colonist has woken up from cryosleep alone on a new planet. Your mission was to be one of the first to colonize the planet. Unfortunately things haven't gone as planned. Your colonist wakes up alone, and it appears others have already looted your supplies and technology.
You will have to slowly build your colony from the ground up despite this setback. Hunt for food, create a settlement, recruit new colonists, and discover advanced technology hidden away. But be careful. Not everyone is friendly, and there appears to be some strange, dangerous creatures roaming about. Maybe something much worse.
## WIP ideas for the game
- gRPC API for streaming game and sending in commands
- Utility-based decision trees. Colonists have a mind of their own, but you can command them to attempt certain tasks. Assign colonists to leadership roles to improve coordinated effort.
- Crafting and Construction. Build farms, mines, workshops, fortificatons, trade depots and other buildings to sustain your colonists needs and desires
- Combat. Train your colonists and prepare them for battle from raiders, dangerous animals and much, much worse things crawling in the dark recesses of the planet
- Trade. Build a trade depot and send your colonists out to trade with other players.
## How to start the game server
To start the game server, run the following command. It will create a default game and you can find the GameKey in the logs.
```script
go run main.go start
```
## How to stream the game server
(There is currently a bug and this is WIP)
Run the following in a tall terminal window to see the JSON game state streamed at 30fps.
```script
go run main.go streamGame {GameKey}
```
## How to pause / speed up the game
```script
go run main.go setSpeed {GameKey} [0|1|2|3]
```
# Contributing
Guide coming soon.
## How To Add Actions
To create a new action, create a new file in the `game/actions/types` directory and then append it to the SelectNextAction() method in `actions/determineAction.go`. The following is an example action for gathering wood.
```go
package types
import (
"github.com/fogleman/ease"
"github.com/thebrubaker/colony/colonist"
"github.com/thebrubaker/colony/resources"
)
var GatherWood = &SimpleAction{
status: []string{
"gathering wood nearby",
},
effort: Demanding,
duration: Slow,
utilityDesire: colonist.Fulfillment,
satisfiesDesires: []SatisfyDesire{
{colonist.Fulfillment, 35, ease.OutQuad},
},
producesResources: []ProduceResource{
{resources.Wood, 0.1},
},
improvesSkills: []ImproveSkill{
{colonist.Woodcutting, 0.05},
},
}
```