Making Twitter Trading Card Game

twitter-trading-card-game-ttcg

I think it was about a year ago that I added this to my game ideas note in Evernote:

  • Randomly assign all twitter users some pokemon cards (by twitter id), allow trading by hashtag

Well after a year of having life get in the way, realising that I didn’t know how to use php and having to learn it, switching my hosting, and playing weird GameCube shit, here we are.
Three weeks ago I left my old job, and with a week off before starting at my new place I decided to take on the task of finishing what by then was called #ttcg, or Twitter Trading Card Game, and on the 11th of September 2016 it was set live.

So what exactly is #ttcg?

To be honest I think that note I made a year ago does a pretty good job of covering it. Once you know what cards you have it’s just a case of sending a tweet that looks something like this:

@BulchyC POK79 #ttcg

The site takes care of the rest.

So how does it work?

When you log into the site at chrisbulch.com/ttcg with your twitter account the site gets access to your unique user id (I guess this exists so that you can change your account name without it causing problems, as your user id always remains the same), from there it checks your id to see if it already has cards listed in a MySQL database.
If you’re listed in the database, then great! The site loads in all the cards you have. If your id isn’t found in the database however, then your twitter user id is used to seed a random number generator, which then spits out cards for you.
This is a nice set up as using a seeded RNG means that the site only needs to save a user in the database once they’ve sent or received a card, and if someone searches to see the cards a user who hasn’t played yet has, they’ll pull up the same cards that the user will if they ever decide to log in, all without the site needing to keep track of them.

twitter-trading-card-game-cards

Ok so we’ve assigned everyone a bunch of cards, I decided on 24 each to start with, partly because it seemed small enough for people to easily remember more or less what they have, but big enough to get some variety, and partly because it happened to fit nicely into the three column layout I used for the cards.
So now what we need to do is figure out how to trade. I ended up setting up a cron script to run once every 5 minutes (I would’ve liked it to be more frequent but then you start to run into issues with rate limiting on twitter’s API), this searches twitter for “#ttcg”, which happened to be in use already by some Japanese cinema chain but fuck ’em I guess.
So once we have a tweet containing the #ttcg hashtag we need to look for two other things: a recipient and a card, the recipient is easy, it just looks for the first bit of text following an ‘@’, we can do a similar thing for the card by just pulling whatever follows ‘POK’.

Once we have our tweet containing a recipient, a card and the hashtag, it’s just a case of removing the card number from one user in the database and adding it to the other (after a TON of logic of course).
And that’s it.

I did decide to throw in a little something extra when I saw a fun thing I could do though.
Part way through implementing the twitter user id stuff I realised that I could check those ids against whatever the hell list I felt like. So what could be funnier than actually taking a game away from those annoying cunts on twitter that are always accusing people of trying to take their games away?
So a quick shitlist later (the cron job that runs once a day is actually called updateShitlist) and all of those people are blocked from trading, with only one card assigned to them, as a reminder that they need to quit their macho bullshit 😉

twitter-trading-card-game-banned

Softmodding my PS2 with Free McBoot

free-mcboot-ps2-boot-screen

UPDATE 2016/09/24: oh yeah burning a disc and using ESR totally works for the problematic games, just be sure to use the ESR patcher tool on the ISO first. Oh and there’s a completely different compatibility list for doing it this way

Despite having moved out six years ago now, every time I head up North to visit my parents they seem to find more junk from my youth to send me back with. The most recent thing I got saddled with being my old fat PS2.
Now I’ve never been much of an emulation guy, it’s the real hardware or nothing for me, so it’s been a good long while since I got to check out some of the PlayStation 2 classics and maaaann once I picked up a nicer component cable and a new set of thumb sticks did I spend more than a few hours playing The Simpsons Hit & Run, THUG2 and 007: Nightfire. But what about some of the better games that I never got to play? Let’s face it, I was pretty much judging games from the box art and a few screenshots in GamesMaster back then.

Since I had a more or less straightforward experience installing a modchip in my GameCube, I thought it might be worth checking out if anything similar existed for the PS2. Well it turns out that the homebrew scene has been busy, and these days you don’t need to make any permanent modifications to your console at all!

You see, it turns out that the PlayStation 2 was designed with upgradable firmware, a strange little feature that was officially only used once in order to make changes to the DVD player software, an upgrade that was distributed with demo discs at the time (and also took up half a memory card, which might explain why the feature didn’t see wider use).
Well once hackers figured out how this all worked it opened the door for easy softmods, all of which were perfectly reversible by just removing your memory card.

playstaion-2-network-adapter-hard-drive
*Probably* won’t set fire to my flat in the night

It also turned out that with the current firmware (called Free McBoot) you don’t need to faff on with a load of blank DVDs and a spare memory card, and can make use of the network adapter add on and an old IDE hard drive to:

  1. Install Free McBoot straight to your hard drive, saving yourself from filling up a memory card
  2. Load the hard drive up with game backups, saving yourself from burning a folder full of DVDs
  3. FTP those game backups right to your PS2, saving yourself from even having to open up the thing again

So off I went to AliExpress and got myself a cheap knockoff network adapter, and while waiting for that to show up from China I hunted down a 250GB IDE hard drive for a tenner from CeX.
Oh, and I also had to pick up an IDE to USB adapter from Amazon, because to be honest I don’t think I’ve seen an IDE connector since I was a kid.

ps2-ide-hard-drive-adapter
Fuck me what a mess, and that’s not even getting started on my cable management

And here we run into our first mistake, or well misstep at the very least. Just look at that fucking mess. I’m going to need to open up my PC and string together that mess of wires every single time I need to connect the hard drive to my computer. Thanks to the whole FTP thing that shouldn’t be too often, but really I would have been better off getting a dock style connector for the IDE hard drive instead of this thing that needs two different power sources, both for the drive and the adapter itself.

chinese-ps2-network-adapter
Well shit. This is what happens when you buy cheap crap. Nothing some hot glue can’t fix I guess.

Eventually I managed to get the hard drive to detect properly and I copied over an disk image I found, the FHDB “Noobie Package”, which contains every tool I should ever need on my PS2. This was a great find, because otherwise I’d still probably be fucking around trying to find the right downloads now.

With the Noobie Package installed and a ton of games that either I just missed out on, ones that I used to play at friends houses, games have since become cult hits, or even just some bizarre shit that never came out in Europe all copied over using WinHIIP (again a nightmare, if you’re using a hard drive over 120GB make damn sure you’re using the 48bit setting), I think it’s time to check some of this stuff out eh?

free-mcboot-ps2-browser-menu
I have no idea what I’m doing

So with some flashing orange lights on boot (apparently a hard drive access light flashing, nothing to worry about) my PS2 now loads right into Free McBoot! As you can see it’s all pretty familiar stuff, but with a load more menu options now showing up.

There’s some interesting stuff included with the FHDB Noobie Package, including an NES emulator (although I can’t work out how to get any ROMS on my hard drive, I guess I just put them on a USB stick?), and also a tool that apparently should let me force games to run at higher resolutions, but any attempt I’ve made at whacking something up to 1080i just ends in the game loading into a black screen, I guess there are compatibility lists for each game somewhere but to be honest I’m not that bothered about the resolution all that much.

free-mcboot-opl-ps2-game-menu
Like, 95% of this is nowhere near as good as you remember it

Now here’s the thing that I’m really interested in, OPL (or Open PS2 Loader). From here I can run games straight off my hard drive, and even set up virtual Memory Cards so that I’m not having mine filled up right away!
The first few games that I tried out all worked beautifully, loading straight up (super quickly too!) and with no glitches or crashes to be seen. Timesplitters: Future Perfect, Half-Life, Ape Escape 3, Dogs Life and Katamari Damacy all ran superbly!
It’s when I tried to run Tony Hawk’s Underground and THPS 3 (two games that I somehow missed at the time) that I started having issues.

Unfortunately it turns out that compatibility with some games isn’t 100% (THUG crashes after the first level, and THPS 3 doesn’t even boot at all), and if I had known what I was looking for I would have easily found a pretty comprehensive compatibility list for hard drive games online.

katamari-damacy-ps2
Naaaa naa naa na na na na naaa naaa

I’m not that upset that a few games don’t work off of the hard drive, there’s still a hell of a lot of games out there that work perfectly, but for the few that don’t I *think* I might have a workaround.
Google tells me that using ESR Launcher (also included in the Noobie Package) I should be able to launch games that I’ve burned to disc just fine, and well it’s worked out nicely enough with my folder full of Dreamcast and GameCube games so far, so I think soon I’ll be picking up a stack of DVD-R’s and seeing if I can get a few of those tricky ISOs running nicely.

For now though, I’m happy playing some curiosities of the PlayStation 2 back catalogue along with some old classics that aren’t in my collection any more. And it’s always fun getting the Katamari theme tune stuck in everyone’s head.