CES as a useful framework for thinking about the arena and UI

22 views
Skip to first unread message

Ben Ford

unread,
Dec 12, 2012, 5:00:46 AM12/12/12
to lambd...@googlegroups.com
Hi Guys,

I think I arrived a little late yesterday and might have missed some of the discussion. I've had a little think about things now and as luck would have it something from Chris Granger (of light table fame) popped up on hacker news this morning. He posted a small article about his entry to a game programming competition written in clojurescript which I think we'd do well to harvest some ideas from.

Here's the post: http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/ and here's the related hacker news discussion which contains some more links http://news.ycombinator.com/item?id=4907791

I think the key idea is the one of the state of the world being a data structure that the logic of the game (which are simple functions) acts upon. Very crudely, something like:

EntityID = Integer

Component = Pos (Int, Int)
                      | TurretDir (Float)
                      | Speed (Float)
                      | Render [Component] -> ()
 ....

newtype Word = Map EntityID [Component]

botState = [
   Pos (0, 0)
 , TurretDir 90
 , Speed 1.5
]

If we think about it like this then our Bot monad is just something that submits commands to be run against the state of the world. The UI is a function (catamorphism?) that filters the world for Entities that have a Render constructor and calls the function contained.

What do you think?

Ben
Reply all
Reply to author
Forward
0 new messages