r/learnprogramming • • 18h 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 Upvotes

45 comments sorted by

75

u/nathan123uk 18h ago

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

3

u/Random_182f2565 18h ago

But did they have some framework or something?

6

u/nathan123uk 18h 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#

1

u/combustaoinstantanea 16h 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 5h 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 16h 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 18h ago

Unity is just a bunch of scripts in a trenchcoat?

4

u/xarop_pa_toss 17h 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 18h ago

That, and an interactive editor

19

u/desrtfx 18h 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)

9

u/dynamiteSkunkApe 18h 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

4

u/Random_182f2565 18h ago

So I can make my own PS2 games?

4

u/xarop_pa_toss 17h ago

Absolutely

2

u/ooqq 8h ago

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

57

u/tcpukl 16h 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.

13

u/dankmeister666 15h ago

Ur a legend m8 tyfys

4

u/TobiasCB 5h 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.

2

u/tcpukl 3h 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.

•

u/ExternalLavishness37 45m 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?

7

u/Clippy_4060 18h 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 17h 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

5

u/xarop_pa_toss 17h 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 16h ago

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

Lots of assembler still though.

4

u/xarop_pa_toss 16h 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

4

u/pigeon768 11h 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 6h 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 1h 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.

1

u/tcpukl 1h ago

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

→ More replies

7

u/tcpukl 16h 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 16h 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!

3

u/tarix76 10h 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...)

2

u/scriptmonkey420 12h 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 6h 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 3h ago

The PS3 used a custom CPU made by IBM.

1

u/whatThePleb 5h ago

For sure also a lot of inline asm.

20

u/tarix76 10h ago edited 8h 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.)

4

u/fromwithin 1h ago edited 59m 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.

5

u/Comprehensive_Mud803 14h ago

C and C++, mostly. Probably bits of Assembly sparkles on top where needed.

5

u/ooqq 8h ago edited 30m 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

4

u/Comprehensive_Mud803 14h ago

Unreal Engine 2 and other engines existed, but most games were made from scratch using the provided SDK libraries and in-house libraries

3

u/deathreaver3356 8h ago

2

u/kat-tricks 1h ago

i was just about to comment this! Apparently someone maintains a version of GOAL that builds for x86_64 🤔

2

u/lainwindforeskin2007 11h ago

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