Jump to content

MCD Format


sidewinder58

Recommended Posts

Hi Guys

 

I, like you, am an XCOM series enthusiast of many years. I recently started playing these dusty old titles again whereupon I ended up in a level quite close to starting the game.

 

I had one alien to kill, and no way to get to him. The stage was a terror attack on a port and he was hiding in one of those indestructible corugated towers. Problem was, the stairs were out.

 

Thus began my journey into reading xcom datafiles and trying to find that exact offending tile. And so i stumbled across your awesome site.

 

I fiddled around for a day, got through the map file of my save game, and found exactly which piece needed to be changed to what from the terrains aspect. I was having much trouble visualising the map to see where exactly it was and many attempts to download tools mentioned on the site failed.

 

It was at this point that my need to finish the level overcame my will to carry on coding (yes, coder too). So i downloaded xcom2edi, set the buggers health to 0 and that was that. All i really wanted to do was fix the stairs so I could kill him myself, with my own aptly named character (Johnny Justice - Take that alien scum).

 

Needless to say, with my revenge at hand, I remained ensconced in the inner workings of the xcom and have learned much from the resources so generously provided by yourselves. But, alas, I am still lacking in my understanding of the global mcd array and what items are loaded in positions 0 through 19. (Blast!!!)

 

 

Please help me. I have my first preview of a map that i generated with my nifty winforms app, and smack bang in the middle of the draw map function is a nasty little hack that loads "Nothing" into the first 20 MCD and image slots.

 

Preview

Link to comment
Share on other sites

The "global" MCD array is generated out of lots of smaller ones, the selection of which depends on the terrain you're fighting in and the craft present. I documented them all for the first game here (as I see you've found), but I haven't done the same for TFTD yet.

 

If you download my toolkit and read the source file "bb_tact\TilesetLister.java", you'll see all the MCD orders written out there. In this case, your missing tiles are in the "BLANKS" and "SEA" sets (note that BLANKS is loaded first regardless of what your terrain is).

 

You'll also want Daishiva's programs as well, MapView, PCKView and XCView. Note that, in spite of using Microsoft's own .NET platform, they don't work so well under versions of Windows later then XP. Of course.

 

MapView is of note because it allows you to bring up a "translated" listing of the MCD record associated with any given tile. It's not complete information, but it's a great help.

 

One thing I'm unsure on is whether the stairs were unusable because of a design fault, or whether you accidentally shot them during the course of the mission. If you destroyed the stairs, then altering the MCD files wouldn't help you; you'd need to edit the MAP.DAT file in your savegame folder in order to replace them. My battlescape editor allows you to copy and paste tiles (Control + D and Control + F respectively), and so would likely be the easiest way to do it.

Link to comment
Share on other sites

Thanks Bomb Bloke. You're awesome.

 

I totally get that I needed to edit the map.dat file. But at the time I had neither the tools nor the understanding of the files to do it. I knew I had to edit the map.dat, but I didn't know which were the offending tile records.

 

So I decided to do things a little backwards. I created a PCK viewer. (I can now confirm that my decision to skip MCD files with no partners was a good call) Using said viewer I found the tile info for the fixed and broken stairs (TFTD - It is PORT01, index 62 is lower stair fixed, 63 is broken, 64 is upper stair fixed, 65 is broken, and by broken i mean unpassable).

 

With that in mind, I could now safely search my map for broken stairs (63 or 65) and replace with fixed stairs (62 or 64. However, at this point I would not have been changing the correct tiles due to the adjustment to image index when loaded into global arrays. Thank you for sharing the name of that last tileset I needed.

 

Oh, and I liked the crack about keeping everything stored in memory. I chuckled a bit. It really isn't all that much memory usage, but I really could improve my little appy with lazy loading or caching to keep only tiles that get used rendered.

 

I am further going to update my appy by not havingto copy my mcds and imagesets at all with a mapping class that will be called to translate my mcd and image indexes to the applicable index of the storage array based on where they would be loaded in the global. So like a virtual global mcd and image cache. I would simply say Cache.Add(tileset) and the offset and length of both arrays would be known, so I can now easily calculate any index request to an mcd or image in any of the loaded arrays. Further, I could pass my Game class into it and allow it to directly get the tilesets itself by name. So I could then even more simply say Cache.Add(tilesetname) e.g. Cache.Add("PORT01")

 

Next conquests are units and animation. .NET has a nifty animator class that will animate any mutiframe image you tell it to.

 

Soon I might even have my own little xcom game clone. A hillbilly themed xcom, where the medikit is a bottle of moonshine, your weapons are a pitch fork and a shotgun and your vehicles are tractors and pickup trucks.

 

Oh, btw, here is my new render with the sea tiles where they should be. THANKS LOADS.

New Render (Fixed)

 

P.S., Daishiva's PckView app freezes on File > Open. What's up with that (Windows 7)?

 

P.S.S., Due to my last edit, I have decided to up my programs as well, no to compete, but to give an alternative that works on 7. I'm devving on 7 and mine works fine.

 

Regards

Sidewinder58

Link to comment
Share on other sites

P.S., Daishiva's PckView app freezes on File > Open. What's up with that (Windows 7)?

Best I can tell, yes, it's Windows 7 that's "up with that". That is to say, it's not backwards compatible with the earlier versions of .NET.

 

P.S.S., Due to my last edit, I have decided to up my programs as well, no to compete, but to give an alternative that works on 7. I'm devving on 7 and mine works fine.

That would be good, would be nice to have access to some quick'n'easy PCK tools under 7. Would raise my subconcious opinion of that OS ever so slightly. ;)

Link to comment
Share on other sites

Cool. Glad to hear there is interest in my efforts.

 

Just out of interest, could you perhaps enlighten me as to why DaiShivas tools are not "forwards compatible"? (I take it that by "backwards", you meant on backwards OS's, LOL)

 

Also, what operating system are you guys using that what ever you are developing is not compatible?

 

Maybe we can find a way to cooperate nicely here.

 

BTW: I did download you toolkit. I hope you don't mind if I borrow a bit from your code from time to time. Only on an "if need be" basis though...

 

P.S. Did you check out my latest render? What you think?

Link to comment
Share on other sites

Just out of interest, could you perhaps enlighten me as to why DaiShivas tools are not "forwards compatible"? (I take it that by "backwards", you meant on backwards OS's, LOL)

 

Also, what operating system are you guys using that what ever you are developing is not compatible?

I meant that Windows 7 is not backwards compatible - it's a given that his old code is not forwards compatible, because he'd've needed to be psychic in order to write code that would be compatible with an OS that hadn't even been announced when he did his work (let alone released)! ;)

 

In theory he could now go back and rewrite his code to work on the new OS, but like all the thousands of other devs out there who had their old projects busted by the new operating systems, it's unlikely he'll do that.

 

If you're asking about what lines of source are specifically causing the glitch, I'm afraid I can't answer that, as he never released the source.

 

As for my own code (entirely unrelated to his stuff), that has no problems with 7, though my battlescape editor could probably use some tweaks to maintain compatibility with the limitations of some modern displays (LCDs tend not to be able to correctly access the lower resolutions used by games such as UFO/TFTD).

 

BTW: I did download you toolkit. I hope you don't mind if I borrow a bit from your code from time to time. Only on an "if need be" basis though...

No worries at all, though it can be a bit of a mess in places. ;)

 

Speaking of code sharing, have you seen this?

 

P.S. Did you check out my latest render? What you think?

I did, and it appears to be perfect.

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
×
  • Create New...