So, the crazy Team SWI-Prolog folks built a rather simple game where you draw houses.
This post is about the tech we used to build it. We enter Ludum Dare just to stretch our technology.
And it worked! SWI-Prolog and CHR worked out great for this. So we're excited.
SWI-Prolog is a logic language - you write down a set of rules for how your world works, and then ask it questions about the world.
The front end of the game is Snap! - just because it was an easy way to build a graphic front end.
When you stop drawing, Snap sends the list of lines to a web server written in SWI-Prolog. Now for the magic part.
The lines come in, and we put them in the 'constraint store' of a system called 'constraint handling rules' that comes
with SWI-Prolog.
We start recognizing things about the lines, and adding things to the constraint store. "Oh, that's a vertical line".
Then we have recognizers that work on already recognized parts - "a vertical line and a horizontal line with one end near each other make a corner" - "two corners whose ends bboth nearly touch make a box" - and eventually "A triangle sitting atop a box is a house". Then we have the prolog send back 'draw a house at x,y'
Our original idea was that you could draw lots of different stuff - and there's code in there for a rocket - as a kind of art game. But you know game jams - we figured we'd best stick with just drawing houses.
@paulbrownmagic made the Snap! game with the wolf and the pig.
And we're getting nice comments about our little game.
Thanks for letting some academic programmer dweebs play with you all this weekend. Your games are beautiful and amazing.
Please play and rate our game. 3 Little Pigs page
