Page 1 of 1

Max Character Alignments

Posted: Sat Apr 30, 2016 2:57 pm
by DevourMistress
So, in order to help the devs, i have started this topic in order for us to help them figure out the lowest and highest alignments for each character that can be achieved. I raised this topic on steam almost an year ago, but now i raise it here, especially now that i present you: The max rook 25 alignment playthrough. Feel free to comment any choices missed when achieving +72 for Rook 25, as well as taking part in these grand experiments to find the highest and lowest of alignments for all characters.

Playlist for max Rook 25 can be found here: ... -hVTLN72gr

Please support the devs by joining in and helping us figure the highest and lowest points for them, making it much easier to develop The Tower

Re: Max Character Alignments

Posted: Sat Apr 30, 2016 3:33 pm
by FordGT90Concept
For the record, documented this here:

If finding min/max becomes a common thing, I'll add it to the Character template.

Re: Max Character Alignments

Posted: Sat Apr 30, 2016 11:09 pm
by GreatBird
We heartily encourage everyone to help with this effort!! :-) What is the highest alignment you have achieved with all of our characters? B

Because of the way we made our game, there actually isn't any painless way to truly figure out what the highest and lowest Alignment values are for all of the characters...

Re: Max Character Alignments

Posted: Sun May 01, 2016 4:18 am
by FordGT90Concept
Yeah, I looked at the XMLs that define the alignment changes. The way they are organized (linearly with IDs), it is impossible to programmatically solve the problem without external data because triggers are required. The triggers are in the maps which means I'd have to parse the entities chunk of the map file (not a problem) and figure out what's reachable and not (very difficult). Further, there are scripted alignment changes (like +1 to almost everyone if you save Pawn 1) that I'm not even sure where it comes from. It could be solved programmatically but it would take an enormous amount of effort.

I was going to post a picture of where alignment was at when trying to maximize everyone but apparently, I have no such save. Having that (also on the negative side) would establish a good baseline for alignment that is extraordinary.

Re: Max Character Alignments

Posted: Sat May 21, 2016 2:17 pm
by FordGT90Concept
I just played through the game making everyone happy and this is what I got:
Some of the pawns might be maxed...maybe Rook 9 too but Knight 15 and Rook 25 definitely aren't (any decision where it would + one and - the other, I remained neutral).

Does Yanko get +1 for knocking him out?

Re: Max Character Alignments

Posted: Sun Mar 05, 2017 11:33 am
by FordGT90Concept
I thought I might be over thinking this. I could pretty easily go through the XML files and total up positives and negatives to get literal maxes and minimums but doing so would not have the deep enough logic to mimic the player (in other words, conversations the player would be shut out of are still counted).

Is there any value to obtaining this data?

Inside of a dialog tree, does the game keep track of the nodes already used so they are impossible to select again?

Edit: I made great strides in writing a crawler to reduce every group and tree into alignment changes. Once that is done, it will be a matter of human going through the files to figure out which groups are related to each other and condense them. Once these three new documents are produced, it's a simple matter of reading the data, adding stuff up, and spitting out the mins and maxes.

Do you know if there's any infinite loops in these files or is it scripted in a way that it always eventually ejects the player?

I have to remember to do the group/hidden changes.

Edit: What are the conditions that cause a conversation to end? Right now, the code hit an alignment change 2139 times in the first tree but it's failing to string them together into a coherent attempt. It is missing cut off points other than running out of places to go.

Re: Max Character Alignments

Posted: Mon Mar 06, 2017 6:46 pm
by FordGT90Concept
I think I'm going to have to abandon the aforementioned project. These XMLs work great to get a basic understanding of what is going on but they're not designed for a program to traverse. To make it work, I'd basically have to write all new XMLs. It'd probably be faster just to play the game.

Re: Max Character Alignments

Posted: Wed Mar 08, 2017 8:31 pm
by FordGT90Concept
After serious rethinking and recoding, progress!

The second tree conversation with Rook 25 which begins after she turns on the lights and ends before she starts talking about the BUS has 3,937 possible combinations. 3,937! Glancing through here, it appears to be correct. Here's an example (index 43):

Code: Select all

{R25: <jovial> Not so sorry to wake you, Bishop. We thought you should know about our little... escort.}
{Seeker: Escort? Should we be worried?}
{R25: <laugh> Worried? No, Bishop, there's nothing to worry about. Not unless you're afraid of a couple crummy American F-35s, piloted by a group of washed up mercenaries? A few more bad apples who wish the War never ended. <smile> It's just another day in the Consortium.}
{Seeker: Crummy? But Americans make the best stuff!}
{R25: <laugh> Oh, that's funny. You're good. Maybe they did, once.}
{Seeker: You mean they don't anymore? Why?}
{R25: <laugh> You're serious? Global Corporations make everything these days. History 101, Bishop. Where have you been the past 20 years?}
{Seeker: 20 years? What year is it?}
{R25: <frown> Are you trying to be funny? <pause> I don't get it. [-1]}
{Seeker: I come from a different reality and time.}
{R25: { goto R25_[1]1:2:1:2 }}
{R25: <amused/sarcastic> Do you now? Well, back here in this reality and time, Corporations make it all... from bullet casings to space stations.}
{Seeker: That sounds ripe for corruption.}
{R25: <laugh> Some ignorant people still think so, sure. [1]}
{Seeker: Excuse me? You're saying there's no corruption?}
{R25: I'm saying it's better quality goods at lesser prices – and when there's no 'little guy' to hurt anymore, everybody wins.}
{Seeker: Let's back it up; why are these mercs out there bothering us?}
{R25: { goto R25_[1]1:1 }}
{R25: <smile> To 'escort' us through Bulgaria. It's a long story but let's just say the leader of this particular crew has a very strong disliking for our way of doing things. He likes to think he's doing the people of Bulgaria a service by pestering us... but really, they're as fed up with him as the K and I are.}
{Seeker: Who or what is 'the K?'}
{R25: Oh, right. That's just what I call Knight 15. <grin> We've been dealing with these guys for years now and I like to think Kiril, their leader, has a crush on her.}
{Seeker: Do you think Knight 15 feels the same way about Kiril?}
{R25: <big laugh> Oh my gods, that felt good... oh, thank you, Bishop. When you meet Kiril, you'll no doubt have a good laugh over what you just asked me. [2]}
{Seeker: So... who is Knight 15 exactly? Is she the boss?}
{R25: { goto R25_[1]1:1:3:2 }}
{R25: <eyebrow raised> Uh, you met her when you came on board... remember? She's technically our operations manager, the leader of our little team. [-1]}
{Seeker: And so who am I then?}
{R25: { goto R25_[1]1:2:1:2:1 }}
{R25: <shakes head/rolls eyes> Alright, alright... I get it, you're acting the maggot. Ha. Now will you please pay attention for just another two minutes? [-2]}
{Seeker: Uh huh, and so who are you then?}
{R25: { goto R25_[1]2 }}
{R25: <slowly/confused> We just met two hours ago...  [-1]}
{Seeker: Right! So, where exactly are we?}
{R25: At the moment, we're about 45 thousand feet over central Bulgaria.}
{Seeker: No, I mean what is this plane we're in?}
{R25: <sigh> What?! Are you kidding me? [-1]}
{Seeker: Just humour me, what is this plane?}
{R25: Are you feeling alright? You're on a C-3800 Consortium command vessel, codenamed Zenlil.}
{Seeker: And I still don't know who you are...}
{R25: { goto R25_[1]2:2 }}
{R25: This isn't very funny, new guy. But, you know, let's see where this goes... My name is Alannah Boyle, codename Rook 25. I am your weapons and combat specialist. Do you know what YOUR name is?}
{Seeker: I am your commanding officer! Never speak to me like that again!}
{R25: <annoyed> Let's get one thing straight here, big man. You are not my 'commanding officer', nor will you ever be unless it's over my dead - Rook - arse. At the risk of sounding cliche, this isn't quite your daddy's army. [-1]}

Re: Max Character Alignments

Posted: Tue Mar 14, 2017 3:23 am
by FordGT90Concept
I'm almost done with this project (I think). It won't be 100% correct because of the number of variables floating around that are simply too complicated to account for but, this long, isolated Kiril dialog caught my attention and thought I'd share. The tree goes *very* deep and I think probably everyone missed important parts here.


Seeker: So you know where I'm really from?
MercKiril: <confused> Where you are 'from?' I know you are a tree-hugging Canadian... why does this matter?
Seeker: { if no_dialogue.time > 20s }
MercKiril: <laugh> You have a strange way of interrogating prisoners. Is this how Canadians do it? Confuse a confession from people?
K15: I do not think that is going to work... whatever it is you are trying to accomplish.
Seeker: I'm not Canadian, I'm not even Bishop Six!
MercKiril: <pause/leveled> I am intrigued. I was assuming some form of K-1 mind control was at work here, as my men have always suspected with your kind... But now you say you are simply not Bishop Six?
K15: Good, he knows something, keep him talking!
Seeker: Do people actually believe ALL Bishops are being mind controlled?
MercKiril: <snort> Some believe you are artificial, or a part of an alien race, the Guardian race even. There is also a Newswire blog about how all Bishops are time travelers. Children's tales... but mind control I can believe. You put the power of your King, together with your M.U.V.I. implant, then your C.M.C.... and what do you get?
Seeker: You tell me... what do I get?
MercKiril: <scoff> Do not play ignorant with me. It all equates to a powerful mind control tool, the C.M.C. already reads the mind... and the K-1 network is almost untraceable. The perfect crime for the perfect machine.
K15: <rolls eyes> I've heard this 'mind control' tale plenty of times before. Let's try and bring him back on track, shall we?
Seeker: Knight 15 is telling me to change the subject.
MercKiril: <laugh> Isn't that perfectly fitting? Tell the King he does a bad impression of Knight 15.
K15: <annoyed> Thanks a lot, Six.
Seeker: So if we are all being mind controlled, why am I 'not one of them?'
MercKiril: Let's not keep playing games. You have bested me, and I am at your mercy. But does your crew know of your bizarre brand of treachery? How you first helped me, only to later defeat me?
K15: What is he talking about?
Seeker: [CMC-Knight 15] I'm really not sure, how should I proceed?
K15: It's O.K., Six. Play into this fantasy of his, see what he says.
MercKiril: I can hear them now, on that C.M.C. of yours. 'What have you done, Bishop?' Will you tell them, or shall I?
Seeker: They know all of it, so please... cut the crap.
MercKiril: Oh, so then you are all in this together? Hmph, is this what Consortium officers do for kicks then? Is there a wager on what it will take to break me? Or perhaps on which of your Pawns will die?
Seeker: You are the one who attacked us and tried to kill me!
MercKiril: <amused> Did I? Because from here, it looks like you only attacked yourselves. One of you paid me, one of you fed me information... and you... well you are a bit of a wild card, aren't you?
K15: <annoyed> I'm tired of this, he's not going to be any help.
Seeker: So you think I'm being set up?
MercKiril: <smile> Give the man a prize. I believe you are being duped, yes, like me, possibly like most of your crew. I also believe there is more to this day, and while we remain distracted by each other and our petty dispute, events are in motion far beyond even Consortium control.
Seeker: [Laugh] I think that does it, who wagered he'd blame 'the invisible enemy?'
MercKiril: You are very funny, but I can tell when someone is trying to change the subject. They don't know... do they? Do YOU even know?

Seeker: Fine, I'll cave. What do you know, exactly?
MercKiril: I had a feeling you might say that. Three times this morning, I spoke with you, Bishop Six. You are who initiated Phase One, you are who told me to blame Rook 13 if the chance arose. I assumed you were testing my resolve, and so I played along...
R25: He had better be messing around!
K15: Alannah, stay out of this. I mean it. He's attempting to turn us against each other, hoping we'll believe anything after today.
Seeker: Well I couldn't have told you about Pawn 7... how did you know he was dead?
MercKiril: No, my other contact is the one who told me about Pawn 7, through another coded C.M.C. transmission. One of your crew has been updating me on mission details for weeks, whereas YOU only started talking to me this morning. Except... you claim you did NOT speak to me...
Seeker: Maybe I did. So what? You failed, didn't you?
MercKiril: <laugh> Touche, Bishop Six. But what about the dead? Do you even care? And let's not forget about the E.M.P. I was given and the massive sum of money somebody paid me, in full. If this was all merely to catch me, then I am flattered.
Seeker: Can you prove your contact used a C.M.C.?
MercKiril: Ha, from in here? No. And since my headquarters is now being torn to shreds, I believe you'll have to trust me. I have people who know people, and they figured out how to detect the C.M.C. network.
Seeker: I do trust you, but you're not much good to me in here...
MercKiril: <cringe> You can grope me later, but yes... something like that. I know I am not getting out of this either way, so I may as well pick a side.

Re: Max Character Alignments

Posted: Wed Mar 15, 2017 5:22 am
by FordGT90Concept
The results are almost done 78.4% as of now so I figured I would explain my process in detail because corners had to be cut due to memory considerations:

Phase 1: Make the code "move" through the XML. The XMLs in their original state were designed as conversations in the game ("duh"). They weren't designed to be explored and evaluated by a processor. After trying repeatedly to make code understand the XMLs in their original state, I gave up. After a day or two of pondering, I finally decided that the XMLs themselves were the problem so I wrote code that moved all of the data into a singular memory structure. This worked and after some tweaking, worked flawlessly.

Phase 2: Summarize each "group" and "tree" in the game (henceforth called a "region"). Groups are generally conversations that have no input from the Seeker while trees do. Much later, I discovered that the game rarely takes alignment into consideration when it is a group. More on that later. Basically what I did was summarize who was speaking in each region and what their minimum and maximum alignments were. So now I had a summary of every discussion in the game that resulted in an alignment change.

Phase 3: Next, I had to get medieval on the map files (BSP, Binary Space Partition) themselves. By that, I mean I literally took Hex Workshop and chopped out the entities section of the file. I did this manually because I didn't care to study and describe the header format of Source's map files. Shame on me for cutting corners, I know. Why did I tear the BSP apart? Because entities contain, well, everything that triggers dialogs in the game. Of particular interest is the "AddToAlignment" command that entities can trigger. So I dusted off my old Nightfire tokenizer and set it to work finding the important parts of the entities and extracting them so I could get a macro view of what was going on. This lead to a lot of in game testing which lead to updating the alignments page on the wiki here. A lot of you reading this probably didn't even realize these happened in secret.

Phase 4: The tedious process of lining up what is experienced in the game with "indices" (e.g. Zenlil_1|40 where "Zenlil_1" is the source file name and "40" is the unique identifier for the region in the original XML) as well as creating new indices to reflect what I learned from the map files in Phase 3. I dumped these in specially formatted text files knowing I was going to have to make a program read them eventually. This lead to creating this mess on my desktop:

Phase 5: Loading the map laid out by the text files pictured above quickly unveiled problems I didn't anticipate. Specifically, when branching, I couldn't come up with a good solution for preserving the previous decision into each subsequent possibility. I went to bed and couldn't put it out of mind and realized I've been using the solution to this problem since Phase 1: the very same code that handled the XMLs in the first place. So, I went to work converting my text files into a single XML that mimics the very same I came up with in Phase 1. It worked.

So, here we are now, 86.67% done analyzing the final data set: 2,935,296 possibilities with give or take 20 characters each comparing them to a master list of minimum and maximum alignments. The anticipation (and my wrist from doing Phase 5) is killing me.

Before it finishes, and I present the final results, I need to make some things clear:
1. The micro analysis of the code is superb. Every time I checked one of the conversations it settled on, it matches.
2. The macro analysis of the code is less-than-stellar. Corners had to be cut because I have not written a way to carry a decision or choice from one region into another region. For example, talking to Pawn 11 in Act 1 about Jeremy Soule resurfaces again when you talk to her in Act 2. My answer to this problem lies in the branching, as well as min/max nature of the regions. The assumption is that if you're trying to maximum Pawn 11, you'll have chosen the choice that gives you maximum alignment in both situations and they usually theory. In practice, this adds a range of variability that's simply too complex to account for. As such, the outputs of this program should be consider educated guesses rather than absolute values.
3. The bugs in the game (pointed out to the lead writer, Steve MacMartin, already) are preserved in this study.
4. I am human so mistakes were likely made. I tried to avoid as many as I could by making a processor do the work but there's a limit on what I can verify. Phase 4 and Phase 5 could have added a lot of logic errors into the mix too, unfortunately.

Now it is up to 90.98% done and I think I said all that needs saying. I will edit with the final data soon...

9.6 GiB of RAM and 312 minutes of processing...

Name, Minimum, Maximum
King, -22, 24
Kiril, -49, 34
Knight 15, -81, 69
Knight 18, 0, 3
Pawn 1, -25, 13
Pawn 4, -32, 16
Pawn 11, -11, 13
Pawn 12, -8, 26
Pawn 19, -19, 22
Pawn 24, -19, 21
Pawn 32, -30, 20
Pawn 44, -10, 20
Pawn 51, -8, 14
Pawn 62, -26, 19
Pawn 64, -13, 17
Petar, -4, 6
Queen, -33, 21
Rook 3, -10, 7
Rook 9, -31, 64
Rook 13, -9, 26
Rook 25, -82, 93
Traitor, -2, 1
Yanko, -11, 1

If you wish to mimic what happened above, download the attachment and navigate to the MinMax\MinMax\Storyboard folder and take a look at nodes.xml for the specific region min/max conversations and storyboard.xml for the path through those nodes the code explored. Specifically, go through storyboard.xml taking the "Name" field (where available) and search for it in nodes.xml. Whenever you come to a Jump field, note the name and move down to that section of storyboard.xml (it always enters at the first node).

Re: Max Character Alignments

Posted: Wed Mar 15, 2017 12:30 pm
by GreatBird
Amazing work, Ford.

To anyone that reads this: If you have Consortium installed and a saved game that is near the end of the game: We would appreciate checking the above numbers and making sure that YOUR alignment numbers with NPCs fall within the above min and max if you find any issues.

Re: Max Character Alignments

Posted: Wed Mar 15, 2017 5:20 pm
by FordGT90Concept
I already verified Queen Vexus' Rook 25 max ended up inside. I thought I took a picture of all + alignment I had but apparently not so I can't check that.

My greater concern is that the alignments have a broader range than actually reachable in game because of the branching. Ehm, if two branches conflict because of a previous choice, I could not preserve that previous choice so it still takes the minimum and maximum of the greatest branch. Because of this, I highly doubt it is possible to get alignments that are outside of the range but some maxes and minimums may not actually be attainable (e.g. Rook 25's max may be in the 80s instead of 93).

Re: Max Character Alignments

Posted: Wed Mar 15, 2017 8:22 pm
by GreatBird
Ah, gotcha Ford. We'll have the "extreme" alignment options in The Tower be quite a bit lower than these values to help ensure it will work.

Re: Max Character Alignments

Posted: Sun Apr 02, 2017 12:34 am
by FordGT90Concept
Oh, I did post a picture of the maximum alignments in this post. I maxed three: Yanko (1), Knight 18 (3), and Pawn 4 (16). All of them are within the ranges the program came up with. :D

Re: Max Character Alignments

Posted: Thu Jan 11, 2018 1:04 pm
by FordGT90Concept
Updated source code that's multithreaded and less memory intensive. results.xml now contains the IDs (from nodes.xml) showing the complete path of the min/max attempt.

Re: Max Character Alignments

Posted: Thu Jan 11, 2018 8:41 pm
by FordGT90Concept
Here's a program to better see the important stuff in the XMLs. Extract the contents of the ZIP to a directory then run MinMaxExplorer.exe.

January 12 updated. Fixed the +10/-10 King and remove two groups for R25 that don't change alignment (effectively -3 eliminated).

January 14 updated. Lots of amendments and improvements made throughout my run through the game.

Re: Max Character Alignments

Posted: Sun Jan 14, 2018 2:05 am
by FordGT90Concept
Here's an updated min/max tally:
minmax.png (37.6 KiB) Viewed 4973 times
There's still major problems around Kiril and several other characters that are just too complicated to solve with the information I have available. I'd basically have to start all over with a new approach (setting and checking variables) which isn't going to happen.