Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

A game with Guile

A topic by ambrevar created Apr 24, 2018 Views: 1,523 Replies: 13
Viewing posts 1 to 14
(1 edit)

Hi!  A bit late to the party, I'm afraid :p (Hectic week for me, I won't have much time to commit to the jam...)

I've recently switched to GuixSD and found myself playing around Guile a lot. I thought the jam would be a perfect opportunity to hone my skills :)

I've decided to go for a Bomberman-inspired game: https://github.com/Ambrevar/bomberone (as of this posting, there is nothing playable yet).

What do you guys think about Guile?  I've found a few game-dev libraries so far:

- guile-sdl

- guile-sdl2

- guile-opengl

- guile-sly (a game engine)

I know the community is very Common Lisp oriented.  That said, does anyone know of previous games implemented in Scheme / Guile?

Cheers!

Host

There are a lot of nice Guile Scheme libraries. Dave Thompson's chickadee is supposed to be really nice as well: https://dthompson.us/projects/chickadee.html

(1 edit)

Hi, I am the author of guile-sdl2, Chickadee, and Sly! Chickadee is probably the best thing out there for Guile right now, missing features and all. It is built on top of guile-sdl2 and guile-opengl.  A simple 2D game should be feasible with it.  There is some documentation but it's not great.  If you do end up using Chickadee, you can post questions in this thread and I will try to reply.

I don't recommend using Sly. It was an interesting experiment that I started back in 2013 and I used it to make my "lisparuga" game entry a couple years ago, but it's an experiment that didn't work out very well. Thus it has been abandoned.

Hope this helps!

I had somehow missed Chickadee on David's web page.  Thanks for the pointer!

Chickadee does not seem to be packaged for GuixSD yet: I'll work on it.

Also guile-sdl2 does not seem to work on GuixSD either: the module cannot be found.  There might be an error in the package definition.  I'll work on that too.

Off-topic: David, I just figured out that your blog has an atom feed at https://dthompson.us/feed.xml, but I could not find any explicit link on your website.  Is it intentional?

What's your take on Guile's parallelism capabilities?  I see from the manual that it has support for "futures".  Does it cope well with SDL/OpenGL libraries?

I've sent a fix for the guile-sdl2 package to Guix upstream.  It should work well from now on.

Does anyone know if it's possible to evaluate code while a SDL program is running?  In other words, is it possible to update a running program "live" with Guile?

Akin to what Baggers does with Common Lisp on his Youtube channel :)

Yes, it's possible. I use Guile's cooperative REPL server (system repl coop-server) for this purpose, so you can integrate it into the game loop.  First, I do something like this to create it: (define repl (spawn-coop-repl-server)). Then, in the case of Chickadee, I add this code to an update hook: (poll-coop-repl-server repl). This way the commands sent to the REPL are processed at 60hz in the main thread and there are no multithreading concerns as there would be if you had used (system repl server) instead.  Once the REPL is up and running, you can connect to it on port 37146. I use M-x connect-to-guile in Emacs, which requires the Geiser extension.

On the topic of parallelism, I don't write multithreaded games, but I do write concurrent ones. For this I use coroutines ("green threads"), which Chickadee provides in the (chickadee scripting) module.

This is brilliant!  Thank you so much!

(1 edit)

If I understand correctly, here is the workflow:

- `M-x run-guile` to fire up the REPL.

- `M-x geiser-eval-buffer` (or compile).

- Start the game (which starts the coop repl) from the REPL.

- M-x connect-to-guile RET RET.

So all in all we need to REPL: one for the initial setup and one coop REPL for live hacking.

Is that correct?

I guess that would work, but it's not the workflow I use. 2 REPLs seems confusing. First, I start my guile program (e.g. 'guile foo.scm', running 'make' first if I have a proper build system setup) and have that program spawn a cooperative repl server. Then all there is to do is connect to it with M-x connect-to-guile.

Yes, that makes sense :)

I was away for the last 5 days so I did not have much time to commit to the game at all :(  Too bad, next jam I guess!

That said, I intend to keep working on the game, the Git repo will hopefully see further significant updates soon!