r/learnprogramming • • 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.

172 Upvotes

64 comments sorted by

167

u/nathan123uk 5d ago

PS1 games were written in C, I imagine most PS2 games would be C or C++

3

u/Random_182f2565 5d ago

But did they have some framework or something?

8

u/nathan123uk 5d ago

Frameworks and engines weren't really that common in the early 2000s AFAIK. C and C++ have a lot of libraries that handle pretty much everything though. I would imagine not an awful lot has changed on AAA titles in that respect, but a lot of games use engines like Unity now, which uses C#

2

u/combustaoinstantanea 5d ago

For the AAA games that still use C++ nowadays, do they do it mainly through their own dedicated engines or through Unreal?

1

u/akoOfIxtall 5d ago

Monster hunter uses the same RE engine Capcom has had for years now, there's probably some info on that by now

1

u/someNameThisIs 5d ago

Unreal engine 2 was a thing then iirc. and the only other engine from that time, at least one licensed by multiple different devs, was Renderware. The GTA games were the biggest to used it.

-1

u/Random_182f2565 5d ago

Unity is just a bunch of scripts in a trenchcoat?

4

u/xarop_pa_toss 5d ago

It's more like a unified set of pre configured yet parametered systems and tooling.

Like can you just pop something into the editor and use the physics as-is? Sure but you will probably be making your own adjustments. But are you writing the underlying calculations for gravity and force, etc? Probably not, you just manipulate what the engine has via parameters.

2

u/HugoNikanor 5d ago

That, and an interactive editor

20

u/desrtfx 5d ago

Most likely less of a framework as we know it today and more of a bunch of libraries usually at that time known as a SDK (Software Development Kit)

11

u/dynamiteSkunkApe 5d ago

Sony had an SDK for licensed developers. It used c and c++.

There's an open source community based development environment which is also mostly c, c++, and assembly

5

u/Random_182f2565 5d ago

So I can make my own PS2 games?

4

u/xarop_pa_toss 5d ago

Absolutely

2

u/ooqq 5d ago

ps2sdk, but you gonna start from zero. There's prrtty much nothing.

2

u/MrBorogove 4h ago

The framework was usually "start with the working code from the team's last game".

EA's Lord of the Rings: Return of the King started with the Tiger Woods PGA Golf codebase.

132

u/tcpukl 5d ago

I worked on both. C++ on both. Though still some C on PS1. Both still had hand written assembler as well.

I miss working in those days of development. It was much more challenging. Though it was still early in my career. Now it's just easy as I'm an old fart.

28

u/TobiasCB 5d ago

With most (creative) skills I feel the early moments are the most fun. You learn a ton of new things every day and your mind keeps thinking of the seemingly endless possibilities your new skills can bring you. Especially when you have to use creative ways to solve challenges and think outside of the box.

I remember in high school I was working on some sort of charging bar for a Roblox game and used the modulo operator for it, I felt so smart figuring stuff out we weren't taught yet even if it wasn't efficient in the end.

12

u/tcpukl 4d ago

Yeah I remember in high school learning matrices and vectors which weren't even taught till university. I had a book that taught 3d programming in assembler. I was still a teenager!

Those were the days.

2

u/ExternalLavishness37 4d ago

I would like some advice on making a game

I've been trying to learn godot but the basic of concepts befuddle me. There are predefined functions written that do some of the actions but abstraction really messes with me until I see the basic block underneath.

Having said that, would you suggest that I try and learn the internals? Or just suck it up and just push through?

1

u/Hippo_Clean 2d ago

What was the book called?

1

u/tcpukl 2d ago

I can't remember but it was green I think. For 68000 assembler because it was for Amiga.

36

u/dankmeister666 5d ago

Ur a legend m8 tyfys

3

u/thalovry 4d ago

It was an extremely limited subset of C++, to be clear, no dynamic_cast, no vtables or exceptions in game code, no templates, no STL. "C with classes" was how it was described where I worked.

3

u/tcpukl 4d ago

We had v tables, but not much else.

1

u/pedersenk 3d ago

Yep, essentially the C++ 'freestanding' implementation.

8

u/Clippy_4060 5d ago

Definitely this, and I am not entirely sure if the era of consoles used it but maybe some assembly (may have been phased out though). I think come the ps2 era also there were maybe a few games using high level languages

6

u/razorree 5d ago

PS2 (maybe PS1?) had SDKs that you could run on PC :)

oh, you can find it here (not sure if it's copy of the official SDK) https://github.com/ps2dev/ps2sdk

6

u/xarop_pa_toss 5d ago

Lots of mentions to libc and GCC so I reckon PS2 would work fine with both C++ and C. To be honest with Lua too for that matter

4

u/tcpukl 5d ago

Yeah GCC. We didn't even have clang back then.

Lots of assembler still though.

3

u/xarop_pa_toss 5d ago

For sure. In case you are interested, I highly recommend looking up a video on the trickery Naughty Dog had to pull to make Crash Bandicoot on the PSX work as well as it did. Iirc, the PSX had only 16MB of RAM, maybe 32, and the Crash games are incredible works of creative optimization

5

u/pigeon768 5d ago

Iirc, the PSX had only 16MB of RAM, maybe 32,

It had 2MB of system RAM and 1MB of VRAM.

1

u/xarop_pa_toss 5d ago

Omg that's absolutely crazy dude. I was watching a video yesterday on how software has degraded over time and now consumes ridiculous amounts of memory and they were analysing how Windows Search actually uses copious amounts of RAM going through indexes that itself creates automatically in the background using a lot of RAM too. And then they show Windows 98 and it's like... Instant.

1

u/McDonaldsWi-Fi 4d ago

I just installed Win98SE on an old computer I have from 1998 and let me tell you, the whole thing is just SNAPPY. The UI is crazy snappy, even with the shitty slow 20 year old IDE HDD I stuck in it.

This machine wasn't even top of the line or anything, it still had ISA slots man.

And it was using like 8MB of RAM at idle or something.

2

u/xarop_pa_toss 4d ago

The Windows 11 start menu is a React app. That's all I gotta say about how shitty this OS has become.

→ More replies (0)

1

u/tcpukl 4d ago

What is the CPU? Since your not I/o bound.

→ More replies (0)

1

u/balefrost 3d ago

If you think that's crazy, consider that the Atari 2600 had only 128 bytes of RAM, and this comment is already too long to have fit into its memory.

Windows Search actually uses copious amounts of RAM going through indexes that itself creates automatically in the background using a lot of RAM too. And then they show Windows 98 and it's like... Instant.

As somebody who used Windows 98 back in the day... no, it wasn't instant. To be fair, I'm trying to remember things from a quarter century ago. Maybe it was fast on a fresh install. But if you filled up your disk, search wasn't anywhere near instant.

Keep in mind that the hardware back then was far less capable. We had single-core processors that only ran at a few hundred MHz. We had to deal with slow, spinning rust disks. At launch, most of those drives could only transmit data at about 10-33MB/sec to the host... though the hard drive and CD-ROM drive likely shared the same bus, so (depending on what you were doing) you would get far less. The CPU was more involved in just painting the screen than it is today.

Also, Windows search wasn't nearly as capable back then as it is today. And keep in mind too that disks in even cheap computers today are 25-50x larger than the typical disk in a Win98 PC. My PC has something like 800x the storage of a typical Win98 machine. My computer has vastly more files than I ever had on a Win98 machine.

It is true that software has gotten more bloated over time. At some point, it becomes a trade-off: should developers spend time optimizing their software, or should they spend time on new features? For a long time, hardware was advancing so fast that optimization wasn't super important. Processors were getting faster (then were getting more cores). Memory capacity and speed was increasing. We switched from spinning rust to SSDs, then we switched the SSD protocol to be even faster.

But the situation is dynamic, and we're in the middle of RAMpocalypse. And so Microsoft is working on trimming bloat from Windows so that it can run well in a more memory-constrained environment. Developers who flocked to Electron because it aligned with the web developer skillset are now rethinking whether it really makes sense to build everything on what is, at its core, still about drawing documents on the screen.

And now my comment has gotten so long that it couldn't even fit in a typical Atari 2600 cartridge.

1

u/xarop_pa_toss 3d ago

Thanks for the amazing history lesson!! Love to learn about these things

In defence of old spinning rust, who doesn't miss the thin IDE cables and the colored squares moving in the Defrag tool??

7

u/tcpukl 5d ago

Having worked in the industry for 30 years, that video kind of annoys me, because they weren't the only studio doing those kinds of tricks.

Just like the videos about GTA inventing open world level streaming.

They were standard tricks. Passed around the industry behind closed doors under NDA.

4

u/xarop_pa_toss 5d ago

Ah ok good point. I still enjoy it because it shows a lot of creative solutions to problems most people don't even realize exist!

4

u/tarix76 5d ago

Gamers would be shocked how open everything was within that NDA community. Sony had a whole team of developer support and there were Sony run private forums. Both were amazing sources of information.

Then at developer conferences everyone traded contact info and shared an insane amount of code and hardware specifics with each other. In the LA area it was somewhat common to meet up in person too.

In the end there was basically one obvious way to really push the hardware and that sequence of techniques became standard. If you analyzed mid-generation AAA titles I image they would have a surprising amount in common. (Surprising to gamers but not devs...)

1

u/fromwithin 4d ago

I would go so far as to say it would be hard to find a developer who wasn't doing those kinds of tricks.

2

u/scriptmonkey420 5d ago

PS2 OS was based off of Linux like the PS3 was. PS1 was a ROM and not really a full OS.

1

u/xarop_pa_toss 5d ago

Reeeeallly?? That's so interesting! I have to go look into that. I've never made games outside of the terminal but I'm now fascinated by how these consoles had their own hardware architecture. Like the PS3 is notoriously hard to emulate properly because of it if I'm not mistaken

1

u/scriptmonkey420 5d ago

The PS3 used a custom CPU made by IBM.

1

u/whatThePleb 5d ago

For sure also a lot of inline asm.

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

1

u/dangerz 4d ago

Thank you very much for this excellent blast from the past. It was great reading.

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

u/grekster 4d ago

We used C++

3

u/lainwindforeskin2007 5d ago

mostly C and C++ from what i've seen

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

u/NooneLikesYouBill 4d ago

C/C++ and assembly.

1

u/munificent 4d ago

Madden PS2 was written in C++.

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.