Joey Hess: 7drl 2015 day 5 type directed spell system development
I want my 7drl game Scroll to have lots of interesting spells.
So, as I'm designing its spell system, I've been looking at the types, and
considering the whole universe of possible spells that fit within the
constraints of the types.
My first throught was that a spell would be a function from World -> World.
That allows any kind of spell that manipulates the game map. Like, for
instance a "whiteout" that projects a stream of whitespace from the
player's mouth.
Since Scroll has a state monad, I quickly generalized that; making spell
actions a state monad M (), which lets spells reuse other monadic actions,
and affect the whole game state, including the player. Now I could write
a spell like "teleport", or "grow".
But it quickly became apparent this was too limiting: While spells could change
the World map, the player, and even change the list of supported spells, they
had no way to prompting for input.
I tried a few types of the Event -> M () variety, but they were all too
limiting. Finally, I settled on this type for spell actions:
M NextStep -> M NextStep.
And then I spent 3 hours exploring the universe of spells that type allows!
To understand them, it helps to see what a NextStep is:
type Step = Event -> M NextStep
data NextStep = NextStep View (Maybe Step)
NextStep is a continuation, spells take the original continuation,
and can not only modify the game state, but can return an altered
continuation. Such as one that prompts for input before performing the
spell, and then calls the original continuation to get on with the game.
That let me write "new", a most interesting spell, that lets the player
add a new way to cast an existing spell. Spells are cast using ingredients,
and so this prompts for a new ingredient to cast a spell. (I hope that
"new farming" will be one mode of play to possibly win Scroll.)
And, it lets me write spells that fail in game-ending ways. (Ie, "genocide @").
A spell can cause the game to end by returning a continuation that
has Nothing as its next step.
Even better, I could write spells that return a continuation that contains a
forked background task, using the 66 line contiuation based threading system I
built in day 3. This allows writing lots
of fun spells that have an effect that lasts for a while. Things like letting
the player quickly digest letters they eat, or slow down the speed of
events.
And then I thought of "dream". This spell stores the input continuation and
game state, and returns a modified continuation that lets the game continue
until it ends, and then restores from the point it saved. So, the player dreams
they're playing, and wakes back up where they cast the spell. A wild spell,
which can have different variants, like precognitive dreams where the same
random numbers are used as will be used upon awaking, or dreams where
knowledge carries back over to the real world in different ways.
(Supports Inception too..)
Look how easy it was to implement dreaming,
in this game that didn't have any notion of "save" or "restore"!
runDream :: M NextStep -> M NextStep -> (S -> S) -> M NextStep
runDream sleepcont wakecont wakeupstate = go =<< sleepcont
where
go (NextStep v ms) = return $ NextStep v $ Just $
maybe wake (go <=<) ms
wake _evt = do
modify wakeupstate
wakecont
Fun comment thread on reddit

My LTS February
In February I didn't get much LTS work done, as other projects grabbed my attention. I started working on
Between december 9th 2014 and march 9th 2015 I ve been working as an intern for Debian on Improving AppArmor support in Debian.
Progress
Before the internship started, I had no clue about AppArmor at all. Reading the Wikipedia page and the
Dear 




finally, some simple RC bugs appeared, & I could contribute a bit
towards the jessie release:






I was writing in the
My monthly report covers a large part of what I have been doing in the free software world. I write it for
In May, the DebConf15 Team held a competition to design the logo for
DebConf15, which will take place in Heidelberg, Germany. We received
Over the past week I've mailed many of the people who had signed my previous GPG key and who had checked my ID as part of that process. My intention was to ask "Hey you trusted me before, would you sign
There is no question that ESXi uses a lot of Linux kernel code and
drivers. The question as I see it is more around the interface. The
vmkernel provides a well-described API known as vmkapi. You can
write drivers directly to this API; indeed some do. You can download
a
There was also a small syntax bugfix, but functionally nothing has changed because bash was doing the right thing even with that small error.
If you have started using Occasional Rsnapshot, you definitely want now Occasional Rsnapshot v1.3.1. If you haven't started and you don't have backups, please start doing backups, and while you're at it, you might want to try Occasional Rsnapshot (with Rsnapshot).