Standalone FM NewGens
Generate NewGen images for Football Manager using local Stable Diffusion
🖥️ GUI Available! - Now includes a user-friendly graphical interface
Intro
- "There are 10000s of faces out there already"
- "There are tools that work the same already?"
- "Have you got nothing better to do with your time?"
These are some of the questions I think you are going to ask me, but I present to you something I have been working on, Standalone FM NewGens
The Idea
Taking inspiration from fm-ai-face-generator and NewGAN-Manager, this tool generates unique face images for Football Manager NewGens using local Stable Diffusion instead of requiring a separate ComfyUI server.
Thanks to both original projects for the inspiration!
So what does this do? Why would you want to use it? (you probably won't but personally, I like a bit more personalization from my NewGens, some I get quite attached to :) )
- This will create images for your NewGens, based off of information provided from the FM database, making a player's image more unique to that player
- Generate images locally using Stable Diffusion (no external server required)
- Download the images to the specified output directory, all processed players images will be saved as their uid from the game
- Remove all the background from the generated faces
- Create the needed config file for FM to load the faces
- You can then rename the generated folder and place it in your graphics folder as you would normally and voila!
Install Guide
Things you will need that I will not be going over on how to setup.
- Python 3.8+ installed
- Git installed
- At least 4GB of RAM (8GB+ recommended for better performance)
- CUDA-compatible GPU (optional, but highly recommended for faster generation)
Setup Instructions
- Use Git to checkout this repo
- You need to get a
rtf
file of the players you want to add images for, to do this you need the view and filter supplied with the project - Copy the
filters
andviews
folder over to yourFootball Manager 2024
data folder inDocuments
, this may create these folders, or may just add the contained files into your existing folders- You can use
python INSTALL_VIEW_AND_FILTER.py
to do this automatically
- You can use
- Included is the original
is newgen
filter created by the NewGAN-Manager team and a new view created by myself to get the needed data - If you follow this video it will show you how to export the
rtf
file, you want to use our view, not the view in the video - Once you have your
rtf
file add it to the root of the current repo - Create a python virtual environment
python -m venv venv
- Activate the venv
.\venv\Scripts\activate
(Windows) orsource venv/bin/activate
(Linux/Mac) - Install the requirements
pip install -r requirements.txt
- Copy the
user_config.cfg.sample
touser_config.cfg
and make the needed changes- football_manager_version - Version of FM to generate for. Defaults to
2024
- output_dir - Where to save the generated set. Defaults to
./generated_images/
- rtf_file - Path to your exported RTF file with player data
- model_name - Hugging Face model to use (see Model Selection section below)
- model_dir - Custom directory to store models (optional)
- football_manager_version - Version of FM to generate for. Defaults to
Usage Options
🖥️ GUI Mode (Recommended)
For the best user experience, use the graphical interface:
# Test if GUI works on your system
python test_gui.py
# Launch the full GUI
python run_gui.py
GUI Features:
- Easy configuration with file browsers
- Real-time progress monitoring
- Live image preview
- Start/stop controls
- Comprehensive logging
📝 Command Line Mode
For advanced users or automation:
python comfy_fm_newgen.py
Command Line Features:
- Fast batch processing
- Resume capability
- Detailed logging
- Script automation
Model Selection
The tool uses Hugging Face models for image generation. You can specify which model to use in your user_config.cfg
:
Recommended Models for Face Generation:
SG161222/Realistic_Vision_V6.0_B1
- Best choice for realistic faces (default)digiplay/AbsoluteReality
- Photorealistic faces and peoplestabilityai/stable-diffusion-2-1
- General purpose, good for facesrunwayml/stable-diffusion-v1-5
- Classic SD 1.5, widely supported
Model Storage:
- Default: Models are stored in Hugging Face cache (
~/.cache/huggingface/
) - Custom Directory: Set
model_dir
in config to store models in a specific folder - Model Size: Most face models are 2-5GB, ensure you have sufficient disk space
- First Run: Model downloads automatically when you first run the tool
Changing Models:
- Edit
model_name
in youruser_config.cfg
- Delete the old model from your cache/directory if desired
- Restart the tool - it will download the new model automatically
System Requirements
- CPU Mode: Requires at least 8GB RAM, expect 2-5 minutes per image
- GPU Mode: Requires CUDA-compatible GPU with at least 4GB VRAM, expect 10-30 seconds per image
- First run will download the Stable Diffusion model (~5GB), so ensure you have sufficient disk space
Features
Core Features
- Local Generation: No external servers or API keys required
- Model Selection: Choose from various face generation models via configuration
- Automatic Processing: Batch process multiple players from your RTF file
- Background Removal: Automatically removes backgrounds from generated faces
- XML Configuration: Generates proper Football Manager configuration files
- Resume Support: Can resume from previous runs without regenerating existing images
- Model Caching: Downloads and caches models locally for faster subsequent runs
🖥️ GUI Features
- User-Friendly Interface: Modern tabbed interface with intuitive controls
- File Browsers: Easy selection of RTF files and output directories
- Real-Time Progress: Live progress bars and status updates
- Image Preview: View generated images as they're created
- Configuration Management: Save and load different configurations
- Error Handling: Clear error messages and troubleshooting tips
- Multi-threaded: Non-blocking interface during generation
GUI Troubleshooting
Common Issues:
GUI won't start:
- Ensure Python 3.8+ is installed
- Install requirements:
pip install -r requirements.txt
- Check for missing dependencies:
python -c "import tkinter"
Dependency installation fails:
- Try installing packages individually:
pip install torch torchvision diffusers transformers
- For Python 3.11+, use:
pip install rembg==2.0.59
(instead of 2.0.60) - If
striprtf
fails, try:pip install striprtf==0.0.28
- Use alternative requirements:
pip install -r requirements-gui.txt
for GUI-only
Numba/rembg compatibility issues:
- The application now handles missing
rembg
gracefully - Background removal is optional - images will work without it
- Test GUI functionality:
python test_gui.py
- If you encounter Numba compilation errors, the GUI will still work
Alternative installation methods:
- Conda:
conda install pytorch torchvision torchaudio cpuonly -c pytorch
- GPU Support: Replace
cpuonly
withcudatoolkit=11.8
for CUDA support - Individual packages: Install problematic packages one by one to identify issues
Model download fails:
- Check internet connection
- Verify disk space (models are 2-5GB)
- Try a different model from the recommended list
Images not appearing in preview:
- Check output directory permissions
- Ensure images are being generated successfully
- Try refreshing the preview tab
Configuration not saving:
- Check file permissions in the project directory
- Ensure no other instances are running
- Try running as administrator
Performance Tips:
- First run takes longer due to model download
- Close other applications during generation for better performance
- Use SSD storage for faster model loading
- Monitor system resources - generation is CPU/GPU intensive
Command Line Usage
For advanced users or automation, you can still use the original command-line interface:
python comfy_fm_newgen.py
The GUI and command-line versions share the same configuration files and generated data.
You should get some console output of the progress, good luck!
Open an issue here if you're having problems
Thanks