unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Re: trying Chickadee
       [not found] <mailman.101.1536076823.21859.guile-user@gnu.org>
@ 2018-09-04 18:34 ` Zelphir Kaltstahl
  2018-09-04 19:22   ` Thompson, David
  0 siblings, 1 reply; 8+ messages in thread
From: Zelphir Kaltstahl @ 2018-09-04 18:34 UTC (permalink / raw)
  To: guile-user

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


On 04.09.2018 18:00, guile-user-request@gnu.org wrote:
> Send guile-user mailing list submissions to
> 	guile-user@gnu.org
>
> 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
> 	guile-user-request@gnu.org
>
> You can reach the person managing the list at
> 	guile-user-owner@gnu.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of guile-user digest..."
>
>
> Today's Topics:
>
>    1. Re: How to get started in guile & programming generally
>       (Joshua Branson)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 03 Sep 2018 16:53:39 -0400
> From: Joshua Branson <jbranso@fastmail.com>
> To: <guile-user@gnu.org>
> Subject: Re: How to get started in guile & programming generally
> Message-ID: <871saab8vg.fsf@fastmail.com>
> Content-Type: text/plain; charset=utf-8
>
> Amirouche Boubekki <amirouche.boubekki@gmail.com> writes:
>
>> Using guix on my Ubuntu I successfully installed chickadee master.
>>
>> Try to install guix again and report the error you have please :]
>> Le mer. 29 ao?t 2018 ? 23:09, Joshua Branson <jbranso@fastmail.com> a ?crit :
> 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
> guile-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/guile-user
>
>
> ------------------------------
>
> End of guile-user Digest, Vol 190, Issue 6
> ******************************************




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: trying Chickadee
  2018-09-04 18:34 ` trying Chickadee Zelphir Kaltstahl
@ 2018-09-04 19:22   ` Thompson, David
  2018-09-04 22:03     ` Christopher Lemmer Webber
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Thompson, David @ 2018-09-04 19:22 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: Guile User

Hello Zelphir,

First, thanks for trying Chickadee!

On Tue, Sep 4, 2018 at 2:34 PM, Zelphir Kaltstahl
<zelphirkaltstahl@gmail.com> wrote:
> 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)
> ~~~~~

(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!)

> 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.

> 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.

> 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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: trying Chickadee
  2018-09-04 19:22   ` Thompson, David
@ 2018-09-04 22:03     ` Christopher Lemmer Webber
  2018-09-05 19:08     ` Zelphir Kaltstahl
  2018-09-05 20:42     ` Arne Babenhauserheide
  2 siblings, 0 replies; 8+ messages in thread
From: Christopher Lemmer Webber @ 2018-09-04 22:03 UTC (permalink / raw)
  To: Thompson, David; +Cc: Guile User, Zelphir Kaltstahl

Thompson, David writes:

> 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.

This sounds great!  Looking forward to seeing it and trying it out!

Happy game hacking,
 - cwebber



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: trying Chickadee
  2018-09-04 19:22   ` Thompson, David
  2018-09-04 22:03     ` Christopher Lemmer Webber
@ 2018-09-05 19:08     ` Zelphir Kaltstahl
  2018-09-05 19:41       ` Thompson, David
  2018-09-05 20:42     ` Arne Babenhauserheide
  2 siblings, 1 reply; 8+ messages in thread
From: Zelphir Kaltstahl @ 2018-09-05 19:08 UTC (permalink / raw)
  To: Thompson, David; +Cc: Guile User

Adding (add-hook! quit-hook abort-game) worked flawlessly, thanks.

Can I do anything to help Chickadee to recognize my monitor refresh rate?


On 04.09.2018 21:22, Thompson, David wrote:
> Hello Zelphir,
>
> First, thanks for trying Chickadee!
>
> On Tue, Sep 4, 2018 at 2:34 PM, Zelphir Kaltstahl
> <zelphirkaltstahl@gmail.com> wrote:
>> 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)
>> ~~~~~
> (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!)
>
>> 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.
>
>> 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.
>
>> 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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: trying Chickadee
  2018-09-05 19:08     ` Zelphir Kaltstahl
@ 2018-09-05 19:41       ` Thompson, David
  0 siblings, 0 replies; 8+ messages in thread
From: Thompson, David @ 2018-09-05 19:41 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: Guile User

On Wed, Sep 5, 2018 at 3:08 PM, Zelphir Kaltstahl
<zelphirkaltstahl@gmail.com> wrote:
> 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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: trying Chickadee
  2018-09-04 19:22   ` Thompson, David
  2018-09-04 22:03     ` Christopher Lemmer Webber
  2018-09-05 19:08     ` Zelphir Kaltstahl
@ 2018-09-05 20:42     ` Arne Babenhauserheide
  2018-09-05 20:51       ` Thompson, David
  2 siblings, 1 reply; 8+ messages in thread
From: Arne Babenhauserheide @ 2018-09-05 20:42 UTC (permalink / raw)
  To: Thompson, David; +Cc: Guile User, Zelphir Kaltstahl

[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]


Thompson, David <dthompson2@worcester.edu> writes:

> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1076 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: trying Chickadee
  2018-09-05 20:42     ` Arne Babenhauserheide
@ 2018-09-05 20:51       ` Thompson, David
  2018-09-06 20:27         ` Arne Babenhauserheide
  0 siblings, 1 reply; 8+ messages in thread
From: Thompson, David @ 2018-09-05 20:51 UTC (permalink / raw)
  To: Arne Babenhauserheide; +Cc: Guile User, Zelphir Kaltstahl

On Wed, Sep 5, 2018 at 4:42 PM, Arne Babenhauserheide <arne_bab@web.de> wrote:
>
> Thompson, David <dthompson2@worcester.edu> writes:
>
>> 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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: trying Chickadee
  2018-09-05 20:51       ` Thompson, David
@ 2018-09-06 20:27         ` Arne Babenhauserheide
  0 siblings, 0 replies; 8+ messages in thread
From: Arne Babenhauserheide @ 2018-09-06 20:27 UTC (permalink / raw)
  To: Thompson, David; +Cc: Guile User, Zelphir Kaltstahl

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]


Thompson, David <dthompson2@worcester.edu> writes:
> 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.

Yes. Sleeping unconditionally is just a hack to get close to that, but
not a clean solution.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1076 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-09-06 20:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.101.1536076823.21859.guile-user@gnu.org>
2018-09-04 18:34 ` trying Chickadee Zelphir Kaltstahl
2018-09-04 19:22   ` Thompson, David
2018-09-04 22:03     ` Christopher Lemmer Webber
2018-09-05 19:08     ` Zelphir Kaltstahl
2018-09-05 19:41       ` Thompson, David
2018-09-05 20:42     ` Arne Babenhauserheide
2018-09-05 20:51       ` Thompson, David
2018-09-06 20:27         ` Arne Babenhauserheide

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).