Maradonna90 / NewGAN-Manager

A tool to generate and manage xml configs for the Newgen Facepack.
GNU General Public License v3.0
174 stars 34 forks source link

[BUG] Some Players dont get new Faces. #127

Closed FM2222 closed 9 months ago

FM2222 commented 2 years ago

Describe the bug I'm in the 2027 season and I've noticed that some players don't get faces anymore. All the players who didn't get it have black skin as far as I can see.

I have selected the "Preserve" mode and allowed duplicates. The players are in the RTF file but the face is not created. When I enter the UID in the search field after the replace, the error message Player with ID does not exist appears.

The newgan log shows the message

Ethnicity African has no faces left for mapping. Skipping player 2002497151

Error

FM 2022.txt

No face for mapping

rospaseta commented 2 years ago

I got same issue, preserve sometimes won't give faces for newgen, even they are on .xml file. Doesn't matter what country or skin colour they got they just won't get faces. Have been tried also generate totally new face everyone, but then it lose those older ones and gives new ones face :D my save is currently 5th seasons. atm my youth has only 1 of 16 players real looks face. EDIT : BTW My %localappdata% newgan *.rtf file is about 2.4gb big?!?

Maradonna90 commented 2 years ago

def a bug. bc the player has Caucasian ethnicity but the mapper looks in African ethnicity to find a face.

@rospaseta very unclear if your issue is related bc lack of information.

rodriturnes commented 2 years ago

Hi guys!

I have been getting some weird behaviour on FM22 using the tool. I have recently had a youth intake where most of my players are African and they are not getting faces. So I investigated and found this thread that matches my problem.

FM22

As you can see on my .log file, there are different type of cases where the tool crashes:

  1. it looks for the first nationality and it doesn't seem to find a match
  2. it looks for the second nationality and it doesn't seem to find a match
  3. it looks for a different nationality (not first nor second) and it doesn't seem to find a match

Is this a bug or something wrong on my end?

Thanks for your help and everyone involved in the development, it has been a game-changer since I started using it!

Manningham commented 2 years ago

@Maradonna90 It looks like there's a fallback case which sets player ethnicity to "African" in situations where it shouldn't?

Ex:

| 2002855376| USA       | MEX       | Gustavo Macías                               | 2         | 11        | 7         | 
2022-06-05 21:20:57,539 | NewGAN App: 77108/226428: ['2002855376', 'USA', 'MEX', '7'], Caucasian, South American
2022-06-05 21:20:57,539 | NewGAN App: Ethnicity African has no faces left for mapping. Skipping player 2002855376

Certainly I think it's fine to have players with African ethnicity originating from Mexico. But strictly following the app logic, it looks like the evaluated ethnicity should either be "South American" or "Caucasian" to match "USA" and "MEX" nationalities as listed in cfg.json:

{
    ...
    "MEX": "South American",
    ...
    "USA": "Caucasian",
}

Perhaps this is an issue? I'm noticing that for every case where the "Ethnicity African has no faces left for mapping" message arises, the player's skin tone is one of the values in the conditional block containing the fallback case linked ^. That is, I'm only seeing this error message for players with skin tones 3, 6, 7, 8, and 9.

WRT why the "Ethnicity African has no faces left for mapping" message, I guess the image selection pool is empty in pick_image(). Unclear to me on sight why that would be happening, especially because African pictures are successfully selected later on in the program execution, so the selection pool is certainly populated at those later times.

Here's my log file in case it helps, as well as the rtf: newgan_rtf_and_log.zip

EDIT: I'm not familiar with python development... would have been happy to run/debug this application if there were some simple startup instructions in the readme ;)

As a workaround, I've added portraits for the 4 youth intake players who were missing them by adding a line for each of them to the config.xml file in my player pictures directory (I have it installed here: ...\Documents\Sports Interactive\Football Manager 2022\graphics\FMNEWGANv2 + Update 1\config.xml, you may have it somewhere else). You can add a line like the following, where PATH/TO/PICTURE is the file path to a player portrait relative to the .xml file, and PLAYER_ID is the player's ID as listed in the game and the .rtf file:

<record from="{PATH/TO/PICTURE}" to="graphics/pictures/person/{PLAYER_ID}/portrait"/>

So for instance:

<record from="Scandinavian/Scandinavian3477" to="graphics/pictures/person/2002725843/portrait"/>
Maradonna90 commented 2 years ago

@Manningham thanks for the very detailed post. There is definitely an issue and I think your helped tremendously narrowing it down.

@rodriturnes thanks for the info as well :)

Im super busy the last months, but hopefully I can iron out the last couple of bugs before moving forward with the project in general.

gert-dubois commented 2 years ago

I use the following workaround to generate faces for my newgens until this issue is fixed.

  1. Make a backup of your config.xml in your newgan graphics folder.
  2. Export all newgen players you want to generate faces for to .rtf, I personally limit the custom filter by age 15-16. This will also have some newgens from the previous year, but it doesn't matter
  3. Use the Generate option in newgan and use the generated file as input, this will overwrite your previous config.xml in the newgan graphics folder
  4. Edit the config.xml file with notepad and copy all <record from="..." to="..."/> lines from the file.
  5. Paste the lines underneath the last <record .../> in your backup config.xml
  6. Remove the config.xml you generated and rename your backup to config.xml
  7. Reload the skin data in FM

Because of how FM loads graphics data it will only use the first portrait mapping record for a player it loads. So even though you generated duplicates for previous newgens, because they are below the old picture mappings FM will skip over them. Over time this will make your config.xml file much bigger, but for me this at least provides a workaround.

lmilne96 commented 2 years ago

@Maradonna90 I believe this is caused by this commit. Specifically, removing these lines from mapper.py prevents the issue from occurring:

30    for eth in self.eth_map:
31        self.eth_map[eth] = self.eth_map[eth] - set(prf_imgs)

If I'm reading correctly, this block should only run if duplicates is set to false.

talelburg commented 1 year ago

@Maradonna90 I believe this is caused by this commit. Specifically, removing these lines from mapper.py prevents the issue from occurring:

30    for eth in self.eth_map:
31        self.eth_map[eth] = self.eth_map[eth] - set(prf_imgs)

If I'm reading correctly, this block should only run if duplicates is set to false.

For sure this has to be added? Just spent two hours figuring this up. Just need to make it

if not duplicates and mode in ....

This solved it instantly of course.

talelburg commented 1 year ago

@Maradonna90 I believe this is caused by this commit. Specifically, removing these lines from mapper.py prevents the issue from occurring:

30    for eth in self.eth_map:
31        self.eth_map[eth] = self.eth_map[eth] - set(prf_imgs)

If I'm reading correctly, this block should only run if duplicates is set to false.

For sure this has to be added? Just spent two hours figuring this up. Just need to make it

if not duplicates and mode in ....

This solved it instantly of course.

This of course doesn't work but something very similar does.

Maradonna90 commented 9 months ago

fixed it. Re-Open if issue persist with NewGAN-Manager versions higher than 1.3.1