[Haskell-cafe] Tetris
Henrik Nilsson
nhn at Cs.Nott.AC.UK
Wed Nov 21 06:57:43 EST 2007
Hi Peter,
> About continuous time; it is in fact, not really continuous is it,
> since floats are used to approximate time. So the longer your program
> runs, the less accurate an absolute time value will become no?
Well, yes and no.
Yampa, at least, does not use absolute time internally, only time
deltas, so the problem you describe only occurs if the programmer
*explicitly* choose to accumulate absolute time, or *explicitly* make
use of very large relative time intervals (e.g. combinators like
"after" that emits an event after a given, relative, time interval).
So, as always with floating point, or with any finite representation of
numbers, the programmer has to understand the limitations and
implications of the chosen representation. But this is not any inherent
flaw of FRP or its Yampa incarnation as such.
One could also imagine using some infinite-precision number
representation with FRP instead of floating point. The fact that
Yampa uses floating point is merely a pragmatic implementation
choice.
I believe I also saw someone asking about Modelica in this context.
Modelica is a hybrid modelling and simulation language. Efficient
simulation and accurate results are of key importance, and for that
reason Modelica implementations use sophisticated numerical
and symbolic methods. Unfortunately, this also limits
the expressiveness of the language. In particular, Modelica cannot
handle systems with highly dynamic structure like video games.
Thus I don't think we'll see video games written purely in languages
like Modelica any time soon, even if there is active research on
making such languages cope better with structurally dynamic systems.
(One could probably imagine using Modelica for handling game physics,
though, i.e. as a component of a games programming suite.)
Best,
/Henrik
--
Henrik Nilsson
School of Computer Science and Information Technology
The University of Nottingham
nhn at cs.nott.ac.uk
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
More information about the Haskell-Cafe
mailing list