Rock, Paper, Playstation moonlit July 27, 2012 How-To 2 Comments I was just sitting around earlier, as I am wont do in the midst of a night, and I realised that some years ago I’d told myself I’d take a look at writing software for games consoles. So I did. In a few hours I was able to write two very basic games for the original Playstation. I could’ve picked any console, really, there are various legal and somewhat less legal SDKs floating around the world wide web-a-nets and that’s just the one I happened to go for. The specific SDK I used was a legal open source one, available here. Now, I’m not gonna beat around the bush, documentation is sparse. When I say sparse, I mean there isn’t any. At all. It’s also not compatible with the official Sony PSY-Q SDK either, so you needn’t think you’ll get away with it that easily. Anyway, you can install the Windows version extremely easily, and it comes with Cygwin and all sorts of necessary stuff preconfigured for your convenience. That’s about the only thing that’s convenient about it though, because the only way you can figure out what it’s capable of or how to write code to compile with it is to look at the very little example code given, along with a few other bits and bobs available here. With that said, I appreciated the ease with which it was ready for use. It doesn’t take long to download or install, it’s nice and self-contained, and it ran just fine on my 64bit Windows machine. It doesn’t have an IDE, I happened to have Notepad++ already installed, which worked fine in a pinch. It’s no Visual Studio, but it’s functional. It’s at this point I should point out that I really haven’t got much of a clue when it comes to C/C++, the former being what this SDK is built to turn into PS1-compatible binaries. It’s quite nice in that it doesn’t expect you to do any crazy initiation stuff which takes a week to bend your brain around, and the demo code will get you up and running to a vague fashion, enough to get something to appear soon after trying. The final product that this thing generates should be compatible with a real PS1, and I suppose the PS2 and some PS3s as a result of backwards compatibility, but minus the extra functionality of that hardware, natch. However, I don’t happen to own a PS1 any more, and even if I did, it’d have to be a modded one, because PS1s in all their different models aren’t nearly as CD-R friendly as the beloved Dreamcast is. I do, on the other hand, have emulators out the wazoo, so off to faithful old ePSXe I trotted, and not only can it run ISOs which the SDK will helpfully generate and licence for you, it can also run the exe files directly. Not that there’s much difference in practice, but I’d say that the ISO option is probably the way to go if you have to bundle a bunch of images or audio with your executable. Now we have the SDK and the means to run the output. So what can it do? Honestly, I’m really not the best person to answer that. I’ve never worked with any console or SDK to any appreciable degree before, and as I mentioned earlier my grasp of C is… tenuous, at best. What I can do though is show you what I managed to come up with in just a few hours. The first game, as pictured above, is an entirely unscientific single player reaction time test. It counts down from 3 to 1, then you have to hit X as fast as you can. That’s about it. Try and get as close as possible to to the start time without making a false start. It’ll know if you try to cheat, by the way, so don’t be trying to spam them buttons. It’ll also time out if you don’t press anything for a while. Then you just hit circle and do it all over again, trying to beat your score. Alright, so it’s not gonna win any design awards, it’s no Call of Duty or Grand Theft Auto, but for a first attempt at writing for a system I’ve never programmed for before in a language I’ve barely touched, it’s not a bad effort. There’s some quirkiness in the graphical output, but I have a feeling that’s more a result of my emulator settings than anything else, the scanlines really show up. It seems to have something to do with whether the text is drawn every frame or just when required. I also played around a bit with different screen modes, which you can select by using the D-pad, as seen above. It’s pretty simple to change modes, a one liner will do it, you’d probably want to pick according to what you’re actually doing in your game or app, but here I just set it to switch on the fly. Looks a little odd with so little on-screen, but it’s probably super useful if you’re writing a full game. Then I realised I could go a litte further, add some human competition to the mix, so I created a basic two player rock, paper, scissors game. It’s nothing special, but it functions just as you’d expect. Standard rules apply, rock beats scissors, scissors beat paper, paper beats rock. First to 10 wins. Draws give no score. It’s just about as simple as that. I did add a little colour this time though, to try and spruce it up a little. I reckon if you’re really really bored, you sort of squint a bit, and you have no such loyalty, it *might* be better than a few of the lesser-loved BBC Micro, ZX Spectrum, Commodore 64 or Apple II games. Just maybe. Just by a fraction. If you’re crazy enough to want to see my atrocious, inefficient, borderline hangable-offence attempts at writing these games, you can grab a copy of the source and pre-made ISOs for both games right here. The source should be ready to compile, just stuff it in a subfolder in the Projects folder of wherever you install the SDK to, run msys.bat, cd to the subdirectory and then type “make”. That should compile the code for you and spit it out as both a Playstation exe file and a .bin CD image. If you can’t be arsed to go to the trouble of all that downloading and compiling nonsense, the CD images I’ve included work in any good PS1 emulator, or if you’re willing to waste a CD-R on it, a real modded PS1. As I think I’ve made pretty obvious, I’m really not the soft of guy to be pumping out hardcore multimedia demos with this stuff, but I wanted to plant the seed. I don’t think many people consider writing random little apps for games consoles, they’re mysterious sealed boxes that you buy AAA games for, you just put the disc in and away you go. It’s more than that, though, for all its proprietary being, and its copy protection, and its anti-homebrew mechanisms, the console is still essentially just a computer. A computer that you, with the right tools and a few hours to spare, can program. Besides, how cool is it to be able to say you’ve written a classic console game? 2 Responses preciousroy July 27, 2012 Actually, I’ll try it this weekend after i’ve charged my flip cam. Additional Hints and Winks. Log in to Reply RPS2: The Revengening (or Stuff I Learnt About The PS1) | The New Tech August 2, 2012 […] my mind’s eye, reflecting off the phrase “ps1 sdk” sitting in a Google search. I began slowly, it turned out to be quite simple to bash out a simple text-only game, but it also didn’t […] Log in to Reply Leave a Reply Cancel Reply You must be logged in to post a comment.