Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hoot example project

A topic by David Thompson created 59 days ago Views: 247 Replies: 3
Viewing posts 1 to 2
Host(+1)

If you are interested in making a web game using Scheme then Hoot is a great option for you! Hoot is a Scheme to WebAssembly compiler that supports most of R7RS-small and some Guile extensions such as delimited continuations (useful for scripting games via coroutines). Our game jam template repository on Codeberg that has everything you need to get started making 2D games.

The template repository includes:

  • Bindings to the necessary web APIs to make an interactive game with HTML5 canvas
  • A Makefile for compiling, running a development web server, and generating a .zip bundle for uploading to itch.io
  • A very simple Breakout-like example game that demonstrates how to put all the pieces together

Some games made with Hoot for past jams:

I'm currently working to release a new version of Hoot before the jam starts.

I'll do my best to help anyone that uses Hoot for the jam, whether here in this forum, on the official Spritely forum, or on the #spritely channel on the Libera.Chat IRC network. Have fun!  馃

I have some questions regarding  Hoot (or the game template):

- Is it possible to reduce the compile times?, maybe compiling into separate wasm modules  and combining them somehow using tools external to Hoot?

- Emacs geiser does not work with hoot right?, I tried  evaluating hoot related modules, even with the load path indicating Hoot's source code does not seem to work. I wonder how can I use the guile repl and hoot, it would improve development time considerably.  Maybe it can be done by organizing the code in a different way and keep some guile modules without Hoot dependencies?.

- Guile specific question. Is it possible to filter the error messages, sometimes the full backtrace is not that useful, only the file and line number indicating the error. Ideally Emacs next-error  would work with Guile or Hoot's error reporting. Here is an example error message.

 -    hoot/library-group.scm:1231:27: unbound top-level #("engine/map.scm" 151 11)  some-undefined-variable

Ideally some hoot compiler option could present the error like this:

- engine/map.scm:151:11

Host
  • Hoot is a whole-program compiler so compilation times are longer than in separate compilation because there's simply a lot more code to deal with. However, it's possible to compile multiple separate modules and have them work together. One module would serve as the primary module that exports its ABI and the other modules would be secondary modules that import their ABI. I recently did this for a program by splitting up the backend (which was a lot of code that rarely changed) and the frontend (which was much smaller and quicker to compile). The --mode=secondary flag for guild compile-wasm is what you should look into. In JS, you'd call load_main for the main module and then load_extension for each secondary module. See here for an example.
  • Correct, Geiser is not supported right now so there isn't really a usable workflow for live hacking.. We have plans for a geiser-hoot.el package but we haven't gotten to it yet. Since the REPL would be running inside a web browser tab, it cannot act as a REPL server like we need it to. Resolving this will require introducing a WebSocket daemon middleman, much like Fennel's webrepl.  I hope this is something I can work on soon.
  • Yes, I would like to catch that unbound top-level error and print a better message rather than just a raw backtrace. That error is generated from an early phase in the compiler defined in the (hoot library-group) module. I filed an issue to track it.
(+1)

Thanks!, I will try the suggested approach for compiling modules.