For the second assignment of Console Development 1 at the University of Derby we were tasked with the creation of a 3D demo scene on the Sony PSP. Despite being guided towards using C for this project by our lecturer’s preference, I chose to use C++ because of the ambitious concept of my demo for the allotted time, and my greater wealth of experience in working with C++ over C. I think this was the right decision as it allowed me to put together a rough framework very quickly, and get to the more complicated (and fun) parts of developing my demo. If you’ve looked at much of my work you’ve probably noticed that every damn framework or engine I make is named after a cake or dessert of some sort, and PSPPudding was not going to be left out, even if it was incredibly lightweight, consisting of a scene graph, content manager, and some other utilities.
I chose to base my demo on the closing titles of the risqué animated series Panty & Stocking with Garterbelt. Originally I just wanted to have the two main characters in their car, See-Through, their heads bobbing from side to side to the closing theme, and some scenery passing by. I never got around to implementing mp3 streaming in the first semester, but the rest of the demo came together quite nicely.
The scenery consisted only of road tiles which constantly move backwards and are moved back to the front when they go out of sight. Point lights were used for the vehicle’s headlights, and ambient lighting was set to 0x00000000 so you would never see the ends of the road. I also spawned Mudkips randomly on the road ahead, and put a counter in the top left of your current kill-streak, along with the other statistics required for the assignment. That’s right, you can steer the car left, right, back and forth to squash the little buggers under you wheels. You can also rotate the camera around See-Through for a good look and the scene, and zoom in and out.
I won’t detail the workings of the solution as it was put together over a short period of time using the incomprehensible samples and documentation provided by Sony, so I’m not sure it’s optimal. I did gain a lot of experience with a closed platform API during this exercise though, and valuable general programming practice. I’m also dubious about putting up the source for this, since I’m not sure how much of the API I’m allowed to expose, but since the homebrew API is almost identical, and the PSP is kind of old news now, it should be fine, right?
Well well well:
I’d never used Makefiles before this project, so that was a challenge in the beginning. Once I’d wrapped my head around the syntax and failed to implement automatic dependency generation due to some timing bug, I settled on a solution which used multiple Makefiles to go through headers, src, and assets directories and compile and link any cpp file in sight, as well as convert all of my textures and models and send everything to an output directory.
The PSP is really not very powerful, so I had to be careful with the quality of models and textures I used. The 15 fps you mark in the photographs and videos I provide is the result of a ridiculously high-poly model of a HummerH1 I had to tear limb from limb in order to squeeze into memory. Once it was in memory I continued to strip the model of course – currently it has about a quarter of the number of vertices it originally had, and the textures are much, much smaller. There are a few other slowdowns in the program of course – namely the lack of VFPU use, which I was to discover in the second semester is crucial to efficient PSP programming.
For the life of me I could not get spotlights to look good as the headlights of the Hummer. This was partly due to the lack of per pixel lighting, and low number of faces in the road, but also due to a lack of understanding of the parameters, which the documentation and samples once again failed to assist me in. I mean, two of the parameters in the fog set up function are labelled ‘fog parameters’ on the function’s own page – come on!
Finally, I’d like to have gotten audio working so i could have played a certain theme song along with my demo. I’ve added it on to the video I uploaded to YouTube, but due to time constraints and other looming deadlines, and the lack of any feature-full library for streaming audio, I was unable to implement it proper. I did get this working for my second semester project though.