Ray1Editor - Rayman 1 Level Editor
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.
Please keep the forum rules and guidelines in mind when creating or replying to a topic.
Re: Ray1Editor - Rayman 1 Level Editor
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.
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.
Re: Ray1Editor - Rayman 1 Level Editor
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? 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.
Edit: Would something like this work for you? 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.
Re: Ray1Editor - Rayman 1 Level Editor
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")?
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")?
Re: Ray1Editor - Rayman 1 Level Editor
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.
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.
Re: Ray1Editor - Rayman 1 Level Editor
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).
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.
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).
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.
-
- 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
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…
Sig with Dora made by R4Y_ANC3L; others made by me
Android: How to block an image you don't like
It's good to learn from the past: read the Pirate-Community Documentary!
Other things you should know about this site
Re: Ray1Editor - Rayman 1 Level Editor
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.
-
- 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
I guess there's something in the sprite/state that makes the follow sprite correspond to something in the void though…
Sig with Dora made by R4Y_ANC3L; others made by me
Android: How to block an image you don't like
It's good to learn from the past: read the Pirate-Community Documentary!
Other things you should know about this site
Re: Ray1Editor - Rayman 1 Level Editor
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.
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.
Re: Ray1Editor - Rayman 1 Level Editor
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.
Re: Ray1Editor - Rayman 1 Level Editor
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.
Re: Ray1Editor - Rayman 1 Level Editor
So I've come back to this after doing some other stuff...
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... With image clearing the gradients disappear but the colours look mixed up and also look like a negative image... I decided to invert the colours and the negative image affect seems to have gone, but the colours are still very wrong...
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 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.
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.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).
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... With image clearing the gradients disappear but the colours look mixed up and also look like a negative image... I decided to invert the colours and the negative image affect seems to have gone, but the colours are still very wrong...
Re: Ray1Editor - Rayman 1 Level Editor
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);
Re: Ray1Editor - Rayman 1 Level Editor
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.
Re: Ray1Editor - Rayman 1 Level Editor
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.
Edit: I should also mention there's a checksum if you want to edit the image data.
Re: Ray1Editor - Rayman 1 Level Editor
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.
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
Re: Ray1Editor - Rayman 1 Level Editor
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:
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.
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;
}
Re: Ray1Editor - Rayman 1 Level Editor
Thanks for that, tried it and sure enough it fixed the problem.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.
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...
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.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 came up with this because the longer candy platform has 3 components, and I assumed by adding another one it would work.
-
- Posts: 326
- Joined: Tue Aug 25, 2020 3:55 pm
- Contact:
- Tings: 2780
Re: Ray1Editor - Rayman 1 Level Editor
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!
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!
Re: Ray1Editor - Rayman 1 Level Editor
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).