shard_land

Version, currently 0.1.01 version
  • 0.1.0latestMar 25, 2021

github.com/da1nerd/shard_land

A console RPG in the midst of a broken world.

2 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  shard_land:
    github: da1nerd/shard_land
    version: ~> 0.1.0

Then run:

shards install

shard.yml

Crystal
1.0.0
License
MIT
Author
Joel
Target
  • shard_land from src/shard_land.cr

Dependencies

This version declares no dependencies.

README

Shard Land

GitHub release Build Status

A simple text RPG terminal game/engine. This is just a fun way to experiment with simple game logic and command line interfaces.

It's pretty simple right now, but it could be a fun community developed game. PRs and ideas are welcome!

Features

  • Save/Restore games
  • Scene based tree-like game structure
  • Immutable game state - functional programming style
  • Chainable user commands

Installation

Build the executable.

shards build

Usage

Simply run the compiled code.

./bin/shard_land

Development

The engine code is mostly abstracted. I may pull it out into a lib shard in the future so people can easily make their own games.

Game state is stored in State which has information about the Character and the current scene. You can inject extra properties into those structs to support custom functionality.

struct Character
  # Note: the Character struct is already serializable,
  #  so you just need to serialize new fields.
  @[YAML::Field(key: "skill")]
  property skill : Int32
end

Players interact with a scene via Commands. These Commands can be used to change the state, navigate to a new scene, or both.

Look at ./src/engine/menu.cr for an example of how commands can be used.

require "./engine/*"

class LevelUpCommand < Command
  def execute(state : State, user_input : String?) : State
    state.character.skill += 1
    return state
  end
end

# elsewhere, in a scene...
LevelUpCommand.new("+", "Level up before going to the next scene!", NextScene)
# The character levels up before navigating to the `NextScene`

More details can be found in the docs.

Contributing

  1. Fork it (https://github.com/da1nerd/shard_land/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • Joel - creator and maintainer