Jump to content

C&C Full Map Preview Generator


Iran

Recommended Posts

https://github.com/Iran/CnCFullMapPreviewGenerator

 

This tool generates a preview image of a map using the game's graphics. It's written in c# 2.0 and requires the .Net framework v2.0.

 

This uses code from OpenRA and code that hifi gave me. Thanks go to Mailaender and pchote for helping me with using the OpenRA code and answering questions. Nyerguds also helped with answering my questions, documenting the tile sets ID mappings used by the game and documenting the remap colors stuff for every color remap. Additional thanks go to the FreeCNC documentation of the game's map format and XCC Editor for showing me how things should somewhat look like.

 

Usage:

ExeFile InputMap [OutputImage] [--DrawVisibleOnly]

 

Example:

CncFullMapPreviewGenerator.exe x.ini derp.png --DrawVisibleOnly

 

The '--DrawVisibleOnly' option only draws the part of the map that's visible in-game.

If 'OutPutImage' is left out the filename (minus .ini) + '.png' is used.

 

 

THIS IS STILL A BETA SO THE TOOL MIGHT CRASH OR GIVE INCORRECT RESULTS

 

https://dl.dropboxusercontent.com/u/21865790/CnC%20Full%20Map%20Preview%20Generator.zip

Link to comment
Share on other sites

Okay. I have to say, this tool is very, VERY nice! I'll probably update the map previews on my site with this :D

 

Did you test the turret offsets ingame or something? XCC Editor gets those all wrong.

 

I think you forgot the turrets on the Buggy and Jeep, though. Oh, and the Rocket Launcher, too, though with its rotating turret connection point I guess that one's pretty annoying to do.

 

[edit]

 

Some notes:

 

-Why is the second argument required, btw? You could just make it default to "[basic filename without extension].png"; you cut off that basic filename anyway to find the .bin

-What exactly does "DrawVisibleOnly" do?

-Could you build in an option for adding a red tinted "passable terrain" filter like XCC Editor has, based on the tilesets.ini data? The one in XCC Editor itself is occasionally completely wrong, and the ini has all passability data in the Primary/Secondary Type data.

 

[edit]

 

Nevermind on the "DrawVisibleOnly" - I tested it, and it just cuts out the actual playable map :)

Link to comment
Share on other sites

"Okay. I have to say, this tool is very, VERY nice! I'll probably update the map previews on my site with this :D"

 

Thanks! Please do keep testing this tool and see if you can find bugs.

 

"Did you test the turret offsets ingame or something? XCC Editor gets those all wrong."

 

The turrets are part of the unit SHP, I calculate the frame for tank from the angle and if the unit is considered one that has a turret (yeah jeep etc aren't considered yet, gonna fix that) it also draws the calculated frame + 32 (which is the start offset for turrets, 0-based). 64 frames in total, half for the unit and half for the turret. XCC Editor doesn't consider the angle of the turret at all. Both unit and turret are drawn centered, because units like Harvester are larger than the cell they occupy.

 

"I think you forgot the turrets on the Buggy and Jeep, though. Oh, and the Rocket Launcher, too, though with its rotating turret connection point I guess that one's pretty annoying to do."

 

Not at all, it would be annoying to do for RA1 vessels as their turrets aren't part of the unit SHP, in C&C95 the turret ARE part of the unit SHP (not sure if that's for every unit).

 

"-Why is the second argument required, btw? You could just make it default to "[basic filename without extension].png"; you cut off that basic filename anyway to find the .bin"

 

I'll add that

 

"-Could you build in an option for adding a red tinted "passable terrain" filter like XCC Editor has, based on the tilesets.ini data? The one in XCC Editor itself is occasionally completely wrong, and the ini has all passability data in the Primary/Secondary Type data."

 

Would you use this? I don't see a point in adding this.

 

My code should also consider the PrimaryColorScheme= and SecondaryColorScheme= keys although I haven't fully tested it. It also supports the additional color remaps you added and it shows the blossom tree in its transformed state.

Link to comment
Share on other sites

Not at all, it would be annoying to do for RA1 vessels as their turrets aren't part of the unit SHP, in C&C95 the turret ARE part of the unit SHP (not sure if that's for every unit).

Actually, I'm referring to the fact the turret on the rocket launcher, SSM and MHQ isn't centered in C&C1. The turret is on the backbed of the vehicle.

 

Would you use this? I don't see a point in adding this.

I would, actually. Might look into the code myself to add this, in fact :)

 

My code should also consider the PrimaryColorScheme= and SecondaryColorScheme= keys although I haven't fully tested it. It also supports the additional color remaps you added and it shows the blossom tree in its transformed state.

Ooh, neat :D

Link to comment
Share on other sites

The apache is also missing its rotor.

You can't place aircraft on maps anyway. The code for reading that ini section was disabled in the exe. I once tried enabling it, and it seems it was disabled with good reason; they spawn in the air and leave a permanently impassable cell behind at the location where they should've been spawned on the ground.

 

What will you be using the "passable terrain" filter for?

Mostly for identifying choke points, and maybe checking for openings in more maze-like missions.

 

By the way, you can get the passability information for trees, rocks and and buildings in grids.ini :P

(though, to correctly link them you'd also need the structures and terrain inis that reference them. Might not be worth it for this, heh.)

Link to comment
Share on other sites

Yeeah, XCC editor doesn't have a clue. Olaf should've implemented smudges rather than adding those air units :P

 

And yes, I checked it out, how else did you think I found that out? As I said, I even re-enabled it once.

 

Mind you, I have no idea how the spawning code itself works. I suspect they spawn in the air because that's the default behaviour needed for A10s, C17a, and any trigger-reinforced air units.

Link to comment
Share on other sites

Well considering XCC Editor has support for Apaches it should work I assume? Can you test with XCC Editor?

 

I added code to adjust the position of the turret on the SSM Launcher and Rocket Launcher but I can't get the offsets right. Might be my 2D rotation code.

 

 

Link to comment
Share on other sites

I fixed drawing of the rectangle around waypoints so the bounds don't like into other cells. I also added parsing of the [base] section, but are there any maps which have structures in the [base] section which aren't in the [structures] section?

 

I uploaded the new version, to-do:

 

-Civilian remap colours (if C&C95 uses the same system as RA95, Nyerguds?)

-Manually doing the offsets for the Rocket Launcher and SSM Launcher turret

Link to comment
Share on other sites

I had to remove the caching of rendered SHP files as it didn't take in consideration other palettes, after caching a SHP with red color remap it would draw that SHP even when I gave it a yellow color remap. I'll figure something out for this hopefully soon.

Link to comment
Share on other sites

Civilians seem to act completely normal in C&C95. No special remap code. All ten civilians (C1-C10) have their own graphics, and use those exactly as you'd expect, with the normal remapping system. I doubt any of them actually contain remap colour, though.

 

I also added parsing of the [base] section, but are there any maps which have structures in the [base] section which aren't in the [structures] section?

Practically every single Covert Ops mission. Also, GDI mission 15b. I advise pasting any buildings in there in a black or gray remap scheme, since technically they have no owner set.

 

Well considering XCC Editor has support for Apaches it should work I assume?

Because some fan tool makes a dumb mistake the game should accept that? Nope.

Link to comment
Share on other sites

In RA95 there's only C1 and C2 (male and female) graphics, 8 of the 10 civilians have remaps. I also noticed that the normal theaters only have the graphics for v01 to v20 even though up to v37 is supported (like in C&C95).

 

I'm currently checking what team the player as and set the palette drawing the [base] structures according to the sensible opponent (if playing as GoodGuy the opponent is Badguy and vice versa).

 

I figured cause XCC Editor has it and it's such a popular tool it would make sense..but yeah C&C RAED doesn't support aircraft and in the RA95 maps that have aircrafts seemingly pre-placed I could fine none.

Link to comment
Share on other sites

In RA95 there's only C1 and C2 (male and female) graphics, 8 of the 10 civilians have remaps. I also noticed that the normal theaters only have the graphics for v01 to v20 even though up to v37 is supported (like in C&C95).

Yeah, C&C95 does none of that odd stuff; it just has shp files for all civvies.

 

I'm currently checking what team the player as and set the palette drawing the [base] structures according to the sensible opponent (if playing as GoodGuy the opponent is Badguy and vice versa).

 

I figured cause XCC Editor has it and it's such a popular tool it would make sense..

Don't use the same way XCC Editor does that, please. It leaves unbuilt buildings indistinguishable from the normal built ones. The remap method is okay, I guess, but I advise putting them on the map with 50% alpha to make them semitransparent (both bib and building), to show they're not built yet at the start.

 

On my current map previews, I've made them teal, just to show the difference.

 

but yeah C&C RAED doesn't support aircraft and in the RA95 maps that have aircrafts seemingly pre-placed I could fine none.

Yeah, as far as I know they're always reinforced.

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...