Why isn't it possible to make a Pong with Reactive? Where is the problem?<br>Conceptually, I don't see where it is. IMO, it's a time-leak issue due to a Reactive bug, but it is not a limitation of Reactive.<br>
I mean, it's not that it <i>can't</i> work, it's that it <i>should</i> work, shouldn't it?<br><br>And why would it be more possible with Yampa?<br>I'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 "Yampa Arcade" 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'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 "dungeons of wor" it worked properly ;)<br>I will have a look...<br><br><div class="gmail_quote">2010/5/16 Peter Verswyvelen <span dir="ltr"><<a href="mailto:bugfact@gmail.com">bugfact@gmail.com</a>></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 <<a href="mailto:limestrael@gmail.com">limestrael@gmail.com</a>> wrote:<br>
> Eventually, I don't think it is a profiling issue.<br>
> Maybe a problem with integral. According to a quite recent post on the<br>
> reactive mailing list, the following minimal code produces the same problem<br>
> :<br>
><br>
>> import FRP.Reactive<br>
><br>
>> import FRP.Reactive.LegacyAdapters<br>
><br>
>> import Control.Applicative<br>
><br>
>> type Velocity = Double<br>
>> type Position = Double<br>
><br>
>> data Car = Car { vel :: Velocity, pos :: Position } deriving Show<br>
><br>
><br>
>> velocity :: Behavior Velocity<br>
><br>
>> velocity = 1<br>
><br>
>> position :: Behavior Position<br>
>> position = integral (atTimes [0, 0.5 ..]) velocity<br>
><br>
>> car :: Behavior Car<br>
>> car = Car <$> velocity <*> position<br>
><br>
><br>
><br>
>> main :: IO ()<br>
>> main = adaptE $ print <$> car `snapshot_` atTimes [0, 0.5..]<br>
><br>
>> 1) why is the leak happen?<br>
>> 2) how can I fix this problem?<br>
><br>
>> Some more detailed informations:<br>
><br>
><br>
>> * reactive 0.11.4<br>
>> * GHC 6.12.1<br>
>> * Gentoo Linux (2.6.32-tuxonice, x86_64) or Ubuntu 9.10 64bits<br>
>> * compiled with or without -O2 flag<br>
><br>
> 2010/5/16 David Leimbach <<a href="mailto:leimy2k@gmail.com">leimy2k@gmail.com</a>><br>
>><br>
>><br>
>> On Sat, May 15, 2010 at 8:42 AM, Limestraël <<a href="mailto:limestrael@gmail.com">limestrael@gmail.com</a>> wrote:<br>
>>><br>
>>> Okay,<br>
>>> guess I'll have to bring out the chapter 25 of my Real World Haskell...<br>
>><br>
>> I find it's often the most practical chapter that I hit a lot during<br>
>> writes and changes to my server process I have in Haskell in our control<br>
>> system code :-)<br>
>> That plus the information that I had missed that Control.Monad.State<br>
>> defaulted to the Lazy version (which is consistent, but for some reason it<br>
>> got by me) helped me to realize why I was leaking so much space in a garbage<br>
>> collected environment.<br>
>> I wouldn't have gotten very far with Haskell as this piece of our code<br>
>> without that chapter. I'd love to see more writing of that sort around<br>
>> Haskell in book form. One can become fluent in tuning Haskell by trial and<br>
>> error, but the sharp corners one must bump into are often sharper than in<br>
>> other languages I've found.<br>
>> Dave<br>
>><br>
>>><br>
>>> 2010/5/15 Bulat Ziganshin <<a href="mailto:bulat.ziganshin@gmail.com">bulat.ziganshin@gmail.com</a>><br>
>>>><br>
>>>> Hello Limestraėl,<br>
>>>><br>
>>>> Saturday, May 15, 2010, 7:02:38 PM, you wrote:<br>
>>>><br>
>>>> > But when I set my beat to tick every 60 times per second, the<br>
>>>> > position is well updated, but I clearly see that the display<br>
>>>> > dramatically slows down after a few seconds of execution. Too heavy<br>
>>>> > rate for integrate?<br>
>>>><br>
>>>> it may be due to lot of uncollected garbage that is result of lazy<br>
>>>> evaluation. profile program to check its GC times<br>
>>>><br>
>>>><br>
>>>> --<br>
>>>> Best regards,<br>
>>>> Bulat mailto:<a href="mailto:Bulat.Ziganshin@gmail.com">Bulat.Ziganshin@gmail.com</a><br>
>>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Haskell-Cafe mailing list<br>
>>> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
>>> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
>>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><br>
><br>
</div></div></blockquote></div><br>