unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Thompson, David" <dthompson2@worcester.edu>
To: Arne Babenhauserheide <arne_bab@web.de>
Cc: Guile User <guile-user@gnu.org>,
	Zelphir Kaltstahl <zelphirkaltstahl@gmail.com>
Subject: Re: trying Chickadee
Date: Wed, 5 Sep 2018 16:51:27 -0400	[thread overview]
Message-ID: <CAJ=RwfaxPARvYbfQx6WVu31Yra6wLUqxFtyRJVOk4Acn8J+g+A@mail.gmail.com> (raw)
In-Reply-To: <875zzj4qws.fsf@web.de>

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.



  reply	other threads:[~2018-09-05 20:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2018-09-06 20:27         ` Arne Babenhauserheide

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ=RwfaxPARvYbfQx6WVu31Yra6wLUqxFtyRJVOk4Acn8J+g+A@mail.gmail.com' \
    --to=dthompson2@worcester.edu \
    --cc=arne_bab@web.de \
    --cc=guile-user@gnu.org \
    --cc=zelphirkaltstahl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).