<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Haskell and Game Development</title>
	<atom:link href="http://alexicalmistake.com/2008/10/haskell-and-game-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/</link>
	<description>Languages; Past, Present and Future</description>
	<lastBuildDate>Wed, 17 Dec 2008 19:25:44 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Eyal Lotem</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-47</link>
		<dc:creator>Eyal Lotem</dc:creator>
		<pubDate>Tue, 28 Oct 2008 21:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-47</guid>
		<description>Look at FRP:

Reactive animations:
http://conal.net/fran/tutorial.htm

The above work set the corner stone of FRP.

The Yampa arcade:
http://www.haskell.org/yale/papers/haskell-workshop03/yampa-arcade.pdf

I think the Yampa arcade (and Yampa in general) are not quite functional as we&#039;d like, but they are an interesting approach.

The idea of FRP is that pure functional values CAN be used to denote dynamic things.</description>
		<content:encoded><![CDATA[<p>Look at FRP:</p>
<p>Reactive animations:<br />
<a href="http://conal.net/fran/tutorial.htm" rel="nofollow">http://conal.net/fran/tutorial.htm</a></p>
<p>The above work set the corner stone of FRP.</p>
<p>The Yampa arcade:<br />
<a href="http://www.haskell.org/yale/papers/haskell-workshop03/yampa-arcade.pdf" rel="nofollow">http://www.haskell.org/yale/papers/haskell-workshop03/yampa-arcade.pdf</a></p>
<p>I think the Yampa arcade (and Yampa in general) are not quite functional as we&#8217;d like, but they are an interesting approach.</p>
<p>The idea of FRP is that pure functional values CAN be used to denote dynamic things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lorenz Pretterhofer</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-46</link>
		<dc:creator>Lorenz Pretterhofer</dc:creator>
		<pubDate>Wed, 22 Oct 2008 21:22:06 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-46</guid>
		<description>Yes, I will have to check those out at some point. And speaking of FRP, I actually considered it for my game project before I started this stuff, but not understanding Arrows and due to the frametime delta mechanism being a little strange (from my perspective) I decided to have a crack at a conventional engine first.

When I get to the postmortem however, I fully intend to have another look at the FRP architecture.</description>
		<content:encoded><![CDATA[<p>Yes, I will have to check those out at some point. And speaking of FRP, I actually considered it for my game project before I started this stuff, but not understanding Arrows and due to the frametime delta mechanism being a little strange (from my perspective) I decided to have a crack at a conventional engine first.</p>
<p>When I get to the postmortem however, I fully intend to have another look at the FRP architecture.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Michael</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-45</link>
		<dc:creator>Simon Michael</dc:creator>
		<pubDate>Wed, 22 Oct 2008 18:42:48 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-45</guid>
		<description>Hi Lorenz, thanks for exploring this, please continue. I&#039;ve looked at a few of the haskell games (on hackage) and one game framework (FunGEN) for ideas. It might be instructive to see and compare your evolving code attempts. The OO approach seems natural (and newspeak seems very promising) but natural-feeling functional solutions still seem possible. Maybe they will look like functional reactive programming. I wonder.</description>
		<content:encoded><![CDATA[<p>Hi Lorenz, thanks for exploring this, please continue. I&#8217;ve looked at a few of the haskell games (on hackage) and one game framework (FunGEN) for ideas. It might be instructive to see and compare your evolving code attempts. The OO approach seems natural (and newspeak seems very promising) but natural-feeling functional solutions still seem possible. Maybe they will look like functional reactive programming. I wonder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lorenz Pretterhofer</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-43</link>
		<dc:creator>Lorenz Pretterhofer</dc:creator>
		<pubDate>Tue, 21 Oct 2008 03:02:04 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-43</guid>
		<description>I stumbled onto this post on the records syntax. I think it summarizes my issues with the syntax quite nicely.

&lt;a href=&quot;http://bloggablea.wordpress.com/2007/04/24/haskell-records-considered-grungy/&quot; rel=&quot;nofollow&quot;&gt;Haskell Records Considered Grungy&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>I stumbled onto this post on the records syntax. I think it summarizes my issues with the syntax quite nicely.</p>
<p><a href="http://bloggablea.wordpress.com/2007/04/24/haskell-records-considered-grungy/" rel="nofollow">Haskell Records Considered Grungy</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lorenz Pretterhofer</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-41</link>
		<dc:creator>Lorenz Pretterhofer</dc:creator>
		<pubDate>Tue, 21 Oct 2008 00:45:48 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-41</guid>
		<description>I don&#039;t believe I&#039;ve quite gotten to the point where I think I&#039;m comfortable writing a more game specific type (monad or otherwise) yet, but it&#039;s definitely an interesting prospect. It might actually have more far flung implications that you mentioned once you move the IO into higher level tasks, and just expose those to the game/engine type.

As I understand it the IO types are &quot;more or less&quot; just renamed ST types anyway, allowing true IO (externally controlled side effects) to be separated from the pure functional core. Since real side effects which are type constrained so they don&#039;t escape a block of code are, from the outside at least, still referentially transparent and therefore functional. But your right, as the code base grows, some guarantees about IO could become essential.

Right now I&#039;m actually more concerned with the overhead involved in using monadic code like readIORef. Eventually I think I&#039;ll learn the operations involved in combining this kind of code better, but for now I think it might be more useful just to get something working and go from there.


Heh, that tying the know thing reminds of a post that appeared on planet haskell a while back...&lt;a href=&quot;https://www.joachim-breitner.de/blog/archives/308-guid.html&quot; rel=&quot;nofollow&quot;&gt;Infinite loops in Haskell&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t believe I&#8217;ve quite gotten to the point where I think I&#8217;m comfortable writing a more game specific type (monad or otherwise) yet, but it&#8217;s definitely an interesting prospect. It might actually have more far flung implications that you mentioned once you move the IO into higher level tasks, and just expose those to the game/engine type.</p>
<p>As I understand it the IO types are &#8220;more or less&#8221; just renamed ST types anyway, allowing true IO (externally controlled side effects) to be separated from the pure functional core. Since real side effects which are type constrained so they don&#8217;t escape a block of code are, from the outside at least, still referentially transparent and therefore functional. But your right, as the code base grows, some guarantees about IO could become essential.</p>
<p>Right now I&#8217;m actually more concerned with the overhead involved in using monadic code like readIORef. Eventually I think I&#8217;ll learn the operations involved in combining this kind of code better, but for now I think it might be more useful just to get something working and go from there.</p>
<p>Heh, that tying the know thing reminds of a post that appeared on planet haskell a while back&#8230;<a href="https://www.joachim-breitner.de/blog/archives/308-guid.html" rel="nofollow">Infinite loops in Haskell</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Danielson</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-40</link>
		<dc:creator>Sam Danielson</dc:creator>
		<pubDate>Mon, 20 Oct 2008 21:12:39 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-40</guid>
		<description>&gt; Please, don’t use IORefs in this way. Instead, give objects unique IDs, and maintain a table of relationships between objects by their unique ID.

IOW to turn the game state into something like a relational database. It&#039;s good for serialization e.g. one could implement save game via &quot;deriving (Read)&quot;, but slow for lookups. It fits the idea of expressions quite well and the flexibility is great but for a real game wouldn&#039;t it be better if relationships were by pointer under the covers? I imagine one would create a datatype that lies on top of the expression oriented fkey style database, similar to a view in RDMS terms. As a n00b this hurts my head but it seems like I&#039;m thinking in the right direction. &quot;Tying the knot&quot; appears to be required in the general case.

http://haskell.org/wikisnapshot/TyingTheKnot.html</description>
		<content:encoded><![CDATA[<p>&gt; Please, don’t use IORefs in this way. Instead, give objects unique IDs, and maintain a table of relationships between objects by their unique ID.</p>
<p>IOW to turn the game state into something like a relational database. It&#8217;s good for serialization e.g. one could implement save game via &#8220;deriving (Read)&#8221;, but slow for lookups. It fits the idea of expressions quite well and the flexibility is great but for a real game wouldn&#8217;t it be better if relationships were by pointer under the covers? I imagine one would create a datatype that lies on top of the expression oriented fkey style database, similar to a view in RDMS terms. As a n00b this hurts my head but it seems like I&#8217;m thinking in the right direction. &#8220;Tying the knot&#8221; appears to be required in the general case.</p>
<p><a href="http://haskell.org/wikisnapshot/TyingTheKnot.html" rel="nofollow">http://haskell.org/wikisnapshot/TyingTheKnot.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Lane Hinson</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-39</link>
		<dc:creator>Christopher Lane Hinson</dc:creator>
		<pubDate>Mon, 20 Oct 2008 20:27:50 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-39</guid>
		<description>Please, don&#039;t use IORefs in this way.  Instead, give objects unique IDs, and maintain a table of relationships between objects by their unique ID.

There&#039;s a common notion among outsiders and new Haskellers that Haskell &quot;can&#039;t handle something as complex as X.&quot;  This is absolutely true if you&#039;re using the IO monad to do work that is not IO.</description>
		<content:encoded><![CDATA[<p>Please, don&#8217;t use IORefs in this way.  Instead, give objects unique IDs, and maintain a table of relationships between objects by their unique ID.</p>
<p>There&#8217;s a common notion among outsiders and new Haskellers that Haskell &#8220;can&#8217;t handle something as complex as X.&#8221;  This is absolutely true if you&#8217;re using the IO monad to do work that is not IO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Griffin</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-37</link>
		<dc:creator>Sam Griffin</dc:creator>
		<pubDate>Mon, 20 Oct 2008 13:36:34 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-37</guid>
		<description>I generally stick my entire program state in one data record (call it GameState, maybe) and then put that in an IORef.  Then I can keep my code as purely functional as possible.  I still haven&#039;t figured out a good way to deal with interrupt-driven IO in an elegant way in Haskell.</description>
		<content:encoded><![CDATA[<p>I generally stick my entire program state in one data record (call it GameState, maybe) and then put that in an IORef.  Then I can keep my code as purely functional as possible.  I still haven&#8217;t figured out a good way to deal with interrupt-driven IO in an elegant way in Haskell.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tac-Tics</title>
		<link>http://alexicalmistake.com/2008/10/haskell-and-game-development/comment-page-1/#comment-36</link>
		<dc:creator>Tac-Tics</dc:creator>
		<pubDate>Mon, 20 Oct 2008 13:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://alexicalmistake.com/?p=50#comment-36</guid>
		<description>For the longest time, I was baffled how something as complex as a game could be written in Haskell. Even writing a configuration file for a game (or any software really) seems, at first, to be an impossible task.

But later, as I worked with it, the big picture became clear. The idea in Haskell isn&#039;t to eliminate IO. That&#039;s impossible. A program made from pure functions is rarely useful. Instead, monads (and monad transformers) allow the programmer to put his or her own restrictions on how much of the outside world touches your program.

The first thing I&#039;d do if I were writing any sort of complex game-looking program in Haskell would be to create a type to manage the state of your program: GameState. This type will be a monad and a member of MonadIO, to allow you give you access to the lovely Turing-based world on the other side of the void. 

From there, you expose only the IO calls you need. If you need a timer in the game, then you provide for a function sleepMilli :: Int -&gt; GameState (). But you probably don&#039;t need general disk access for the game, so you hide openFile. The only time you&#039;ll need to read and write files is for config files, maps, and saved games, but those simply become parameters for generating your game state object: loadGame :: String -&gt; IO GameState, which takes the name of a save file and loads it.

Using a GameState object is also useful for maintaining mutable objects in your game. Replacing all the IORefs with STRefs or similar makes the guarantee Turing stays on the other side, while still providing you a ton of flexibility. 

From there, all your generic algorithms: collision detections, state-based game AI, victory conditions are just functions of your game state.</description>
		<content:encoded><![CDATA[<p>For the longest time, I was baffled how something as complex as a game could be written in Haskell. Even writing a configuration file for a game (or any software really) seems, at first, to be an impossible task.</p>
<p>But later, as I worked with it, the big picture became clear. The idea in Haskell isn&#8217;t to eliminate IO. That&#8217;s impossible. A program made from pure functions is rarely useful. Instead, monads (and monad transformers) allow the programmer to put his or her own restrictions on how much of the outside world touches your program.</p>
<p>The first thing I&#8217;d do if I were writing any sort of complex game-looking program in Haskell would be to create a type to manage the state of your program: GameState. This type will be a monad and a member of MonadIO, to allow you give you access to the lovely Turing-based world on the other side of the void. </p>
<p>From there, you expose only the IO calls you need. If you need a timer in the game, then you provide for a function sleepMilli :: Int -&gt; GameState (). But you probably don&#8217;t need general disk access for the game, so you hide openFile. The only time you&#8217;ll need to read and write files is for config files, maps, and saved games, but those simply become parameters for generating your game state object: loadGame :: String -&gt; IO GameState, which takes the name of a save file and loads it.</p>
<p>Using a GameState object is also useful for maintaining mutable objects in your game. Replacing all the IORefs with STRefs or similar makes the guarantee Turing stays on the other side, while still providing you a ton of flexibility. </p>
<p>From there, all your generic algorithms: collision detections, state-based game AI, victory conditions are just functions of your game state.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
