mhuesch / swarm

Resource gathering + programming game

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swarm

Build Status GitHub release (latest by date) Swarm release on Hackage Contributor Covenant ircchat GitHub Contributors

Swarm is a 2D programming and resource gathering game. Program your robots to explore the world and collect resources, which in turn allows you to build upgraded robots that can run more interesting and complex programs. Check out the installation instructions below, join the IRC channel, take a look at the wiki, or see how you can contribute!

World 0 after scanning a tree and making a log.

Features include:

  • Practically infinite 2D procedurally generated worlds
  • Simple yet powerful programming language based on the polymorphic lambda calculus + recursion, with a command monad for describing first-class imperative actions
  • Editor support with LSP and highlighting
  • In-game tutorial
  • Multiple game modes:
    • In Classic mode, you start with the ability to produce only very basic, limited robots; collecting resources allows you to bootstrap your way into programming more sophisticated robots that can explore more of the world, collect more resources, etc.
    • Creative mode places no restrictions: program robots to your heart's content using whatever language features you want, without worrying about collecting resources.
    • There are also challenge scenarios where you attempt to program robots in order to solve pre-designed puzzles or challenges.

Installing

NOTE: Swarm requires a POSIX-style terminal environment that supports terminfo. Linux and MacOS should work out of the box. On Windows, you will need to use Windows Subsystem for Linux; you should then be able to follow instructions for installing on Linux.

It is recommended that you use a relatively large terminal window (e.g. 170 columns x 40 rows or larger). To find out the size of your terminal, you can type stty size at a command prompt. If it's not big enough, try decreasing the font size. You can read about and/or share recommended terminal settings in this GitHub issue.

Installing via binaries

Currently we have one binary release built on Ubuntu Bionic; it will probably work on any GNU/Linux. We hope to add MacOS binaries in the near future.

You can download the swarm binary and compressed data directory from the latest release. If you want to run the binary simply as swarm, you have to put it in one of the directories in your PATH:

chmod +x ./swarm          # make it executable
echo $PATH | tr ':' '\n'  # choose one of the listed directories
mv ./swarm /my/chosen/bin/directory/

You will also need to extract the data to your local Swarm folder so the executable can find it:

mkdir -p ~/.local/share/swarm/
unzip swarm-data.zip -d ~/.local/share/swarm

Installing from Hackage

If you can't use the provided binaries, or prefer installing from Hackage, you should be able to install with

cabal install swarm

If you don't already have the cabal tool, first install ghcup, then run ghcup install cabal (if cabal was not automatically downloaded as part of ghcup's installation).

You may need to add ~/.cabal/bin to your PATH; alternatively, you can install with cabal install --installdir=<DIR> swarm to have cabal install the swarm executable in a <DIR> of your choosing.

Installing from source

If you want the latest unreleased bleeding-edge features, or want to contribute to Swarm development, you can build from source.

  1. Clone the Swarm repository, e.g.

    git clone https://github.com/swarm-game/swarm.git
    
  2. If you don't already have the stack tool:

    1. Get the ghcup tool, a handy one-stop utility for managing all the different pieces of a Haskell toolchain.

    2. Use ghcup to install stack:

      ghcup install stack
      
  3. Now use stack to build and run Swarm:

    cd /path/to/the/swarm/repo
    stack run
    
  4. Go get a snack while stack downloads a Haskell compiler and all of Swarm's dependencies.

Configuring your editor

Although you can write commands and definitions directly in the Swarm REPL, once you get beyond the basics you'll probably want to use an external editor for writing Swarm programs. Swarm has support for external editors with highlighting and LSP integration:

Editor with problem popup

See the editors folder for details on how to configure your editor. Currently, emacs and VS Code are officially supported, but more can be added.

Community

Check out the COMMUNITY page for ways to connect with others in the community.

If you want to contribute, you're most welcome! There are lots of ways to contribute, regardless of your Haskell background. For example, even someone with no Haskell experience whatsoever could still help with e.g. game design, playtesting, and creating challenges and scenarios. Check out the CONTRIBUTING file for more specific information about how to contribute.

About

Resource gathering + programming game

License:Other


Languages

Language:Haskell 99.1%Language:Emacs Lisp 0.6%Language:TypeScript 0.2%Language:Shell 0.1%