Reverse Engineering WipEout (PSX)
In 1995 one of my all time favorite video games was released: the original WipEout for PlayStation. The brand new PlayStation produced 3D graphics previously unseen on living room TVs and WipEout exploited its capabilities like no other game at the time. It was one of the pioneering titles of the fifth generation console era.
WipEout's art style was distinctively different from other games too. With the help of the UK based design studio The Designers Republic the game achieved a mature look that was in stark contrast to the comic style found in most other games.
I remember poking around on the CD of the PC Version of WipEout back in the day, looking for ways to modify the game. I was thrilled to find .pcx images of all textures and tried to change one of the in-game billboard graphics to show my name. I wasn't able to get it working.
Now, almost 20 years later, I thought I'd give it another shot.
WipEout Model Viewer – A WebGL Experiment
Extracting 3D Models
I didn't have much experience with reverse engineering any data formats, but given the game's age, I expected the 3D format to be quite simple and straight forward. What surprised me was the many different nuances in which scene models were stored. The track itself was stored separately with a different format, spanning multiple files, yet again.
Knowing the PlayStation didn't have a Floating Point Unit (FPU) I assumed vertex data had to be stored as Integers. Using JavaScript and the three.js 3D Library I quickly whipped up a page that would load one the games's .PRM files that I thought would contain the 3D objects. I loaded all data in the file as coordinates of 3 Integers (x, y, z) and rendered them as a point cloud. This allowed me to quickly shift the stride (the spacing between distinct coordinates in the file) and look for patterns.
What I found was indeed chunks of raw vertex data, along with an object header specifying the object's internal name and number of vertices and polygons in that object. Each polygon is preceded by a polygon header and a chunk of index pointers into the object's vertices. These polygon headers is where I probably spent most of my time. I identified 11 different polygon types used by the game – triangles, quads, sprites, textured or flat, having vertex colors or face colors etc. Two types are still ignored because I couldn't figure out what they were.
The track itself is stored in several distinct files. The most interesting of which are TRACK.TRV, containing raw vertices, and TRACK.TRF containing the track faces as quads of 4 index pointers into the vertices. Pretty straight forward.
Reading textures
Most textures in early PSX games were stored in the TIM image format, containing data straight in the PSX' native frame buffer format. A TIM file stores pixels either directly as 16 BPP colors, or as for 8 BPP or 4 BPP indices into a color palette. And indeed, you can find a number of TIM files on the original WipEout CD: the start splash screen, background images, loading images etc. However, the images I was most interested in – the textures used for 3D models - were missing.
Some googling revealed that textures are stored in the compressed SCENE.CMP files. These files contain a very simple header that specifies the number of TIM images in the file, along with the uncompressed sizes of each image. The data itself is compressed using LZ77. I even found some C code in a reverse engineering wiki, that would uncompress these files. With this code quickly ported to JavaScript and poking around in the polygon data to find the texture index and coordinates, I was finally be able to draw textured models.
The textures for the track however were an entirely different beast. Along with the vertex and face data (TRACK.TRV and TRACK.TRF) each track comes with an additional TRACK.TRS, containing Track Sections of some sort, and a TRACK.VEW, containing visibility lists (I think). I spent a lot of time trying to find the texture index for each track face in any of these files.
In fact, the unhelpfully named TRACK.CMP did not contain the track textures. Instead, track textures were stored in a file called LIBRARY.CMP, which seemed to be compiled from a set of source images.
As I painstakingly found out, the tracks in WipEout had Level of Detail (LOD) system, subdividing each track face in up to 4x4 quads when they're near the camera. This was probably done to lessen the impact of the PSX' missing perspective correction when drawing textures. These subdivided faces also used higher resolution textures.
Now, here's the kicker the LIBRARY.CMP file contains about 300 images, but only 19 distinct textures - each in 3 different LOD levels: 4x4, 2x2 and 1x1 tiles, each tile being 32x32 pixels in size. And, as if that wasn't complicated enough, these 4x4 and 2x2 tiles are not stored in the right order. Instead, yet another file, LIBRARY.TTF, stores indices into the LIBRARY.CMP to compose these 4x4 and 2x2 versions.
Knowing that the texture index has to be between 0 and 18, I found it stored as a single byte along with each track face. I also found that another single byte for each track face specifies a few flags for that face. The most important one for drawing: whether to draw with flipped X texture coordinates.
Wrapping up
Finally, I had a complete, textured, vertex-lit scene and track. Using three.js drawing everything was a no-brainer, as it happily lets you create models of all kinds of different polygon data. I also wanted to have a simple fly-through animation for each track. three.js was tremendously helpful to create a smooth camera spline along the track. The optional orbit controls for three.js are top notch, too. They just work without any modifications on mobile and touch devices.
With all the work that went into this project, handling the WebGL drawing with three.js turned out to be one of the simplest parts.
The finished WipEout Model Viewer loads all the original data files and does all the binary file reading, unpacking and scene creation in JavaScript.
All in all, I wrote about 800 lines of JavaScript to load and draw 3D scenes for a 20 year old game. I wonder how big the original WipEout sorurce is. It's quite sad that probably nobody will ever see it again, considering that it now belongs to Sony.
Full source on github: github.com/phoboslab/wipeout
44 Comments:
Impressive work!
Amazing work. Well done.
Very Cool
What a great project. It looks fantastic.
I would even pay some real money for a full WebGL conversion of the game (do you hear that Sony?!).
Totally incredible. Fantastic stuff! <3
Emulate the PS One - all you need is...
www.epsxe.com/
Brilliant work! - Any chance you could do Destruction Derby next? :-)
Absolutely excellent work, what a great new way to look at an old classic! Can you do Wipeout 2097/XL and Wipeout 3? It would be very interesting to look at those tracks the same way!
That's impressive. Looks absolutely stunning in full screen.
This is great, and it even plays well on mobile. I threw together a WebVR mod, which I will gladly share if anyone wants it. But it is guaranteed to make you want to throw up.
This is exactly what I want them to do with PS1 classics, simply make them look like they should in the correct resolution (doesn't even have to be widescreen (60fps and no warping)
However, the warping needs to be an option to turn off and on, but atleast fix the resolution problem. these and ps2 games look so much worse on an hdtv.
would be nice if they coud fix fog and draw distance. while adding in thins to fix the barrier issues. amazin.
This is really great. Not only were you efficient w/ only 800 lines! But the fly-through runs smooth, and ColdStorage himself commented!! Open WipeOut 2015.
Excellent work, brings back a few memories
Respect, a very high work project. ( and btw a very nifty game ;))
A blast from the past! 20 years on the clock and it still looks fresh. Thank you a lot!
Totally awesome!
Cold Storage - Tentative, possible for audio?
Outstanding work. I would love to view this with a VR headset!
Simply awesome to be able to revive this game on a browser. Great job!
Oh god, my hands are twitching with the desire to play this.
Impressive work.
(Wipeout is one of my favourite games of all time, I played it obsessively until I could finally beat it.)
HatsOff!!
Well done man...
Wow! Impressive. And what are you waiting for? Go write your name on the billboard!
Awesome. I'm blown away. Gorgeous work.
I too was amazed and felt this was one of those series at the start that just "sat right" the whole package. Although 2097 was my favourite, I respect the whole series.
That era of gaming just brings back so many memories. I have 3 distinct eras I can close my eyes and fly back to. The Megadrive times that I just used to love as a child, the Wipeout, Tekken, Destruction Derby and to an extent the MGS / Gran Turismo later PSX time and the Battlefield times when I first played BF2 and literally thought "this is everything". Although, 2142 is still my favourite.. again, something with a fond futuristic love must be inside me.
Did you ever get your name in the billboard here? - I've looked, but can't find it :)
Holy crap that brought back memories. I played that level over and over in a Wipeout demo.
Świetna robota, pozdrowienia z Polski.
Awesome work! It's always good to see there's more PSX reverse engineering :-) I did a similar project for Vagrant Story: github.com/morris/vstools - it supports character models, map files, and (partly) animations.
This is amazing, great work
<3 Wipeout <3
That is fantastic. great work, It brought me back as well as this was one of my all time fave games that stil stands the test of time. 2097 was great as well. Remember they also made a game called rollcage which was great too. Not many games like that any more.
Thanks foe making my week.
This is awesome! Congratulations for your work.
A wonderful piece of art ...
of hacking you did there; and i fully agree with your opinions.
Although i would push it further:
Besides the stark contrast to comparable games at that time, i would state it Generic and Unique at once.
WipeOut ever was a masterpiece and what Designers Republic created, was an atmosphere that punched the whole industry and any potential player straight into the face;
Like Blade Runner impacted at cinemas and blasted viewers with its reinvention of a classical tale, if in terms of modelling, showcasing or just 'the inbetween'.
To me WipeOut was 'THE INBETWEEN', that ( before it was released ) to the world wasn't imagineable at all.
The perfectionism and love to detail, especially when kitting and fitting components that can't be glued neatly, remembered me of creations like Turrican on Commodore 64, or Katakis; It looked to me as if the designers have used similar techniques, to span the arch over gaps given by the architecture of the platform.
Not many games have been constructed with that love for 'too new to be understandable' and 'too old to reconsider retrofitting';
But WipeOut was not just a fascinating 'Otherwise Perspective' to the Racing Genre.
It grewed emotions ( in my opinion ) , based on a not-anywhere-ever-again-reached 'FEEL OF FUNCTION' by an unbelievably realistic/humanoid traction to the Analogue JoySticks of the Dual-Shock-Controller. Though that was the most disturbing thing for most players, as the masses were used to play straight digital. If you ever played a paddle-controlled PONG you might understand what i try to describe. The sumpy feel, the swampy reaction, the drifting decay of Velocity ... With that you could even beat and wipeout those hemp-fueled racers who prefer to play days in row until reaching perfection, with nothing but most-efficient minimal ticks to the digital-cross, steering blind-flight.
- Not to mention, the SoundDesign and -Tracks, the artwork, the UserInterfaces ( especially in Part III of this Epic Series ).
On point ? Perfect .
Not many titles have been that hilarious at giving a feel of Speed and nervously tremending hope of please-do-not-crip-at-that-corner. And though shocking to the max, when fully cracking up in the midst of superb Turbo-per-Turbo-per-Turbo-Boost, it ( in comparison to other racing games ) never spend the feel of 'now you can forget it at all' - it trimmed players to try to go on from crash-site instead of heavily practicing restart-game-combo-techniques.
Woah, sorry; That was a load. It seems i ran wet just by reminiscing that masterpiece.
Let me say thanks to you for a creative work on something that deserves to be held alive.
PAETH CLAUDDIUSRAPHAEL
S466531257 BOSS
Man sorry if I sound like a pussy but I'm getting teary eyes. Just one week ago I remembered about this game (well, the three PSX entries of the series) and a lot of curiosity about its development came to me. So I started digging for interviews and stuff like this. And today someone posted this in a forum and I'm just blown away, it's a lot more than what I expected to find. Big Kudos to you for making this, it's absolutely cool. Also greets to the Wipeout devs wherever they are (CS seems to be here you rock man).
Thanks everyone..
This was amazing to look at.
The only things I could possibly request are to do the same with 2097's assets, and to make windows screensavers out of them both.
I'm loving this so much!
Come introduce yourself over at www.WipEoutZonE.com!
Well done sir. As one of the developers (I was actually on Krazy Ivan but helped a little on the tech for Wipeout here and there and I worked on Wipeout Fusion for PS2) and a keen reverse engineer, I must say you have done an extremely good job.
Fathoming out how to store and render the (in those days) large data sets required us to get quite creative in how we stored stuff as we tried to cram as much as we could into every last bit and byte.
Most of us were fresh out of university too so it was all very new to us but the fact you've managed to figure out every twist and turn is impressive to say the least.
Thank you for that excellent blast from the past. :)
Now that we're finally able to render the textures in real time on any device, I'd love to see someone mod WipEout 1-3 with some sexy HD texturing for emulator-play.
Ohhhhh man that would be fantastic.
PAETH CLAUDIUSRAPHAEL - FYI Designers Republic didn't design this game they just provided the Graphic Design direction - it was made in Liverpool UK, by a team of awesome people at Psygnosis, which later went on to become Studio Liverpool for SCEE.
Hello, I'd like to point out that the fly-view sometimes goes under the track on Firefox 37, under Linux Mint (uname -a: Linux 3.13.0-37-generic #64-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux) (I am using the open source radeon (r600) drivers on a Radeon HD 5670 if that matters)
Awesome work, thanks
This is our generation's version of making ships in a bottle, isn't it? Technically impressive and perhaps to an outsider a waste of time. To those for whom it meant a lot, incredibly evocative and powerful. Thank you so much for this.
Wow, thank you so much. I loved the game and I was very impressed to see the graphics from DR back in my Browser!
Have you considered taking a look at the tracks from the Windows port of Wipeout XL to see if the format is the same? It would be interesting to be able to swap in the tracks from the original to XL in that fashion.
Complete guess, but maybe the last two polygon types specify where the power-up pickups are?
Amazing this is one my favorite games and to see it like this made me feel young again. Great job thanks for sharing
Currently exploring Wipeout 3's files to see if I can use your work on that game too.
Excellent job!
Very interesting post.
Hello from C# : postimg.org/image/s9d6qtauf/
Thanks for sharing this !
Post a Comment: