Detective

Posted on May 11, 2015

UPDATE: Sorry folks, we are out of robots!

It seems that my access to the Cleverbot API is either blocked or heavily rate-limited. Please stand by while I investigate.

UPDATE 2: So it turns out that the npm package I used was just a scraper and there is no free tier for Cleverbot’s API. I am not really interested in investing money in this non-profit (and quite unprofitable) project, but I will definitely update the game if I find a suitable replacement (be sure to shoot me an email if you know about a free or self-hosted solution).Also, there already is an app that’s quite similar to this game. Oh well.

UPDATE 3: The game is back up, a bigger update post will follow.The original post continues below:—

I really enjoyed working with node.js and socket.io on my last project, /message. I was actually going to work on a similar project, sort of a “spin off”, but I came up with an idea that seemed a bit more interesting.

Detective is a game with a pretty simple concept: there are three “players” in this game: Detective, Robot and an Impostor. The Detective’s role is to guess whether he or she is speaking to a Robot or an Impostor. Impostor must convince the Detective that he or she is a Robot. And a Robot, well, I’ll get to that in a little bit.

*Note: Screenshots below are from an earlier version of the game.**

When you open the game, you will have to wait for a second player – or a Robot – to join in. Once that happens, you will be randomly assigned a role of a Detective or an Impostor. If you are the Detective, as I explained above, you have to ask your “partner” questions that will help you figure out whether you are speaking to an Impostor pretending to be a Robot or an actual Robot.

As an Impostor, you have to answer Detective’s questions in such a way that he or she will think that you are a Robot, which – and here’s the twist – is a chat bot.

So to put it simply, Detective and Impostor are real human beings and Robot is a chat bot.

The Impostor should emulate the way a chat bot would speak so that the Detective wrongly guesses that he or she is speaking to a chat bot (in this game a Robot).Now, a more obvious game would have the Detective guess whether he or she is speaking with a Robot (chat bot) or a Human, but I think such a game would be way too easy considering how “convincing” chat bots generally are. Hence the little twist.

I added a few mechanisms that make guessing a bit more difficult. For example – the way the game works, you have a 50-50 chance of speaking with an Impostor or a Robot. There will be a random delay before the Robot “connects”. There is also a random delay before you receive the Robot’s message – and a whole lot of “clever tricks”, I’m just not going to spoil them here :-)

As for some technical information, as I already pretty much said in the beginning, the game is built with node.js, express and socket.io. The chat bot is implemented through fojas/cleverbot-node and the whole thing is hosted on my “hybrid” DigitalOcean droplet that already hosts my other projects written with PHP, Python/Flask or just using static HTML files. There are no front-end libraries or frameworks – a modern browser is strongly suggested!One feature I am considering is a leaderboard that shows how many conversations players had in each role and how well they did. This – and any other updates depend on the feedback and interest of the players.

I’m still testing the game mechanics, so if you notice any issues – or have any questions or suggestions for improvements, feel free to reach out to me on Twitter or send me an email!