[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71103":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":17,"lastSyncTime":27,"discoverSource":28},71103,"street-fighter-ai","linyiLYi\u002Fstreet-fighter-ai","linyiLYi","This is an AI agent for Street Fighter II Champion Edition.",null,"Python",6525,1384,86,56,0,1,2,3,40.42,"Apache License 2.0",false,"master",[],"2026-06-12 02:02:47","# SFighterAI\n\n[简体中文](README_CN.md) | English | [Español](README_ES.md)\n\nThis project is an AI agent trained using deep reinforcement learning to beat the final boss in the game \"Street Fighter II: Special Champion Edition\". The AI agent makes decisions based solely on the game screen's RGB pixel values. In the provided save state, the agent achieves a 100% win rate in the first round of the final level (overfitting occurs, see the [Running Tests](#running-tests) section for discussion).\n\n### File Structure\n\n```bash\n├───data\n├───main\n│   ├───logs\n│   ├───trained_models\n│   └───scripts\n├───utils\n│   └───scripts\n```\n\nThe game configuration files are stored in the `data\u002F` folder, and the main project code is in the `main\u002F` folder. Within `main\u002F`, the `logs\u002F` folder contains terminal\u002Fconsole outputs and data curves recording the training process (viewable with Tensorboard), while the `trained_models\u002F` folder contains model weights from different stages. These weights can be used for running tests in `test.py` to observe the performance of the AI agent's learned strategies at different training stages.\n\n## Running Guide\n\nThis project is based on the Python programming language and primarily utilizes standard libraries like [OpenAI Gym Retro](https:\u002F\u002Fretro.readthedocs.io\u002Fen\u002Flatest\u002Fgetting_started.html) and [Stable-Baselines3](https:\u002F\u002Fstable-baselines3.readthedocs.io\u002Fen\u002Fmaster\u002F). The Python version used is 3.8.10, and it is recommended to use [Anaconda](https:\u002F\u002Fwww.anaconda.com) to configure the Python environment. The following setup process has been tested on Windows 11. Below are console\u002Fterminal\u002Fshell commands.\n\n### Environment Setup\n\n```bash\n# Create a conda environment named StreetFighterAI with Python version 3.8.10\nconda create -n StreetFighterAI python=3.8.10\nconda activate StreetFighterAI\n\n# Install Python libraries\ncd [parent_directory_of_project]\u002Fstreet-fighter-ai\u002Fmain\npip install -r requirements.txt\n\n# Run script to locate gym-retro game folder\ncd ..\npython .\\utils\\print_game_lib_folder.py\n```\n\nAfter the console outputs the folder path, copy it to the file explorer and navigate to the corresponding path. This folder contains the game data files for \"Street Fighter II: Special Champion Edition\" within gym-retro, including the game ROM file and data configuration files. Copy the `Champion.Level12.RyuVsBison.state`, `data.json`, `metadata.json`, and `scenario.json` files from the `data\u002F` folder of this project into the game data folder, replacing the original files (administrator privileges may be required). The `.state` file is a save state for the game's highest difficulty level, while the three `.json` files are gym-retro configuration files storing game information memory addresses (this project only uses [agent_hp] and [enemy_hp] for reading character health values in real-time).\n\nTo run the program, you will also need the game ROM file for \"Street Fighter II: Special Champion Edition\", which is not provided by gym-retro and must be obtained legally through other means. You can refer to this [link](https:\u002F\u002Fwowroms.com\u002Fen\u002Froms\u002Fsega-genesis-megadrive\u002Fstreet-fighter-ii-special-champion-edition-europe\u002F26496.html).\n\nOnce you have legally obtained the game ROM file, copy it to the aforementioned gym-retro game data folder and rename it to `rom.md`. At this point, the environment setup is complete.\n\nNote 1: If you want to manually capture save states and find memory variables in the game, you can use the gym-retro integration ui. Copy `data\u002FGym Retro Integration.exe` to the parent menu (two levels up, `retro\u002F` folder) of the aforementioned gym-retro game data folder.\n\nNote 2: If you want to record videos of the AI agent's gameplay, you will need to install [ffmpeg](https:\u002F\u002Fffmpeg.org\u002F).\n\n```bash\nconda install ffmpeg\n```\n\n### \u003Ca name=\"running-tests\">\u003C\u002Fa>Running Tests\n\nOnce the environment is set up, you can run `test.py` in the `main\u002F` folder to test and experience the AI agent's performance at different stages of training.\n\n```bash\ncd [parent_directory_of_project]\u002Fstreet-fighter-ai\u002Fmain\npython test.py\n```\n\nModel weight files are stored in the `main\u002Ftrained_models\u002F` folder. The default model used in `test.py` is `ppo_ryu_2500000_steps_updated.zip`, which has good generalization and is capable of beating the final level of Street Fighter II: Special Champion Edition. If you want to see the performance of other models, you can change the `model_path` variable in `test.py` to the path of another model file. The observed performance of the models at various training stages is as follows:\n\n* ppo_ryu_2000000_steps_updated: Just beginning to overfit state, generalizable but not quite capable.\n* ppo_ryu_2500000_steps_updated: Approaching the final overfitted state, cannot dominate first round but partially generalizable. High chance of beating the final stage.\n* ppo_ryu_3000000_steps_updated: Near the final overfitted state, almost dominate first round but barely generalizable.\n* ppo_ryu_7000000_steps_updated: Overfitted, dominates first round but not generalizable. \n\n### Training the Model\n\nIf you want to train your own model, you can run `train.py` in the `main\u002F` folder.\n\n```bash\ncd [parent_directory_of_project]\u002Fstreet-fighter-ai\u002Fmain\npython train.py\n```\n\n### Viewing Training Curves\n\nThe project includes Tensorboard graphs of the training process. You can use Tensorboard to view detailed data. It is recommended to use the integrated Tensorboard plugin in VSCode to view the data directly. The traditional viewing method is listed below:\n\n```bash\ncd [parent_directory_of_project]\u002Fstreet-fighter-ai\u002Fmain\ntensorboard --logdir=logs\u002F\n```\n\nOpen the default Tensorboard service address `http:\u002F\u002Flocalhost:6006\u002F` in your browser to view interactive graphs of the training process.\n\n## Acknowledgements\nThis project uses open-source libraries such as [OpenAI Gym Retro](https:\u002F\u002Fretro.readthedocs.io\u002Fen\u002Flatest\u002Fgetting_started.html), [Stable-Baselines3](https:\u002F\u002Fstable-baselines3.readthedocs.io\u002Fen\u002Fmaster\u002F). The contributions of all the developers to the open-source community are appreciated!\n\nTwo papers that had a significant impact on this project:\n\n[1] [DIAMBRA Arena A New Reinforcement Learning Platform for Research and Experimentation](https:\u002F\u002Farxiv.org\u002Fabs\u002F2210.10595)\nThe valuable summary of the experience in setting hyperparameters for deep reinforcement learning models in fighting games in this paper was of great help to the training process of this project.\n\n[2] [Mitigating Cowardice for Reinforcement Learning](https:\u002F\u002Fieee-cog.org\u002F2022\u002Fassets\u002Fpapers\u002Fpaper_111.pdf)\nThe \"penalty decay\" mechanism proposed in this paper effectively solved the \"cowardice\" problem (always avoiding opponents and not daring to even try attacking moves).","该项目是一个针对《街头霸王II：冠军版》游戏的AI代理，使用深度强化学习训练以击败游戏中的最终Boss。其核心功能是基于游戏屏幕的RGB像素值进行决策，在提供的保存状态下，该代理在最终关卡的第一轮中实现了100%的胜率（尽管存在过拟合现象）。项目主要采用Python语言开发，依赖于OpenAI Gym Retro和Stable-Baselines3等开源库，并通过Tensorboard记录训练过程的数据曲线。适用于游戏AI研究、强化学习实践以及对经典游戏自动化挑战感兴趣的开发者或研究人员。","2026-06-11 03:35:54","high_star"]