← All talks

X-Com - Editing Save Game Files Is Still Strategy

BSides London · 202216:05730 viewsPublished 2022-01Watch on YouTube ↗
Speakers
Tags
About this talk
Paul Williams explores reverse-engineering X-Com's save-game file format to edit inventory, facilities, and alien captures without replaying tedious missions. Using hex editing on three key .DAT files, he demonstrates how to manipulate money, instantly complete base construction, and populate alien containment—bypassing the game's grind while maintaining strategic depth.
Show transcript [en]

yeah um good morning everyone i'm sorry that we took a little bit of time though uh you know technology being what it is um today i'm going to talk about my uh my uh xcom talk which is save game editing is still strategy now um what's going on so why why am i doing this talk so basically this this is the uh this is the first game i ever bought on a real pc and uh you know there were the big ones with the huge towers and the mice with the metal balls and you know back in the 90s i don't know if you all remember the 90s um but um it was the first game ever played on a

real pc and uh i got to do that know here and um i wanted to do a talk it wasn't necessarily in the weeds there's a lot of the talks i watch um not that they're not interesting but sometimes people get lost in the half an hour 35 45 minutes or whatever it is and there's a lot of information to convey so i thought i'd stick to like a high level sort of uh summary of the things you can do and also i wanted to finish the game i've had it since 95 and i still haven't done it yet so i was gonna do it in the hotel room earlier but then you know got drunk instead so as we all do these

things so uh let's get into it

so yeah so as i said this is mostly gonna be my ramblings about um the reverse engineering process i mean a lot of the stuff that i manually looked up you can go on there's a few wiki pages where you can actually go and you can see the summary tables off all the different items where they fit inside the dat files and all that kind of stuff but i did it manually because that's what that's the fun right is to take it and then to pull it up and go i wonder what happens if you do this so that'd do that so uh that's what we did here also it should work on the original xcom

game this is based on terror from deep which was the second one nowadays that would probably be dlc because all they did was the rest reskinned it and threw it underwater you'd probably still be paying 45 quid for it now though even if it was dlc uh so i don't know how well you can see that um but basically uh each of the save game files uh there's ten slots and each of the slots is in a folder helpfully called game underscore and then the slot and inside each of these is some files that we're going to edit with a hex editor to get us different things like uh more money instantly build facilities and capture aliens which is the whole

point of the game so as i said um there's three files we're going to be looking at uh the ace dot dot which is the alien containment where all the aliens that live uh the base dot deck which is where the meat of this is going to be because that's your base your inventory and your scientists and stuff like that so that's going to be all in there and then there's the uh libglub.dat which is where the the money is so we're going to start with the money though because that's easy to do it's just a couple of edit a couple of characters at the beginning and then we'll see how much money we've got

yeah so um as you can see i picked a number that was fairly big but not too big because don't forget this game's from 95 so uh they have things like overflows and stuff like that if you if you throw a big number in there and it's too big you'll end up with minus money which you can't do anything with obviously um so i we're going to do a demo now it's not going to be a lag demo because that would be ludicrous i don't know [Music] bear with me

oh no you can hear all the sounds

[Music] that yeah well never mind you can't see that at all so we're gonna skip the demos [Music] it's good job i didn't do them live there but basically uh editing the money uh you end up with a about 285 million dollars which is plenty of money for all the things you're going to need especially since instead of buying the things we're just going to drop them directly in that bit's a little bit involved so i'm not going to get into that now because there's a huge uh the stores is like 200 bytes long also so i'm not gonna go each of those bits because again it's a short talk so i've got to keep it keep

it to sync but the uh the base dot dot file is essentially split up into the following four sections the name uh the stores the facility map which is which is a grid which is effectively two sections because you've got the actual facility but then you've also got the build times of each of the the items so for example if you wanted to build a facility it has a build time you have to wait so many days for it to be completed we can just go in and edit that and get it built immediately which is great and then the scientists and the technicians the technicians are the ones who build the things that we research

and the scientists obviously the ones that research it so that's a bit of an overview of the the structure of each of the base.dat files um it you can have eight bases in the base dot dot which is split up into 296 bytes each the first 12 bytes yep and the name and then after that the bit in red is the store and then the purple and the teal-ish color is the grid i was talking about for the uh the base facilities and and then at the bottom we have one bite for the technicians of one bite for the scientists so again you probably can't see that very well but that's um [Music] the the grid i put little

notes on each one each space obviously is contiguous so it goes six six six six underneath ff refers to the open water in this one in the original game it was like just dirt and then each part of the facility has a corresponding address and then as i said before after 37 bites afterwards it will have its related build time now on the i don't know if you can see very well one of the facilities here isn't built it's got 13 days left on it so what we do is we look for the value 0d in the hex which is the number 13 in decimal which is 37 bytes after the facility in the structure

what we then do is we set because we set that zero d to zero zero save it and then reload the uh the game and it will be built i did have demos but obviously i'm not going to change the next one either because it'll just just know um i will be putting this on github with probably on vimeo maybe for the actual videos where i've done all of the work but obviously that's not today and there's lots about hours and hours of it you have loads of fun see we're going to skip that bit a little bit more on the stores so the stores are basically um where all your inventory live so any recovered

artifacts from missions or dead aliens or or uh weapons for your ships and submarines and that they all go into stores each of those uh items is two bytes long the way i did this part was basically i went i started at ff and then incremented one all the way along and then looked up uh basically the in the stores the numbers corresponded obviously with the hex values ff and then uh zero one fm you know and so on so then i knew it was 255 266 257 and then that was very very long and laborious just going like this i said there's always a bit online um and then i came with a map for what what

parts i were and then you could drop them in when you need them example you need some uh components for your submarines you can just drop them in instead of buying them which is why we don't need the money

uh the the biggest slide here with all the most right now i apologize because there's quite a lot of writing though i'll i'll i'll just read it um basically the scientists and the technicians share living quarters with the soldiers that you have which are called aquanauts in the second game um so you have to be careful if you just drop in max numbers you'll have no living space for soldiers if you need to replace them when they die so that's just something to be aware of if you if you have people killed on missions you're gonna have to get rid of some of your scientists until you can buy new soldiers um it's just how it is

um but yeah you need scientists to do the research but you don't need the technicians so you only need to edit the scientists one really because again we can just drop the stuff in manually by editing the file anyway um but you do need the scientists to do the research and then lastly we've got the a store.dat file which is where the aliens live um now i don't know if any of you played this game before but the point is to stun aliens and bring them back to interrogate them to find out what the mission is and stuff like that certain aliens you need to capture alive at certain points in the game because if you don't

excuse me you won't get past um a certain research tree okay so you have to capture live terrorists aliens and live aliens that are like commanders and stuff like high ranking ones so you can just interrogate them to get your um end game missions research but the problem is the high ranking aliens are hard to kill and then you're going to waste 10 12 soldiers trying to kill one of them so instead of doing that you can just drop them in like this by editing a value um again i had a live demo for this but not chance in it i don't if you can see that uh table there but that's a table basically of

each of the different alien races and the uh [Music] classes and the ranks so basically uh certain aliens can be the high ranking ones other ones are only terrorists and they don't they don't appear if you put the invalid ranking it won't appear so you have to have a particular you have to have a matching rank and race for it to work properly which is why i created the little grid that you can't really see because it's all white sorry um i will put this slide up if anybody wants to read them at some point um but yeah so the idea is you need to capture a few terrorists of particular kinds to get certain research topics and then

you also need to capture um a few of the commander rank aliens which is the lobster man which if you've ever played this game you know that those are going to be the hardest ones to get because they just did this murder um yeah once you once you've captured those you drop them in and then you can research them and then uh you get the end game research topics but then you can still drop more aliens in because certain aliens will give you information over and over again so it's valuable to drop them in for example the navigators will give you sub designs so that you can then build your submarine to go to the end level

um but other than that it's basically just it's easier than just stunning them because if they wake up it'll still kill you so you've got to be careful you've got to stun them and then bring them back and it's just easy to do it this way this is why my this is my strategy that was the whole point it's not cheating it's alternate strategy as i said um you need certain aliens to um to get certain parts certain research topics to progress again past a certain point um that's going to be lobster men so there's a particular one you're going to do so one of the things i wanted to do when i actually do the tool is basically

um have pre-programmed in progress sort of thing so if you want to get to a certain point and then start from the you just click a button and it'll boom and then when you load the game up you'll be where you want to be rather than having to do all of the boring bits and the initial missions and then you can just you can just do the end game and say yeah i did that game it's dead easy and then i've got some references but uh that's it uh is anybody any questions

[Music] so the question was are you not able to just manually mark the research rather than have the scientists do it for you um probably but i wanted to keep it light on the technical bits i mean there are parts as well where you can edit the soldiers so one of the things you can do you can edit their accuracy rating but the problem is if you edit the accuracy accuracy rating so high if they get an accuracy bonus like let's say they're on top of a building it then overflows and then they'll not hit anything which if you've ever played the game you'll know is the very time you'll need them to hit something is the

time they'll hit nothing um but you so you can but it's just it makes it a little bit longer because if you just tick the box to have every other research done then where's the fun in that i hope i answered your question cool any other questions uh yep

uh well and the tactical ones yes i have seen that before um that was basically uh so the question was did i look into the the control uh break interrupt to complete the missions with the repeating the last the the outcome of the last mission uh yes um i did do that um but not in this talk um i have done that before um what was what stored it i think it's in the tactical. but i didn't look into that for this talk but the the way that that works is effectively you have um it's basically a recovery method basically you're leveraging a bug in the fact that if the game crashed it was all

right we'll just go back to where we were which was the last tactical mission so when you do that it effectively gives you the results of the last mission instead of just breaking sorry um in the references there's a couple of pages that i go into a lot more detail on all of the files um as i said i'll throw these slides up on my github and then people can look at them if you like um anybody else yep

so sorry the question was what was my motivation for doing this uh yeah and so as i said i haven't finished it since and i've had it since 1995. there is a couple of known bugs in this game one of them being the research tree bug which i didn't go into where that if you get past a certain point you can't research certain topics you need to do to finish so you have to have them at certain times it has to be on time my motivation work i'm not very good at these kind of games anymore so i just thought i'll i'll do an alternative strategy any other questions no okay thank you for your time um sorry

about the uh the no demos and stuff like that i promise it'll be better next time