Resource gathering + programming game
Go to file
Ondřej Šebek a0e65d9e66
Add vscode editor integration (#255)
- adds `editors` directory
- migrates [xsebek/swarm-vscode](https://github.com/xsebek/swarm-vscode) repo to `editors/`
- updates the highlighting (drill, sum types,...)
- adds some notes how to test and build the extension
- part of #100 
- closes #123
2021-11-11 16:15:17 +00:00
.github Add the CI file check to mergify (#283) 2021-11-07 15:55:03 +01:00
app Add seed option to CLI (#170) 2021-10-05 19:43:52 +00:00
bench Delay type (#223) 2021-10-25 13:28:41 +00:00
data Add has and count commands (#265) 2021-10-29 19:47:36 +00:00
docs/blog Add vscode editor integration (#255) 2021-11-11 16:15:17 +00:00
editors Add vscode editor integration (#255) 2021-11-11 16:15:17 +00:00
example Add list example (#261) 2021-10-26 19:54:04 +00:00
images Add vscode editor integration (#255) 2021-11-11 16:15:17 +00:00
src/Swarm Hide unknown entities with ? (#276) 2021-11-07 15:03:20 +00:00
test Add location to type matching errors (#270) 2021-11-04 17:09:24 +00:00
.gitignore Add cabal to HLS configuration (#131) 2021-10-03 21:14:04 +00:00
.hlint.yaml add a .hlint.yaml 2021-08-27 22:30:31 -05:00
.mergify.yml Add the CI file check to mergify (#283) 2021-11-07 15:55:03 +01:00
.restyled.yaml import .restyled.yaml 2021-10-02 14:17:03 -05:00
.stan.toml exclude some stan observations 2021-09-15 06:39:21 -05:00
cabal.project Add basic editor integration with LSP (#108) 2021-10-01 20:11:08 +00:00
CHANGELOG.md new name: swarm 2021-08-23 11:47:04 -05:00
CODE_OF_CONDUCT.md Adopt the Contributor Covenant Code of Conduct 2021-09-19 13:38:33 -05:00
COMMUNITY.md create a first draft of a COMMUNITY document 2021-09-29 13:45:57 -05:00
CONTRIBUTING.md Add cabal to HLS configuration (#131) 2021-10-03 21:14:04 +00:00
DESIGN.md add a design principle 2021-09-27 23:23:06 -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 clean up .cabal file and add LICENSE 2021-08-26 21:05:46 -05:00
README.md Add vscode editor integration (#255) 2021-11-11 16:15:17 +00:00
stack.yaml remove https://github.com/jtdaugherty/brick/issues/337 workaround 2021-10-22 11:55:32 -05:00
swarm.cabal Store history in XDG data directory (#253) 2021-11-04 14:59:17 +00:00
TUTORIAL.md Add vscode editor integration (#255) 2021-11-11 16:15:17 +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
  • (TBD) 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.
    • Creatrive mode places no restrictions: program robots to your heart's content using whatever language features you want, without worrying about collecting resources.
    • (TBD) Hardcore mode like Classic mode, but you start with only a limited number of robots. If they get stuck or you run out of resources, it's game over!
    • (TBD) In Challenge mode, where you attempt to program robots in order to solve pre-designed puzzles or challenges.
    • (TBD) 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/byorgey/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! At the moment, you probably want to take a look at the tutorial to help get you started. Eventually there will be an in-game tutorial.

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.