Logo
Current time: 02-29-2020, 03:45 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.MIP files and developing a new tool
02-15-2019, 04:01 PM (This post was last modified: 02-15-2019 04:35 PM by checkpoint10.)
Post: #11
RE: .MIP files and developing a new tool
More things I've learned about the .mip file.

1) Byte 20 (size 4) is the average color of the image. I was able to recalculate this on several images.

2) The width and height of each subimage is the width and height of the previous subimage divided by 2 and rounded to the nearest integer.

3) There seem to be 4 extra bytes at the end of the file that are sometimes all zero but sometimes has values. Not sure yet if they mean anything.
Find all posts by this user
Quote this message in a reply
02-16-2019, 12:46 AM
Post: #12
RE: .MIP files and developing a new tool
1) I never found that, so things will work without changing it for each file, but it makes sense as a final step for if something is at such a far distance it shrinks to a single pixel.

2) The width of the original image is always a power of two, and each sub-image is half the previous, so yeah. On the height, make sure to round up - but when you do color recalculations, don't include the blank rows you add in.

3) Dunno.
Find all posts by this user
Quote this message in a reply
02-16-2019, 04:01 PM
Post: #13
RE: .MIP files and developing a new tool
Big update - I was able to build a working version of the tool which can do the following: 1) unpack/repack a tracks.dat file, 2) convert mips to bmp, 3) convert bmp back to mip, 4) create a point-in-time backup of a .dat file. It has no real UI at the moment, just a very basic set of menus like a DOS program.

Scaling turned out to be less of an issue because I was able to utilize the Python Imaging Library which has functions to resize images and apply a palette.

Of course, the true test is - could I do something useful with it? I was able to use the tool to update some graphics at Laguna Seca. Check out the result and a brief glimpse of the tool, attached.

I will keep trying to do different things with the tool, such as painting cars and such, before working on a better UI.


Attached File(s) Thumbnail(s)
       
Find all posts by this user
Quote this message in a reply
02-17-2019, 05:47 AM
Post: #14
RE: .MIP files and developing a new tool
(02-16-2019 04:01 PM)checkpoint10 Wrote:  Big update - I was able to build a working version of the tool which can do the following: 1) unpack/repack a tracks.dat file, 2) convert mips to bmp, 3) convert bmp back to mip, 4) create a point-in-time backup of a .dat file. It has no real UI at the moment, just a very basic set of menus like a DOS program.

Scaling turned out to be less of an issue because I was able to utilize the Python Imaging Library which has functions to resize images and apply a palette.

Of course, the true test is - could I do something useful with it? I was able to use the tool to update some graphics at Laguna Seca. Check out the result and a brief glimpse of the tool, attached.

I will keep trying to do different things with the tool, such as painting cars and such, before working on a better UI.

I'm liking it! What does this need to run? (Dos, Windows, etc...)
Find all posts by this user
Quote this message in a reply
02-17-2019, 06:20 AM
Post: #15
RE: .MIP files and developing a new tool
(02-17-2019 05:47 AM)samsepi0l Wrote:  I'm liking it! What does this need to run? (Dos, Windows, etc...)

Right now the tool exists in the form of Python code which requires a Python interpreter to run. After I get a GUI in there, I would probably compile it as a Windows executable to make the installation more hassle-free for most users. But I will make the code available too, so that folks can improve on it or extend functionality or whatever.

One thing I just realized I may need to code: for car liveries, I believe I need to make the tool only use the colors 32-175 in the palette. I think otherwise it may create conflicts with the other colors that show up in the sunny.pcx palettes.
Find all posts by this user
Quote this message in a reply
02-18-2019, 12:12 AM
Post: #16
RE: .MIP files and developing a new tool
For cars I hard-coded the palette. For the section that does track graphics it uses the track's palette.
Find all posts by this user
Quote this message in a reply
02-18-2019, 05:25 PM
Post: #17
RE: .MIP files and developing a new tool
(02-18-2019 12:12 AM)CowtownBob Wrote:  For cars I hard-coded the palette. For the section that does track graphics it uses the track's palette.

I went ahead and coded the tool to avoid colors 0-31 and 177-255 for cars... in fact, if the user accidentally uses those colors, it will convert those colors to the closest colors between 32-176. I have tested this by painting an awful looking car (see attached) using illegal colors, and noting that after I imported to .mip and re-exported to .bmp, the colors have indeed been corrected.

Question about number of subimages. I believe generally it is based on the width of the image, so that 2^n = width, where n = number of subimages. Can you confirm?
width 16 = 4 images
32 = 5
64 = 6
128 = 7
256 = 8
512 = 9
I will have the tool automatically decide the number of subimages, but leave open the option to manually specify this.


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
02-19-2019, 01:28 AM
Post: #18
RE: .MIP files and developing a new tool
Yes, that's the math on the number of images. There's no need to have a manual option; the game is going to be expecting subimages down to two pixels wide.
Find all posts by this user
Quote this message in a reply
02-25-2019, 03:41 PM
Post: #19
RE: .MIP files and developing a new tool
Quick update - I found that with carsets, my tool didn't create a .dat file that was readable by the Paintkit. The reason seems to be that my tool would reshuffle the files within the .dat file (which the game itself can still load), but the Paintkit requires the files to be in certain order.

I also looked into the car 3do file and I mostly understand where the colors are:

Panel 1-21 - car panels, except:
3, 12, 22-30 - unsure what these colors represent, they are outside the selectable palette, maybe suspension/engine parts?
48-77 - crew uniform
78-85 - helmet

I started learning how to make a GUI using Tkinter but having a little less time lately. I will continue to clean up the code in the text-based version of the program and I might release that first, in case I can't make quick enough progress on the next part.
Find all posts by this user
Quote this message in a reply
02-25-2019, 06:42 PM
Post: #20
RE: .MIP files and developing a new tool
Funny you are doing this, because I am using WINMIP tonight actually putting together all of my already finished 99carset cars.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Privacy policy