📜 ⬆️ ⬇️

Playstation: how it was

At the end of the first half of the 90s, the first Sony console, the Playstation 1 or PSX, hit the CIS market. It can be considered unique from many points of view, but for all of us the main difference was probably the fact that at last a full-fledged video appeared in the games, sane 3D graphics, and the possibility will not be saved with a password, frantically searching for a piece of paper (forgive me readers for the awkward comparison that has arisen in their heads), and, as befits a white person, on a digital medium.



In fact, this console marked a quiet revolution in the programming of games. That is what I would like to talk about today. And what's more, if you want to write your game for the console gathering dust in the pantry, thus avenging the creative powerlessness experienced in adolescence, then under the cut you can get an idea of ​​how to do it.
')

Some facts


It is important to know:

Where does the difference begin


Few people know, but programming for other common consoles of that time was a living hell (from the point of view of a programmer who does not have a love for assembler). Gamedev of that time rather resembled modern programming of microcontrollers, with all the ensuing consequences - the lack of a normal interface to the file system, manual generation of sound frequency, access to I / O ports for each operation, and assembler, assembler, a lot of assembler. There were other small pleasures like several processors in one console, or RAM that does not have a continuous range. All the little things you can not remember. The only prefix of that time that could boast of humanism in relation to the programmers was the Panasonic 3DO, which still did not find popularity in the CIS (and the rest of the world, too).
To understand the degree of hopelessness that occurred when programming for the then most common prefixes, take a look at these characteristics:
ConsoleCPURAM capacityMedia RestrictionsVideo memory capacity
Dendy / Nes1.66-1.79 MHz2 KB48 KB2 KB
Sega mega drive7.61 MHz64 KB4 MB64 KB
Playstation 133.8688 MHz2 MBabout 700 MB1 MB

Of course, there were tricks to increase the capacity of cartridge consoles - a cartridge, in fact, an electronic circuit, with a lot of conclusions, not all of which were intended to read data from a cartridge's ROM. What can be placed on the diagram? Yes, anything - additional RAM, ROM controller with the possibility of mapping the data of big games into the allowed I / O address space. The main thing is that the console supports the interface for interacting with similar devices of the cartridge. And she, as a rule, supported! Thus, the programming of games was not limited only to the development of code, sometimes it was necessary to “finish” the game by hardware in order to somehow surpass the meager capabilities of consoles of that time. However, few of the many who have Dendy in the post-Soviet space have been fortunate enough to deal with cartridges that accommodate a mythical and semi-divine being - namely, a “battery” to which the game could be saved.
This obscenity ended with the arrival of the Playstation: firstly, the console had quite impressive characteristics and could compete with computers of the time on which DOS worked (which caused a considerable number of games that were ported from PC to Playstation), secondly, the game was now located on the CD -disk, which meant the impossibility of any hardware tricks. In short, the arrival of the Playstation put a section on two epochs — the one when crutches were considered good practice, and the one when crutches became considered crutches. But when one era replaces another, retrogrades always appear, sacredly honoring past covenants - it was thanks to their dedicated work that several games came to the market that work only on the earliest revisions of the Playstation. So, by changing the device port addresses from revision to revision, Sony engineers gently but persistently, let the developers understand that the official SDK and detailed documentation were given to them for a reason.
Programming for the Playstation was so simple that in addition to special hardware stations (Dev Unit), sold to professional game developers for about $ 35,000, Sony also released a special version of the console for home developers, called Net Yaroze, and comparable in cost to the console itself.

How was it done


We have already said that for early consoles, programming was carried out almost exclusively in assembler. In the case of the Playstation, the C language became the de facto standard for development. Normal C, without assembler inserts, connections to ports and any serious limitations, you no longer needed to write your own implementation of strncat or write your own library for I / O, if you just wanted to read the file from the disk.
Another important difference from the previous consoles was that the developer received a full-fledged API interface for all the console's hardware capabilities, such as a co-processor for vector computing. The SDK supplied by Sony had wrappers for everything that could come in handy, which made it possible to truly abstract from the features of the console. As a result, porting games from under DOS often turned around only by rewriting the layers responsible for graphics and sound.
In general, the development for a typical programmer was of this nature: a development module that connected to a computer was connected to the Playstation through the connector indicated in the figure. Through this bridge, an EXE file was loaded into the operating memory of the console, and through it the output of debug information to the computer was possible. Just as many homemade web studios are now experiencing a shortage of Apple technology to test their applications, the developers of the Playstation games lacked the Dev Unit. Thus, a large incomprehensible port on the back of the console should serve as a silent reminder that some things do not change even after almost two decades.

Of course, not every developer had enough self-control to write a game on the disgusted S. And then the ambitious developer’s weapon, the self-made programming language, was used. It is reliably known that at least 2 series of games suffered such a fate - Crash Bandicoot, which was written in the self-made dialect of lisp, as well as the entire Final fantasy line up to part 9, the engine of which migrated through a bunch of platforms and had its own interpretable assembler. About the creation of both games can be read here:
Crash Bandicoot: http://all-things-andy-gavin.com/2011/02/02/making-crash-bandicoot-part-1/
Final fantasy: http://q-gears.sourceforge.net/gears.pdf

How it was done here


The significance of the Playstation is also in the fact that its discs could be read on any computer and recorded on it. What gave rise to the unprecedented wave of piracy for the other consoles. Now, in order to translate the game, it was enough to have a disassembler for the MIPS architecture, as well as a writing CD-ROM. Perhaps it is the fact that the translation of these games required so little to give rise to such a poor quality of the first translations. It can be regarded as an ideal illustration of the division of people into techies and humanities: when a person had enough knowledge of English exactly enough to study the reference book to the disassembler, we received a translation so richly flavored with jargon and obscenity that the game plot was somewhat lost; on the other hand, when the texts that were torn out by the debugger were sent to the translation by the student of philology, who wanted to earn some extra money, the output was so literary and cut off from the essence that a rare techie could understand exactly how to go through the described quest.
The other side of the relative ease of modifying the software code of games was the ability to collect several games on a single disc, to the joy of limited-media children. For the most popular games, coaches have been sewn in - loaders who have patched the decrement of lives, cartridges, etc. to death.
The Demoscene was surprisingly small and did not really form to this day. Therefore, I urge everyone who has anything to do with the piracy of console games to tell about it! I will be very grateful to those with whom I can talk on this topic in detail.

Gamedev features


Massively, games for the Playstation ceased to be released around 2002-2003, but enthusiasts do not give up and try to continue this noble cause. This can be done in two ways - just as many decent SDKs exist for the Playstation today. About where you can get both you can read at the end.

Psy-Q

This is the official SDK released by Sony for professional game developers. It contains the C compiler, as well as all the necessary libraries. There are also many tools for processing graphics and bringing it to a format suitable for processing the Playstation, some of the tools are already useless due to the presence of modern analogs, some exist incomprehensibly for what - the documentation for them is lost.
This SDK really allows you to write high quality games, but it has one drawback - it is designed to work under Windows 95-98, you can run into problems already on XP. But even with it, the creation of games that use 3D models will be difficult - in those times, rather specific 3D editors were used, and the SDK contains only a tool for converting models from formats of many years ago.
In general, this SDK is worth trying just to understand what the programmers of the time had to work on and how imperfect their tools were compared to today.

PSXSDK

Since 2008, a fully open SDK, based on the GCC compiler, has evolved to this day. It allows you to create only 2D games - well, or if you feel strong enough to write an engine for 3D rendering in C, then all roads are open to you. Write a video player on it will also be problematic, but in general it is the best option to start programming.
From pleasant advantages - with the help of this SDK you can compile such things as gzip, libpng, etc. - any modern plain C code. So the author managed to compile earlier versions of Lua to work on the Playstation. Therefore, if you know any library designed for work in microcontrollers that implements basic work with 3D graphics such as rendering polygons or mapping textures, then this will be a good help for the project.
The documentation is currently being written by me, and in my free time. But there are code examples, using which, it is more than possible to write your own Super mario or an analogue of almost any flash game.
In addition, this SDK works successfully under both Windows and Linux. Yes, what a sin to confess - under all under which you can only collect it.

Community


The community of enthusiasts is divided into 2 groups, depending on the use of the SDK. At the same time, the group that uses Psy-Q has a more “iron” focus, like modding consoles. In this way, the dispersed efforts of an already small number of people occur. The habitats of members of both communities also vary:
Psy-Q:
irc: irc.eversible.com #psxdev
forums: http://psxdev.net/

PSXSDK:
irc: irc.freenode.net #unhaut
forums: http://unhaut.fav.cc/forums
project website: http://code.google.com/p/psxsdk

If you know any Russian-speaking communities involved in developing for Playstation or translating games, or did you translate these games in due time, or did you have any tools or documentation from people you knew and who did it? please, write to me! Moreover, if you have information about device-independent C-libraries for rendering 3D-graphics, which are also undemanding of resources, then again - write!

Source: https://habr.com/ru/post/168807/


All Articles