Why isn&#39;t it possible to make a Pong with Reactive? Where is the problem?<br>Conceptually, I don&#39;t see where it is. IMO, it&#39;s a time-leak issue due to a Reactive bug, but it is not a limitation of Reactive.<br>
I mean, it&#39;s not that it <i>can&#39;t</i> work, it&#39;s that it <i>should</i> work, shouldn&#39;t it?<br><br>And why would it be more possible with Yampa?<br>I&#39;ve already checked Yampa, but I find it much less simple and easy to use than Reactive.<br>
Moreover, I tried the space invaders sample (the sample that the paper &quot;Yampa Arcade&quot; is about), and it lauches but it is completely unusable (I do have a decent PC, and I get like 5fps and a gun which absolutely doesn&#39;t move correctly). Not very appealing ^^, but maybe the problem is with the code of the game itself or with my PC, not with Yampa...<br>
<br>I did not look thoroughly at elerea, but at least, when I tried its sample &quot;dungeons of wor&quot; it worked properly ;)<br>I will have a look...<br><br><div class="gmail_quote">2010/5/16 Peter Verswyvelen <span dir="ltr">&lt;<a href="mailto:bugfact@gmail.com">bugfact@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">As far as I know, it was never possible to make a pong game in<br>
Reactive, at least not with the versions I tried, but I admit a lot of<br>
never versions got released since then. It would be great to see one<br>
though :)<br>
<br>
You might want to try Yampa, that works for sure (although you should<br>
mark all your output data strict, as is done in the examples,<br>
otherwise you might also get space leaks or shaky frame rates). Or<br>
Elerea, which comes with a breakout game.<br>
<div><div></div><div class="h5"><br>
On Sun, May 16, 2010 at 9:30 PM, Limestraël &lt;<a href="mailto:limestrael@gmail.com">limestrael@gmail.com</a>&gt; wrote:<br>
&gt; Eventually, I don&#39;t think it is a profiling issue.<br>
&gt; Maybe a problem with integral. According to a quite recent post on the<br>
&gt; reactive mailing list, the following minimal code produces the same problem<br>
&gt; :<br>
&gt;<br>
&gt;&gt; import FRP.Reactive<br>
&gt;<br>
&gt;&gt; import FRP.Reactive.LegacyAdapters<br>
&gt;<br>
&gt;&gt; import Control.Applicative<br>
&gt;<br>
&gt;&gt; type Velocity = Double<br>
&gt;&gt; type Position = Double<br>
&gt;<br>
&gt;&gt; data Car = Car { vel :: Velocity, pos :: Position } deriving Show<br>
&gt;<br>
&gt;<br>
&gt;&gt; velocity :: Behavior Velocity<br>
&gt;<br>
&gt;&gt; velocity = 1<br>
&gt;<br>
&gt;&gt; position :: Behavior Position<br>
&gt;&gt; position = integral (atTimes [0, 0.5 ..]) velocity<br>
&gt;<br>
&gt;&gt; car :: Behavior Car<br>
&gt;&gt; car = Car &lt;$&gt; velocity &lt;*&gt; position<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&gt; main :: IO ()<br>
&gt;&gt; main = adaptE $ print &lt;$&gt; car `snapshot_` atTimes [0, 0.5..]<br>
&gt;<br>
&gt;&gt; 1) why is the leak happen?<br>
&gt;&gt; 2) how can I fix this problem?<br>
&gt;<br>
&gt;&gt; Some more detailed informations:<br>
&gt;<br>
&gt;<br>
&gt;&gt; * reactive 0.11.4<br>
&gt;&gt; * GHC 6.12.1<br>
&gt;&gt; * Gentoo Linux (2.6.32-tuxonice, x86_64) or Ubuntu 9.10 64bits<br>
&gt;&gt; * compiled with or without -O2 flag<br>
&gt;<br>
&gt; 2010/5/16 David Leimbach &lt;<a href="mailto:leimy2k@gmail.com">leimy2k@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Sat, May 15, 2010 at 8:42 AM, Limestraël &lt;<a href="mailto:limestrael@gmail.com">limestrael@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Okay,<br>
&gt;&gt;&gt; guess I&#39;ll have to bring out the chapter 25 of my Real World Haskell...<br>
&gt;&gt;<br>
&gt;&gt; I find it&#39;s often the most practical chapter that I hit a lot during<br>
&gt;&gt; writes and changes to my server process I have in Haskell in our control<br>
&gt;&gt; system code :-)<br>
&gt;&gt; That plus the information that I had missed that Control.Monad.State<br>
&gt;&gt; defaulted to the Lazy version (which is consistent, but for some reason it<br>
&gt;&gt; got by me) helped me to realize why I was leaking so much space in a garbage<br>
&gt;&gt; collected environment.<br>
&gt;&gt; I wouldn&#39;t have gotten very far with Haskell as this piece of our code<br>
&gt;&gt; without that chapter.  I&#39;d love to see more writing of that sort around<br>
&gt;&gt; Haskell in book form.  One can become fluent in tuning Haskell by trial and<br>
&gt;&gt; error, but the sharp corners one must bump into are often sharper than in<br>
&gt;&gt; other languages I&#39;ve found.<br>
&gt;&gt; Dave<br>
&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2010/5/15 Bulat Ziganshin &lt;<a href="mailto:bulat.ziganshin@gmail.com">bulat.ziganshin@gmail.com</a>&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hello Limestraėl,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Saturday, May 15, 2010, 7:02:38 PM, you wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; &gt; But when I set my beat to tick every 60 times per second, the<br>
&gt;&gt;&gt;&gt; &gt; position is well updated, but I clearly see that the display<br>
&gt;&gt;&gt;&gt; &gt; dramatically slows down after a few seconds of execution. Too heavy<br>
&gt;&gt;&gt;&gt; &gt; rate for integrate?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; it may be due to lot of uncollected garbage that is result of lazy<br>
&gt;&gt;&gt;&gt; evaluation. profile program to check its GC times<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt; Best regards,<br>
&gt;&gt;&gt;&gt;  Bulat                            mailto:<a href="mailto:Bulat.Ziganshin@gmail.com">Bulat.Ziganshin@gmail.com</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; Haskell-Cafe mailing list<br>
&gt;&gt;&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt;&gt;&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>