PS2 Homebrew and Tyra: First Impressions

Please complete the required fields.




I’ve been recently looking into doing some PS2 homebrew. The PS2 was one of the consoles I grew up with so the idea that I could develop games for it sounded interesting and also I have a vague idea for a play script based around 2 characters reconnecting over a video game and if I can get the hang of it I may be able to bring that script to stage way easier than I could if it was written around a game which I do not hold the rights to. That, however, is far in the future plans.

So as far as homebrew tools go the PS2 seems to be a weird one to work with. Something which a lot of developer forum posts from the early 2000s seem to agree with. There’s a lot of posts out there that’ll sum it up better than I ever could but the long and short of what I’ve found out so far is:

  • The PS2’s GPU equivalent is split over 2 devices: The Graphics Synthesizer (GS), the bit that actually does the rendering, and the second Vector Unit (VU1), which is a coprocessor you can run shaders on to manipulate things before it gets to rendering. There’s also VU0, which is the same but isn’t connected to the GS in any way, just a coprocessor to hand other vector math off to.
  • Programming the VU doesn’t really fit any of the estabilshed standards of the late 90s that eventually evolved into how GPUs are programmed today.
  • There’s multiple ways to call the PS2’s Graphics Synthesizer to render things and the most round about way is the fastest.
  • The PS2 has practically no VRAM but can stream data to the GPU incredibly quickly.
  • There’s no hardware for clipping polygons to a fustrum on the PS2. Paradoxically this means that models with more polygons are faster in some situations that models with less polygons as it’s easier and potentially faster to just cull polygons that fall outside of the fustrum and hope they’re small enough to not be on screen when you do it vs manually clipping things in software.
  • The PS2, in general, does not follow the IEEE 754-1985 standard for Floating Point Arithmetic. Working with floats on the PS2, Infinity and 0 are handled in entirely different ways to code running on pretty much any other computer. Like I said. Weird.

I’ve dabbled with engine programming in the past but this isn’t really anything like what I’ve dealt with in the past so I decided to look around to see what tools were available. Specifically I was hoping I could find an engine of some variety so I could jump into actually developing software quickly. I’ve been trying to get into the mindset of integrating more free-to-use libraries into my projects to speed up development time. Why reinvent the wheel when you can get angry at someone else’s wheel? Anyway, what I found was an engine called Tyra. Tyra is a small C++ engine that handles rendering, music, asset handling, and I/O, with the promise of creating an engine that anyone could pick up and make a program with with a couple of hours work. Also it uses containers via Docker, so I don’t have to install more crap on my PC to get it all compiling, which I am very happy about. Through Tyra I also discovered the PS2DEV sdk, a PS2 homebrew sdk and toolchain dating back to 2001 that Tyra is ultimately built on top of. Like I said I wanted to jump into developing software rather than grappling performance out of some weird architecture, so I’m not going to be diving too deep into PS2DEV but if that sort of thing is something you like messing around with, then it’s out there.

Messing around with Tyra has been interesting. It supports all sorts of pngs, wavs and obj models, but its options for animation are limited. Animations can be done either using a different obj file for each frame (doesn’t feel particularly efficient) or the MD2 model format used by Quake 2 (seems more efficient but the best way I could find to make these was to download a very old version of blender and export them from there using a script that doesn’t work with modern blender. So much for “I don’t have to install more crap”). Or simply breaking character models into parts and moving them around like an N64 game. I’m sure more options will crop up with time but it’s the current set of limitations to work around. There’s no boned animations in there. That’s going to be interesting to work around. My first attempt at making something was simply taking a PNG and a model and swapping between them using the X button. Not exactly a game but it gave me a good level of experience with the basics of how to use the rendering and input APIs. It also crashed PCSX2 a lot so… I’m not sure how much of that is down to PCSX2 (probably some, especially as there’s been a big change between the current and last major releases), how much is down to Tyra (it’s in active development and stability isnt 100% there yet) and how much is down to me (Probably a lot as I still have much to learn about this). However it did run so I’ve been emboldened to have a go at designing a bit of a demo game.

I want to make something loosely riffing off of Runescape’s Tutorial Island. Just a small sort of environment where you run around trying out different mechanics. Tyra doesn’t have a solution for physics or collision yet, and because of the whole weird Float thing I imagine I’ll have to implement something myself rather than finding a library to handle it, so my rough plan is to:

  • Implement a heightmap based mesh creator. Basically something that’ll load up a texture, my planned shape for the island, and output a mesh.
  • Add heightmap collision using barycentric interpolation. Nothing too fancy, Just something to push the player up to the height of the model, and block them from going up cliffs or into the water.
  • Some sort of extra collision system for buildings. Because I don’t think the player needs to have a collider it’ll be linecasting against something.
  • Some sort of animation state system, swapping between MD2s and handling any in-parts animations.
  • Make a character controller that implements moving and animating with all of the above.
  • Also a 3rd person camera. My favourite game from this era was the original Ratchet and Clank so 3rd person adventure and PS2 kinda stick together in my mind.
  • Come up with some attraction “Quests” to scatter around the island. Mostly just experiments for me rather than anything coherent.

At the moment I’m messing around with the heightmap system but I’m kind of waiting for a PR to be merged into Tyra that’ll add FreeType support. I can imagine having that’ll make it a lot easier for me to debug my heightmap code.

So, PS2 Development with Tyra, what do I think? It’s interesting and I think I’ll be messing around with it for a while. Especially if I want to get my play script finished.