[Haskell-beginners] Generating Code To Embed in an Event Loop
Darrin Thompson
darrinth at gmail.com
Tue Oct 25 18:54:41 CEST 2011
I've been thinking about how I could use Haskell for programming just the
"business logic" for games.
So for a mobile game I might use an existing library such as libgdx or
cocos2d for input handling and sprite batching. Where I'd like to use
Haskell is for writing the big function to process the inputs and output a
sprite list and audio triggers.
Why Haskell? In even a simple 2d platformer there's a lot of polish needed
to get the game to feel good to a player. For instance, if I was using box2d
physics to take care of movement and collisions, I might still need to
detect that inputs indicate applying a force vector opposite to the player's
current velocity and the player is "on the floor". A naive game would show
the player moon walking. A more sophisticated game would show a skidding
player sprite or animation until the player's velocity reaches 0.
I was hoping to use Haskell to capture a lot of little details like that
more elegantly than I can in C or Java.
However, my program needs to be compiled for a mobile device.
I'm wary of trying to use GHC to generate arm machine code. I've had bad
luck with cross compilers.
It seemed to me that I could design a GADT to model my game actors and their
relationships. I would then (misused term I'm sure) "lift" my behavior
functions into some context where they can produce Java or C code for use in
Xcode or Eclipse. That's my favored approach.
Is there some background I could look at to save myself some dead ends
pursuing this?
--
Darrin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111025/6abfd60c/attachment.htm>
More information about the Beginners
mailing list