Discussion:
trying Chickadee
Zelphir Kaltstahl
2018-09-04 18:34:15 UTC
Permalink
On my system Chickadee seems to build fine with the usual configure,
make, make install. However I want to mention something, which might
indicate a problem.

When I run the example code:

~~~~~
(use-modules (chickadee)
             (chickadee math vector)
             (chickadee render sprite)
             (chickadee render texture))

(define sprite #f)

(define (load)
  (set! sprite (load-image "logo.png")))

(define (draw alpha)
  (draw-sprite sprite (vec2 256.0 176.0)))

(add-hook! load-hook load)
(add-hook! draw-hook draw)

(run-game)
~~~~~

It works and the sprite is rendered, however, one core is used to 100%.
I guess the game loop is rendering the sprite over and over again in a
non-updated position.

Another thing is, that I cannot click the close button of the window
that renders the sprite. I guess because I do not handle the closing
event in this example code. I need to close it by C-c C-c in my Eshell.

Aside from that it seems to work fine. I would like to see development
in 2D game engines for Guile. I imagine minimalistic libraries / game
engines and Guile to be a powerful combination! I always wanted to make
a game (like probably most people in CS :D). Maybe with Guile and
Chickadee or similar I can grab some new motivation. So far I have not
tried to build anything complex with Chickadee, but maybe it is already
possible. I think it would be cool to have a page listing projects using
Chickadee, even if those projects are not done or only proofs of concepts.

Thanks!

Zelphir
Send guile-user mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.gnu.org/mailman/listinfo/guile-user
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of guile-user digest..."
1. Re: How to get started in guile & programming generally
(Joshua Branson)
----------------------------------------------------------------------
Message: 1
Date: Mon, 03 Sep 2018 16:53:39 -0400
Subject: Re: How to get started in guile & programming generally
Content-Type: text/plain; charset=utf-8
Using guix on my Ubuntu I successfully installed chickadee master.
Try to install guix again and report the error you have please :]
Thanks for the encouragement! I successfully install guix via the
binary installation method. I'm sure chickadee will install without any
problems. If it doesn't, I'll let you know.
------------------------------
Subject: Digest Footer
_______________________________________________
guile-user mailing list
https://lists.gnu.org/mailman/listinfo/guile-user
------------------------------
End of guile-user Digest, Vol 190, Issue 6
******************************************
Thompson, David
2018-09-04 19:22:11 UTC
Permalink
Hello Zelphir,

First, thanks for trying Chickadee!

On Tue, Sep 4, 2018 at 2:34 PM, Zelphir Kaltstahl
Post by Zelphir Kaltstahl
On my system Chickadee seems to build fine with the usual configure,
make, make install. However I want to mention something, which might
indicate a problem.
~~~~~
(use-modules (chickadee)
(chickadee math vector)
(chickadee render sprite)
(chickadee render texture))
(define sprite #f)
(define (load)
(set! sprite (load-image "logo.png")))
(define (draw alpha)
(draw-sprite sprite (vec2 256.0 176.0)))
(add-hook! load-hook load)
(add-hook! draw-hook draw)
(run-game)
~~~~~
(Just a heads up: Chickadee 0.3.0 will be released soon and it will
remove the add-hook! stuff. It's an easy change, but be sure to refer
to the updated example code when 0.3.0 is released!)
Post by Zelphir Kaltstahl
It works and the sprite is rendered, however, one core is used to 100%.
I guess the game loop is rendering the sprite over and over again in a
non-updated position.
Correct, the game loop doesn't stop because you're not moving
anything. Chickadee's game loop renders frames as often as possible.
If 100% of one CPU core is being used, the likely culprit is that
Chickadee was unable to sync it's drawing with the monitor's refresh
rate, which could cause it to pause a bit after rendering each frame.
Perhaps I could automatically factor in a small usleep call when vsync
is unavailable in order to avoid this situation.
Post by Zelphir Kaltstahl
Another thing is, that I cannot click the close button of the window
that renders the sprite. I guess because I do not handle the closing
event in this example code. I need to close it by C-c C-c in my Eshell.
Yes, that's exactly why. The quit hook is run when the close button
is pressed, but you haven't added anything to handle that hook. If
you eval (add-hook! quit-hook abort-game) then the game will close
when you click the window's close button.
Post by Zelphir Kaltstahl
Aside from that it seems to work fine. I would like to see development
in 2D game engines for Guile. I imagine minimalistic libraries / game
engines and Guile to be a powerful combination! I always wanted to make
a game (like probably most people in CS :D). Maybe with Guile and
Chickadee or similar I can grab some new motivation. So far I have not
tried to build anything complex with Chickadee, but maybe it is already
possible. I think it would be cool to have a page listing projects using
Chickadee, even if those projects are not done or only proofs of concepts.
I don't know of anyone that has built anything particularly complex
with Chickadee, but if anyone has that is reading this please let me
know!

I call Chickadee a "game toolkit" rather than an "engine" because it's
simply a collection of handy building blocks that you need to piece
together on your own, whereas an engine has already made major
architecture decisions for you. It's more like building your own
furniture than assembling something from IKEA. It's a lot easier to
make a collection of essential game utilities that almost every game
developer needs than it is to design an entire engine, so that's why
Chickadee is what it is. I mentioned elsewhere in this thread that
I'm working on a somewhat minimal game engine built on top of
Chickadee called Starling (sticking with the bird theme) that I think
will help people go from nothing to playable game in much less time.
However, you may not like the abstractions I chose for Starling, but
Chickadee's building blocks will always be there to assemble however
you wish.

- Dave
Christopher Lemmer Webber
2018-09-04 22:03:45 UTC
Permalink
This post might be inappropriate. Click to display it.
Zelphir Kaltstahl
2018-09-05 19:08:50 UTC
Permalink
Adding (add-hook! quit-hook abort-game) worked flawlessly, thanks.

Can I do anything to help Chickadee to recognize my monitor refresh rate?
Post by Thompson, David
Hello Zelphir,
First, thanks for trying Chickadee!
On Tue, Sep 4, 2018 at 2:34 PM, Zelphir Kaltstahl
Post by Zelphir Kaltstahl
On my system Chickadee seems to build fine with the usual configure,
make, make install. However I want to mention something, which might
indicate a problem.
~~~~~
(use-modules (chickadee)
(chickadee math vector)
(chickadee render sprite)
(chickadee render texture))
(define sprite #f)
(define (load)
(set! sprite (load-image "logo.png")))
(define (draw alpha)
(draw-sprite sprite (vec2 256.0 176.0)))
(add-hook! load-hook load)
(add-hook! draw-hook draw)
(run-game)
~~~~~
(Just a heads up: Chickadee 0.3.0 will be released soon and it will
remove the add-hook! stuff. It's an easy change, but be sure to refer
to the updated example code when 0.3.0 is released!)
Post by Zelphir Kaltstahl
It works and the sprite is rendered, however, one core is used to 100%.
I guess the game loop is rendering the sprite over and over again in a
non-updated position.
Correct, the game loop doesn't stop because you're not moving
anything. Chickadee's game loop renders frames as often as possible.
If 100% of one CPU core is being used, the likely culprit is that
Chickadee was unable to sync it's drawing with the monitor's refresh
rate, which could cause it to pause a bit after rendering each frame.
Perhaps I could automatically factor in a small usleep call when vsync
is unavailable in order to avoid this situation.
Post by Zelphir Kaltstahl
Another thing is, that I cannot click the close button of the window
that renders the sprite. I guess because I do not handle the closing
event in this example code. I need to close it by C-c C-c in my Eshell.
Yes, that's exactly why. The quit hook is run when the close button
is pressed, but you haven't added anything to handle that hook. If
you eval (add-hook! quit-hook abort-game) then the game will close
when you click the window's close button.
Post by Zelphir Kaltstahl
Aside from that it seems to work fine. I would like to see development
in 2D game engines for Guile. I imagine minimalistic libraries / game
engines and Guile to be a powerful combination! I always wanted to make
a game (like probably most people in CS :D). Maybe with Guile and
Chickadee or similar I can grab some new motivation. So far I have not
tried to build anything complex with Chickadee, but maybe it is already
possible. I think it would be cool to have a page listing projects using
Chickadee, even if those projects are not done or only proofs of concepts.
I don't know of anyone that has built anything particularly complex
with Chickadee, but if anyone has that is reading this please let me
know!
I call Chickadee a "game toolkit" rather than an "engine" because it's
simply a collection of handy building blocks that you need to piece
together on your own, whereas an engine has already made major
architecture decisions for you. It's more like building your own
furniture than assembling something from IKEA. It's a lot easier to
make a collection of essential game utilities that almost every game
developer needs than it is to design an entire engine, so that's why
Chickadee is what it is. I mentioned elsewhere in this thread that
I'm working on a somewhat minimal game engine built on top of
Chickadee called Starling (sticking with the bird theme) that I think
will help people go from nothing to playable game in much less time.
However, you may not like the abstractions I chose for Starling, but
Chickadee's building blocks will always be there to assemble however
you wish.
- Dave
Thompson, David
2018-09-05 19:41:27 UTC
Permalink
On Wed, Sep 5, 2018 at 3:08 PM, Zelphir Kaltstahl
Post by Zelphir Kaltstahl
Adding (add-hook! quit-hook abort-game) worked flawlessly, thanks.
Can I do anything to help Chickadee to recognize my monitor refresh rate?
I'm not really sure what's going on there, not even sure if that's
really your problem. It's just a hunch. Chickadee relies upon SDL2 for
a lot of things, including handling all of the vsync stuff. On some
systems it throws an error when enabling vsync and it was blocking a
lot of people from getting started so I just started ignoring the
error. The upcoming version of Chickadee will print a warning in this
case so it will be obvious if it's happening or not.
Arne Babenhauserheide
2018-09-05 20:42:43 UTC
Permalink
Post by Thompson, David
Correct, the game loop doesn't stop because you're not moving
anything. Chickadee's game loop renders frames as often as possible.
If 100% of one CPU core is being used, the likely culprit is that
Chickadee was unable to sync it's drawing with the monitor's refresh
rate, which could cause it to pause a bit after rendering each frame.
Perhaps I could automatically factor in a small usleep call when vsync
is unavailable in order to avoid this situation.
That sounds important. In every game loop I wrote myself till now (only
two or three) I had to add some small delay because otherwise people on
laptops really notice this (though the real reason why I did it — as
opposed to the reasoning after the fact — is that it just feels wrong to
burn cycles without need).

Adding a single 1 ms sleep in the game loop should never hurt, because
even if someone has a 200Hz refresh rate (so you only have 5 ms to
render), this sleep still only take up 20% of the time between
frames. And it gives you some maneuvering mass if you find in the end
that 10% performance are missing :-)

Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken
Thompson, David
2018-09-05 20:51:27 UTC
Permalink
Post by Arne Babenhauserheide
Post by Thompson, David
Correct, the game loop doesn't stop because you're not moving
anything. Chickadee's game loop renders frames as often as possible.
If 100% of one CPU core is being used, the likely culprit is that
Chickadee was unable to sync it's drawing with the monitor's refresh
rate, which could cause it to pause a bit after rendering each frame.
Perhaps I could automatically factor in a small usleep call when vsync
is unavailable in order to avoid this situation.
That sounds important. In every game loop I wrote myself till now (only
two or three) I had to add some small delay because otherwise people on
laptops really notice this (though the real reason why I did it — as
opposed to the reasoning after the fact — is that it just feels wrong to
burn cycles without need).
Adding a single 1 ms sleep in the game loop should never hurt, because
even if someone has a 200Hz refresh rate (so you only have 5 ms to
render), this sleep still only take up 20% of the time between
frames. And it gives you some maneuvering mass if you find in the end
that 10% performance are missing :-)
I've read plenty of material that argues both ways. I don't think
adding an unconditional sleep is the best move because it's entirely
possibly that the simulation is behind and needs to catch up, in which
case the correct action is to skip rendering frames and focus on
updating game state instead. When vsync is on, there is no point in
sleeping because you are already sleeping to await the monitor
refresh. That leaves one case where a sleep should occur: When vsync
is off and there is leftover time before the next update needs to
happen.
Arne Babenhauserheide
2018-09-06 20:27:24 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...