Skip to content

#PROCJAM PuzzleScript + Tracery Generating A Whole Script

Mon 29th October 2018

After my last post, I started ruminating over what I actually wanted to achieve in this week of #PROCJAM. I realised that while I’m very interested in investigating mechanic generation, that’s quite an involved topic and #PROCJAM is only a jam! 🙂 I remembered that part of the aim of this jam project was to generate all the bits of a PuzzleScript using Tracery, so I spent a little time filling in the gaps.

The latest code is checked into Github.

All I really did was build a main Tracery rule that contained the general structure of a PuzzleScript (metadata, objects, collision layers, rules, win conditions, levels, etc.) then wrote some rules to generate some of the metadata (author name), objects (colour of the block), rules (see previous post), and the level (completely random, probably impossible to win, with a ~64% chance of a background tile and equal chance of being a player, crate or target).

The first Tracery-generated PuzzleScript had 3 players, 2 targets and no moveable blocks, so was not possible to complete 😀

It was quite satisfying to pull all the elements together, and be able to copy the entire script into the editor. Obviously it generates nonsense quite a lot of the time, so as the comment in my last post said, maybe what’s needed here is some utility function to determine if a generated game is “good” (for some value of “good”).

I would like to iterate on this, and refine the generation a little. It would be nice to find a way in Tracery to randomly pick from the bag without putting the value back in the bag (e.g. it would be nice to randomly select the player tile when creating levels, but not to be able to select the player tile 3 times!) It would also be good to find a way to create the same number of moveable crates as targets, but for the number selected to not be pre-determined. I’d also like to add some generation to some of the things that are currently static: collision layers, types/design of objects, win conditions and sounds.

However, I think the next thing I’ll try to do (and possibly the last part of this’s #PROCJAM) is to integrate with the PuzzleScript editor in some way. I’m not quite sure how I’ll do this, but I’m imagining adding a button to generate a script and replace the existing contents will be quite straightforward. Maybe I don’t even need the editor; I might be able to generate direct into the player.

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: