Jump to content

User talk:Morgan525: Difference between revisions

From UFOpaedia
Morgan525 (talk | contribs)
 
(250 intermediate revisions by 15 users not shown)
Line 1: Line 1:
I'm also known as "Tycho" on Strategycore forums. I've been learning about disassembly and coding since December of 2011. I guess I started learning disassembly to mod the tank/cannon into a chaingun. I started playing with DOSbox but switched to the CE version and began focusing on its sound problems.  Lately, I have been tinkering with Seb's UFOloader and added those fixes of my own.  I've also been trying to rearrange Seb's INI file to make it less overwhelming to new users.
=Questions&Feedback=
Any questions or feedback one may have.... (please be sure to leave a signature: "~" three times in a row, four to time-and-date stamp it.)


The following is a list of how most events in TACTICAL generate sounds.  This data is scattered throughout the executable in various data arrays.  First an event number is passed to the sound subroutine. The program then compares the event with its corresponding entry in another section to determine how to play that sound. 06 is the standard method. 01 plays the sound uninterrupted by other sounds.


==Table of Battlescape sound calls==
'''FYI: I've created a new [[UFOextender|UFO Extender page]]. If you are having a problem on this, please use the discussion page located there. If your message is about UFO Extender, you can leave it here but I may start copying it to the UFO page and leaving my reply there.'''
<nowiki>
Play CAT
Evt# Setting reference          Description
00 00 -- Normal bipedal movement. Routine refers to tileset and alternates between 1 and 2.
01 01 0E normal tank move
02 01 00 snakeman move
03 02 --
04 01 0F Flying unit move
05 01 10 Celatid move
06 01 2F Silacoid move
07 02 --
08 02 --
09 02 --
0A 01 28 hovertank/cyberdisk move
0B 06 04 rifle/pistol shoot
0C 06 16 bullet hit
0D 03 14 sliding door opens. Routine randomly plays 1 of the 2 entries in SAMPLE2.
0E 06 03 normal door opens
0F 02 --
10 06 0C big gun shoots
11 06 0D big gun hits
12 06 0B laser gun shoots
13 06 13 laser shot hits
14 06 12 plasma gun shoots
15 06 13 plasma shot hits
16 06 34 rocket launches
17 06 35 blaster bomb/stun launcher shoots
18 06 0C small explosion (problem: zombie move)
19 06 05 big explosion
1A 02 -- stun rod  (*problem*)
1B 06 24 psi attack
1C 06 06 mind probe use*
1D 06 11 reload weapon
1E 06 26 place an item
1F 02 --
20 04 -- death of a male. Routine randomly plays 1 of the 3 sounds in SAMPLE2.
21 06 17 tank destroyed
22 06 0A sectoid death
23 06 08 snakeman death
24 06 09 etheral death
25 06 06 muton death
26 06 0A floater death
27 06 07 celatid death
28 06 08 silacoid death
29 06 09 chryssalid death
2A 06 0A reaper death
2B 06 17 sectopod death
2C 06 17 cyberdisk death
2D 06 30 zombie & reaper attack
2E 06 31 chryssalid attack
2F 06 32 silacoid attack
30 06 30 celatid attack
31 06 27 throw an item
32 05 -- death of a female. Routine randomly plays 1 of the 3 sounds in SAMPLE2.
33 02 --
34 02
35 02
36 02
37 02
</nowiki>


==OTHER RANDOM SOUND INFORMATION==
Hi Morgan. This is just a comment about your recent edit of the Alien Missions (TFTD) page. Terrori'''s'''e is actually the proper British spelling of the American terrori'''z'''e. There are quite a few regular contributors here who write British English so there will be a lot of these "misspellings". Us American English contributors will just have to learn to recognize and accept these cultural differences to prevent edit wars. The policy here is to just leave cultural spellings the way they are, unless you are absolutely sure. --[[User:Zombie|Zombie]] ([[User talk:Zombie|talk]]) 20:36, 27 May 2015 (EDT)
<nowiki>


406100-subroutine for melee attacks
: Zombie, some differences between US and UK English I am aware of and don't care how a word is spelled as long as it is correct in either method (color vs. colour). I hadn't realize that "terrorise" was spelled differently under UK English. I was just going by what the auto-correct program said was a mispelled word. I didn't mean to offend anyone.
406110- set default melee sound event to 1A
(4067C8)data base of melee attacks
value offset sound event #
00 461B2 2F
01 461BC 2E
02 461C6 2D
03 461E7 skip
04 461E7 skip
05 461E7 skip
06 461E7 skip
07 461C6 2D


Reference points for unit movement sound event IDs. [this word referenced]
:: No worries, you didn't offend anyone. I speak and write "American" English anyway, hehe. At this site I try my best to use the nomenclature in-game so that links are standardized, etc, but sometimes I forget as well. --[[User:Zombie|Zombie]] ([[User talk:Zombie|talk]]) 23:22, 27 May 2015 (EDT)
.data:0046D1A0  00 00  00 00  01 00  01 00  00 00  00 00 [00 00] 00 00 
.data:0046D1B0  [00 00] 00 00 [00 00] 00 00  [01 00] 01 00 [00 00] 00 00 
.data:0046D1C0  [02 00] 01 00 [00 00] 00 00  [00 00] 00 00 [04 00] 01 00 
.data:0046D1D0  [05 00] 01 00 [06 00] 01 00  [00 00] 00 00 [00 00] 00 00 
.data:0046D1E0  [00 00] 00 00 [0A 00] 01 00  [00 00] 00 00 [00 00] 00 00 
.data:0046D1F0  [18 00] 01 00  01 00  00 00  01 00  0B 00  0C 00  01 00
data set for death scream per unit.
0.data:0046B644 word_46B644    dw  20h                  ; DATA XREF: sub_40E450+55�r
1.data:0046B646                db  20h
2.data:0046B648                db  20h
3.data:0046B64A                db  21h
4.data:0046B64C                db  22h
5.data:0046B64E                db  23h
6.data:0046B650                db  24h
7.data:0046B652                db  25h
8.data:0046B654                db  26h
9.data:0046B656                db  27h
A.data:0046B658                db  28h
B.data:0046B65A                db  29h
C.data:0046B65C                db  2Ah
D.data:0046B65E                db  2Bh
E.data:0046B660                db  2Ch
F.data:0046B662                db  20h
10.data:0046B664                db  32h
11.data:0046B666                db  20h


I reverted your edit, as ENGLISH.DAT uses "terrorise" and "fulfil" in that sentence. No biggie&mdash;it's positively simple to undo one edit compared to the years of links to "Base Defen'''s'''e"&mdash;but it might be worth asking yourself whether something's a direct quote before changing the spelling used. [[User:Magic9mushroom|Magic9mushroom]] ([[User talk:Magic9mushroom|talk]]) 03:50, 28 May 2015 (EDT)


SUBROUTINE              USED FOR
== Decompiled accuracy algorithm? ==
Hi Morgan/Tycho


404650+1AE PSI ATTACK EFX
Is the algorithm you describe above, what you have decompiled from the standard game? Or is it a variant for UFOExtender? Great news if you have decompiled what the game actually uses - I will need to check some of my firepower calculations to make sure they are still in line with the algorithm.
406100+4F9 TERRORIST MELEE ATTACK EFX
40B420+111 EXPLOSION EFX
40B420+24F EXPLOSION EFX?
40E450+73 DEATH SCREAM EFX
40F2C0+285 PLACE ITEM EFX
4110E0+E0 ITEM USE EFX
4110E0+901 SHOT HIT EFX
419660+1A5 PLACE ITEM (INVENTORY) EFX
419660+346 RELOAD EFX
41DCC0+D1 STUN ROD ATTACK EFX
41EE10+8C PSI ATTACK EFX
41F0F0+8C PSI ATTACK EFX
41FD10+8B MIND PROBE EFX
421140+13 DOORS EFX
4247D0+27A NON-WALK MOVE EFX
4247D0+4D4 WALK MOVE EFX
42A630+B7 GMTATICS.MID
42A6F0+18 GMLOSE.MID
42B6F0+E9 GMWIN.MID
43D8C0+E GEOSCAPE OPEN WINDOW EFX
4407D0+2E ?
4407D0+9C GMGEOx.MID
445B00+BC GMINTER.MID
4467C0+1C1 X-COM CRAFT LEFT WEAPON EFX
4467C0+233 X-COM CRAFT RIGHT WEAPON EFX
446DA0+267 UFO HIT EFX
4470B0+F2 UNKNOWN INTERCEPTION EVENT (CRAFT CRASH EFX?)
447EE0+32 GMSTORY.MID
448390+28F ??
448390+2DD BASE DEFENSE (EVENT 9)
448390+3DC ?0A (BASE DEFENSE?)
448390+3F1 ?0A
448390+406 ?0A
44A220+15 GMSTORY.MID
44C940+10 GMDEFEND.MID
44CD40+26 GMBASE.MID
44D030+D GMDEFEND.MID
44D3C0+E GMMARS.MID
44D690+10 GMMARS.MID
44DACO+10 GMBASE.MID
450F10+91 BLEEP (1)
45DCA0+17 ??
</nowiki>


==Modding Tank/Cannon into a Tank/Chaingun==
cheers,
[[User:Spike|Spike]] 09:37, 30 June 2012 (EDT)


Many people have questions about this.  It's fairly easy to change the ammo type of the Tank/Cannon turrent and damage into a AP/rifle and then giving the turret autofire. The real problem is changing the amount of ammo in the tank and not cause problems with the amount of ammo in your base stores.  In the executable there are various places that handle updating the amount of ammo for the various events: adding a tank onto a craft(checking if the base has the proper amount of ammo for the tank and removing that amount from base stores, if so), removing the tank from a craft (adding the ammo back to base stores), post-interception-battle (adding the remaining ammo from the tank into base stores and attempting to add the tank back onto the craft), and post base defense (adding the remaining ammo to base stores.) In addition, there is the routine that sets the amount of ammo for the tank in battlescape.  If you miss any of these areas, your ammo supply quickly spirals out of control or you get no benefit for the changes you have made.
''It is an extender version of the original formula if one chooses to enable it. The original is the one that has been noted already: [1+(3/UFOsize)]/2 * Weapon Accuracy ... UFO sizes going from 5 for very small to 1 for very large. The calculation starts at offset 0x446DCD of the CE version.  The original UFO accuracy algorithm is a flat 60% chance to hit despite the difficulty level (and no penalty for the Xcraft being in cautious mode.)''


The DOS version of the game makes it much simpler to adjust the stats, but I have lost the notes on the offsets.  The CE version has a problem in the way the compiler wrote the calculations. In the original code, everything was handled in multiples of five with bit-shifts to get to 30 or multiples of 30.  I "rewrote" many of these lines to make it simpler to understand and mod(Feel free to use these changes. I gave my tank 60 rounds {3Ch}. However, unless you want to deduce for yourself how to modify the proper locations, don't increase the amount of ammo over 63. [This has to do with how the game uses bit-shifts to calculate the ammo during the post-tatical phase]):
[[User:Morgan525|Tycho]] 19:23, 30 June 2012 (EDT)
<nowiki>TANK/CANNON AMMO ALTERATION
POST-TACTICAL PHASE BASE/CRAFT INVENTORY UPDATE
0x449C53: B8 3C 00 00 00 0F AF C2 90 90 3B F0 7D 2C 66 0F B6 D2 66 01 17 B8 89 88 88 88 F7 EE 03 D6 C7 44 24 10 01 00 00 00 C1 FA 05 8B C2 C1 E8 1F 03 D0 88 55 2C 66 0F B6
          D2 66 29 17 66 0F B6 45 00 8B D0 C1 E2 0B 2B D0 C1 E2 04 03 D0 C1 E2 02 66 02 91 1A 01 00 00 90 90


.text:00449C53                mov    eax, 3Ch
== Source ==
.text:00449C58                imul    eax, edx
.text:00449C5B                nop
.text:00449C5C                nop
.text:00449C5D                cmp    esi, eax
.text:00449C5F                jge    short loc_449C8D
.text:00449C61                movzx  dx, dl
.text:00449C65                add    [edi], dx
.text:00449C68                mov    eax, 88888889h
.text:00449C6D                imul    esi
.text:00449C6F                add    edx, esi
.text:00449C71                mov    [esp+30h+var_20], 1
.text:00449C79                sar    edx, 5
.text:00449C7C                mov    eax, edx
.text:00449C7E                shr    eax, 1Fh
.text:00449C81                add    edx, eax
.text:00449C83                mov    [ebp+2Ch], dl
.text:00449C86                movzx  dx, dl
.text:00449C8A                sub    [edi], dx
.text:00449C8D                movzx  ax, byte ptr [ebp+0]
.text:00449C92                mov    edx, eax
.text:00449C94                shl    edx, 0Bh
.text:00449C97                sub    edx, eax
.text:00449C99                shl    edx, 4
.text:00449C9C                add    edx, eax
.text:00449C9E                shl    edx, 2
.text:00449CA1                db      66h
.text:00449CA1                add    dl, [ecx+11Ah]
.text:00449CA8                nop
.text:00449CA9                nop


0x449DFA: B8 3C 00 00 00 0F AF C2 3B F0 7D 2E 90 90 66 0F B6 D2 66 01 17 B8 89 88 88 88 F7 EE 03 D6 C7 44 24 10 01 00 00 00 C1 FA 05 8B C2 C1 E8 1F 03 D0 88 55 00 66 0F B6
Hi Tycho
          D2 66 29 17 66 0F B6 45 00 8B D0 C1 E2 0B 2B D0 C1 E2 04 03 D0 C1 E2 02 66 01 91 1A 01 00 00 90 90


.text:00449DFA                mov    eax, 3Ch
Do you make the source code for TFTD Extender and UFO Extender available somewhere? I'm interested in seeing if I can help to hunt down bugs / develop new features. Cheers, [[User:Spike|Spike]] 08:23, 4 October 2012 (EDT)
.text:00449DFF                imul    eax, edx
:''I just uploaded a new version of the UFOExtender source files to Seb's list.- -''[[User:Morgan525|Tycho]] 06:04, 6 October 2012 (EDT)
.text:00449E02                cmp    esi, eax
:''Source code for TFTDExtender is now available from my user page. -[[User:Morgan525|Tycho]]''
.text:00449E04                jge    short loc_449E34
.text:00449E06                nop
.text:00449E07                nop
.text:00449E08                movzx  dx, dl
.text:00449E0C                add    [edi], dx
.text:00449E0F                mov    eax, 88888889h
.text:00449E14                imul    esi
.text:00449E16                add    edx, esi
.text:00449E18                mov    [esp+30h+var_20], 1
.text:00449E20                sar    edx, 5
.text:00449E23                mov    eax, edx
.text:00449E25                shr    eax, 1Fh
.text:00449E28                add    edx, eax
.text:00449E2A                mov    [ebp+0], dl
.text:00449E2D                movzx  dx, dl
.text:00449E31                sub    [edi], dx
.text:00449E34                movzx  ax, byte ptr [ebp+0]
.text:00449E39                mov    edx, eax
.text:00449E3B                shl    edx, 0Bh
.text:00449E3E                sub    edx, eax
.text:00449E40                shl    edx, 4
.text:00449E43                add    edx, eax
.text:00449E45                shl    edx, 2
.text:00449E48                add    [ecx+11Ah], dx
.text:00449E4F                nop
.text:00449E50                nop


[TANK/CHAINGUN AMMO AMOUNT SET FOR TACTICAL REFERENCE]
== How to start modifying the game code ==
0x44ED27: C6 45 76 3C


.text:0044ED27                mov    byte ptr [ebp+76h], 3Ch
I like some of the changes made in the UFO extender but dislike others.  I'm also running X-Com through DOSbox so it's a moot point anyway.  Essentially I'd like to be able to make modifications to the game - like fixing the dismantled structure bug - myself.  Where should I start?  I have some experience with object oriented programming through languages like C# (most familiar) and Java.  


[TANK/CHAINGUN AMMO CHECK IN BASE INVENTORY AND ALTERATION OF AMOUNT]
[[User:Juke|Juke]] 21:04, 16 October 2012 (EDT)
0x456410: 66 83 84 90 1A 01 00 00  3C


.text:00456410                add    word ptr [eax+edx*4+11Ah], 3Ch
:''Your first step is going to be to become very familiar with Disassembly and Disassemblers. Most people use IDA.  Then your going to have to be able to understand the language itself.  Take a look at the few examples on my page and see what it looks like.  That code comes from the CE version, the DOS version doesn't disassemble as well (at least with any free dissassembler that I've found). [[User:Morgan525|Tycho]] 23:24, 16 October 2012 (EDT)''
0x4564F1: 66 83 F9 3C
.text:004564F1                cmp    cx, 3Ch
0x456512: 83 C1 C4
.text:00456512                add    ecx, 0FFFFFFC4h  (add    ecx, -3Ch)


[Alternate option]
I am running the game on steam with the DOSBox. Will I still be able to make changes to the source code?  Thanks for the info btw.
0x456512: 83 E9 3C
[[User:Juke|Juke]] 22:03, 28 October 2012 (EDT)
.text:00456512                sub    ecx, 3Ch             


:''I started using the DOS version under DOSbox and making simple changes to the data points via a hex editor. However, it is really hard to do more than that.
:''The problem is knowing where to make changes since no free program is able to disassemble the DOS version well.  For that reason, I switched to the Windows version.''


TANK STATS start at offset 47573B
== Shifting 5 shot laser mod to other weapons ==


TANK UFOpaedia info 4752B0~4752CF
Is there any easy way to shift the 5 shot mod that's currently on the heavy laser on to other weapons?  I plan on getting the source code and working on it a bit (it's been years since I've touched assembly, I mostly code in C# now), but it'd be helpful to have a clue of where to start looking. I'd love to contribute to the project as well.  [[User:KingMob4313|KingMob4313]] 09:27, 17 October 2012 (EDT)
</nowiki>
:''I'm sure it can be done.  I focus on providing content that will enhance the challenge of the game from a somewhat logical viewpoint without making changes just to make the game harder.  The source code for Extender is available and mostly written in C++ so you shouldn't have much trouble understanding it.  You will need a disassembler, such as IDA, for the actual game executable and be familiar with how to decipher the tangled mess of assembly code that IDA provides.  For some features, I can write the code in C++ but, for a lot of fixes, I find writing in assembly much easier to insert into the proper subroutines. - [[User:Morgan525|Tycho]] 09:54, 17 October 2012 (EDT)''
::I should have just read some of the above responses, I am sorry.  I will take your advice and pick up the disassembler and try to familiarize myself with the code a bit.  Seems that everything works via a hook-system, where it waits for the calls to the subroutines and replaces it, correct?  In any case, I appreciate the quick answer.  [[User:KingMob4313|KingMob4313]] 12:30, 17 October 2012 (EDT)
:''The hardest part of familiarizing youself with the code is that the subroutines and variables are just offsets with no identifiers.  If you take the time to match offsets to labels given in the xcom.h file (in the Extender source) you can manually transfer the labels yourself.  This will make analyzing the code much easier. - [[User:Morgan525|Tycho]] 20:07, 17 October 2012 (EDT)''


==CALCULATIONS USED IN UFOLOADER'S INTERCEPTION==
== We're all... feeling... so... sleepy ==
For those that might want to know how accuracy is calculated with the new options for interception turned on:


X-Craft Accuracy
Hi Tycho


[(1+((3-(.5*(difficulty level-1)))/UFOsize)/2 ] * Weapon Accuracy .......        [beginner=1..superhuman=5]
Well, I was not expecting that! Your TSL-firing Hallucinoids just kicked my *ss on a Superhuman Colony Assault. They kept firing their TSL-like built in weapons - in fact it looks like it's an auto burst TSL? - right into the transport door. And I kept popping another guy out of the door to grab the bodies outside and take out the Tasoth with a TSL I presumed was out there. I could never see the Tasoth, just some stupid Hallucinoid floating around - and they're never a threat, right? Wrong!
<nowiki>Diff Ship Size
VS S M L VL
begin 0.8 0.875 1 1.25 2
exp 0.75 0.8125 0.91667 1.125 1.75
vet 0.7 0.75 0.83333 1 1.5
Genius 0.65 0.6875 0.75 0.875 1.25
Super 0.6 0.625 0.66667 0.75 1</nowiki>
         


UFO Accuracy
Brilliant, in one stroke you have breathed new life into a previously-ignored enemy, making it as frightening as it always should have been. I hope you don't mind me adding a slight spoiler to the Bug Fixes section - if you do, feel free to revert it so you can surprise others like you surprised me. :) Cheers, [[User:Spike|Spike]] 18:46, 21 October 2012 (EDT):


60 + (difficulty level *3) - [Cautious Mode bonus (10)]
:''Hehehe. >;) No, its not autofiring but the Hallucinoid has a high reaction score and the cost to fire their weapon is 33%. However, they don't often move so they always have most of their TUs. Now that they have a valid range weapon, they are extemely deadly in outdoor settings. Indoors, they tend to stun themselves too often.  I'm thinking they might need to have their immunity to stun increased or build in an exception into the alien spawn routine that turns off their TSL attack indoors.-[[User:Morgan525|Tycho]] 19:53, 21 October 2012 (EDT)''
:: Ah, good explanation, thanks. Yes I think it would be a good idea to increase their Freeze resistance considerably. After all they are (now) the definitive freeze-using monster from the deep. As a four square unit they will take extra damage from their own attack, approaching 3-4x at point blank, so think it would be fine to give them a very high immunity, maybe take only 20% damage from Freeze. Or even 10% / completely immune. In fact it's probably simpler just to say they are immune (0%). [[User:Spike|Spike]] 20:50, 21 October 2012 (EDT)


==Feedback==
== TFTD Mod Question ==
The site's article on the TFTD OBDATA.DAT explains exactly what needs to be changed in order to give a weapon infinite ammo (like lasers). To that end, is it possible to change a weapon's ammo type indexes (AKA offsets [26]-[28]) with the loader INI's OBDATA section? Because I don't see that option anywhere (maybe it was left out intentionally because you wouldn't know the indexes anyway without looking into OBDATA?). Additionally, the OBDATA page says grenades always default to HE damage type; is there a way for the loader to override that in order to, for example, have a sonic pulser that explodes normally but inflicts sonic damage instead of HE?--[[User:Amitakartok|amitakartok]] 10:29, 20 March 2013 (EDT)
 
''The loader doesn't reference the ammo type indexes.  As you pointed out, that is an advanced level of modding and anyone interested in that should be able to do it directly in the OBDATA file since they would need to view it anyway to get the correct references. The subroutine for explosions only handles five types of damage ( HE, IN, smoke, STUN/THERMAL, and light.) It would require a large amount of rewriting and troubleshooting to the explosion code to use other types of explosion damage. I don't have that much time anymore to devote to this as I used to, so I won't be able to do such myself.  - [[User:Morgan525|Tycho]] 02:00, 1 May 2013 (EDT)''
 
== EU and TFTD destination code ==
Here is the code that the game uses to determine the intermediate destination of a craft.
 
mov    ax, [ebp+10h] <------------------Destination/target's LOC.DAT reference number
mov    ecx, pLoc_Dat_49AAB0
mov    [esp+50h+destinationID], eax
movsx  eax, ax
lea    eax, [eax+eax*4]
mov    di, [ecx+eax*4+2] <------------- Destination/target's current Horzontal Coordinate
mov    dx, [ecx+eax*4+4] <-------------              current Vertical Coordinate
lea    eax, [ecx+eax*4]
xor    ecx, ecx
mov    word ptr [esp+50h+DestVerticalCoord], dx
mov    [esp+50h+DestHorzonCoord], edi
mov    cl, [eax+1]      <------------- Target's CRAFT.DAT reference number
mov    eax, ecx         
mov    ecx, pCraftDat_49AB18
lea    edx, [eax+eax*2]
lea    eax, [eax+edx*4]
mov    ax, [ecx+eax*8+0Ch]  <---------- altitude of target
test    ax, ax
mov    [ebp+0Ch], ax
jnz    short loc_4577AA
 
==Zrbite spawn locations==
 
Do you have any proof that Zrbite was intended to always spawn within Ion Beam Accelerators? Not always spawning in IBAs is only a bug if it was intended to always spawn in IBAs. [[User:Magic9mushroom|Magic9mushroom]] ([[User talk:Magic9mushroom|talk]]) 06:52, 3 April 2015 (EDT)
 
*''zrbite=elerium(EU), Ion Beam Accelerators=Power Supply (EU).'' 
*''In EU, elerium always spawns in the location of a PS.  That way if the PS explodes in a UFO crash the elerium is destroyed.  That is by design.  Why should is be any different in TFTD?  To be easier? No, since the developers were attempting to make a harder game. ''
*''If the designers were putting zbrite in other locations besides the IBA, it should still be somewhere inside the ship.  On several USO, some zbrite spawns outside the ship.'' 
*''When looking at the spawn database, many of the locations would have been almost correct, had the two middle bytes (x-pos and Y-pos) been switched.  Either the designers got their coordinates mixed when populating this table, and/or the USO designs where changed and this table was never updated.''
*''All this, in conjunction with all the other similar issues that are in the game, have led me to classify this as a development bug.''[[User:Morgan525|Tycho]] ([[User talk:Morgan525|talk]]) 09:11, 5 April 2015 (EDT)
 
:There are several parts of TFTD that are in fact easier than EU. There is less psi; Tasoths do not have all ranks psi-active like Ethereals do, and those aliens that are psi-active aren't nearly as good at it (even on Superhuman with TFTD's increased difficulty scaling). Tentaculats do not appear in Terror Missions, and cannot kill tanks the way Chryssalids can. And while there are more near-indestructible enemies, both kinds do have a "kryptonite" weakness that will instantly destroy them when applied (drills usually one-shot Lobster Men, and GC-HE rounds and Sonic Pulsers do the same to Triscenes), while EU's Sectopods have no such weakness (the Heavy Laser still has a 50%+ chance of doing 0 damage against a Sectopod's front and side armour, and they hold up better against Blasters than anything besides Mutons).
 
:Is the spawn database you reference on this site somewhere? I'd like to look at it myself.
 
:In any case, I would suggest you at least correct your spelling of "Zrbite". [[User:Magic9mushroom|Magic9mushroom]] ([[User talk:Magic9mushroom|talk]]) 18:56, 5 April 2015 (EDT)
 
:: FWIW, the Zrbite spawn location in the Cruiser (all the way in the "tail") looks pretty deliberate IMO, but some of the others are just bugs. [[User:AMX|AMX]] ([[User talk:AMX|talk]]) 13:18, 12 April 2015 (EDT)
 
== Interception crash bug ==
 
Hi Tycho,
 
I've encountered the Interception Crash mentioned on the TFTDExtender talk page. Error message and zipped save waiting for you there. [[User:Off the Rails|Off the Rails]] ([[User talk:Off the Rails|talk]]) 22:21, 28 April 2016 (UTC)

Latest revision as of 22:21, 28 April 2016

Questions&Feedback

Any questions or feedback one may have.... (please be sure to leave a signature: "~" three times in a row, four to time-and-date stamp it.)


FYI: I've created a new UFO Extender page. If you are having a problem on this, please use the discussion page located there. If your message is about UFO Extender, you can leave it here but I may start copying it to the UFO page and leaving my reply there.

Hi Morgan. This is just a comment about your recent edit of the Alien Missions (TFTD) page. Terrorise is actually the proper British spelling of the American terrorize. There are quite a few regular contributors here who write British English so there will be a lot of these "misspellings". Us American English contributors will just have to learn to recognize and accept these cultural differences to prevent edit wars. The policy here is to just leave cultural spellings the way they are, unless you are absolutely sure. --Zombie (talk) 20:36, 27 May 2015 (EDT)

Zombie, some differences between US and UK English I am aware of and don't care how a word is spelled as long as it is correct in either method (color vs. colour). I hadn't realize that "terrorise" was spelled differently under UK English. I was just going by what the auto-correct program said was a mispelled word. I didn't mean to offend anyone.
No worries, you didn't offend anyone. I speak and write "American" English anyway, hehe. At this site I try my best to use the nomenclature in-game so that links are standardized, etc, but sometimes I forget as well. --Zombie (talk) 23:22, 27 May 2015 (EDT)

I reverted your edit, as ENGLISH.DAT uses "terrorise" and "fulfil" in that sentence. No biggie—it's positively simple to undo one edit compared to the years of links to "Base Defense"—but it might be worth asking yourself whether something's a direct quote before changing the spelling used. Magic9mushroom (talk) 03:50, 28 May 2015 (EDT)

Decompiled accuracy algorithm?

Hi Morgan/Tycho

Is the algorithm you describe above, what you have decompiled from the standard game? Or is it a variant for UFOExtender? Great news if you have decompiled what the game actually uses - I will need to check some of my firepower calculations to make sure they are still in line with the algorithm.

cheers, Spike 09:37, 30 June 2012 (EDT)

It is an extender version of the original formula if one chooses to enable it. The original is the one that has been noted already: [1+(3/UFOsize)]/2 * Weapon Accuracy ... UFO sizes going from 5 for very small to 1 for very large. The calculation starts at offset 0x446DCD of the CE version. The original UFO accuracy algorithm is a flat 60% chance to hit despite the difficulty level (and no penalty for the Xcraft being in cautious mode.)

Tycho 19:23, 30 June 2012 (EDT)

Source

Hi Tycho

Do you make the source code for TFTD Extender and UFO Extender available somewhere? I'm interested in seeing if I can help to hunt down bugs / develop new features. Cheers, Spike 08:23, 4 October 2012 (EDT)

I just uploaded a new version of the UFOExtender source files to Seb's list.- -Tycho 06:04, 6 October 2012 (EDT)
Source code for TFTDExtender is now available from my user page. -Tycho

How to start modifying the game code

I like some of the changes made in the UFO extender but dislike others. I'm also running X-Com through DOSbox so it's a moot point anyway. Essentially I'd like to be able to make modifications to the game - like fixing the dismantled structure bug - myself. Where should I start? I have some experience with object oriented programming through languages like C# (most familiar) and Java.

Juke 21:04, 16 October 2012 (EDT)

Your first step is going to be to become very familiar with Disassembly and Disassemblers. Most people use IDA. Then your going to have to be able to understand the language itself. Take a look at the few examples on my page and see what it looks like. That code comes from the CE version, the DOS version doesn't disassemble as well (at least with any free dissassembler that I've found). Tycho 23:24, 16 October 2012 (EDT)

I am running the game on steam with the DOSBox. Will I still be able to make changes to the source code? Thanks for the info btw. Juke 22:03, 28 October 2012 (EDT)

I started using the DOS version under DOSbox and making simple changes to the data points via a hex editor. However, it is really hard to do more than that.
The problem is knowing where to make changes since no free program is able to disassemble the DOS version well. For that reason, I switched to the Windows version.

Shifting 5 shot laser mod to other weapons

Is there any easy way to shift the 5 shot mod that's currently on the heavy laser on to other weapons? I plan on getting the source code and working on it a bit (it's been years since I've touched assembly, I mostly code in C# now), but it'd be helpful to have a clue of where to start looking. I'd love to contribute to the project as well. KingMob4313 09:27, 17 October 2012 (EDT)

I'm sure it can be done. I focus on providing content that will enhance the challenge of the game from a somewhat logical viewpoint without making changes just to make the game harder. The source code for Extender is available and mostly written in C++ so you shouldn't have much trouble understanding it. You will need a disassembler, such as IDA, for the actual game executable and be familiar with how to decipher the tangled mess of assembly code that IDA provides. For some features, I can write the code in C++ but, for a lot of fixes, I find writing in assembly much easier to insert into the proper subroutines. - Tycho 09:54, 17 October 2012 (EDT)
I should have just read some of the above responses, I am sorry. I will take your advice and pick up the disassembler and try to familiarize myself with the code a bit. Seems that everything works via a hook-system, where it waits for the calls to the subroutines and replaces it, correct? In any case, I appreciate the quick answer. KingMob4313 12:30, 17 October 2012 (EDT)
The hardest part of familiarizing youself with the code is that the subroutines and variables are just offsets with no identifiers. If you take the time to match offsets to labels given in the xcom.h file (in the Extender source) you can manually transfer the labels yourself. This will make analyzing the code much easier. - Tycho 20:07, 17 October 2012 (EDT)

We're all... feeling... so... sleepy

Hi Tycho

Well, I was not expecting that! Your TSL-firing Hallucinoids just kicked my *ss on a Superhuman Colony Assault. They kept firing their TSL-like built in weapons - in fact it looks like it's an auto burst TSL? - right into the transport door. And I kept popping another guy out of the door to grab the bodies outside and take out the Tasoth with a TSL I presumed was out there. I could never see the Tasoth, just some stupid Hallucinoid floating around - and they're never a threat, right? Wrong!

Brilliant, in one stroke you have breathed new life into a previously-ignored enemy, making it as frightening as it always should have been. I hope you don't mind me adding a slight spoiler to the Bug Fixes section - if you do, feel free to revert it so you can surprise others like you surprised me. :) Cheers, Spike 18:46, 21 October 2012 (EDT):

Hehehe. >;) No, its not autofiring but the Hallucinoid has a high reaction score and the cost to fire their weapon is 33%. However, they don't often move so they always have most of their TUs. Now that they have a valid range weapon, they are extemely deadly in outdoor settings. Indoors, they tend to stun themselves too often. I'm thinking they might need to have their immunity to stun increased or build in an exception into the alien spawn routine that turns off their TSL attack indoors.-Tycho 19:53, 21 October 2012 (EDT)
Ah, good explanation, thanks. Yes I think it would be a good idea to increase their Freeze resistance considerably. After all they are (now) the definitive freeze-using monster from the deep. As a four square unit they will take extra damage from their own attack, approaching 3-4x at point blank, so think it would be fine to give them a very high immunity, maybe take only 20% damage from Freeze. Or even 10% / completely immune. In fact it's probably simpler just to say they are immune (0%). Spike 20:50, 21 October 2012 (EDT)

TFTD Mod Question

The site's article on the TFTD OBDATA.DAT explains exactly what needs to be changed in order to give a weapon infinite ammo (like lasers). To that end, is it possible to change a weapon's ammo type indexes (AKA offsets [26]-[28]) with the loader INI's OBDATA section? Because I don't see that option anywhere (maybe it was left out intentionally because you wouldn't know the indexes anyway without looking into OBDATA?). Additionally, the OBDATA page says grenades always default to HE damage type; is there a way for the loader to override that in order to, for example, have a sonic pulser that explodes normally but inflicts sonic damage instead of HE?--amitakartok 10:29, 20 March 2013 (EDT)

The loader doesn't reference the ammo type indexes. As you pointed out, that is an advanced level of modding and anyone interested in that should be able to do it directly in the OBDATA file since they would need to view it anyway to get the correct references. The subroutine for explosions only handles five types of damage ( HE, IN, smoke, STUN/THERMAL, and light.) It would require a large amount of rewriting and troubleshooting to the explosion code to use other types of explosion damage. I don't have that much time anymore to devote to this as I used to, so I won't be able to do such myself. - Tycho 02:00, 1 May 2013 (EDT)

EU and TFTD destination code

Here is the code that the game uses to determine the intermediate destination of a craft.

mov     ax, [ebp+10h] <------------------Destination/target's LOC.DAT reference number
mov     ecx, pLoc_Dat_49AAB0
mov     [esp+50h+destinationID], eax
movsx   eax, ax
lea     eax, [eax+eax*4]
mov     di, [ecx+eax*4+2] <------------- Destination/target's current Horzontal Coordinate
mov     dx, [ecx+eax*4+4] <-------------               current Vertical Coordinate
lea     eax, [ecx+eax*4]
xor     ecx, ecx
mov     word ptr [esp+50h+DestVerticalCoord], dx
mov     [esp+50h+DestHorzonCoord], edi
mov     cl, [eax+1]       <------------- Target's CRAFT.DAT reference number 
mov     eax, ecx          
mov     ecx, pCraftDat_49AB18
lea     edx, [eax+eax*2]
lea     eax, [eax+edx*4]
mov     ax, [ecx+eax*8+0Ch]  <---------- altitude of target
test    ax, ax
mov     [ebp+0Ch], ax
jnz     short loc_4577AA

Zrbite spawn locations

Do you have any proof that Zrbite was intended to always spawn within Ion Beam Accelerators? Not always spawning in IBAs is only a bug if it was intended to always spawn in IBAs. Magic9mushroom (talk) 06:52, 3 April 2015 (EDT)

  • zrbite=elerium(EU), Ion Beam Accelerators=Power Supply (EU).
  • In EU, elerium always spawns in the location of a PS. That way if the PS explodes in a UFO crash the elerium is destroyed. That is by design. Why should is be any different in TFTD? To be easier? No, since the developers were attempting to make a harder game.
  • If the designers were putting zbrite in other locations besides the IBA, it should still be somewhere inside the ship. On several USO, some zbrite spawns outside the ship.
  • When looking at the spawn database, many of the locations would have been almost correct, had the two middle bytes (x-pos and Y-pos) been switched. Either the designers got their coordinates mixed when populating this table, and/or the USO designs where changed and this table was never updated.
  • All this, in conjunction with all the other similar issues that are in the game, have led me to classify this as a development bug.Tycho (talk) 09:11, 5 April 2015 (EDT)
There are several parts of TFTD that are in fact easier than EU. There is less psi; Tasoths do not have all ranks psi-active like Ethereals do, and those aliens that are psi-active aren't nearly as good at it (even on Superhuman with TFTD's increased difficulty scaling). Tentaculats do not appear in Terror Missions, and cannot kill tanks the way Chryssalids can. And while there are more near-indestructible enemies, both kinds do have a "kryptonite" weakness that will instantly destroy them when applied (drills usually one-shot Lobster Men, and GC-HE rounds and Sonic Pulsers do the same to Triscenes), while EU's Sectopods have no such weakness (the Heavy Laser still has a 50%+ chance of doing 0 damage against a Sectopod's front and side armour, and they hold up better against Blasters than anything besides Mutons).
Is the spawn database you reference on this site somewhere? I'd like to look at it myself.
In any case, I would suggest you at least correct your spelling of "Zrbite". Magic9mushroom (talk) 18:56, 5 April 2015 (EDT)
FWIW, the Zrbite spawn location in the Cruiser (all the way in the "tail") looks pretty deliberate IMO, but some of the others are just bugs. AMX (talk) 13:18, 12 April 2015 (EDT)

Interception crash bug

Hi Tycho,

I've encountered the Interception Crash mentioned on the TFTDExtender talk page. Error message and zipped save waiting for you there. Off the Rails (talk) 22:21, 28 April 2016 (UTC)