Color Palettes

The role-playing games (I-X) that started it all and the various spin-offs (including Dark Messiah).
User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Color Palettes

Unread postby Vector » 04 Dec 2009, 06:16

Does anyone here know how to import palettes correctly? Everytime I import one, it displays incorrectly in game. According to the MM8 level Editor, I noticed two things:

-Color palettes are suppose to have a data length of 768; the one I upload has a data length of five-hundred and something.

-Also, the decompressed size is suppose to be 0 where as my decompressed size displays as 768.

It seems like my palette is getting jumbled up in the process of being imported. Anyone have any ideas? Thanks for your input.
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

User avatar
Big Daddy Jim
Swordsman
Swordsman
Posts: 551
Joined: 29 Oct 2007
Location: Republic de Panama

Re: Color Palettes

Unread postby Big Daddy Jim » 04 Dec 2009, 09:53

Vector wrote:Does anyone here know how to import palettes correctly? Everytime I import one, it displays incorrectly in game. According to the MM8 level Editor, I noticed two things:

-Color palettes are suppose to have a data length of 768; the one I upload has a data length of five-hundred and something.

-Also, the decompressed size is suppose to be 0 where as my decompressed size displays as 768.

It seems like my palette is getting jumbled up in the process of being imported. Anyone have any ideas? Thanks for your input.
Vector,

The standard MM color pallet is 0x300 bytes (768 decimal), each color stored in 'true' form (RGB) in the binary file. If you look at the pallet that is stored in a standard .BMP file, you'll find it to be 0x400 bytes (BGR plus alpha channel which is always a '0'). If you are creating your pallet from the .BMP, you must write code to 'extract' and transpose the numbers (from BGR to RGB) and 'drop' the Alpha Channel.

The MM8LevelEditor does not properly import pallets. You'll have to do that using a Hex Editor or by writing code.

Hope this helps.

BDJ

"BDJ the Coding Wizard has moved out of the Coding Fortress, has retired from Might & Magic game modification, and now lives a peaceful life in Alto Lino, Republic de Panama.

http://www.mediafire.com/BDJs

User avatar
vladimir-maestro
Genie
Genie
Posts: 1033
Joined: 19 Jun 2008

Unread postby vladimir-maestro » 04 Dec 2009, 12:04

there is a program that creates proper palettes for MM games by GrayFace.
I had no time to test it to be 100% sure that it works correctly...but palette file seems to be a right one
You can contact me here:
maestro_mod@yahoo.com
vladud @ yandex.ru - preferred one
---
Site about MODs: http://www.mmgames.ru
---
if you wish to upload some materials for this site - let me know.

User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Unread postby Vector » 04 Dec 2009, 14:49

Thanks guys! It looks like my color palette is correct, so no problem there. I never knew that the MM8 lvl editor wouldn't import them correctly; something new learned. I will explore the idea of using code to import my palette correctly... never done it before.
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

User avatar
Big Daddy Jim
Swordsman
Swordsman
Posts: 551
Joined: 29 Oct 2007
Location: Republic de Panama

Pallete

Unread postby Big Daddy Jim » 04 Dec 2009, 16:13

Vector,

Before going any further with your color pallet problem, could you provide me with the sprite replacement, game database (MM6/7/8), and pallet number you are using? Perhaps you have replaced the wrong pallet?

BDJ
"BDJ the Coding Wizard has moved out of the Coding Fortress, has retired from Might & Magic game modification, and now lives a peaceful life in Alto Lino, Republic de Panama.

http://www.mediafire.com/BDJs

User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Re: Pallete

Unread postby Vector » 04 Dec 2009, 18:28

Big Daddy Jim wrote:Vector,

Before going any further with your color pallet problem, could you provide me with the sprite replacement, game database (MM6/7/8), and pallet number you are using? Perhaps you have replaced the wrong pallet?

BDJ
This isn't actually sprite replacement, but rather another aspect that requires palettes. Your experiment got me curious about landmass textures, so I decided to test something with Palettes on MM7. This is what I was trying to do:

Replace all grass textures with Volcanic textures; only MM7 does not have a volcanic texture in its' Bitmaps.LOD file. In turn, I replaced all grass texture TGA files with volcanic texture TGA files. When I launched MM7, I discovered that there was a Palette for the grass texture that causes the volcanic texture to look green. The grass palette is 90 in the MM7 Bitmaps LOD file. I was trying to replace it with the volcanic palette 309 from the MM8 LOD file. I believe I replaced the right palette though because I can tell a difference when I modify palette 90 in the MM7 Bitmaps LOD file.
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

User avatar
vladimir-maestro
Genie
Genie
Posts: 1033
Joined: 19 Jun 2008

Unread postby vladimir-maestro » 04 Dec 2009, 19:12

yes, landscape's tiles got their palettes =)
I've tried to replace sand desert into snow =)
same snow dunes...but with color of sand dunes =)
You can contact me here:
maestro_mod@yahoo.com
vladud @ yandex.ru - preferred one
---
Site about MODs: http://www.mmgames.ru
---
if you wish to upload some materials for this site - let me know.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1660
Joined: 29 Nov 2005

Re: Pallete

Unread postby GrayFace » 04 Dec 2009, 20:04

Vector wrote:The grass palette is 90 in the MM7 Bitmaps LOD file. I was trying to replace it with the volcanic palette 309 from the MM8 LOD file. I believe I replaced the right palette though because I can tell a difference when I modify palette 90 in the MM7 Bitmaps LOD file.
That's very strange actually. All bitmaps.lod pictures have palettes inside them.
Here's my program to import into MM archives (except .hwl): http://sites.google.com/site/sergroj/wo ... ects=0&d=1
It's was tested very briefly, but in theory it should be able to add all kinds of files and not just replace files, but add *new* files. Try adding those textures with it. (don't forget to backup the LOD file - it doesn't do it)
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Re: Pallete

Unread postby Vector » 04 Dec 2009, 22:39

GrayFace wrote:That's very strange actually. All bitmaps.lod pictures have palettes inside them.
Here's my program to import into MM archives (except .hwl): http://sites.google.com/site/sergroj/wo ... ects=0&d=1
It's was tested very briefly, but in theory it should be able to add all kinds of files and not just replace files, but add *new* files. Try adding those textures with it. (don't forget to backup the LOD file - it doesn't do it)
Yes, I think it's weird how these 8-bit bitmap images each come with their own palette of colors, yet they need another palette of colors to work properly. I can understand how sprites would need them, but not a landmass texture or a sky texture.

As for the LOD Comparte program, it is an extremely useful tool, especially when having a lot of items you want added to the game like swords, armor, gems, reagents, etc. Unfortunately, this program does not add the textures I am refering to correctly, nor does MM7 View. MM8 Lvl editor is the only program that can import them back in correctly. As far as the palette is concerned though, I see you have an option to add a new palette with your LOD Compare tool. I got an error while trying to add my palette which leads me to think mine is incorrect (I would have wagered my palette was 100% correct, but I've been wrong before....). What program are you all using to modify/create palettes? Thank you for all your input guys.
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1660
Joined: 29 Nov 2005

Unread postby GrayFace » 05 Dec 2009, 01:21

Here's the program Vladimir was referring to: http://sites.google.com/site/sergroj/mm ... ects=0&d=1
As you see, it's an awfully looking draft.
The "DoIt" is to make palettes for monster variants. I can explain it if you'll need it.
The "Simple Bmp -> Pal" is what you need. Simply creates a palette from Bmp.

About LodAdd:
Note that you should pass pictures with simple BMP extension to it, both for sprites and textures. Like, SNOW.bmp and 32HAXE.bmp.
I forgot to change the caption. That's why it's version 0.0 :)
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Unread postby Vector » 05 Dec 2009, 01:48

GrayFace wrote:Here's the program Vladimir was referring to: http://sites.google.com/site/sergroj/mm ... ects=0&d=1
As you see, it's an awfully looking draft.
The "DoIt" is to make palettes for monster variants. I can explain it if you'll need it.
The "Simple Bmp -> Pal" is what you need. Simply creates a palette from Bmp.

About LodAdd:
Note that you should pass pictures with simple BMP extension to it, both for sprites and textures. Like, SNOW.bmp and 32HAXE.bmp.
I forgot to change the caption. That's why it's version 0.0 :)
That is a very handy tool as well; I never knew about this one. This program makes me curious though, is there a program that can import .act files to the bitmaps.lod file? I thought all the available programs could only import .pal extensions? The only way I can think of to get a new palette into a M&M LOD file is by code as BDJ suggests.
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1660
Joined: 29 Nov 2005

Unread postby GrayFace » 05 Dec 2009, 04:05

Vector wrote:That is a very handy tool as well; I never knew about this one.
No wonder. The only one who tried it before was Vladimir-maestro. :) Now I think I'll make it a part of LodAdd and release a public version.
Vector wrote:This program makes me curious though, is there a program that can import .act files to the bitmaps.lod file?
LodAdd :)
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Unread postby Vector » 05 Dec 2009, 04:26

I could see Vladimir using that tool quite often as a lot of his work involves palettes.
GrayFace wrote:LodAdd :)
Ah, that's good news. However I guess I am trying to add them incorrectly? I don't know what this means, but this is the error I get:

Failed to read 768 bytes at offset 768 (c:\program files\borland\bds\4.0\lib\RSLod.pas, line 885)

I am using the MMpal to make an ACT file and then using the LODAdd to import the palette. On LODAdd, do I have to have a certain number in the palette box? I assumed 1 since I was only adding 1 palette? I'm guessing it is for a hexadecimal value since the box accepts numbers and alpha characters a, b, c, d, e, f?
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1660
Joined: 29 Nov 2005

Unread postby GrayFace » 05 Dec 2009, 07:05

It was a bug. Here's an updated version: http://sites.google.com/site/sergroj/mm ... ects=0&d=1
Now you can simply copy a bitmap under palette name without extension (like "pal090") and it will be added as a palette. No need for MMPal for this.
Vector wrote:On LODAdd, do I have to have a certain number in the palette box? I assumed 1 since I was only adding 1 palette? I'm guessing it is for a hexadecimal value since the box accepts numbers and alpha characters a, b, c, d, e, f?
It's only for sprites and (now) textures. It's palette index the sprite/texture will use. If you leave it 0, the palette index will stay the same (e.g. 90 for grastyl). When you add a sprite/texture with a new name, you must specify palette index.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Unread postby Vector » 05 Dec 2009, 19:10

Ok guys, I finally got this issue resolved and was able to get this experiment to work. I was able to import my palette with a BMP file format with the use of Grayface's LODAdd Program. Thanks BDJ, Grayface, and Vladimir.
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

Ck-NoSFeRaTU
Leprechaun
Leprechaun
Posts: 23
Joined: 22 Dec 2009
Location: Russia

Unread postby Ck-NoSFeRaTU » 22 Dec 2009, 18:51

When using LodAdd I'm always get "Failed to read %filesize of my file% bytes at offset 0 (c:\program files\borland\bds\4.0\lib\RSLod.pas, line 887).
It there any other tool which can be used to replace all resources in icons.lod of mm7? MM8LevelEditor at least can't import all BMP resources and some pcx like mm6title.pcx, mm7view also have problems with some resources like IB-Mb-A (Says "Stream read error").

User avatar
vladimir-maestro
Genie
Genie
Posts: 1033
Joined: 19 Jun 2008

Unread postby vladimir-maestro » 22 Dec 2009, 19:49

mm8leveleditor can import that files!!! i've tested it many times.
just need to know "exact file name"!!!
for example:
if you import monster sprite - file should have name as "MON***.sprite.bmp".
sensitive to registry!!!
also i recomend you to extract file first to see how it is written!
some fles got very interesting format...PCX files for example, or tile sets (compiles 4 BMP files in one)
You can contact me here:
maestro_mod@yahoo.com
vladud @ yandex.ru - preferred one
---
Site about MODs: http://www.mmgames.ru
---
if you wish to upload some materials for this site - let me know.

User avatar
Vector
Pixie
Pixie
Posts: 118
Joined: 30 Sep 2006
Location: United States
Contact:

Unread postby Vector » 22 Dec 2009, 19:55

Yes, MM8 Lvl Editor can import all bmp and pcx images. I have tested it as well. Your naming convention has to be perfect. For example if the file is named: 'part.bmp' you can not name your file 'Part.bmp'

Also, as Vladimir said, extract the file you are wanting to replace, and give your new file the exact filename the extracted file has.

LODadd should be able to read in your bitmap image. Is your new image a 8-bit indexed bitmap image?

MM7view only supports the importation/exportation of 8-bit bitmap images and text files.
||\............/||_||\............/||_\\.....//
||..\......../..||_||..\......../..||__\\.//
||....\..../....||_||....\..../....||__//.\\
||......\/......||_||......\/......||_//.....\\

Might and Magic X: The Anduran Saga
Official Website: http://www.mightandmagic10.thegaminguniverse.com/

User avatar
GreatEmerald
CH Staff
CH Staff
Posts: 3330
Joined: 24 Jul 2009
Location: Netherlands

Unread postby GreatEmerald » 22 Dec 2009, 20:58

Ah, Linux-style case sensitivity :) I wonder if LODs allow you to add files with different cases as different files, like files on Linux? Like, MON001.bmp and mon001.BMP in one place?

Ck-NoSFeRaTU
Leprechaun
Leprechaun
Posts: 23
Joined: 22 Dec 2009
Location: Russia

Unread postby Ck-NoSFeRaTU » 23 Dec 2009, 00:36

vladimir-maestro wrote:mm8leveleditor can import that files!!! i've tested it many times.
just need to know "exact file name"!!!
for example:
if you import monster sprite - file should have name as "MON***.sprite.bmp".
sensitive to registry!!!
also i recomend you to extract file first to see how it is written!
some fles got very interesting format...PCX files for example, or tile sets (compiles 4 BMP files in one)
I already extracted all archive and tried in various ways... For example icons.lod and mentioned above IB-Mb-A, it was extracted with the name IB-Mb-A.tga.bmp, I tried to import as IB-Mb-A, IB-Mb-A.bmp, IB-Mb-A.tga.bmp, IB-Mb-A.tga... As tga & bmp format... Nothing works... In some cases I receive the error message like:
Image
In others resulted lod-file is fully equal to original.
With some pcx files like MM6TITLE.PCX I have exactly same behaviour - produced lod-file is fully equal to original.
I tried to update from v3.47 to fresh cvs sources, builded it with ant on freebsd. Nothing changed.
Also for example I can't open Magic7.vid from Russian Buka localization with error "Wrong lod file", but the game and mm7view opens it without any problems.
So at least for me mm8leveleditor is very buggy.
Vector wrote:Is your new image a 8-bit indexed bitmap image?
Aah, I get it... So, currently only BMP supported? I simply tried to add some pcx files and after getting some bunch of these errors I'm give up. Now I'm successfully imported that evil IB-Mb-A. So problems with BMP seems resolved and now remain to find how to import files like MM6TITLE.PCX on which mm8leveleditor breaks.


Return to “Might and Magic”

Who is online

Users browsing this forum: Google [Bot] and 58 guests