Generating Roguelikes From The Web

I entered 7DRL for the first time this year, but without a strong library base and enough time dedicated to it (I slacked!) unfortunately my game didn’t come to fruition. However, the interesting part of the roguelike – the tech behind it – did get finished, which means it might be helpful to you – yes, you! – in developing experimental roguelikes in the future. Here’s how my entry, A Rogue Dream, was going to work, and how you can use the code that made it up.

First of all, here’s the code dump in Github

The game doesn’t work well on anything other than my machine, but that’s besides the point. The premise was as follows: upon starting the game, the phrase Last night, I dreamt I was a… appears on the screen, and the player enters a noun. From that noun, A Rogue Dream generates an entire roguelike. Sort of. Here are the two bits of cool tech at work inside A Rogue Dream’s codebase:

Mining Google Autocomplete For Facts

University College Dublin’s Tony Veale noticed that if you ask Google a question, the autocomplete results often give you factual (or at least, interesting/common knowledge) information. You can read more about the technique in his ICCC paper here:http://computationalcreativity.net/iccc2012/wp-content/uploads/2012/05/001-Veale.pdf

This means that if you put into Google “why do doctors”, the autocomplete results tell you that doctors wear white coatssay stat andprescribe steroids, among other things. I used this technique in A Rogue Dream, with modifications, to extract information that might help one design a roguelike. This includes asking extended questions such as “why do ‘noun’s wear” or “why do ‘noun’s hate” to get information on clothing and enemies respectively.

You can find the code relating to this in net.cutgar.ard.coldread. I use the Google GSON library I believe, along with evo-inflector (https://github.com/atteo/evo-inflector) to pluralise words.

Automatically Generating Sprites From The Web

A Rogue Dream generates its own game icons and sprites automatically. It does this using Spritely, a tool I’m building that can mine the web for images and process them into a particular size and format, including recolouring according to a theme.

Spritely is bundled here somewhere as a jar, and you can see the code that calls Spritely in the package net.cutgar.ard.concurrent. Spritely is used in a separate thread so that the sprite generation can be done online in realtime. Of course you can also use spritely during development to generate placeholder art for your games while fast prototyping.

More on Spritely later when I release it as a standalone tool. It’s really only included here because it’s part of the game – I’m not going to great lengths to explain much about it right now.

Where Next

I may explore this idea in the future (probably in the context of my research into automated game design) but you should absolutely have a crack at it too if you’re interested. Take a look at my code, and keep an eye on my Twitter feed for announcements about Spritely’s release within the next month. Spritely is a tool for generating placeholder art, but I hope roguelike devs might find inventive uses for it too, perhaps inspired by A Rogue Dream’s attempts to make an entire game procedurally.

If you want to know more, please get in touch! This is a brief post unfortunately, and the release isn’t as clean as I’d like, but hopefully it might spark an idea or two with someone better at roguelike development than I!

Thanks to all for arranging the 7DRL. I had a lot of fun!

5 thoughts on “Generating Roguelikes From The Web”

  1. This seems awesome. I had the idea once of having a roguelike game with sprites that it got from searching google images. The images would be specified like “orc”, “fierce cat” etc. then they would be looked up on google and put in. It could be shocking or hilarious if you let safesearch be disabled.

    Look forward to seeing what you come up with given more time. Really interested.

  2. That’s downright genius 😀

    It kind of reminds me of the game ‘virus’ that used the file structure of your harddrive to generate the level structure (you started in C:/ and could fly through your folders and into files and stuff to hunt viruses. The walls of the rooms were made from the contents of the file so if it was an image it’d be tiled all over it while if it was a word doc you’d see text from it everywhere)

    Still, very cool :3

  3. Oh my! I just read an article published today on Eurogamer and saw a pic of this game there, then realised you’re the author of ANGELINA XD
    Fascinating stuff :3

    I must admit, the reason I ended up doing this roguelike challenge, outside of giving myself a deadline and goal, was that i’m facinated by a game that surprises it’s creator, aka procedural stuff. It’s not quite as far as perhaps ANGELINA goes, but I guess that’s the most extreme example of it so it was interesting to see how far you’ve come since the days of the template system back when I first heard about it :3

Leave a Reply