Resource gathering + programming game
Go to file
Ondřej Šebek 8366135ae1
Notify user about newer version (#652)
- query GitHub Releases for a new version
- add `swarm version` command
- show the version notification in the main menu
- add a new app-wide logging queue
- show the app-wide logs in the main menu as Messages
- catch and show the web API failure in the Messages
- closes #66
- closes #627
2022-09-06 07:32:24 +00:00
.github Notify user about newer version (#652) 2022-09-06 07:32:24 +00:00
app Notify user about newer version (#652) 2022-09-06 07:32:24 +00:00
bench Add heavy robots that require tank treads to move (#590) 2022-07-26 00:23:17 +00:00
data Add cotton, strings, and nets (#658) 2022-09-04 20:38:14 +00:00
docs/blog progress report blog post 2022-06-20 11:29:14 -05:00
editors Add cotton, strings, and nets (#658) 2022-09-04 20:38:14 +00:00
example Retire raise command (#407) 2022-06-23 11:25:23 +00:00
images switch from U+2591 Light Shade to U+2592 Medium Shade (#449) 2022-06-20 17:56:55 +00:00
src/Swarm Notify user about newer version (#652) 2022-09-06 07:32:24 +00:00
test Add cotton, strings, and nets (#658) 2022-09-04 20:38:14 +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 update URL repo references from byorgey/swarm to swarm-game/swarm 2022-03-14 14:09:47 -05:00
CONTRIBUTING.md update URL repo references from byorgey/swarm to swarm-game/swarm 2022-03-14 14:09:47 -05:00
DESIGN.md add a design principle 2021-09-27 23:23:06 -05: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 Finish tutorial (#593) 2022-07-28 13:51:49 +00:00
scenarios Documentation for scenario file format (#612) 2022-07-30 08:02:11 -04:00
stack.yaml update to brick-1.0 (#641) 2022-08-17 12:35:10 -05:00
swarm.cabal Notify user about newer version (#652) 2022-09-06 07:32:24 +00:00

Swarm

Build Status Contributor Covenant 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.

World 0 after scanning a tree and making a log.

The implementation is still in an early stage, but these are some of the (planned) features:

  • 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.
    • Future versions might also have multiplayer modes, with co-op or PvP play over a network...?

Installing and Playing

Warning: Swarm is still in an early stage; it's missing many of the planned features, there is no winning condition, and the gameplay is not very deep yet. But you can program cute little robots, and hey, that's all that really matters, right?

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.

The recommended way to install Swarm at the moment is as follows:

  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!

Programming swarm

Your base has a dictionary to store definitions, like this one:

def moveUntil : cmd bool -> cmd () = \predicate.
  res <- predicate;
  if res {
    noop
  } {
    moveUntil predicate
  }
end

The indentation is not required but ; is, as it is similar to Haskell >> - that is the command monad, which imperative programmers can ignore. 😉

This allows you to program robots to perform complicated tasks.

While you can write commands and definitions like the one above in the REPL, swarm also has a editor support with highlighting and LSP integration:

Editor with problem popup

See the editors folder for details on how to configure your editor.

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 level design for challenge mode. Check out the CONTRIBUTING file for more specific information about how to contribute.