Are you, in fact, a pregnant lady who lives in the apartment next door to Superdeath's parents? - Commodore

Create an account  

 
reMoO Project - Discussions and Feedback

Just a quick warning: the hashing code if fuxored. I had 3 collisions in 1500 images. I removed it from reMOM for now.
Reply

there could be the two reasons: the same data (therefore same hash) or weakness of the hashing function (use SHA-256 or above instead of the MD5)
Reply

Indeed it is the weak hash function causing it.
Whenewer i come around fixing that part, ill replace with a better hash and an equality comparison in case of collision. Or maybe ill just use a dictionary, like I should in the first place.
Reply

i took a look, but cant see anything fundamentally wrong. You might have a default palette mismatch. Can you check what index the color, that should be transparent, is? You can try setting that colors alpha channel to 0.

Also, makeBytes in ByteAnim: 0xf should be 0xff in all cases. This will fuck up the hash function badly. Still, the hashing can fail in a bad way anyway.
Reply

Sorry about the lack of activity, I was busy with a lot of stuff. Tonight I had some free time, so I decided to tackle the transparency issue. When I first set up ReMoO, I just wanted it to run. So I didn't really take a close look at the code that I was copying lol

So I took some time to see how it all works, and realized that I can optimize some things (the hashing code will slow down loading significantly). So I changed the hashing code to a simple function below:

Code:
internal string GetPaletteHash()
{
    byte[] hash = new byte[256 * 4];

    for (int i = 0; i < 256; i++)
    {
        byte[] bytes = makeBytes(Palette[i]);
        hash[i * 4] = bytes[0];
        hash[i * 4 + 1] = bytes[1];
        hash[i * 4 + 2] = bytes[2];
        hash[i * 4 + 3] = bytes[3];
    }
    return Encoding.ASCII.GetString(hash);
}
So if an duplicate palette exists, it'd use that palette instead of creating a whole new palette.

I then fixed the "0xf" with "0xff". But still there's transparency issues. So I examined how palettes are loaded, and found this:

Code:
if (animHeader.paletteoffset > 0)
{
    for (int colorNr = 0; colorNr < animHeader.paletteInfo.PaletteColourCount; colorNr++)
    {
        pic.Palette[animHeader.paletteInfo.FirstPaletteColourIndex + colorNr] = ByteAnim.makeInt([u][b](byte)255[/b][/u], (byte)(br.ReadByte() << 2), (byte)(br.ReadByte() << 2), (byte)(br.ReadByte() << 2));
    }
}
What this means is that if a custom palette is found, ALL of its color will have 255 for alpha. So I added a check after each color is loaded:

Code:
if (pic.Palette[animHeader.paletteInfo.FirstPaletteColourIndex + colorNr] == ByteAnim.makeInt(0xff, 0, 0, 0))
{
    pic.Palette[animHeader.paletteInfo.FirstPaletteColourIndex + colorNr] = ByteAnim.makeInt(0x00, 0, 0, 0);
}
This will ensure that all black pixels are loaded as transparent. I think that's the purpose of black pixels, they're transparent in MoO 1 right? If not, then I will have a bigger problem than I thought.

Anyway, with this change, BAM! The main menu's title are drawn correctly, with the background ship/vortex. Yay. Now back to lurk mode lol
Dominus Galaxia, a Master of Orion inspired game I'm working on.
Reply

Any news on this?
Reply

No, I'm busy working on Beyond Beyaan. There are people who've pre-ordered the game, so I need to finish that first for them. When that game's done, I will go back to reMoO project.

As for the reMoO, I'm at the part where I need to add font/text drawing for the game, I hope that won't be too difficult. I also need to know how big the galaxies are (100x100? 1000x1000?) and how star placement works in the original MoO, so if someone could research that, that'd help me a lot. Then I can finish the game setup screens for reMoO.
Dominus Galaxia, a Master of Orion inspired game I'm working on.
Reply

I think I can look into the star placement appareil. I actually always wanted to know how it is handled.
Reply

I suspect you could just lift the text display from reMOM. Im not 100 % sure if the font files are compatible, tough.
Reply

Kyrub - Thanks, looking forward to hearing the results of your research!

VM - That's the plan, I will try and start with reMoM's font handling, if that don't work, then I'll figure out what's different and fix it.
Dominus Galaxia, a Master of Orion inspired game I'm working on.
Reply



Forum Jump: