Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Chris Hecker <checker@d6.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Ocaml and games
Date: Wed, 23 Jan 2002 22:59:43 -0800	[thread overview]
Message-ID: <4.3.2.7.2.20020123222504.03050660@arda.pair.com> (raw)
In-Reply-To: <4.3.2.7.2.20020122204927.028b0db0@arda.pair.com>


Replying to my own post here...

>- Linking of bytecode and native code would be good.  Currently if you're using bytecode (debugging, compile speed, toplevel, etc.) and you need to optimize something, dropping to C is your only choice, which is silly.

I thought I might explain this one a bit in case it wasn't clear why you might be _forced_ to optimize something (as opposed to just wanting to).  This is intimately related to the "debugger for native code" issue as well.  I'm not trying to be condescending at all here, I just don't know if everybody on the list is used to writing time-dependent interactive code or not, and the thing I'm going to describe is kind of surprising at first (at least, it was for me when I figured it out, and it seems to be for other game developers).  And, I'm not trying to beat the horse (since we know how Xavier loves that sort of thing :) of this specific bytecode-native linking thing, this is just using that as a jumping-off point.   So, anyway, if you already know this, hit delete, if not, maybe it's useful to know...

The idea is if you have a system that's got an interactive feedback loop in it that has a certain type of time-dependent behavior, then there's a floor beneath which your performance can't drop or things don't work.  I don't mean "things go slow so it's annoying", I mean the system actually stops working.  All that's necessary is that you have a system that's time to complete is proportional to the time over which you'd like to run it.  So, for example, physics simulation is like this:  if you ask a [nontrivial] physics simulator to simulate from t0 to t1, the bigger t1-t0 is, the longer it will take to give you an answer back.  Graphics can behave like this as well if you've got stuff like viewer-dependent level-of-detail; the longer your timestep is, the farther the camera moves, so the more level-of-detail changes your system needs to make, so the longer it takes to render the frame.

If you've got this kind of feedback loop in your application, and if your framerate drops below a certain magic threshold (that's dependent on the system, obviously), then it takes longer to generate each successive frame and things grind to a halt.  In other words, you have the start time of t0 and the end time of t1, and you generate the frame at t1, and if it took longer than t1-t0 seconds, then t2-t1 is going to be even longer, so it takes even longer again, and you get this:

t1-t0 < t2-t1 < t3-t2 ...

And you're screwed.  This is known among some in the game industry as "The Evil Feedback Loop."  :)  You can sometimes work around it with fixed steps and whatnot, but if you're trying to debug actual behavior where the user is interacting with the system, you're pretty much stuck with it at some point.

So, this relates to byte/native linking and native debugging because if you're using the bytecode compiler for debugging (or any of the other reasons) and you run into this problem, but the native code is fast enough, you have a nasty decision to make:  you can either rewrite the slow part in C so you can keep using bytecode, or you can move to native code and give up the debugger.

Anyway, hopefully that is interesting to somebody...

Chris


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  parent reply	other threads:[~2002-01-24  7:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-21 23:27 cgillot
2002-01-21 22:43 ` [Caml-list] Re: your mail Markus Mottl
2002-01-22  0:03   ` [Caml-list] Re: about toplevels cgillot
2002-01-22 20:41     ` Chris Hecker
2002-01-22 21:35       ` [Caml-list] Ocaml and games Matthew D Moss
2002-01-22 21:43         ` Will Benton
2002-01-22 23:53         ` Eric C. Cooper
2002-01-23  0:58         ` Ian Zimmerman
2002-01-23  1:23         ` Yaron M. Minsky
2002-01-23  3:29         ` Doug Bagley
2002-01-23  5:20         ` Chris Hecker
2002-01-24  3:02           ` Matthew D Moss
2002-01-24  6:59           ` Chris Hecker [this message]
2002-01-25 20:22           ` Daniel Phillips
2002-01-25 20:53             ` Ken Rose
2002-01-25 22:16             ` Chris Hecker
2002-01-25 23:00               ` Thatcher Ulrich
2002-01-23  8:39         ` Sven
2002-01-23 15:35         ` Xavier Leroy
2002-01-22  9:00   ` [Caml-list] Re: your mail Daniel de Rauglaudre
2002-01-22 13:12     ` Markus Mottl
     [not found] ` <4.3.2.7.2.20020123011902.00cde840@arda.pair.com>
2002-01-23  9:35   ` [Caml-list] Re: about toplevels Christian Gillot
2002-01-23 10:20     ` Chris Hecker
2002-01-24 16:03     ` Daniel de Rauglaudre
2002-01-24 17:20       ` Christophe Raffalli
2002-01-24 17:34       ` Christian Gillot
2002-01-24 20:42     ` [Caml-list] gotchas [Was: toplevels] Ian Zimmerman
2002-01-25 10:59       ` Christian Gillot
2002-01-25 11:17         ` Sven

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

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

  git send-email \
    --in-reply-to=4.3.2.7.2.20020123222504.03050660@arda.pair.com \
    --to=checker@d6.com \
    --cc=caml-list@inria.fr \
    /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