Jump to content

CnC64 File Converter released!


Nyerguds

Recommended Posts

I got a present for ya! :commando:

http://nyerguds.arsaneus-design.com/project_stuff/2017/CnC64FileConverter/release/
CnC64FileConverter_v1.0.0.png

This tool can open about any graphically-representable format in the N64 game, and can convert between most of them. This includes images, maps, palettes and tilesets.

Its usage is really simple. Drag-and drop a file in there, or use File-> Open (Ctrl+O) to open a file, and use Save (Ctrl+S) to save it. the Save dialog will give a types dropdown in which you can select the type to convert to.

Note that there is also a Quick Convert (Ctrl+E) option in the menu. This is actually identical to Save, except that it automatically selects the most logical convert type when opening the "Save As" dialog. This means PC images will quick-convert to N64 img format and vice versa, N64 and PC map formats will convert to each other, and palettes will convert between the N64 8-bit and PC 6-bit format.

Tilesets can only be exported at the moment, not saved, because they have a rather annoying format of tiles using sections of a larger colour palette. I might make a converter from and to actual single cells for that later, when I add a 'Convert' menu to the program.

One of the immediate practical uses of this this tool is that it can write the image format used as height maps by the game's missions. These images are paletteless 65x65 images on which each value in the image data represents a height, which is why I display them using a grey palette. This is the "C&C64 paletteless image" type in the save dialog's dropdown. The image needs to be either high-colour or 256-colour to be converted correctly for a height map; if it's 16-colour you'll get a 16-colour paletteless img file, a format which is also used by the N64 game, but not for that :P

I mentioned a 'Convert' menu before... one of the things that'll be in there is an option to automatically convert a map to a rudimentary height map.

Here's the algorithm I'm developing for that, shown on rocks:
heightmap_algo_lg.gif

This isn't programmed yet, but the theoretical algorithm seems to work right. The final conversion will do similar things with beach and water, and then combine them in a logical way.

Link to comment
Share on other sites

By the way, many thanks to Chad1233 for his help in beta testing this tool. I never even knew CCMap also messed up the 'clear terrain' tiles when saving a map. Seriously, how hard is it to get that right? It's two freaking bytes, and every official map has them! O_o

Link to comment
Share on other sites

It's gonna end up a lot simpler than I thought, lol... I found out the reason my resize method gave odd results was because I apparently used a resize method in Gimp (cubic) that was just not simple enough. I now tried another one, "Linear", and that gives exactly the result I intended. Basic method is just, assign all heights the correct colour, resize to double size (128x128), add a 1-pixel border around it, resize back to half of that new size (65x65) using Linear resize.

 

I might even just add an option to do just the resize itself and, accept already-greyscale images from the user, so they can assign plateaus and such.

 

So all I gotta do now is see how the resize in .Net reacts, and if I can give it different methods. Fairly sure I can, though; if I remember correctly the pixel resize used in the zooming image box already needed a tweak in exactly that code.

Link to comment
Share on other sites

Found a nice new way of doing things. If the user provides an image based on the cliff formations which divides the map into plateaus, the system can automatically trim the edges of these plateaus to give a better slope on the cliffs.

 

This basically means you need to save the map's image and convert it to these plateaus. At this moment, this approach also means that rocks on the actual map are ignored in favour of the plateaus, though the plateaus are trimmed down at all sides, so small height differences get lost in this method. Because of this, this is really only meant as a tool to help make a height map, and not something to actually automatically generate the heights.

 

The process in action: terrain map / plateaus / combination / applied heights (note the river height change) / conversion to height map

 

7ikWfNN6.gif

 

The plateau image will always be simplified to just five levels; 0, 64, 128, 192 and 255. So when making it, use these values for the gray colours.

 

Plateaus give the basic height, meaning water and beach will be slightly lower than the plateau height. Because of this, the basic level is 64, and not 0.

 

 

Currently I just got this hardcoded to read the same filename as the map file you opened, but with "_lvl.png" added behind the basic filename.  I'll probably make this more use friendly later and actually put a UI for this process in :P

Link to comment
Share on other sites

Awsome work i've been using this tool all night and a love it! it doesn't make the height maps for you but it get's you started which is still great so thanks again for making this tool! here are some photos of the heightmaps for the covert operations levels i've been working on:

 

he5_zpsvb57kxex.png

he6_zpsii0rzuds.png

he1_zpspozyr4cd.png

he2_zpszn4dv98u.png

he3_zps2559bpz2.png

he4_zpsqkhy5m47.png

 

 

 

Link to comment
Share on other sites

I just implemented the first rudimentary version of system to convert tilesets to a series of images.

 

With the converted files list, I can confirm that the tile mapping for the map conversion is indeed 100% complete, besides the 16 cells for clear terrain on each theater (and those IDs aren't used on maps anyway).

 

So, yeah, the list I posted earlier about which tilesets are missing from N64 is also complete, with no hope of finding more tiles.

 

[edit]

 

Oh, this is peculiar. The .TL4 / .TL8 files do not contain the N64 map values at all. They contain the PC map values O_o

Meaning, that file accurately links each tile to the cells of its PC version's equivalent.

 

This does mean that contrary to what I expected, the actual mappings of the values used in the N64 maps are somewhere in the ROM code, though, and not easily accessible as file. Strange that they did it this way; surely if they actually use the tileset definitions internally, it'd be easier to just use those on the maps, too...

Link to comment
Share on other sites

This data is so horribly unoptimized it's not even funny. With a little more effort, the N64 terrain could look ten times better and take less space to boot.

 

There is not a single full tileset in the ROM (meaning a full piece of terrain like a bridge or a piece of cliff or river) that uses more than one palette. Each cell of the graphics inside one tileset consistently uses the same 16 colour palette. In other words, there is no optimization to maximize the amount of usable colours, even though the system perfectly allows this.

 

I'm half tempted to write a graphics optimizer for this stuff and reconvert all graphics form PC, even though I have no idea how to even start on that :P

Link to comment
Share on other sites

I've done some more heightmaps for the covert operations levels and the playstation levels that needed the terrain 3Dized

 

3_zpsry0qru44.jpg

4_zpsk1gyah9u.jpg

5_zpsrgxwlfo7.jpg

6_zpsftmzbaon.jpg

7_zpsxc8wtywr.jpg

2_zpswsxwex15.jpg

1_zpstenym7q2.jpg

8_zpsfbgzua7f.jpg

9_zps5wn0kx4e.jpg

9_zps5wn0kx4e.jpg

 

SCB20EA # CO: Bad Neighborhood         = Done
SCB39EA   CO: Deceit                   = Done
SCB40EA   CO: Eviction Notice          = Done
SCB31EA # CO: The Tiberium Strain.     = Done
SCB32EA # CO: Cloak and Dagger         = 
SCB33EA # CO: Hostile Takeover         = Done
SCB35EA # CO: Under Siege: C&C         = Done
SCB37EA # CO: Nod Death Squad          = Done
SCB60EA ! PSX Nod Special Ops #1       = Done
SCB61EA ! PSX Nod Special Ops #2       = Done

SCG22EA # CO: Blackout                 = Done
SCG23EA # CO: Hell's Fury              = Done
SCG36EA # CO: Infiltrated!             = Done
SCG38EA # CO: Elemental Imperative     = Done
SCG40EA # CO: Ground Zero              = 
SCG41EA # CO: Twist of Fate            = 
SCG50EA # CO: Blindsided               = 
SCG60EA ! PSX GDI Special Ops #1       = Done
SCG61EA ! PSX GDI Special Ops #2       = Done
SCG62EA ! PSX GDI Special Ops #3       = Done

Link to comment
Share on other sites

Some updates on this...

1. Image copy option. You can now press Ctrl+C (or right-click the image and select "Copy") to copy the currently opened image representation to the clipboard.

2. Support for paletteless formats has been upgraded with the ability to load different palettes than the standard grayscale fade:

bl4WQoA.png

This code is obviously just copied from the font editor, though I still have to do some tweaks to make it react right in all situations.

Palettes on other file formats (which contain colours) are also freely editable now, and these edits will be preserved if you save the result as new file (if the file preserves colours, of course). This means this tool can now also be used as palette editor. (Happy now, Kamuix? :P)

 

3. I added support for opening/converting C&C1 tileset (template) files.

kNKwvxj.png

Haven't written the saving code yet, but the format is dead easy, so yea.

Link to comment
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...