Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Wrong ethnicities assigned #226

Open
6ellard opened this issue Feb 17, 2024 · 8 comments
Open

[BUG] Wrong ethnicities assigned #226

6ellard opened this issue Feb 17, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@6ellard
Copy link

6ellard commented Feb 17, 2024

Describe the bug
Some regens start having completely wrong ethnicities in a large multi-year save (currently ~ 320.000 regens) using the preserve function in the editor

To Reproduce
Steps to reproduce the behavior:

  1. Create a savefile with all players loaded
  2. Create a regen list either in 2023 or in 2024
  3. Generate a config file with the generate option
  4. Go on holiday, come back every july, create an rtf with the regens
  5. Refresh the config file yearly with the latest rtf with the preserve option
  6. After 3 or 4 seasons, look around the db random youth (e. g. National) teams

Expected behavior
All players should have the right ethnicities applied

Screenshots
Asian Ethiopian
Black Lao
Cambodia squad
Cook Islander
Macau squad
SE Asian Paraguayan
White Eritrean

Desktop (please complete the following information):
Windows

Attachments
Images

Solution:

As I have just recently had a youth intake with faces preapplied, I realised what is going on: FM keeps the ids for regens which have retired, and they can pop up randomly in a different nation in the save. Hence the program thinks the faces are assigned, the ID has been used, but in reality, this has been assigned to a different player.

I would have two suggestion, a more basic one and a more involved one, but one which should also solve some other issues and make the program more streamlined.

  1. When running the preserve order, build in a second loop that leaves the number in the face graphic file alone, but switches the directory and file name prefix to the correct ethnicity the player would get assigned if the program would see him the first time.

  2. A radical suggestion: The program should not generate random numbers at all, but get this information from the player's id (as it should already be a random number). The program only needs to know how many total faces there are for each of the ethnicities, which ethnicity the player should get and the player's id - so you still have the bit of the program find the ethnicity of the player as usual, but do not generate a random number to go with it.
    Instead, you perform a Euclidian division https://en.wikipedia.org/wiki/Euclidean_division on the player's id with the number of faces of the player's ethnicity, and the leftover number will become the face's number that is assigned to a player.
    You get rid of the preserve, generate, overwrite options as they are superfluous. You just have the individual profiles belonging to different saves.
    The method scales for any number of faces in the directories, circumvents the issue of other ethnicity regens getting stuck with a previous incarnation's picture and you get to reduce the complexity of the code. The player's regen ID will always assign him the same face without having to generate and manage a second set of random numbers yourself.
    What needs to be looked into for this to work however, is whether the regen IDs are indeed distributed evenly (at least on the scale of the face numbers, e. g. up to 5 or 6 last digits) as is my assumption for the suggestion to work.

@6ellard 6ellard added the bug Something isn't working label Feb 17, 2024
@freopt
Copy link

freopt commented Feb 20, 2024

Same problem, half my youth intake is white Nigerians, effectively breaks the entire program.

@6ellard
Copy link
Author

6ellard commented Mar 10, 2024

I have written the code to fix the issue, does someone want it? (It's not compiled into a program, you have to run it from the console)

@nicketc99
Copy link

I'm seeing this issue too - it would be great to get this fixed. Don't think it will change in any following update to FM until at least FM25

@nicketc99
Copy link

@Maradonna90 @Ayal1 Just want to check if there's a possibility for a fix to this?

@6ellard
Copy link
Author

6ellard commented Mar 29, 2024

@Maradonna90 @Ayal1 Just want to check if there's a possibility for a fix to this?

If you know how to compile the source code into the exe file, I could create it, but I have no knowledge of this myself. My version works well when started from a console.

@CoffeeKittyGrey
Copy link

Seeing the same. It's definitely the most recent FM patch. The same behaviour occurs in FMRTE.

@MEleveld
Copy link

@Maradonna90 @Ayal1 Just want to check if there's a possibility for a fix to this?

If you know how to compile the source code into the exe file, I could create it, but I have no knowledge of this myself. My version works well when started from a console.

@6ellard Not sure if I'm able to compile the source code into an exe file, but I'm interested in the code you created so I can at least run it locally in a console. Would it be possible to share this in a pull request or some other way? And this will then work accross multiple saves as you mentioned in your first comment?

Thanks in advance!

@6ellard
Copy link
Author

6ellard commented Jun 25, 2024

@Maradonna90 @Ayal1 Just want to check if there's a possibility for a fix to this?

If you know how to compile the source code into the exe file, I could create it, but I have no knowledge of this myself. My version works well when started from a console.

@6ellard Not sure if I'm able to compile the source code into an exe file, but I'm interested in the code you created so I can at least run it locally in a console. Would it be possible to share this in a pull request or some other way? And this will then work accross multiple saves as you mentioned in your first comment?

Thanks in advance!

Hmmm I am very unfamiliar in how github works, so it seems you would need to explain step by step how I can upload my code here, or point to a good alternative. As per across saves: each player will have the same face in a singular save, no matter how often you "generate" it anew. But across saves, you will need to manage your config files, the same ID may be a different ethnicity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants