RayCarrot wrote: Mon Apr 17, 2023 8:29 am
This is something I've been wondering a lot as well. I don't think PC was treated as its own thing per say. The code was most likely written the same for all platforms, but with platform specific parts of it. I've decompiled most of the PS1 code for a
modding project we've been working on (some examples
here) and most of the game code is identical to the PC version. It however uses an older engine version. For example, on PC there's a table of object functions where each object type has a function which gets called for certain conditions, such as for checking collision, doing a u-turn etc. On PS1 this table doesn't contain as many functions and instead the places where they'd get called from instead have a big ugly switch statement for each object type. If you go even further back to the early PS1 demos it's even worse, the code is filled with hard-coded object and level checks everywhere!
Oh wow, I hadn't realized that the ObjetsFonctions table was such a "recent" innovation, that PS1 code sounds awful! I guess it just means PC was branched later then, there must have been a less strict deadline…
RayCarrot wrote: Mon Apr 17, 2023 8:29 am
Now if we check L'Histoire de Rayman we can find some development info. Frédéric Houde wrote the original engine on Jaguar in assembly. Yann Le Tensorer was then the one who wrote the multi-platform engine, this time in C (with some minor parts in assembly). He describes how the engine was written for PC and made so it could be adapted for PS1 and Saturn. It seems PS1 was still seen as the target platform though. I can't find much more info than this though, but then again I've had to use Google Translate to read it

Ah yes, I'd forgotten this stuff. I should reread it… The mention of minor parts in assembly reminds me of that
dodgy sprite deformation code that only ever existed (that we know of!) for x86, again presumably because of PC getting branched later!
RayCarrot wrote: Mon Apr 17, 2023 8:29 amThen there are some interesting "leftovers" in some levels. For example
Cake 2 on PC has some of the audio triggers from the PS1 version left in! They appear to be in the exact same positions too. Was the PS1 level copied to the PC version and then modified after that? That wouldn't make sense with the tiles (comparing the two you can clearly see the level was re-tiled), but maybe just the object placements were copied?
Oh wow, cool! If only they'd left them in everywhere, that would make it a lot easier to
readd those tracks to the PC version…
RayCarrot wrote: Mon Apr 17, 2023 8:29 amBut then even stranger, the
PS1 version of Mountain 6 (and a few other maps I can't remember) has a palette swapper! Its placement and state makes no sense there, so it's not a PC leftover. The PS1 code completely ignores this object type as well. Also worth mentioning it's there on Saturn as well. This I'm guessing is more of a leftover from something they were testing during development. Perhaps it was made to load the palette for that house that appears there? It uses quite unique tiles compared to the rest of the Mountain world!
That's strange indeed! I guess it is something to do with loading that house in the editor…
RayCarrot wrote: Mon Apr 17, 2023 8:29 amSomething which I've come to realize is just how much of their workflow was impacted by their choice to start with the Jaguar version. The Rayman Designer code is a goldmine when it comes to understanding how the developers created the game with a lot of leftover editor functions existing. I've been wanting to decompile that more some day, but I really don't like IDA

It's been a long time since I've dived into my IDA database of RAYKIT.EXE, but I'm starting to feel like doing it again!
RayCarrot wrote: Mon Apr 17, 2023 8:29 amAnd sadly Ghidra doesn't support that exe format

I'm not familiar with Ghidra, but would it help if you could get a flat binary file with all the relocation fixups pre-applied? I have a tool that does something similar, which I could tweak a bit and release…
RayCarrot wrote: Mon Apr 17, 2023 8:29 amBut some interesting things related to Jaguar I've seen over the years are:
- The game objects are defined in similar ways, at least in the editor. On Jaguar the game has a list of every object, known as a Multi-Sprite. These themselves work very differently from other versions. They have a
verbe which define what they "do" each frame and how its params are used. The multi-platform engine uses an
object type index instead. However, there are similarities. Every object on Jaguar is named like "MS_XXX". Their editor, and thus also Rayman Designer, does the same! It's first when the level gets "compiled" into an actual level file that the name stops being used. So their editor could have very easily matched these with the Jaguar Multi-Sprites and allowed levels to be saved as Jaguar levels!
Another piece of evidence here is that the level data is stored in almost the same way in
the Rayman Designer editor as it is on
Jaguar. That is, they don't have an absolute x and y position, but are stored as a sort of tile-map with relative offsets to each "tile".
- The multi-platform game's sprite graphics are actually converted native Jaguar Objects! The sprite struct always confused me. It had some unused flags, a type index which seemed to support additional image formats and other oddities. It all made sense when I found the function in Rayman Designer which allows loading raw DES data and that it actually loads native Jaguar Objects, changes them from big to little endian, and converts them to the game's sprite struct! So whatever graphics tool they used seemed to always save the graphics as Jaguar data, which then got converted.
Ah yes, I remember you telling me about some of this when you first discovered it. I guess this sort of suggests they built the editor first in C, then bolted on the multi-platform engine, initially in the same codebase to make "RAYKIT". I wonder if the decision to use only two music tracks per world in the PC version is somehow linked to the fact that the editor was on PC. After all, the released Mapper only offers you "Piece 1" or "Piece 2", so it makes sense in that context. Maybe the development versions of the PC version were so similar to this that they never bothered to bring in the more extensive soundtrack which was standard on PS1 / Saturn. (Especially since they apparently were tweaking the maps and some of the code until the very last moment, somewhere between 24 November and 4 December 1995

)
Perhaps the most annoying thing is that the PC version contains all these functions for CD tracks that are heard in the PS1 version:
change_audio_track_puit (evidently intended for the Tarayzan level, but not called at all in the PC code)
change_audio_track_moskito_acc (called during the mosquito flight as one would expect)
change_audio_track_moskito_dec (ditto)
start_cd_gros_rayman (called during the intro with big Rayman)
start_cd_gagne (intended to play the fanfare when Rayman reaches the exit sign)
start_cd_perdu (intended to play Rayman's death sound from the CD)
start_cd_suspence (called when showing the vignette where Betilla gets kidnapped)
start_cd_replay (no idea what this one was for tbh, it's not called anywhere)
start_cd_bbdead (called when a boss is defeated)
start_cd_continue (called when you wake Rayman up on the game over / continue screen)
start_cd_tempo (again, this isn't called anywhere, I don't know what it was for)
Anyway, all these functions exist in the PC version, but almost all of them were left empty (which means that in the original DOS releases, the Watcom compiler condensed them all down into the return points of adjacent non-empty ones). The only ones that weren't empty were
start_cd_perdu, which redirects to
PlayTchatchVignette so it plays Rayman's death sound as a normal effect instead of a CD track, and
start_cd_bbdead, which just redirects to
start_cd_rap (playing the menu music). Some of them would have been really easy to implement on PC (especially
start_cd_continue, since that track was included on the flipping disc!) but they just left them blank, and even removed the calls to some of them.
RayCarrot wrote: Mon Apr 17, 2023 8:29 amAll that is to say, they most definitely used the same tools to create levels for all versions, including on Jaguar. But then how they separated the levels between versions is more unclear. The objects could very easily be copied, so I'm guessing they did that, and then made unique tile-maps for each version. We also know the PC version uses a later build than on PS1, so a lot of changes are probably just the result of them continuously tweaking the levels. That of course doesn't explain everything though.
But finally, let's look at the first level:
R1_PS1_JP - 1 01.png
MapJ1-1PS.jpg
R1_Saturn - 1 01.png
R1_PS1 - 1 01.png
R1_PC - 1 01.png
Quite a lot of minor changes over time here. The Ubisoft map is odd too, being like a mix between the PS1, PS1 JP and Saturn versions! We also know the Ubisoft maps were generated from Rayman Designer. There's a leftover function in there for converting a level to a bitmap in the same way as is seen here. This all makes sense with their editor being able to edit levels for all versions, but why does the Ubisoft map have only one color for the pink leaves? That's not the case in any other version.
I guess maybe the PCX / tilemaps used to render the Ubisoft maps were an older version?
RayCarrot wrote: Mon Apr 17, 2023 8:29 amAnd that raises more questions, like how did they handle PS1 palettes when editing the levels on PC? PC only supports 256 colors, while PS1 has no such limit.
Maybe they used some higher-colour graphics mode available on the graphics cards on certain PCs in the development studio, for example
mode 6Fh of a "Cirrus CL-GD 5422/5426" (from the list at
https://fd.lod.bz/rbil/interrup/video/1 ... able-00010)? They could have used that knowing that the development PCs in question had this mode available, but then for the actual PC release used only the standard mode 13h, to make sure customers wouldn't be tied to a particular graphics card.
That said, I also wonder why Bad Rayman's colours seem to be screwed up on every version other than PC. Perhaps the high-colour versions of his sprites were never tested properly, maybe because the Cake world was developed so late…