Ray1Editor - Rayman 1 Level Editor

Discuss tools to aid in the modification and running of Rayman games.

Moderators: English moderators, Modding and utilities team

Forum rules
Please keep the forum rules and guidelines in mind when creating or replying to a topic.
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

So one of the reasons I would like something like that is so that I can play around with things like the alternative cymbal behaviours (TYPE_CYMBAL1 & TYPE_CYMBAL2).

I just used 2 standard cymbal objects, linked them and changed them to the two different behaviours, which makes them behave like a slow lift/elevator until yoyu reach the top where the cymbals smash together, the bottom part gose back down afterwards but way slower.

It also appears that this object must be the last placed object in the level otherwise the top bit comes down instead.

It's a bit dodgy though, if you loose a life, the thing dosen't respawn correctly, so I was toying with converting it to do the same bevaiour as the flat stone slab, but going up instead of down, but I need to chaneg a lot of commands to do that.

RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

I see. I'll have a look and see if I can implement something for editing the commands.

Edit: Would something like this work for you?
2022-02-21_17-21-23.png
2022-02-21_17-21-23.png (74.4 KiB) Viewed 5102 times
It's would just be editing them as raw data, but that's the easiest way of doing it. I can also include some info in the window for what instructions each number corresponds to and the arguments it has. Then when saving the changes in the window you can see the readable representation of the commands in the object properties update to reflect your changes.
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

Yeah that'll probaby work.

I assume you'd be able to copy and paste a whole script into that top textbox then (provided it's in the numeric format like "30, 200" rather than the command names like "GOTO LINE 8")?
RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

Yep, you can just copy it over. You should include the label offsets as well though if they're present as the commands rely on them.

I've released the new update now (0.2.0.0). I should also note I removed the updater in this update, so future updates will have to be downloaded from the GitHub releases. With that I'm now also including two exe files to choose between so that if you have the .NET Core framework installed you can choose the much smaller file.
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

I don't know why but there is an issue with the small candy platform sprites in Rayman 1 PC version.

Essentially you can walk on the platform as expected but it also creates an invisible area you can walk on offset to one side (refer to images below).
CandyIssues.png
CandyIssues.png (839.24 KiB) Viewed 4673 times
They use a behaviour called TYPE_BONBON_PLAT which at first I thought was the problem, but now I'm not so sure as the nougat platform uses the same behaviour but doesn't do this. Also if I use TYPE_BON3 which the large candy platforms use, it has the same issue.

Anyone got any ideas what this issue is? It's fixed in Junior and Designer and my guess is there is a difference in the WLD files PLA DES and PLA ETA, but not sure what.
PluMGMK
Aline Louïa
Posts: 37010
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 102745

Re: Ray1Editor - Rayman 1 Level Editor

Post by PluMGMK »

I guess there's something wrong with the "follow sprite"? So it keeps going for many more pixels than it should? Not sure if that's an ETA or DES problem…
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

PluMGMK wrote: Sat Oct 29, 2022 7:03 pm I guess there's something wrong with the "follow sprite"? So it keeps going for many more pixels than it should? Not sure if that's an ETA or DES problem…
Follow Sprite isn't a DES or ETA property, it's part of the objects properties in the LEV file, no matter what follow sprite you use the issue occurs but the hidden extra platform is always offset to the left or the right above the platform.
PluMGMK
Aline Louïa
Posts: 37010
Joined: Fri Jul 31, 2009 9:00 pm
Location: https://www.youtube.com/watch?v=cErgMJSgpv0
Contact:
Tings: 102745

Re: Ray1Editor - Rayman 1 Level Editor

Post by PluMGMK »

I guess there's something in the sprite/state that makes the follow sprite correspond to something in the void though…
RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

The issue isn't in the game data (it's the same in R1 and Designer) but rather with how the flipping is handled. The single-frame animation consists of two mirrored sprites, with the second one being flipped. The "follow" system only defines the first sprite by default, but here it also includes the second, flipped, one (if you check ray1map you can see I didn't take that into account and thus only the first sprite shows the follow line!). Now how this is handled exactly I don't know, but it seems related to the object type since changing it doesn't result in the flipped follow collision. My guess is there's an issue in how the game handles this calculation and it was later fixed in Designer.

Edit: Seems the issue is caused because the object type has a flag set which causes SET_RAY_DIST_MULTISPR_CANTCHANGE to be called. I haven't seen that function before, but it's doing something with follow sprite, so it's very likely it's responsible for flipping it and there's an error there.
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

By the sounds of it I think I'll have to create an additional ImageData entry in PLA DES that contains a full version of the object that dosen't require any mirroring.
RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

Yeah if you do that and use the standard TYPE_PLATFORM on it then it should work fine. Might be a bit complicated modifying the sprites though as the image data transparency is handled in a very unusual way (along with the game's over usage of checksum checks and xor encryption). The easiest might be to use the existing half-sprite and then create two objects which use it, with one of them being flipped in the animation. So all you'd need to do then is to create two new animations and use them on two objects you place next to each other in the level.
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

So I've come back to this after doing some other stuff...
RayCarrot wrote: Sat Oct 29, 2022 9:49 pm The easiest might be to use the existing half-sprite and then create two objects which use it, with one of them being flipped in the animation. So all you'd need to do then is to create two new animations and use them on two objects you place next to each other in the level.
It would exceed the 255 object count for the levels so I can't afford to do that in this case.
RayCarrot wrote: Sat Oct 29, 2022 9:49 pm Yeah if you do that and use the standard TYPE_PLATFORM on it then it should work fine. Might be a bit complicated modifying the sprites though as the image data transparency is handled in a very unusual way (along with the game's over usage of checksum checks and xor encryption).
I was looking at the way image data worked and indeed, it's very confusing. I got close to getting it but the images always came out with the wrong colours.

In this example I took the first palette from Mr Darks Dare 1 and attempted to match it with the PLA DES image data, here is an example of how the big swiss army knife came out...

Without image clearing you'd see weird gradients that were about 16 pixels wide but the colours look mixed up and also look like a negative image...
0_NoClearing.png
0_NoClearing.png (4.3 KiB) Viewed 4354 times
With image clearing the gradients disappear but the colours look mixed up and also look like a negative image...
1_Cleared.png
1_Cleared.png (3.73 KiB) Viewed 4354 times
I decided to invert the colours and the negative image affect seems to have gone, but the colours are still very wrong...
2_ClearedInverted.png
2_ClearedInverted.png (3.73 KiB) Viewed 4354 times
RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

The image data buffer is encrypted with an xor key (0x8F) which seems to be the step you missed. If you're doing this in C# I'd highly recommend BinarySerializer.Ray1. We made it specifically to easily be able to modify the game's data and is what Ray1Editor is built from. It automatically handles things like xor keys etc. Here's an example for accessing the image data:

Code: Select all

// Create a context. The base path passed in is the absolutely base path for all the files which are to be serialized.
using var context = new Context(gameDir);

// Add settings (only the engine version will matter for this)
context.AddSettings(new Ray1Settings(Ray1EngineVersion.PC, World.Cake, 1, pcVersion: Ray1PCVersion.PC_1_21));

// Add the files to serialize using their relative paths (relative to the base path)
LinearFile wldFile = context.AddFile(new LinearFile(context, "PCMAP/RAY6.WLD"));
LinearFile lvlFile = context.AddFile(new LinearFile(context, "PCMAP/CAKE/RAY1.LEV"));

// Use FileFactory for reading/writing helpers
PC_WorldFile worldData = FileFactory.Read<PC_WorldFile>(context, wldFile.FilePath);
PC_LevFile levelData = FileFactory.Read<PC_LevFile>(context, lvlFile.FilePath);

// Get the image data
byte[] imgData = worldData.DesItems[22].ImageData;

// Process it
byte[] processedImgData = PC_DES.ProcessImageData(imgData);

// Get the palette
RGB666Color[] pal = levelData.MapData.ColorPalettes[0];

// TODO: Do modifications

// Use FileFactory to write the file, saving the modifications
FileFactory.Write<PC_WorldFile>(context, wldFile.FilePath);
FileFactory.Write<PC_LevFile>(context, lvlFile.FilePath);
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

RayCarrot wrote: Sun Dec 11, 2022 8:14 pm The image data buffer is encrypted with an xor key (0x8F) which seems to be the step you missed.
Thanks that was it, I tried using the library before but I was getting some weird errors at the time, I think it was framework related so that's part of the reason I couldn't use it in the end, but also doing it this way helps me get a better understanding of what's actually happening if I do it myself.
RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

Oh okay. As for the gradient background, you can remove it by just ignoring any byte greater than or equal to 0xA0. That's how the game does it. In the game it has two sprite drawing modes; a normal one where the range is 0-0x9F and a 256 one where the range is 1-0xFF. Anything outside of the range is treated as transparent. The reason for the range being lower for normal sprites is because the remaining colors are reserved for the background. The 256 color mode is only really used for menus and such (and in Rayman Designer for a few specific objects like the totem in the Jungle world since it actually uses colors from the background palette!).

Edit: I should also mention there's a checksum if you want to edit the image data.
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

I tried adding 2 new DES entries into RAY6.WLD from Rayman Education, (the smug nougat blocking walls and the bouncy jelly glitter) but the editor said index was outside the bounds of the array. I then went to the game to see if it would crash and I got a lot of unable to read from address errors.

I looked at the serializer log and it seems to have gotten past the WLD part ok? (I would have uploaded it but they get quite big.)

I'm wondering if I exceeded a limit for a world file size or whether or not I missed something fundamental in the data (the array bounds suggests this) .

Below is the world file that I used.
Attachments
RAY6.zip
(214.66 KiB) Downloaded 84 times
RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

Oops, my bad! I didn't check the array bounds when getting the DES/ETA file names, so adding new ones causes it to crash. I've fixed this with a new release now.

I'm not sure why the game crashes for you though. I tried the file you sent and it works fine for me. So it's probably something in the level then. Can you show me the exact error message? The game does have a size limit for the DES data (which was why when we made a Dark Rayman in every level mod we had to use Rayman's sprites as we couldn't add Dark Rayman into every world), but that should show an allocation error I think (and I should have gotten a crash then too).

If it's a memory size issue though then that can be fixed by editing the exe. This is what the game does on startup:

Code: Select all

if (availableMemory >= 0x300000)
{
    TailleMainMemTmp = 139264;
    TailleMainMemWorld = 1002496;
    TailleMainMemLevel = 556032;
    TailleMainMemSprite = 914432;
    TailleMainMemFix = 317440;
}
else
{
    TailleMainMemTmp = 95232;
    TailleMainMemWorld = 404480;
    TailleMainMemFix = 317440;
    TailleMainMemSprite = 1228800;
    TailleMainMemLevel = 385024;
}
This is how much the game allocates to different types of data. The DES would probably go under sprites or world. I can't remember which. You should be able to find these values in the exe if you search with a hex editor though and edit them that way, but once again I'm not sure if this is the issue here.
Chacanger
Ptizêtre en or
Posts: 159
Joined: Tue Aug 10, 2010 9:55 pm
Tings: 895

Re: Ray1Editor - Rayman 1 Level Editor

Post by Chacanger »

RayCarrot wrote: Wed Dec 14, 2022 8:11 pm Oops, my bad! I didn't check the array bounds when getting the DES/ETA file names, so adding new ones causes it to crash. I've fixed this with a new release now.
Thanks for that, tried it and sure enough it fixed the problem.
RayCarrot wrote: Wed Dec 14, 2022 8:11 pm I'm not sure why the game crashes for you though. I tried the file you sent and it works fine for me. So it's probably something in the level then.
Yeah turns out that I had a script that imported those new world elements and it was wiping out the bottle cap DES entry which broke a level that contained them, so I fixed that and they are now in the world file along with the new elements.

EDIT:

I managed to fix the problem I was having with the small candy platform aka what was mentioned here...
RayCarrot wrote: Sat Oct 29, 2022 7:40 pm The issue isn't in the game data (it's the same in R1 and Designer) but rather with how the flipping is handled. The single-frame animation consists of two mirrored sprites, with the second one being flipped. The "follow" system only defines the first sprite by default, but here it also includes the second, flipped, one (if you check ray1map you can see I didn't take that into account and thus only the first sprite shows the follow line!). Now how this is handled exactly I don't know, but it seems related to the object type since changing it doesn't result in the flipped follow collision. My guess is there's an issue in how the game handles this calculation and it was later fixed in Designer.

Edit: Seems the issue is caused because the object type has a flag set which causes SET_RAY_DIST_MULTISPR_CANTCHANGE to be called. I haven't seen that function before, but it's doing something with follow sprite, so it's very likely it's responsible for flipping it and there's an error there.
I simply duplicated another frame in the DES AnimationFrames collection and it works perfectly, it means I don't need to add any new image data either which is better.

I came up with this because the longer candy platform has 3 components, and I assumed by adding another one it would work.
RaymanRedemption
Boomboleros
Posts: 326
Joined: Tue Aug 25, 2020 3:55 pm
Contact:
Tings: 2780

Re: Ray1Editor - Rayman 1 Level Editor

Post by RaymanRedemption »

Hello :)

I'm using the editor again to edit some maps in the original game. I have a stupid question I couldn't figure by looking at the help menu or the FAQ: how to add an object in a map that doesn't exist in the map itself, but exists in other maps of the same world?

For example, I'm trying to add a Moth in the first band land's map and I don't understand how to do it as I can only duplicate or delete objects, if I trust the help menu.

Thanks!
Terror Notes spread Chaos in Band Land!
:arrow: https://youtu.be/VLHLHlrNPpI

Image
RayCarrot
Tily
Posts: 2278
Joined: Sat Jan 11, 2014 5:46 pm
Tings: 36217

Re: Ray1Editor - Rayman 1 Level Editor

Post by RayCarrot »

You can add objects by going to the "objects" tab on the panel to the right. There's a list on the top with every object which can be added in the current level. Once you've selected an option you press the + button to add it to the map (it'll get placed in the center of the screen).
Post Reply