Resource gathering + programming game
Go to file
2022-10-05 17:52:52 -05:00
.github Rename the bug tag 2022-10-03 08:36:35 +02:00
app Fallback to XDG data directory (#678) 2022-10-01 20:40:56 +00:00
bench rename unit type to unit (#697) 2022-09-26 20:10:12 +00:00
data Add author (optional) and version (required) fields to scenarios (#719) 2022-10-05 18:01:32 +00:00
docs/blog put some screenshots in alpha release blog post 2022-10-02 15:45:28 -05:00
editors Add swap command (#685) 2022-09-17 11:21:26 +00:00
example rename unit type to unit (#697) 2022-09-26 20:10:12 +00:00
images better tutorial/log screenshot 2022-10-02 15:51:30 -05:00
src/Swarm Fix default robot direction 2022-10-05 21:37:51 +02:00
test Allow multiple robots in palette (#711) 2022-10-01 15:26:05 +00:00
.gitignore Add scenario json schema (#620) 2022-08-06 23:07:26 +00:00
.hlint.yaml Make GHC2021 extensions default (#520) 2022-07-01 09:07:41 +00:00
.mergify.yml update to brick-1.0 (#641) 2022-08-17 12:35:10 -05:00
.restyled.yaml Make GHC2021 extensions default (#520) 2022-07-01 09:07:41 +00:00
.stan.toml exclude some stan observations 2021-09-15 06:39:21 -05:00
cabal.haskell-ci Move HLint to GHC 8.10.7 in CI 2022-06-09 01:29:05 +02:00
cabal.project update to brick-1.0 (#641) 2022-08-17 12:35:10 -05:00
CHANGELOG.md Notify user about newer version (#652) 2022-09-06 07:32:24 +00:00
CODE_OF_CONDUCT.md Adopt the Contributor Covenant Code of Conduct 2021-09-19 13:38:33 -05:00
COMMUNITY.md some updates to README and COMMUNITY 2022-10-05 17:52:52 -05:00
CONTRIBUTING.md Documentation edits in preparation for alpha release (#691) 2022-09-17 15:28:13 +00:00
DESIGN.md More minor edits (#693) 2022-09-18 12:04:33 +00:00
feedback.yaml remove --flag=swarm:ci from feedback.yaml 2022-07-04 21:33:04 -05:00
fourmolu.yaml Reformat the haskell code with fourmolu (#146) 2021-10-02 18:40:24 +00:00
hie.yaml.stack Add cabal to HLS configuration (#131) 2021-10-03 21:14:04 +00:00
LICENSE Update editors (#581) 2022-07-25 00:16:23 +02:00
NOTICE Use a new opaque type for robots instead of strings (#303) 2022-03-02 03:00:44 +00:00
README.md some updates to README and COMMUNITY 2022-10-05 17:52:52 -05:00
scenarios Documentation for scenario file format (#612) 2022-07-30 08:02:11 -04:00
stack.yaml rename unit type to unit (#697) 2022-09-26 20:10:12 +00:00
swarm.cabal Notify user about newer version (#652) 2022-09-06 07:32:24 +00:00

Swarm

Build Status 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

There will soon be a release of Swarm on Hackage and in a binary form! If you are interested in Haskell or functional programming, you can install it from source (see below) or, once it is released, with the Cabal tool. For instructions on how to install the binary directly, check the releases.

Installing from Source

NOTE: Swarm requires a POSIX-style environment that supports terminfo. On Linux and OSX, the below instructions should work natively. On Windows, see the comments on this GitHub issue for instructions getting it to work under the Windows Subsystem for Linux.

To install Swarm 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. It is recommended that you use a relatively large terminal window (e.g. 132 columns x 43 rows or larger).

    • To find out the size of your terminal, you can type stty size.
  4. Now use stack to build and run Swarm:

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

  6. Have fun!

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.