Talk:Exercising The AI

From UFOpaedia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Tactical Debug Mode

Looks like the developers left some debug code behind. The code is activated depending on a variable which of course, is always set to 0. However if you manage to change it to 1, you get full map disclosure at startup, every alien movement is visible, and as an added bonus you are able to select the alien units at the end of their turn to see their stats and equipment. And the icing on the cake: you can even control them with what's left of their TUs! Hope this'll help further analysis of the game ;-). Here is a patch for the CE edition to activate the sleeping code. At offset 025455h, replace:

C3 90 90 90 90 90 90 90

with

66 FF 05 D2 7B 47 00 C3

Have fun! Seb76 05:55, 2 May 2008 (PDT)


Interesting, standard technique for manually patching out code. -- Zaimoni 18:41, 2 May 2008 (CDT)


Another more extensive example is here if you want to play with patches: File:Ufo weight.zip. I hardly got any feedack from it so feel free to report problems ;-) Seb76 02:40, 3 May 2008 (PDT)


Finally reactivated the game in question, and used the patch to rectify some AI weirdness. And promptly got myself into a "transfer black hole" -- purchased soldiers never arrived at the target base. [Hex-edited my way out by setting the TRANSFER.DAT offset 0 to the target base, but that plausibly wasn't the correct way to do it.] -- Zaimoni 21:32, 26 May 2008 (CDT)


I only tested this in tactical mode so yeah, there may be other side effects in geograph. Isn't there a patch to mimic DOS and have 2 binaries for geo/tactical? Maybe you can get away with patching only the tactical exe... I'll have a look and see where exactly the flag is used. Seb76 04:56, 28 May 2008 (PDT)


I use XCOMUtil (need the graphical loader on W2K), so I did only path tactical.exe. I'm in the middle of tracking down what's going on operationally; I think the transfer black hole was persistent even against complete closing and restarting, but vanished after the second debug-mode battlescape. I'll find out what happens after the third debug-mode battlescape shortly. -- Zaimoni 10:24, 28 May 2008 (CDT) [*EDIT*: it's not oscillating based on games played. Game 1: two soldiers killed, transfer blackout. Game 2: 3 soldiers killed (1 by AI override), no transfer blackout. Game 3: 1 soldier killed (by AI override), no transfer blackout.]


So the problem occured only once? I checked every occurence of the flag check, and it is only used in tactical mode. Maybe you had your savegame files screwed up for some other reason? Anyone else had the same bug? Seb76 09:08, 28 May 2008 (PDT)


So far; there are a couple of variables I haven't checked yet. If I do see the bug again, I'm going to run binary diffs against a before-combat Geoscape. What's annoying is that this bug doesn't show in the TRANSFER.DAT file (that is completely normal-looking); it fires when the items/soldiers arrive. You get the arrival message, but then the items/soldiers disappear from the game. -- Zaimoni 11:43, 29 May 2008 (CDT)

Also: the hex-edit I did to bypass it should not have worked if the usual TRANSFER.DAT spec was in effect. (Changing the source of the transfer, should not suddenly cause it to arrive. Countdown happened normally, so it's safe to say the bug was triggering a reinterpretation of TRANSFER.DAT.) -- Zaimoni 11:48, 29 May 2008 (CDT)

Does this patch means that you get to see the aliens move on their turn? If so, I'm completely out of water regarding patching things an so on, could someone tell how to do it or get me a patched version? Because it would be very very interesting to use to test the values on the .RMP files - Hobbes 13:24, 29 May 2008 (PDT)


Yep, you can see everything the aliens do :) I personnaly use hexworkshop (just google for it) to test my patches. You go to the indicated offset (it in hexadecimal btw) and replace the bytes there with the ones specified. You can also have a look at BB's page, there is a "Seb76 Patcher" he made already ^_^ Seb76 16:49, 29 May 2008 (PDT)

Thanks a lot for the tip :) - Hobbes 15:10, 5 June 2008 (PDT)

You see more than the aliens do (it simply shows you all of your units regardless of the "aliens know where you are status".) It also effectively applies XCOMUtil's "all map seen" effect. Note: stuck alien syndrome appears to be an AI setting that simply skips over the alien entirely during turn processing. It cannot be cured simply by manually moving the alien during its turn. -- Zaimoni 10:09, 30 May 2008 (CDT)


Couple of observations while using the patch. On a terror mission the civilian turn was still hidden. On a base attack, all aliens started moving towards the final door leading into the control center (most got blocked due to Cyberdiscs), while a single alien sat moved to one spot and stayed there.

- Bomb Bloke 19:59, 30 May 2008 (PDT)


Hobbes, if you're using a different version, you could search for the sequence Seb listed. Using MS Edit or HexWorkshop; more details on hex editing at HackerTools.

Fascinating finding, Seb! -MikeTheRed 21:08, 30 May 2008 (PDT)

The sequence is non-specific. Disassembled, it would be RET NOP NOP NOP NOP NOP NOP NOP, which would occur anywhere that much padding was needed to align the function entry points. -- Zaimoni 10:00, 31 May 2008 (CDT)
Yeah, these padding zones are a blessing... Anyway, if he uses a modified executable there is very little chance that this particular bytes were also patched in his version. Seb76 09:30, 31 May 2008 (PDT)

LOL, looks like the developers were quite sloppy, I found another "hidden" flag that activates another interesting piece of code... At the same location as the patch before (025455h), if you use this:

66 FF 05 F2 D1 46 00 C3

then the aliens will spawn unarmed, and they will completely pass their turn and you'll have full control of them. Can be quite useful for testing. It might even be possible to exploit that to hack in a 2-players-hot-seat-duel mode ^_^ (right now it would be quite useless since the aliens have no weapons in that setup). Note that the 2 patches are incompatible since they use the same piece of padding space to inject their code... Seb76 08:03, 1 June 2008 (PDT)

Potential applications for Debug Mode

Aliens and Smoke

Perhaps these debug modes could be used to decisively determine, once and for all, how smoke affects aliens. Arrow Quivershaft 09:49, 9 September 2008 (PDT)