-
Kotaku picked up on the L4D Twitterbots I wrote. Needless to say, the discussion thread descended into general Valve-baiting.
-
"So why don’t we aim for a new tier – something that takes a chunk out of the 90, to lead it closer to the 9 and the 1? Why not give users a chance to enter something personal and creative, but let the system mediate, moderate and filter it into something useful?" Yes. The 90-9-1 pyramid is actually a very unhelpful metaphor, IMHO, and trying to explore and encourage creativity along a sliding scale rather than an absolute is important.
-
Lots of good stuff in here, and, indeed, most of the blogs I started following this year. Somewhat flattered to have snuck in myself. It's a great starting point if you're interested in the games-crit-o-sphere, and nice that representative posts have been pulled out from each blog.
-
Freddie25 plays the Wind Waker theme, on a selection of instruments, as a Christmas treat for you. It's delightful, and the bit when the nine-part vocals come in is lovely. Proper good, this.
-
"..some tweets were destined for fail." – or, at least, not for public consumption. Oh dear.
Twit 4 Dead: more silly nonsense with Twitter bots.
29 December 2008
As a little post-Christmas present, I thought I’d share a little code toy I’ve been working on recently.
You might know that I’m a fan of Twitter as a messaging bus, and I’ve already built some entertainingly daft bots in my time with it. Recently, I decided to flex my programming skills a bit and build not one but four bots. And, more specifically: four bots that talk to each other.
Enter @louis_l4d, @zoey_l4d, @bill_l4d and @francis_l4d. You might notice that they’re named for the characters in Left 4 Dead.
This is not a coincidence.
One of the most wonderful things in that game (which I’ve already commented on the brilliance of) is the banter between the four player characters. There’s so much dense, specific scripting, and enough dialogue so that it rarely repeats. I thought it would be interesting to see if you could simulate the four players’ dialogue over Twitter, sharing some state between the bots, but also finding a way to make them communicate a little with each other.
Well, a bit later, I worked out how, and this is the result:
You get the picture. They run a scenario, they bump into boss zombies, they find stuff, they get hurt (and help each other), they get scared (and reassure each other). At the moment, there are some dialogue overlaps; my main work at the moment is adding more unique dialogue for each bot. Bill is sounding pretty good, but the rest of them need work. It takes about 2-3 hours for them to run a scenario, and it’s usually fun to watch. (And, as you can see, it makes sense to follow all four of them).
So how does it work?
It turned out that rather than trying to build any real AI, it was much more fun just to simulate intelligence. The bots are state machines; they have a variety of states, which they transition in or out of dependent on factors, and suitable dialogue for each state.
I wrote the bots in Ruby. There are two main components to the twit4dead code: the Actor class and the Stage class. The Stage is a singleton; it’s where the state of the world is determined, and global variables tracked. It’s also where all the probabilities are run from. The Actor class is what each of the bots are, and it’s based on the Alter Ego state-machine library for Ruby. We have a lot of states, rules for transition, a selection of methods to handle being helped or talked to by friends, and a method to choose a random piece of dialogue appropriate to the current state.
All the bots are instantiated from a YAML file. For each bot, I store its Twitter username and password, and a nested tree of dialogue for each state. This means it’s really easy to add new states and maintain the dialogue for each bot. It’s also easy to add new bots – you just create a top-level entry in the YAML file.
Originally, I thought about the bots broadcasting and listening over Twitter, but the API calls were just going to get out of hand, and it turned out that Twitter didn’t like being bombarded with messages and would drop a few over time. So I separated out writing the script and broadcasting it. A small utility generates a script file; each line of this file consists of three delimited fields for username, password, and message to send to Twitter. Then, another program – which I currently run on a screen
ed shell – reads that file and broadcasts one line of it every minute until it’s done.
And that’s it. I have to run it by hand for now, which is fine – it’s more something I fire up every now and then, rather than something you want to permanently run. I originally was going to keep track of loads of statistics – health, zombies in play, etc – but found a cruder set of rules worked much better. Every time they’re in combat, there’s a slim chance somebody gets hurt; every time somebody’s hurt, a friend will rush to save them. That sort of thing. Simulated Intelligence, then, rather than Artificial Intelligence.
Alter Ego turned out to be a lovely library; dead simple to use, and as a result the bots are really nicely modelled (or, at least, I’m very happy with how they’re modelled). The notion of a Stage with Actors, rather than a Game with Players, feels about right, and the modularity of it all is pretty nifty. It still requires a little refactoring, but the architecture is solid, and I’m proud of that.
I think my favourite aspect of it, though, is that at times, watching the bots play together is a little like magic. The first time I saw them talk to each other, cover each other whilst reloading, help each other up after a Boomer attacked, I felt a little (only a little, mind) like a proud father. They’re dumb as a sack of hammers, but they look convincing, and that was the real goal. It’s fun to watch them fight the horde amidst all my other friends on Twitter.
Nonsense, then, but a fun learning exercise about state machines, object orientation, and simulating conversations. State machines are a ton of fun and if you’ve not seriously played with them, I thoroughly recommend it.
Do follow the four of them, if you fancy; I’ll make sure I run them with reasonable regularity, and I’ll be fixing the dialogue over time. After all, I want to keep Francis happy.
-
"I am a terrible gaming evangelist. Every time I think I’m onto something my mind’s invaded by Marcus Fenix and his sweaty, homoerotic pecs, by Cloud and his implausible sword and cod-philosophy and, most poignantly, by me, in my pajamas aged nine playing Tetris on the toilet and by me, in my pajamas aged twenty-nine, playing Tetris on the toilet." And Simon powers straight into /my/ favourite games writing of 2008. Bravo.
-
"I was startled to realize that stock photo and video purveyors actually create material in anticipation of demand… These suppliers of the world's commercial imagery are making bets on what life will look and feel like in the near future." But of course.
-
"The city is here for me to use, and it tells me so." Indeed.
Plans are afoot…
13 December 2008
The latest in a series of dumb experiments with Twitter is nearly complete. The above should give you a bit of a clue; all you need to know is that somewhere in the Twitterverse, it’s the zombie apocalypse, and @bill_l4d, @francis_l4d, @louis_l4d and @zoey_l4d are doing their best to survive. If you think that sounds somewhat similar to Valve’ popular zombie-slaying co-operative FPS, Left 4 Dead… you might be on to something.
You might want to friend them all. More to come, very soon.
-
"Just remember, 'There’s only us.'" Some good analysis; fair and even-handed.
-
"Sometimes you want to follow someone on Twitter, but you don't want them to know you're following them. We present to you TweetStalk ‒ the simple way to stalk Twitter users without having to follow them." Oh for heavens' sake.
-
"A man can only eat so many cheap sniper shots, so many deaths by machine gun from over 75 meters away, so many attempts at a final tricky jump to a tiny ledge across a giant gap, so many degrading restarts… Sometimes I hate games so very much." Sadly, much of this is pretty true.
-
"Introduced by Dr John C.Taylor, Invenit et Fecit" – or, to translate, he invented it, and he built it. Video explaining some of the finer points of the chronophage. Stunningly beautiful.
-
"He calls the new version of the escapement a 'Chronophage' (time-eater) – "a fearsome beast which drives the clock, literally "eating away time". It is the largest Grasshopper escapement of any clock in the world." Stunning new timepiece for the Corpus library. Breathtakingly beautiful.
-
"Computer Entertainment Thirty-Five Years From Today: A solo spoken word performance by Bruce Sterling" Wonderful, surreal, exciting; Sterling's keynote from Austin GDC. Good stuff, and worth a read for gamers, futurists, and designers alike.
-
"This is something I said about Spore a while back, actually. I thought Spore could be a little like what Understanding Comics is to Comics. As in something from the form which uses the form to explain the form." Oh, I like that as an idea. He can be a smart one at times, that Gillen.
-
"I've just finished attending the AIR tour and during the final (particularly funny) presentation, I completed a TextMate plugin that has full API completion support." Useful – some syntax completion, and a shortcut for application preview.
-
"We hijack innocent tweets, subject them to our patent pending penisization process by replacing certain words with 'penis', and republish it for your entertainment. We find it funny."
-
"I was at Aperture Foundation a Tuesday to see a panel about collecting photography, and I haven't been able to get this image out of my mind since." Oh wow.
-
"You might argue that an iPhone without connectivity is, well, an iPod, but its not. To state the (obviously overlooked) obvious – it is a phone without connectivity and that over time the ease and evolving practice of disconnecting fundamentally changes our assumptions of what we can expect from a phone, which in turn alters our expectations about the connectivity of other people." Jan Chipchase on pause buttons and understandings of what "social" means. Excellent.
Making bridges talk
28 February 2008
I’ve written before about how wonderful Twitter can be as a messaging bus for physical objects. The idea of overhearing machines talking about what they’re doing is, to my mind, quite delightful.
So when I found an untapped data source for such an object, I thought it was worth having a poke. Half an hour of scripting later and Tower Bridge was on Twitter. It tells you when it’s opening and closing, what vessel is passing through, and which way that vessel is going. The times are determined by taking the scheduled time for the “lift” and subtracting five minutes for the opening, and adding five minutes for closing – the official site suggests that, at rush hour, lifts should take five minutes to open and close tops.
That’s it, really; it’s just a simple case of scraping some data and outputting it. It’s not a hugely frequent event, so won’t disturb you very much; if anything, it’s just a little insight into the heartbeat of the Thames.
As a note on its design: it’s very important to me that the bridge should talk in the first person. Whilst I’m just processing publicly available data on its behalf, Twitter is a public medium for individuals; I felt it only right that if I was going to make an object blog, the object should express something of a personality, even if it’s wrapped up in an inanimate object describing itself as “I”.
And, if you want proof that it works… how about this:
I’d set the server up yesterday; suddenly, this morning, it twittered into life, and we charged out of the office around the corner to the bridge, where the MV Dixie Queen was getting into position for its lift. As it went through, I took a picture. That was a very satisfying moment.
(Thanks to Tom for helping me bash a crontab and a few other server-shaped things into shape. If you’re interested in the technology, which is really not very relevant, it’s about thirty lines of Ruby that glues together a combination of: wget, Hpricot, John Nunemaker’s Twitter gem, and cron.)
Updated June 22nd 2011 with the new URL for the bot, following this whole series of events.
Twitter: a messaging bus for telescopes (and almost anything else you’d like to overhear)
22 May 2007
One of the things that’s been making me happiest recently has been the fact that Jodrell Bank’s telescopes have been Twittering. These big machines, peering into the cosmos, chattering to themselves about where they’re currently pointed – and that chatter is overheard and reproduced on the web. Obligatory screengrab, in case Twitter is down:
It’s cute, and adds to the growing number of non-humans burbling away on Twitter. As I thought about this, it became clear that Twitter isn’t just “the status message turned into communication” (as I usually describe it), but a human-readable messaging bus.
Continue reading this post…