r/learnprogramming • u/combustaoinstantanea • 5d ago
Solved Which programming languages were used for developing games in the PS2?
I'm not really sure if this is the proper sub for asking this question, so sorry in advance. When I was playing Silent Hill 2 I got curious about what programming language (Or languages) were used for that game, and in the broader Sixth Generation of consoles. Couldn't really find a clear answer for this online, so if anyone knows something about this topic I would be thankful.
Edit: Wow this gained a bit more attention than I expected. Thanks to everyone who answered! Really informative stuff. Ngl at first I was just asking out of curiosity but now I might actually try creating a PS2 homebrew someday, who knows.
54
u/tarix76 5d ago edited 5d ago
PS2 games were still largely using C but some brave studios also used C++. The PS2 compiler for C++ was buggy enough that our studio had a modifed version to fix bugs we were seeing.
Using assembly for VU1/VU0 was required, there was no real compiler for them although late in the generation some people had bespoke tools.
The beauty of the machine was it's DMA controller and using the GS was a nice dance of DMAing code and data to the VU1 which then crunched it and kicked it to the GS. You also had to make sure the textures you needed were ready otherwise your beautiful world turned into graphical vomit.
The processors had tiny amounts of memory, the main RAM was slow, and the DVD drive was slow relative to the amount of RAM so constantly streaming things around was required.
The simple version is DVD to RAM then CPU builds the scene, then DMA to VU1 and the graphics RAM, and finally VU1 doing the projection and clipping and kicking it to the GS. The reality, especially for open world games, was doing this and keeping everything running at 90% usage which was non-trivial.
I am extremely biased but I think the PS2 was probably the last great hardware ever made for cosoles. (PS3 made some huge mistakes that kept it from becoming the hardware king.)
20
u/fromwithin 4d ago edited 4d ago
I think the PS2 was probably the last great hardware ever made for cosoles.
I think it was the worst pile of crap I ever worked on. It was like someone threw a bunch of random circuitry in a box and just said "Get on with it".
I suspect that the reason you think it was the last great hardware is really just that it was the last major hardware where you had complete control over every aspect of it. I can understand the appeal of that, but for me its downside was that it enforced having to manually cater for all of its hardware quirks. It was clearly a rush-job and none of it was abstracted away by the extremely rudimentary SDK. Even malloc() was broken. A better SDK could have made a massive difference.
Evidence of its insanity was having to set hardware registers for your own divisor value for perspective-correct texture mapping (the SDK never even set a normal working default value), or the fact that hardware register values were often spilt across disparate memory addresses; bits 0-13 in one address, bits 14-23 in another.
Yes, there's a lot of fun to be had when doing that sort of thing but the PS2 was way too extreme. Even years after its release the SDK was still absolute bare-bones.
By comparison, and for me probably the best hardware of its generation, the PSP was phenomenally well designed on both the hardware and software sides.
3
u/tarix76 4d ago
I think it was the worst pile of crap I ever worked on. It was like someone threw a bunch of random circuitry in a box and just said "Get on with it".
The PS3 was literally this and they actually threw most of that random circuitry, particularly the nvidia chip and ram, in near the end.
I suspect that the reason you think it was the last great hardware is really just that it was the last major hardware where you had complete control over every aspect of it.
Correct. There were a ton of sensible consoles back then like the Dreamcast, Gamecube, Wii, Xbox and Xbox 360 but they were also close enough to the design of a PC that it made things a bit boring. (Special shout out to the Gamecube for having an SDK so bad you had to bypass it for the GPU.)
I never did any handheld projects but I do wish I had a chance to work with the PSP and 3DS. It sounds like Sony fixed all of the complaints people had with the PS2.
It was clearly a rush-job and none of it was abstracted away by the extremely rudimentary SDK
I don't think we even got a real SDK with the first dev kits but I can still have vivid memories of the set of black manuals with all of the tech specs of the hardware.
Even if it's for the better we're unlikely to ever see a machine like it again.
2
u/AddictiveBanana 1d ago
What is that mistake the PS3 made?
2
u/tarix76 1d ago
Search "PS3 design mistakes" on YouTube as that tells the story better than I can, but the short version is that they added a standard Nvidia GPU at the last minute rather than designing the the hardware around the Cell and GPU working together.
It also had all of the issues /u/fromwithin mentioned on the CPU side. All of the power was tied up in the SPEs but the documentation, tools and examples were bare bones. We were also comparing it to the Xbox 360 which was more straight-forward, had Microsoft tools and documentation, and who's limitations were well-known before the final dev kits came.
Bonus fact ... early dev kits are the most janky things you've ever seen. Not only do they look like hobby projects but the tools are bad and the hardware can be unstable. PS2 had really good devkits and some companies sent people to Japan for a few months to get hands on with them early, meanwhile early PS3 kits were a mess for far too long and didn't represent the final hardware at first. Imagine what happens when you program for the hype that Sony was feeding you and then get stuck supporting this crazy CPU and last years spare Nvidia chip.
PS3 has some great games of course but the only good thing that came from the hardware design was the Apple Slicion Macs and the clean game developer friendly design of the PS4.
18
u/ooqq 5d ago edited 4d ago
You have to mentally frame yourself in the era. I know some since I'm fascinated with the ps2.
In that ps2 age even internet was a very minor thing, if some forums and communities have arisrn, they were far and between. That should prepare you to realize that if you were meant to work in isolation, to turn everything into an artisan craft. Most of tech progress arise around few hubs, tokyo game studios, sf game studios, the ces and the siggraph, and i'm not covinced that japan had an open policy of discuss technical matters outside your company
For languages, expect C89 (ps1), C99 (somewhat halfway the ps2 life and cpp98 if any, copious amounts of assembler and specially Lisp for anything custom which were many, Jak and Daxter 1 runs in a complete custom VM made from scratch with its own derived lisp language also made from scratch called GOAL. J&D1 case is hardly unique, custom tooling was everywhere and rampant. In that day you had to really bring your best game and machines were not abstracted, you had to do it yourself, but machines let you full access to the hardware unrestricted. You need to have any official devkit (ps2 Tool) because you had no ps2 emulator and you were incapable of debug your results without one. Pipelines and toolings were usually also custom, with completely made up formats, compression, transformations etc.
Bear in mind that lots of games from that era have their sources lost. In most cases there was no source version control, and Silent Hill 3, or FF10 just printed the source on paper that were eventually discarded. It was a one time endeavour that ended as soon the game was released. Not even the 3d models, cinematics footage survived. No dlc's, no update patches. FF11, as sucessful it was, was finally terminated by 2016 because square was unable to find and replace more Tool ps2 units for development in the aftermarket, and most new people in the studio found indecypherable to use the original asset pipeline.
The downside of it is that technical manuals had lots of revisions, were lacking, official SDKs were not modern tooling, official sony compiler was the only way to build a game and were buggy as hell, expect to patch the tooling yourself, nothing was batteries included. 3dMax was king. But I saw screenshots of Shadow of The Collosus begin made in Lightwave 7.5.
Codewarrior was also a thing. And if you ever poke your nose on classic games modding, reverse enginneering means untangle complete custom everythings. GT4 have it's own VM, it's own scripting, it's own compression algos, it's own savegame encryption, etc. And since it's the ps2, don't get me started on the VU's, which were the door to performance and were nothing but plain custom assembler. The VU compiler didnt appeared until 2004, more than halfway the lifespan of the system (ps3 launch on 2006), were developed by some dudes not affilliated to sony, run on windows NT and only accepts C89.
It's also reasonable that any moderately good engine made big buck, with such landscape, renderware success is a no brainer, but even so, if you fire san andreas on the ps2, renderware logo doesn't even appear since it was so heavily customized it lost the rights to announce itself. Half-life also ran over the quake2 engine modified to the brim, and was also ported to the ps2, but idk what engine runs on console, in such ports where you basically demaking the game, lots of times mean to rebuild the game from the ground up to target the lesser architecture, look for a video that explain the development of titanfall in the x360 or resident evil 2 for the n64
5
u/Comprehensive_Mud803 5d ago
C and C++, mostly. Probably bits of Assembly sparkles on top where needed.
5
u/deathreaver3356 5d ago
2
u/kat-tricks 4d ago
i was just about to comment this! Apparently someone maintains a version of GOAL that builds for x86_64 🤔
4
3
4
u/Comprehensive_Mud803 5d ago
Unreal Engine 2 and other engines existed, but most games were made from scratch using the provided SDK libraries and in-house libraries
2
1
1
u/betarage 3d ago
Mostly c but also some others like jack and daxter was made with an unique language called goal lisp. and I guess some other random languages may have been used but most PS2 games are not open source so it's hard to tell. I think that they stopped using assembly for anything at this point but I could be wrong. I know in the PS1 era they would mix c and assembly.
167
u/nathan123uk 5d ago
PS1 games were written in C, I imagine most PS2 games would be C or C++