Jump to content

CnCNet Forums

Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Nyerguds

Creating a mission height map for C&C64

Recommended Posts

With Kamuix writing a guide on inserting maps into the N64 version, I got busy looking into how it would be possible to more-or-less automatically generate height maps of C&C maps, so inserted maps actually look good in N64.

It took me a couple of tries, but finally I managed to create a set of tools to convert maps to height maps. All of these are contained inside the CnC64 File Converter. (v1.0.3 or higher)

 

The basics:

C&C terrain is not three-dimensional, but gives an illusion of 3D with the images on the cliffs. However, this illusion falls flat (literally) in a real 3D environment. To remedy this problem, they added greyscale images to the missions in N64 that indicate the elevation of the terrain (brighter = higher). So if you want to import maps into an N64 ROM and have them actually look good, they are going to need a height map too.

Elevation is not done per cell, but on the four corners of each cell. Because of this, the height map images have a size of 65x65, whereas C&C maps are only 64x64 cells. However, the converter takes care of that automatically, so we'll just focus on making a 64x64 height map.

The basic steps to make an image using the CnC64 File Converter:

  • Open a map file, and convert it to a basic terrain levels image. This image will contain only the cliffs of the map.
  • Save the terrain levels image and edit it in an image editor, and fill areas surrounded by cliffs with the colour for that level. If multiple levels are needed, use the brighter colors in the image's palette. There are 4 elevation levels that can be used.
  • Open the map in the File Converter again, and generate the height map, using the terrain levels image you created.
  • Convert the final image to 65x65 height map, and save it as paletteless N64 IMG format.

The detailed steps:

 

1. Convert a map to a basic levels image:

Open the map you want to make a height map for. The process works best if there's a .ini file with it that tells the program which theater the map is, and how big the actual used area on the map is. The ini file itself will not be accepted by the program, so open either the .bin file, or the already-converted .map for the N64.

Open the "Convert" menu, go to "Height map generation", and select "To basic levels image (from map)". This option will only work if you have a map loaded.

guide_01_map_to_levels.png

You will end up with an image which has a dark gray background, and only the cliffs on it, in a slightly brighter gray. Note that this is a paletted image with five colours; even if the image is later saved as high-colour, it will be matched back to these five colours to be interpreted as height levels.

guide_02_basic_levels.png

As you see, the image has some modifications compared to the original; the conversion takes the last terrain types encountered at the edges of the actually used portion of the map, and stretches them to the full frame. This is done so cliffs placed outside a map's border to control reinforcements would not influence the height map.

Note that the image is not saved yet at this point, so press Ctrl+S and save it to disk.

 

2. Create the height levels image:

Now the real work. Open the saved image file in your favourite image editor, and connect the cliffs to form closed areas. To do this correctly, open the map itself in a map editor so you can see the directions of the cliffs, and see what kind of elevation each area should have. Here's my process in a few steps:

making_levels_image.gif

It doesn't matter if the image is saved in high colours, but as noted before, the converter will match it back to the five colours in the original image's palette, so there's no use in making detailed slopes in this. Its only function is to separate the terrain into levels.

For the record, the grey tints used for the five levels are:

  • #000000 (R=0, G=0, B=0) : Pure black. Shouldn't be used, since water creates a slight depression into terrain, and you can't do that on the lowest level.
  • #404040 (R=64, G=64, B=64) : Basic terrain. This will be the starting level on the image, and should be seen as lowest level you can use.
  • #808080 (R=128, G=128, B=128) : Cliffs elevation #1
  • #C0C0C0 (R=192, G=192, B=192) : Cliffs elevation #2
  • #FFFFFF (R=255, G=255, B=255) : Cliffs elevation #3. Note that this is the highest possible level, and no more terrain details can be put on top of this. Rivers should work, though, since they decrease the terrain.

Anyway, with that done, we end up with our terrain levels image:

guide_03_levels_filled.png

 

3. Creating the actual (64x64) height map

Now we got our levels image this is fairly simple. Once again, load the map into the converter program. Open the "Convert" menu, go to "Height map generation", and now select "To height map using levels (from map)".

guide_04_to_heightmap_w_levels.png

It will ask you to select the height levels image. Select the final product of our work from the previous step.

Now the real magic happens. It will generate an image that adapts the terrain to the new heights, and if your cliffs match your levels image correctly, it will make sharp elevations for the cliffs and smooth slopes for the openings where the level decreases on non-cliff terrain. Furthermore, the height of rivers and other water will be applied on each specific level.

heightmap_64.png

Once this step is done, feel free to save the image if you want to add some more specific tweaks to it, or fix any errors the generator might have made. If you think the map is good enough, though, you can continue straight to the next step.

 

4. Converting the height map to the final format

So we got a 64x64 height map image now, loaded into the converter. The N64 game not only needs the image to be 65x65, but also needs it saved in the specific paletteless IMG format.

First things first: go to "Convert", "Height map generation", and select the final option: "To 65x65 height map image (from image)". As you see, this is the only option in there that doesn't use a C&C map as input but an image.

guide_05_heightmap_64_to_65.png

Select it, and the 64x64 data will be centered in a 65x65 frame, creating smoother edges everywhere.

guide_06_heightmap_65.png

Starting from v1.04, the image in the editor will automatically identify itself as paletteless N64 image, so all you need to do is press Ctrl+S to save it in the correct format.

...and that's it! You have your height map, ready to insert into the ROM. The name format the game looks for is exactly the same as for the .ini and the .bin, just with .img as file extension.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • By AndrewFord
      on the CncNet5 (RA, TS, TD version) there is usually a flashing green button that says "streaming" whenever someone is live on twitch but it doesn't show anymore. When shall this be fixed.
    • By Doblofino667
      Hi guys, I have for the first time today joined Cncnet, as I really miss Tiberian Dawn and I had a huge itch to play it. The download went nice and quick and I was able to get it onto the pc. 
      When I run it though, I run into problems. It skips the opening animation and immediately goes to the starting menu. When I press "Start new game" the program hangs and then I need to use task manager to close it. I dinked around with the resolution and compatibility settings too but no joy. In the end I saw a user here report something similar and the admin said something to the effect of changing the rendering to GDI instead of Auto. I did that and still not working. (Obviously when you press start, you go to that snowflake screen where you select GDI or NOD - THAT is the screen that doesn't want to load)
      At this point, I have tried all sorts of screen resolutions, rendering options, windowed/fullscreen options and turned comparability settings on and off. Computer still hangs. 
      Interesting to note, that when I click other options like "Load", "Internet Game" or "Exit", those options work fine. BUT when I click on "Intro & Sneak Peek" all I see is a screen saying "Coming Attraction" and then goes back to the menu. I remember this was an advert for Tiberian Sun. It seems that I can't run the cutscenes or animations or movie sequences. 
      Oh, another thing that might be of assistance. When I run the program without comparability, it hangs after selecting "new game" but when I run it in comparability mode for Windows 95, the game does not load, it simply says "can't play movies" or somesuch. 
      I hope the info helps! Please advise. 
      Thanks a lot guys.
      J
    • By Noyjitat
      I played around a bit in tibed and was thinking. Wouldn't it be cool to have a mod that has the rules of c&c renegade but in an rts c&c game?
      Example:
      Guard towers fire quicker, have longer range and are more armored and nearly 1 shot most vehicles.
      Guard towers have line of sight rules meaning infantry and tanks that are really close to buildings and tall objects can avoid being fired upon. (not sure if this even possible)
      You only get 1 guard tower with the exception of 2 - 4 pillboxes or Gun turrets
      You get 1 refinery with a small amount of credits slowly accumulating overtime and then credit dumps as normal when a harvester returns
      Each team is limited to 6 tanks
      Engineer repairs infantry, tanks and structures over time
      I'm  not sure how c4 and stuff would work. Maybe something in the form of an ivan bomb and you need 4 of them placed on a structure to go off in order to destroy it? Engineers should also be able to remove this.
      Vehicle and infantry fire power, rate of fire should be increased to match the values in renegade.
      Beacon placement for super weapons. A soldier drops the beacon and then it has a count down. Can be removed by engineer.
      Beacon placements on barricks ends the match unless removed by engineer/advanced engineer
      Advanced engineers: Hotwire / Nod technicians repair faster, deploy mines, shorter fuse ivan bomb?
      engineers/ advanced engineers equipped with pistols
      The game should basically all the renegade troops you could purchase such as havoc, sakura, etc with the same role sniping, rail gun etc.
      All aircraft replaced by helicopters/orcas, all infantry/vehicles able to hit them with snipers and rocket soldiers doing the most infantry damage to them. 
       
      Basically an exact copy of the renegade game as close as you can get it but in the form of the many rts c&c games we have now. Though i think you'd want to put an limit on the amount infantry just like most renegade servers could only hand so many players. I think 70 was the biggest I remember back in the day on the renstation server.
       
    • By Techstorm
      Hey, so I want to recommend the classic C&Cs to some people I know, and they may be more likely to try it if it's free. However, while the first free C&C games were released as freeware, the primary sources of downloads are down, the only way is through 3rd party mirrors and the C&C Ultimate Collection includes them for a price. So are the first three games still considered freeware?
    • By Nyerguds
      I'll just repost this here, since PPMsite is a mess these days.
      I have been making a tool to create .mrf files for C&C1 (RA seems to generate these tables in memory rather than keeping them as files). These files are basically palette remapping tables, used in the game to make colour effects like shadow, map shroud edges, stealth darkening (though not the actual effect), the targeting flash when giving attack / repair / dock commands, and a bunch more. Since they are relative to the theater's palette, they are a vital step to fully customizing terrain.
      Download:
      FilterCreator_v1.11.rar - The tool, plus all of the mrf creation projects. (requires .NET framework 3.5)
      All icons used in the program (except the actual program icon) are based on the Fugue Icons 16x16 pack by Yusuke Kamiyamane (Copyright © 2010)
      Test data:
      FilterCreator_testdata.rar - All .mrf files in C&C, plus example screenshots to test on.
      Source code:
      FilterCreator_src_v1.11.rar (Visual Studio 2010 project)
      Now, on to the tool itself:

      The actual main tool's purpose is to recreate the existing filters in the game using brightness / contrast / colour balance / etc filters. However, since I already reconstructed all filters in the 11 .mrf files C&C1 needs for a theater, you can just go to [File] -> [Write multiple .MRF files...] and simply generate all the tables you need for a new theater.
      All you need to do for that is selecting the folder with finished projects that comes with the tool, the palette of your new theater, and an output folder:

      This sub-tool can also be started directly by starting FilterCreator from a shortcut with the command line parameter "-mrfui"
      ---
      The current included projects are obviously just my own reconstructions. They were created to quickly allow people to make new theaters, but they're probably far from perfect.
      So, if you want to try your hand at it, or if you simply want to view existing .mrf files, here's the overview of the UI functions of the main tool:
      Right pane: the preview of the original .mrf file. It shows the filename of the loaded mrf file, and the amount of filters inside the file.
      Left pane: the project. The filename of the loaded project is shown in the title bar of the program.
      The controls get more specific as you go down on the left pane. Top is the project description... a completely optional field, really. Below that is the filters dropdown. Each filter is a "sub-project".
      The three palette buttons allow you to manipulate the final palette in three ways. In all three cases, a yellow asterisk will indicate if anything is customized in the three options.
      The first one, "Manual Remap", allows you to force certain colours to certain other colours before applying the filters. This can be used to make index tables as some mrf files have, or just to change certain colours before adding filters to them. Practically all existing filters seemed to have changed the animated water colours to white before applying their effect, so you probably need to use it for the same thing.
      Notes:
      The specific indices set in this way are only preserved as that specific index if no effects are applied to it later. To set colours here that are not affected by the effects on the filter, you need to also set them in the third function, "Never remapped". The second, "sub-palette", allows you to exclude colours from the used palette. This is usually used to exclude index #0 black from the used colours. Note that this can also be used in reverse, to select specifically the only colours to use for generating the palette. This is used for the unit shadow and some other filters like it, which use specific colours on the palette.
      The third palette option is the "never remapped" list. This will allow you to select colours on the palette that will always remap to their own index (unless set to another index by option #1). These indices cannot be affected by the effects in the filter.
      And, the last palette option, located at the top, next to the "enable filter" one, is the "Match back to palette" checkbox. If this is not enabled, you will see the filters as applied to the image, without taking into account the palette to remap back to. This also means it ignores the selected sub-palette, though force-remap and never-remapped entries are taken into account.
       
      Under "Options", you can find an option to synchronize the filter between the left and right pane if possible, so that when you load the .mrf that corresponds to the project, it'll always show you the right filter from the file.
      Then we have the effects. Available effects are Brightness, Contrast, Gamma correct, Colorize, Saturation change, Luminance change, and a combined Hue/Sat/Lum adjustment control. All effects you add to the list stack up to create the final filter. Since their order often makes a lot of difference, you can move effects up and down in the list.
      Below the effects you see the actual effect sliders. The preview on the image is instant, though it might lag a little if you drag it around while "match back to palette" is enabled, because every small change will need to recalculate the remap table and apply it to the image.
      That's it, I guess. The options in the menus should be pretty straightforward.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...