OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: MaxMahem on February 23, 2023, 06:25:51 am

Title: [DONE][Suggestion] Manual Promotions
Post by: MaxMahem on February 23, 2023, 06:25:51 am
So a feature I have often wanted is a way to handle promotions manually. I know some people don't mind/appreciate the automatic promotions, but I've never been a fan, and I can dislike how sometimes an inferior soldier ends up promoted simply because they had seniority when a position became available (maybe this is realistic, never the less, I dislike it).

As I see it, implementation would be fairly straightforward. The existing `SaveGame::handlePromotions` function would get split into two functions, one that identifies openings (the current first half of the method) returning a `PromotionInfo` object with the available openings and one that then processes the promotions. When this feature is enabled, the debriefing screen will instead display new openings (if any) after a battle. I think new generic translation strings may be necessary for these openings as I know the rank titles can be overridden on a per-soldierType basis (I haven't investigated this yet, though). Some fallback option is probably possible to not-break existing mods.

To actually perform the promotions, I envision clicking on the rank icon (turning it into an interactive surface), which would open up a screen very similar to the SoldierArmorState window, except it would be populated with possible promotions. Clicking on the rank would then promote the soldier. Additionally, it might be desirable to have a "Promotions" view accessible via the combo-drop-down from the soldier screen in the same way the transformation overview screen is. This has the advantage of being more visible as the fact that you can promote via clicking the rank icon wouldn't be immediately obvious, I think. This implementation would be more work, however, so I do not envision creating this screen in an initial implementation.

Questions I have:

So yeah, mostly concerned about the shape of the UI and configuration options. My inclination is, of course, to do the easiest possible implementation for a 1.0 feature, but I don't want to road-block future decisions with decisions made now (which probably means going for single-step promotion since I can later switch to multi-step promotion, but switching back would probably be disruptive).

Looking further down the road, it occurs to me that making ranks more configurable in general is probably desirable, and it's something I might be motivated to work on later, so I also want to avoid getting in the way of any configuration in that respect. However, it does occur to me that manual promotion might be a desirable feature in such a future, even for people who dislike the concept, if ranks were to become more unified with transformations in general, and so that, for example, a promotion might be a "transformation" that comes with both a benefit and a cost. For example, promoting a soldier to Captain or whatever gives them bonus stats, but requires them to be transferred off base for a week at Officer School, or whatever. I know some mods already do this via the transformation screen, but unifying the two might be desirable and could help make the drop-down not become so cluttered.
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on February 23, 2023, 02:28:00 pm
1. If I was to implement this, would it be a patch OXCE would be open to accepting? To be clear, I'm motivated to make this modification simply for my own desires, but I'd be more motivated if chances were good it could be accepted more wildly.

Usually I say no to such (fluff) additions.

But this specific one I am kinda contemplating myself for a longer time already.
My use case actually doesn't have anything to do with the gameplay... as I said, it's 98% just fluff, very few things depend on rank (e.g. some vanilla morale bonuses/maluses, and a few OXCE modding additions).
Also, I really don't want RPG features in Xcom. If an RPG feature can be used for some strategical or tactical purpose as well, I am willing to close one eye, maybe even both eyes... but pure RPG features without any strategical or tactical benefit are in general not welcome.

My use case comes from my Youtube career :) Being able to manually promote a soldier named after an active viewer/subscriber would for sure feel rewarding both for me and for the viewers. And god knows there's not enough acts of random kindness in this world. I know I could also do that via save editing, but it would feel much better real-time on-camera. A pure RPG feature I know, but hey, an exception proves a rule (if that's even a saying in English).

2. As I laid it out, the promotion screen would display all open positions, allowing (potentially) a rookie to be promoted to commander if desired. This is not typically how it works in the game. So instead, the promotion screen might simply give an option to promote to the next rank, if available. Ironically I think this would be somewhat more work to write, as I can't just crib off the existing windows (though there is probably a "confirmation" type window someplace I can crib-off of). Promotion from rookie to commander would still be possible, it would simply take more clicks.

Sounds good. I'm relatively open to changes in the mechanics/limits of the vanilla promotions, if a backwards-compatibility with vanilla is ensured via a master on/off switch. You'll probably also change your mind several times during the implementation.

3. Should demotions be possible? A "demote" option could easily be added to the list of possible new ranks. In a "single-step" promotion scenario, the window that pops up could give promotion and demotion options. Alternatively, one might right-click on the rank to demote and left-click on the rank to promote.

Believe it or not, I have implemented Demotions in OXCE some years ago. But after some time I have removed it, because it wasn't used and because without manual promotions it was kinda meh. But yeah, if manual promotions would be available, manual demotions would make sense too.

4. Should the existing promotion pyramid be enforced? That is, should it be impossible to promote a soldier to say sergant until an existing captain vacancy was filled?

Not sure if I understand the question properly.

But it feels like the answer should be yes.

5. To what extent is it desirable for the above rules to be configurable? Should the ability to demote be an additional configurable option? How about the ability to promote from Rookie to Squadie?

There should be at least a master on/off switch.

As for the rest, it's up for discussion. In general, less is more... but having a couple of meaningful settings wouldn't hurt.
Title: Re: [Suggestion] Manual Promotions
Post by: Vakrug on February 24, 2023, 11:05:59 am
Also, I really don't want RPG features in Xcom. If an RPG feature can be used for some strategical or tactical purpose as well, I am willing to close one eye, maybe even both eyes... but pure RPG features without any strategical or tactical benefit are in general not welcome.
What do you mean by that? I have noticed earlier that many people misunderstand this term. "R" stands for "role". Just because "wondering traders" and "NPC's" appears in many RPG games does not make them RPG elements.

I will ask differently: do you think is is OK and desirable that all maxed out X-COM soldiers are basically the same? If not, then I have some suggestions...
Title: Re: [Suggestion] Manual Promotions
Post by: Solarius Scorch on February 24, 2023, 11:23:30 am
I will ask differently: do you think is is OK and desirable that all maxed out X-COM soldiers are basically the same? If not, then I have some suggestions...

I personally think it's OK and desirable. I believe that a soldier's worth should be determined by merit, courage and luck, not some ingrained "genetics". We already have segregation by Psi Strength, I wouldn't want to pile more on top of that.

However: for more story-oriented mods (literally only Piratez), I personally am in favour of different "backgrounds" with varying pros and cons. This is already a thing in Piratez: units recruited from various sources sometimes have different soldier bonuses to reflect their specialisations; but I'd like to be able to randomise these soldier bonuses instead of "one recruitment method = one specific bonus". But I guess it's not exactly on topic (and I don't know if Dioxine would agree).
Title: Re: [Suggestion] Manual Promotions
Post by: Vakrug on February 24, 2023, 12:19:54 pm
I believe that a soldier's worth should be determined by merit, courage and luck, not some ingrained "genetics".
There is not enough luck in current equation!

We already have segregation by Psi Strength, I wouldn't want to pile more on top of that.
Yes, Psi Strength is pretty much the only RPG element in this game. And I think this is not enough...

I personally am in favour of different "backgrounds" with varying pros and cons.
Better than nothing. But, unlike Psi Strength, background is known before recruitment.

but I'd like to be able to randomise these soldier bonuses instead of "one recruitment method = one specific bonus".
;) This is actually very close to what I was going to propose. All right, I will spill the beans: random bonuses from same commendation. Most straightforward example: after participating in 10 missions a soldier unlocks it's first "perk" which will make him different from other soldiers even after he is maxed out. I will not go in details here -- wrong topic, but if this is somewhat interesting to someone I will make an official suggestion.
Title: Re: [Suggestion] Manual Promotions
Post by: Scamps on February 24, 2023, 12:55:00 pm
There is a mod for randomized stat caps, so "maxed soldiers have same stats" problem can be solved by existing means. In Piratez there are freaks.
Commendations also help differentiate soldiers if they stick to different playstyles. I am not sure random commendations are a good way to solve that problem. For example, why should you play 10 missions to discover some natural inclination towards firing/melee/reaction that never manifested before? Using random commendations for random lasting injuries ("patient" commendations) seems more realistic. But it would be more frustrating and people would want a way to remove commendations  :)
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on February 24, 2023, 12:57:56 pm
What do you mean by that? I have noticed earlier that many people misunderstand this term. "R" stands for "role". Just because "wondering traders" and "NPC's" appears in many RPG games does not make them RPG elements.

Yes, I don't want that R.
Soldiers in Xcom are supposed to be nameless faceless unattached resources used in cold blood to avert the alien invasion. I don't want anything that even hints at "role-playing".
(Note: I have over-exaggerated here to better convey my point)

I will ask differently: do you think is is OK and desirable that all maxed out X-COM soldiers are basically the same? If not, then I have some suggestions...

It is OK that they are the same.
It is NOT desired that they can max out... the soldiers in xcom should die long before they can max out.

More info here (long reading): https://openxcom.org/forum/index.php/topic,3748.0.html
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on February 24, 2023, 12:58:46 pm
Also, this thread is about Manual Promotions.

If you want to discuss soldier max stats and stuff like that, please take it to a separate thread.
Title: Re: [Suggestion] Manual Promotions
Post by: DoxaLogos (JG) on February 24, 2023, 09:57:25 pm
Just wanted to chime and get thread back on topic.

I think the Manual Promotions is a great idea especially if it is configurable  with a switch.   It fits the theme as 'you' playing the role of the commander of X-COM (or whatever mod has you in charge).  It seems logical that you would have a say in who gets promoted in your own organization instead of it being random. 
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 01, 2023, 07:43:39 am
So, still, some work to do, but feature complete enough to demonstrate functionality.

https://imgur.com/ZDG0yV8 (https://imgur.com/ZDG0yV8)

Not much to comment on here. In the current incarnation, you can promote to any open rank, and demote to any rank, though if you demote to rookie, you cannot promote back up again. Not sure if I want to prevent that or not. Ideally, I think these sorts of rules would be configurable, but that's beyond the scope of what I want to do right now.

In creating this, I ripped into existing code a fair bit more than I intended to initially, so I'll want to do a fair amount of testing before I submit. I'm unsure to what degree getting into the guts of my changes to the code is appropriate here.

(sorry for all the edits, had some difficulty embedding the video)
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 01, 2023, 10:08:57 am
I guess I do have some questions, though:

Title: Re: [Suggestion] Manual Promotions
Post by: Yankes on March 01, 2023, 11:36:57 am
in current iteration you can buy 100 soldiers on day one and promote every one to grain one commander?

I think would be preferred that manual promotion have some requirements that are needed to allow it.
And it could be different than used in normal promotions, probably less hard to grain.
Like you would normally need 10 mission to promote automatically some specific solder but after 6th mission you can manually do it.
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 01, 2023, 02:54:57 pm
in current iteration you can buy 100 soldiers on day one and promote every one to grain one commander?

I think would be preferred that manual promotion have some requirements that are needed to allow it.
And it could be different than used in normal promotions, probably less hard to grain.
Like you would normally need 10 mission to promote automatically some specific solder but after 6th mission you can manually do it.
Well, you are still restricted by living space, so you cannot literally hire 100 soldiers day 1. Likewise, the rule that you cannot promote rookies is enforced, so anyone you want to promote to a higher rank must first participate in some combat to obtain that promotion naturally. However, at that point, yes, you could promote them to whatever rank you have available, given the current ranks filled and the number of soldiers you have on staff.

I think, in practice, this kind of "abuse" doesn't seem like that big a deal. Your ability to expand your ranks is limited by space in your living quarters, which also have to compete with scientists and engineers. Given this constraint, unless you actively worked against it, or suffer truly horrendous losses, your soldiers will naturally gain some xp and get promoted to rookie. At that point, ascending up the ranks is automatic, so long as you go on any missions. You only need to keep 10 squaddies out of 30 to fill the ranks. Or guess put another way, I don't think your ability to manually promote soldiers is unlikely to greatly exceed the rate they would be naturally promoted in most situations.

Instead, people wanting to abuse the system are more likely they would go the other way, and simply not promote anyone. That's the exploit that gets brought up in conversations with me. But if you want to avoid having high-ranking soldiers on missions, there are already other ways to do this.

Anyways, I do think that allowing mods to customize requirements for promotions is a good concept and something I'm interested in adding later if desired. Like you might have to have a certain soldier score (using the base game algorithm) or meet some arbitrary stat requirements in order to be eligible for promotion, but that's beyond the scope of what I wanted to do right now. Other then that, I guess I don't really understand what kind of system you are proposing.
Title: Re: [Suggestion] Manual Promotions
Post by: Yankes on March 01, 2023, 03:36:42 pm
Anyways, I do think that allowing mods to customize requirements for promotions is a good concept and something I'm interested in adding later if desired. Like you might have to have a certain soldier score (using the base game algorithm) or meet some arbitrary stat requirements in order to be eligible for promotion, but that's beyond the scope of what I wanted to do right now. Other then that, I guess I don't really understand what kind of system you are proposing.
Its more a free thoughts about this, I simply consider mods that some how put more "meat" behind rank (aka give more bonuses to given solder).
And without limitation manual or automatic promotion could be problematic as it could allow abuses or have unhappy players when wrong unit get promotion.

For now this have small impact on game as ranks AFAIR are only used in morale lose calculations.

One solution I would see is link it to commendations, like each rank require specific list of them to progress (best if we could have `or`/`and` handling).
We could have different set of requirement for automatic and manual promotion (where manual one are easier to get).

Image case xpiratez where to get biggest rank you need kill Ethereal or alterative kill previous captain :D
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 01, 2023, 03:43:01 pm
Its more a free thoughts about this, I simply consider mods that some how put more "meat" behind rank (aka give more bonuses to given solder).
And without limitation manual or automatic promotion could be problematic as it could allow abuses or have unhappy players when wrong unit get promotion.

For now this have small impact on game as ranks AFAIR are only used in morale lose calculations.

One solution I would see is link it to commendations, like each rank require specific list of them to progress (best if we could have `or`/`and` handling).
We could have different set of requirement for automatic and manual promotion (where manual one are easier to get).

Image case xpiratez where to get biggest rank you need kill Ethereal or alterative kill previous captain :D

Yeah, I am all for that, and plan to look into implementing something like that after I finish this. But the two features I feel are independent. Customizing ranks and what they mean mechanically can exist with or without automatic promotions, though I think it would work better with. But when customizing what a rank "means" would feel like the natural time to also add restrictions as to who could have what rank, to prevent the kind of abuse you talk about.
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on March 01, 2023, 08:36:42 pm
though if you demote to rookie, you cannot promote back up again.

I like this.

  • To what degree is feedback and/or negative feedback desirable? IE, if you select a rank that you cannot promote to, what should happen?

Nothing happens.
Just like in the video.
(positive feedback is that the rank icon changes, negative feedback is that the dialog window doesn't close)

  • Should ranks that are ineligible for promotion even show up on the list?

Yes, I think it looks nicer than a mostly empty list.

  • I do not think any feedback is necessary when you successfully promote someone, the result is obvious, but I'm open to other opinions.

I agree.

  • Obviously it should have an on-off switch. But it occurs to me that you might want automatic promotions on and manual promotions on. Since if demotion is possible, you can just change who is promoted anyways. So it wouldn't just be a binary switch of automatic promotions off, manual promotions on, but two switches. Thoughts about this?"

Sounds OK to me.

What I need is a setting, which provides vanilla compatibility (i.e. the off switch).
Other options are open for discussion.

  • It also occurs to me though, that if there is a on/off switch for automatic promotions, it would make sense for that option to be combined with field promotions (which implies automatic promotions), as that option doesn't make sense without automatic promotions being on. However, actually implementing a 3 value switch is somewhat more complicated, and it would be somewhat difficult to do in a backwards compatible manner.

Please leave the field promotions option as it is on the GUI now (and make it apply only when relevant).

Yeah, I am all for that, and plan to look into implementing something like that after I finish this. But the two features I feel are independent.

Yes, one feature = one PR.

"One feature = many PRs" is unwanted.
"Many features = one PR" is also unwanted.
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 02, 2023, 03:52:30 am
Okay my version is more or less feature complete I think. Pull request sent. Here is a demo
.

Some minor style changes from the clip posted before. Ranks now show in the color2 color (configurable) if they aren't eligible for promotion. I removed the notation of if a rank was a promotion or a demotion, since it's kind of obvious and the ranks on the screen anyways. Quicksearch works, and you can middle-click on a rank to bring up the ufopedia article, if any.

I blather on more in the pull request, but the demo above shows how everything works.

The only other major design decision I made was to enforce rank limits in both promotion and demotion. Currently, you can still demote down to rookie, but then you cannot promote back up again afterward. I could go either way on this decision. I can imagine some people wanting to do it, but the behavior is somewhat surprising, I think.
Title: Re: [Suggestion] Manual Promotions
Post by: Yankes on March 02, 2023, 11:28:31 am
Could you check how it will work for mods like xpiratez? I recall that it have more custom ranks than normal game.
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 02, 2023, 01:26:14 pm
Could you check how it will work for mods like xpiratez? I recall that it have more custom ranks than normal game.

I've tested it with XPZ (that's the main mod I'm playing), no issues. Custom rank titles are reflected and perform normally. In addition, soldier types with limited sets of rank titles (like named dogs) have a limited set of promotion opportunities, as expected.
Title: Re: [Suggestion] Manual Promotions
Post by: Yankes on March 02, 2023, 02:04:50 pm
Ok. Your code look clean and I do not see anything against adding it to OXCE.
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on March 02, 2023, 02:17:11 pm
I will review later and do some cosmetic changes, as usual.
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 03, 2023, 10:29:20 am
Hey, sorry to ask a million questions, just want to get a better picture of what ya'll want in patches going forward. Like, when making this feature the dialog is basically a carbon copy of the existing Armor choice dialog. So it's an obvious candidate for refactoring both of them (and possibly others) into a shared "listItem" class or something, with the differences handled via composition or inheritance. I refrained from doing so, because I wanted to be minimally invasive, but would such refactoring be desirable? Or would you prefer I leave well enough alone for the most part?
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on March 03, 2023, 10:47:53 am
So it's an obvious candidate for refactoring both of them (and possibly others) into a shared "listItem" class or something, with the differences handled via composition or inheritance.

It's not "obvious" :)

I refrained from doing so, because I wanted to be minimally invasive, but would such refactoring be desirable?

From my POV, no.

Or would you prefer I leave well enough alone for the most part?

Yes.
Title: Re: [Suggestion] Manual Promotions
Post by: Yankes on March 03, 2023, 11:00:02 am
I think current version is fine, if we would have more screens like this we could consider refactoring it.
I would more worry about game logic duplication that some screens that once created stay same for very long time.
This is because we constantly change game logic and each change need to propagate to multiple places, and every duplication make it harder to do.
In case of screens, most changes only affect one screen at time.
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on March 18, 2023, 11:43:22 pm
I've added a review on github.

Some things didn't work at all... for example when working with custom rank strings.
Mostly copypaste errors, off-by-one, etc.

TFTD support was missing.
en-GB was missing and translations were not in correct places.

The rest was not so important, but even cosmetic issues can pile up :)

I will make the changes, and merge manually.
Probably tomorrow.
Title: Re: [Suggestion] Manual Promotions
Post by: MaxMahem on March 19, 2023, 01:45:02 am
Thanks for the detailed review. Sorry for all the typos, sperling is not my strong suit. I'll push a patch in a bit that should resolve all the ones marked resolved. The few remaining are either ones I didn't know the right fix for (I don't have TFTD installed right now to test) or wasn't sure your preferred resolution of.
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on March 19, 2023, 08:59:08 am
Here's the explanation for the one that was confusing you.
I should have written a better comment already the first time.
Title: Re: [Suggestion] Manual Promotions
Post by: Meridian on March 19, 2023, 09:54:25 am
Merged.

Edit: build failed, because of case-sensitive includes, fix here: https://github.com/MeridianOXC/OpenXcom/commit/35971be2346914468d6c2829b4147568bf813e7b
Title: Re: [DONE][Suggestion] Manual Promotions
Post by: Ethereal on July 30, 2023, 01:04:49 am
Is it possible to disable restrictions for Rank 5 in UFO using this function?

Those who love vanilla, they will not activate this. In other cases, this restriction looks illogical for a long time.
Title: Re: [DONE][Suggestion] Manual Promotions
Post by: Aldorn on November 03, 2023, 01:10:16 am
Really appreciate this new feature, congrats !