Editing X-COM Craft, UFO's as well as craft weapons


  • Please log in to reply
12 replies to this topic

#1 Zombie

Zombie

    Mr. Grognard of X-COM

  • Admin
  • PipPipPipPipPipPip
  • 5,535 posts
  • Gender:Male
  • Location:Wisconsin, USA

Posted 27 March 2007 - 03:42 AM

Editing these stats has basically been a non-issue for CE users because there isn't an editor which can accomplish this. But no more.

For the last couple weeks I have been doing some research into craft.dat and basically got nowhere. Then I happened across Scott T. Jones' new craft mod. While looking at the documentation I saw the config file. Being curious, I took a peek at it. Low and behold, there were these stats listed. That gave me the order. I also searched around and decided these stats must be in the executable. That gave me the place. Last week I formulated a way to convert decimal numbers into little endian. That gave me the tools. All I needed was time and drive. That was easy. :bleh:

Over the course of a couple days I searched the EU executable and found the stats. But I had no idea how many bytes made up each record or where the info started. Luckily, through trial and error and a little luck I figured it out. X-COM craft data starts at non-offset byte 457129 (in MS-Edit with 100 column width it starts at 457229). There are 5 records (Skyranger, Lightning, Avenger, Interceptor and Firestorm) each consisting of 14 fields (2 bytes per field for a total of 28):
  • Pointer within English.dat for craft name
  • Points for destruction of craft (signed integer)
  • Weapon Pods
  • Max Speed
  • Acceleration
  • Fuel Capacity
  • Damage Capacity
  • Size Class
  • Unknown 1
  • Unknown 2
  • Weapon Range
  • Weapon Damage
  • Crew
  • HWP's
X-COM craft data ends at non-offset 457268 and directly after it starts the UFO data (Small, Medium, Large Scouts, Harvester, Abductor, Terror Ship, Battleship and Supply Ship). This ends at non-offset byte 457492. Unknowns 1 & 2 do not apply to X-COM craft and neither does Weapon Range or Weapon Damage. Those are specific only to UFO's.

A little bit past the UFO data starts the craft weapon stats (457497). There are 6 records (Stingray, Avalanche, Cannon, Fusion Ball Launcher, Laser Cannon and Plasma Beam) each having 9 fields (2 bytes per field for a total of 18):
  • Pointer within English.dat for craft weapon name
  • Weapon Range
  • Accuracy
  • Damage
  • Unknown 1
  • Reload Time
  • Max Ammo
  • Unknown 2
  • Ammo Type
Unknown 2 seems to be related to craft weapon type as all launchers are 1, cannon is 100 and the beams are 50. Not sure about this though.

I also found all the corresponding data in TFTD. Included at the end of this post are 2 zipped Excel files: one for X-COM and one for TFTD. Anyone interested in helping decode the unknowns are welcome to look at those files for more intensive data. I did do some minor editing of the unknowns already - but not extensively so any theories will be welcomed. :what:

Attached File  X_COM_All_Craft_Data.zip   5.74K   671 downloadsAttached File  TFTD_All_Craft_Data.zip   5.62K   360 downloads]
- Zombie

My X-COM Patch Kit For UFO Defense | Emergency XCOM Meeting spoof on YouTube




JellyfishGreen said:

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!

#2 endersblade

endersblade

    Sergeant

  • Members
  • PipPipPip
  • 56 posts

Posted 17 June 2007 - 11:40 PM

All of this info is awesome, but it's all based on MS edit.  I can't even begin to understand how to use MS edit, so I use Hex Workshop and Cygnus since they actually show everything in hex (Maybe I'm special, but my MS edit in binary mode shows all kindsa crazy symbols and stuff, not hex.) I still want to edit my ships though.  How would I find this info using one of the other editors? "Starts at 499965" doesn't mean anything to me...
"When the sword becomes a burden, let the warrior lay it aside so another with a truer heart my take it up." -Radiant, Archangel

#3 Bomb Bloke

Bomb Bloke

    The Smily Admin

  • Admin
  • PipPipPipPipPip
  • 4,625 posts
  • Gender:Male
  • Location:Tasmania (AU)

Posted 18 June 2007 - 06:03 AM

499965 is an offset. That's to say, it's a certain byte in the list of data... The very first byte in the file is offset 0, the second is 1, then it goes 2, 3, 4, etc...

MS Calculator (Check Accessories under your Start Menu) can convert decimal to hex, if that helps (though you need to change the view to Scientific). 499965 is 7A0FD in hexidecimal.

There's a brief guide to using MS Edit for this in the UFO Wiki.
BB's X-Com Projects Page - X-Com Games At GamersGate
You're just jealous 'cause the voices only talk to me :P
We love Tammy! :)

#4 endersblade

endersblade

    Sergeant

  • Members
  • PipPipPip
  • 56 posts

Posted 19 June 2007 - 04:01 AM

I realize 499965 is an offset...and I know how to convert...but if I open craft.dat in Hex workshop, use goto and type in 7A0FD, it just dings at me and does nothing.  So either you guys are speaking in a language that nobody but you understands, or I'm not understanding something  :)   From what I can tell (in hex workshop), the last offset in this file is 5500 (0x0000157C).  In Cygnus, it tells me that offset 7A0FD is outside the file length.

Also, in MS edit, how would I go to that offset?  I can't find any kind of goto function.

Thanks to you guys, I understand perfectly how to edit just about anything...I just have to be able to find it :-P
"When the sword becomes a burden, let the warrior lay it aside so another with a truer heart my take it up." -Radiant, Archangel

#5 Bomb Bloke

Bomb Bloke

    The Smily Admin

  • Admin
  • PipPipPipPipPip
  • 4,625 posts
  • Gender:Male
  • Location:Tasmania (AU)

Posted 19 June 2007 - 04:45 AM

Take another read through of Zombie's post. He mentioned that he didn't find the data he wanted in Craft.Dat - It was in the executable.
BB's X-Com Projects Page - X-Com Games At GamersGate
You're just jealous 'cause the voices only talk to me :P
We love Tammy! :)

#6 endersblade

endersblade

    Sergeant

  • Members
  • PipPipPip
  • 56 posts

Posted 19 June 2007 - 07:52 AM

Lol...well, that would explain my problems then :-)  Thanks for pointing that out!

EDIT: Awesome, found it!  Man, I have no idea why I was looking in craft.dat.  I do have a question now, though; what needs to be edited so hammerheads and leviathans don't use zrbite as fuel?
"When the sword becomes a burden, let the warrior lay it aside so another with a truer heart my take it up." -Radiant, Archangel

#7 NKF

NKF

    Mr. Badger in disguise

  • Site Staff
  • PipPipPipPipPip
  • 4,424 posts
  • Gender:Male
  • Location:In my mind

Posted 19 June 2007 - 08:14 AM

To find any offset you want with MS-Edit, use this trick:

Open your file with a line width of 100

Now, let's say we want offset 534925. That's in decimal - use MS-Calculator or your own scientific calculator's hex to decimal function (n-base) if your offset was in hex. Anyway, you just go to line 5349 and scroll across to column 25. Alternately, if you set the line width to 1000, you'd go down to row 534 and scroll across 925 characters. :)

- NKF
NKF, narrow minded fuddy duddy who refuses to let go of the past and will not accept anything newer than 1979.

#8 endersblade

endersblade

    Sergeant

  • Members
  • PipPipPip
  • 56 posts

Posted 19 June 2007 - 10:52 AM

"Unknown 2 seems to be related to craft weapon type as all launchers are 1, cannon is 100 and the beams are 50. Not sure about this though."

I've looked at the file and changed these, but it doesn't seem to do anything.  What you said is correct though.  I tried changing the PWT cannon to 100 and ammo to 0 (effectively making it a sonic cannon) and equipped one in game.  I got a message saying I didn't have enough AJAX torpedoes to re-equip the sub.  ???
"When the sword becomes a burden, let the warrior lay it aside so another with a truer heart my take it up." -Radiant, Archangel

#9 Zombie

Zombie

    Mr. Grognard of X-COM

  • Admin
  • PipPipPipPipPipPip
  • 5,535 posts
  • Gender:Male
  • Location:Wisconsin, USA

Posted 19 June 2007 - 03:25 PM

Yeah, the last two fields are a little strange in general. In fact, I'm not even sure if the last record is Ammo Type anymore. See, when I edited the Stingray Launcher to have a value of 57 for that field, it said I didn't have enough "Small Launcher" to rearm my interceptor. Me thinks this field is a pointer for the name of the ammo. It's possible that Unknown 1 is the ammo type, but haven't had much time to check. :)

- Zombie

My X-COM Patch Kit For UFO Defense | Emergency XCOM Meeting spoof on YouTube




JellyfishGreen said:

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!

#10 endersblade

endersblade

    Sergeant

  • Members
  • PipPipPip
  • 56 posts

Posted 19 June 2007 - 11:41 PM

I tried changing the PWT cannon to match the sonic cannon and it still asked for ammo.  Apparently, there's something else that needs to be changed in order to modify what ammo a craft weapon uses...

I'm about to start randomly changing UNK1 and see what it does in game.  If UNK1 is just the name tho, changing this would be fruitless.  Guess I'll try UNK2 as well.  I'll report anything interesting I find.
"When the sword becomes a burden, let the warrior lay it aside so another with a truer heart my take it up." -Radiant, Archangel

#11 Zombie

Zombie

    Mr. Grognard of X-COM

  • Admin
  • PipPipPipPipPipPip
  • 5,535 posts
  • Gender:Male
  • Location:Wisconsin, USA

Posted 21 June 2007 - 03:25 PM

I fooled around with Unknowns 1 & 2 last night. Basically got nowhere as there doesn't appear to be any visible changes/behavior to the weapon in an intercept mode or sitting in the stockpiles. I think Unknown 1 is either ammo type or possibly damage type. Unknown 2 has to do with ammo somehow, but I haven't figured it out yet. :)

The last column of the craft weapon data is a pointer. Changing it corresponds to the item list in the sell screen at your base. 0 is the Stingray Launcher, 1 is the Avalanche Launcher and so on and so forth until 43. Item 43 corresponds to the first of the 3 unused laser weapons in obdata.dat. Its description is the Firestorm's UFOPaedia text. Item 44 is the Avenger's UFOPaedia text and 45 is the UFOPaedia text for the Terror Ship. I didn't check the CORPSE types in obdata yet, nor did I check the 3 >> unused << items which come later in the list. But I suspect they will be UFOPaedia entries too. The whole linking system in this area is a mess, and it's probably a triple embeded pointer which brings up the name of the ammo used for the craft weapon. :)

- Zombie

My X-COM Patch Kit For UFO Defense | Emergency XCOM Meeting spoof on YouTube




JellyfishGreen said:

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!

#12 Zombie

Zombie

    Mr. Grognard of X-COM

  • Admin
  • PipPipPipPipPipPip
  • 5,535 posts
  • Gender:Male
  • Location:Wisconsin, USA

Posted 28 June 2007 - 03:04 PM

Yesterday I was just thinking about craft weapons in general. When you look in the UFOPaedia entries, damage is always the same as accuracy for some reason. I never understood why the programmers decided on reusing those numbers. Fine, I'll just do a little editing to see what is going on. :)

First I edited the Accuracy byte of the Stingray Launcher in the executable to 80%, just to see if the UFOPaedia entry would update. Nope, it remained the same. Then I edited the damage byte to 90. When I checked the article again, Damage and Accuracy were both listed as 90. So it appears the programmers accidentally linked to the same byte for the article. Do we know where the UFOPaedia does this linking? I'd like to know, because I'd like to fix it. *grumbles* I'd like to fix the problem with the craft weapon text not showing up either... :)

With that established, I wondered if the accuracy stat was actually the number used for damage or the accuracy byte in the executable. This should be easy. I edited Accuracy of the Stingray to 0, equipped my Avenger with dual launchers + 200 ammo and engaged a UFO to find out. All the shots missed. When I edited accuracy to 5% shots sometimes hit. That explains it. The accuracy byte is used, it's just that the values aren't shown in game due to that programming glitch I mentioned above. With this in mind, I prepared this table with the correct accuracy percentages from the executable:

				Wrong	  Right
Weapon		   Acc.	   Acc.
Stingray		 70%		70%
Avalanche	   100%		80%
Cannon		   10%		25%
Fusion Ball	 230%	   100%
Laser Cannon	 70%		35%
Plasma Beam	 140%		50%
Some pretty big differences, eh? I'm happy that the Fusion Ball Launcher is actually 100% instead of the confusing 230%. And so much for the idea that the Plasma Beam is more accurate than the Avalanche. :)

Edit: seems I was a bit late in reporting this. Still, I did play a role in that a little. :)

- Zombie

My X-COM Patch Kit For UFO Defense | Emergency XCOM Meeting spoof on YouTube




JellyfishGreen said:

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!

#13 NKF

NKF

    Mr. Badger in disguise

  • Site Staff
  • PipPipPipPipPip
  • 4,424 posts
  • Gender:Male
  • Location:In my mind

Posted 29 June 2007 - 05:39 AM

I believe the game does random rolls with those accuracies, which explains the misses with the fusion ball's 100% accuracy. Either a random number between 0 - 100% or 50% - 150% as per the norm?

As for the accuracy of the Plasma Beam-v-Avalanche, the plasma beam just looks more accurate because it gets many attempts to suceed whereas the Avalanche only gets a few tries. Like the Cannon. It only hits 1/4 of the time, but it gets so many tries in so little time. It's an illusion of sorts.

- NKF
NKF, narrow minded fuddy duddy who refuses to let go of the past and will not accept anything newer than 1979.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users