MegaMek / mekhq

MekHQ is a java helper program for the MegaMek game that allows users to load a list of entities from an XML file, perform repairs and customizations, and then save the new entities to another XML file that can be loaded into MegaMek.
http://megamek.org
133 stars 171 forks source link

Paid recruitment rolls being debited multiple times per instance #4767

Open OrbMonky opened 2 months ago

OrbMonky commented 2 months ago

Environment

Windows 10, Java 17, 0.50.00 release

Description

One week's paid recruitment recursed 7 times after the original, all on the same date. image Using ATB Market if that matters. Is it possibly rolling for each potential recruiting admin? It did seem to give results commensurate with such an expenditure (or I just got really lucky) but definitely an unintuitive 'where did all my money go' thing.

Files

mekhq.log customs.zip RECRUITMENT.zip

OrbMonky commented 2 months ago

Went back and ran it again and got 9 instead of 8 so it looks like a possible 'roll to failure' effect that is happening? It is definitely grabbing extra recruits for the money - maybe an 'ad blitz' option like this would be good to have as an official option.

Additional note: The instance that caused this was Vehicle Gunner recruitment, but it didn't seem to occur for Admin HR recruitment rolls, so it may be down to what type of recruit is being sought after.

Algebro7 commented 1 month ago

So I'm not sure what's going on, but when I loaded your save and had a play around with it, I was only only getting 1 debit each week afterwards as expected. I was also unable to replicate with other saves, both on master and 0.50. Are you still seeing this behavior if you restart MekHQ and continue advancing days to the following Mondays?

My guess having looked at the code is that there was some kind of bad state, possibly due to switching between Campaign options. There is no loop involved , so the only way I can see that this could fire multiple times on the same day is if there are multiple AtbEventProcessor instances registered for the NewDayEvent. This shouldn't normally happen and I've been unable to induce it again, but it's something we should keep an eye out for and fix if we can figure it out.

OrbMonky commented 1 month ago

I have had it on every roll except for one period after the latest contract, when it started back up again after a few weeks of just making one roll. It seems random in number, not pertaining to any number of staff or other discernible quality of the campaign. I can repro on my end, but I am not sure what to look for in terms of traceable behavior.

IllianiCBT commented 1 month ago

We're having a really hard time replicating this issue. My best guess is that you managed to find yourself in a weirdly specific game state that we've been update to recreate.

My recommendation: turn paid recruitment off. Save and exit the game. Load back in, turn on paid recruitment and see if the issue persists. If it does, remove all units from your hangar and resave, dropping the save file here. I'll then re-open the case and investigate further.

Closing as 'unable to replicate'

OrbMonky commented 1 month ago

Having played a few years in this campaign, it seems that this behavior resets at the end of a contract and slowly builds up over time. Recruitment rolls/expenditures post contract are normal... until they aren't. It seems to gradually build up as time progresses outside of contract. Closing and reopening doesn't seem to resolve on my end, suggesting there is some kind of fundamental issue going on.

WeaverThree commented 1 month ago

Dang, I had this happen once yesterday when I was testing for multiple people in the hiring market, before I learned that having paid recruitment as an option in camops is actually wrong. I haven't a clue what caused it and I didn't think to keep the save though.

IllianiCBT commented 1 month ago

Do we want to just remove paid recruitment? It has no basis in CamOps and causes so many problems. We'd want to include an optional table that expands the official table to include all necessary roles. But other than that, simply removing the option is the way forward imo.

Algebro7 commented 1 month ago

We are planning to remove it for CamOps already but it seems like a lot of AtB and Dylan's folks still use it. Maybe we could use the CamOps acquisition roll system for all of them instead when that's implemented? It would probably be pretty market-agnostic so possibly not much effort.

IllianiCBT commented 1 month ago

So the plan is to remove the various recruitment methods and to only offer CamOps, but with enough campaign options that users can customize their experience. To reduce the amount of methods we’re needing to support.

OrbMonky commented 1 month ago

I think I found the point where the issue is happening - going on contract (possibly just traveling) is exactly when the issue reoccurred this game year. It also happened to be the first week of February so it could be at the start of a new year it slowly has a chance to creep in over the year month over month. image

image

Algebro7 commented 1 month ago

I think I found the point where the issue is happening - going on contract (possibly just traveling) is exactly when the issue reoccurred this game year.

Thanks for the extra info, we can give that a shot.

So the plan is to remove the various recruitment methods and to only offer CamOps, but with enough campaign options that users can customize their experience. To reduce the amount of methods we’re needing to support.

What kinds of options are we thinking about adding? It feels like at some point the complexity of supporting interactions between a bunch of different options could be greater than supporting a couple of discrete methods, although I guess that might not be true once you consider that each method has its own options.

Thom293 commented 1 month ago

Going to remove legacy methods completely?

IllianiCBT commented 1 month ago

In places where it makes sense, yeah. The reality is that we don't have the dev team to support current and legacy options. A line has to be drawn somewhere, and for users who want to continue playing with cut options those options will still exist in older versions.

Also, as this issue is still present (now we've started to narrow in on why it wasn't reproducible), I'm re-opening it.