Iran Posted September 18, 2013 Share Posted September 18, 2013 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 More sharing options...
cn2mc Posted September 18, 2013 Share Posted September 18, 2013 I know next to nothing about programming, but I guess this is ultimately going to be used to make downloading bandwidth-heavy map previews in CnCNet 5 obsolete. So, great job! Link to comment Share on other sites More sharing options...
Iran Posted September 19, 2013 Author Share Posted September 19, 2013 It's not intended to as it takes a few seconds to generate a preview, as opposed to the RA95 generator I wrote which just creates a thumbnail. Link to comment Share on other sites More sharing options...
Nyerguds Posted September 19, 2013 Share Posted September 19, 2013 It also fulfills a function XCC Editor kinda already has built in Anyway, I'll give it a go. Link to comment Share on other sites More sharing options...
Nyerguds Posted September 19, 2013 Share Posted September 19, 2013 Allright, needs some more sane argument checking and error feedback. It crashes when the .bin isn't found. lrn2trycatch, Iran Link to comment Share on other sites More sharing options...
Nyerguds Posted September 19, 2013 Share Posted September 19, 2013 Okay. I have to say, this tool is very, VERY nice! I'll probably update the map previews on my site with this 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 More sharing options...
Iran Posted September 19, 2013 Author Share Posted September 19, 2013 "Okay. I have to say, this tool is very, VERY nice! I'll probably update the map previews on my site with this " 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 More sharing options...
Iran Posted September 19, 2013 Author Share Posted September 19, 2013 Okay the second argument isn't needed anymore and I added code to draw the turret on more vehicles, hopefully it now draws on all of them. Link to comment Share on other sites More sharing options...
Nyerguds Posted September 19, 2013 Share Posted September 19, 2013 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 Link to comment Share on other sites More sharing options...
Iran Posted September 19, 2013 Author Share Posted September 19, 2013 MLRS and MSAM look like: http://i.imgur.com/jayxRjr.png Not sure if that's correct. What will you be using the "passable terrain" filter for? Link to comment Share on other sites More sharing options...
Iran Posted September 19, 2013 Author Share Posted September 19, 2013 Looks like the turrets on MLRS and MSAM are indeed not drawn correctly. The apache is also missing its rotor. I added support for drawing the Turret defense building with an angle. Link to comment Share on other sites More sharing options...
Nyerguds Posted September 19, 2013 Share Posted September 19, 2013 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 (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 More sharing options...
Iran Posted September 20, 2013 Author Share Posted September 20, 2013 Did you check out AircraftClass::Read_INI()? That also isn't used in RA95. XCC Editor places the aircraft under the [units] section of the map. I'll leave adding the passibility stuff up to you. Link to comment Share on other sites More sharing options...
Nyerguds Posted September 20, 2013 Share Posted September 20, 2013 Yeeah, XCC editor doesn't have a clue. Olaf should've implemented smudges rather than adding those air units 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 More sharing options...
Iran Posted September 20, 2013 Author Share Posted September 20, 2013 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 More sharing options...
Iran Posted September 20, 2013 Author Share Posted September 20, 2013 Updated the first post with the latest EXE, I just added caching SHP/template loading and rendering and got a nice 300%+ speed up, Link to comment Share on other sites More sharing options...
Iran Posted September 21, 2013 Author Share Posted September 21, 2013 I fixed parsing and drawing of smudges (not uploaded yet). Does C&C95 also only have graphics for a male and female civilian with the variation being the remap colors on all civilians? Do you have these remaps documented? Link to comment Share on other sites More sharing options...
Iran Posted September 21, 2013 Author Share Posted September 21, 2013 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 More sharing options...
Iran Posted September 21, 2013 Author Share Posted September 21, 2013 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 More sharing options...
Nyerguds Posted September 21, 2013 Share Posted September 21, 2013 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 More sharing options...
Iran Posted September 21, 2013 Author Share Posted September 21, 2013 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 More sharing options...
Nyerguds Posted September 23, 2013 Share Posted September 23, 2013 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 More sharing options...
Iran Posted September 23, 2013 Author Share Posted September 23, 2013 They're kinda transparent drawn with brightness kind of thing, kinda like how RAED does it, it's cool. Link to comment Share on other sites More sharing options...
Nyerguds Posted September 24, 2013 Share Posted September 24, 2013 Ah, neat Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now