factoriax 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- factoriax-0.1.0/.gitignore +244 -0
- factoriax-0.1.0/LICENSE.md +21 -0
- factoriax-0.1.0/PKG-INFO +172 -0
- factoriax-0.1.0/README.md +140 -0
- factoriax-0.1.0/factoriax/__init__.py +13 -0
- factoriax-0.1.0/factoriax/analysis/__init__.py +23 -0
- factoriax-0.1.0/factoriax/analysis/actions.py +1081 -0
- factoriax-0.1.0/factoriax/analysis/build_progression.py +356 -0
- factoriax-0.1.0/factoriax/analysis/categories.py +252 -0
- factoriax-0.1.0/factoriax/analysis/curriculum_strip.py +409 -0
- factoriax-0.1.0/factoriax/analysis/eval.py +299 -0
- factoriax-0.1.0/factoriax/analysis/graph_layout.py +218 -0
- factoriax-0.1.0/factoriax/analysis/inventory.py +289 -0
- factoriax-0.1.0/factoriax/analysis/milestones.py +347 -0
- factoriax-0.1.0/factoriax/analysis/recipe_graph.py +1094 -0
- factoriax-0.1.0/factoriax/analysis/recorder.py +316 -0
- factoriax-0.1.0/factoriax/analysis/state.py +531 -0
- factoriax-0.1.0/factoriax/analysis/trajectory.py +703 -0
- factoriax-0.1.0/factoriax/analysis/utils.py +132 -0
- factoriax-0.1.0/factoriax/analysis/video.py +238 -0
- factoriax-0.1.0/factoriax/assets/__init__.py +4 -0
- factoriax-0.1.0/factoriax/assets/atlas.json +164 -0
- factoriax-0.1.0/factoriax/assets/atlas.layout.md +145 -0
- factoriax-0.1.0/factoriax/assets/atlas.png +0 -0
- factoriax-0.1.0/factoriax/assets/build_atlas.py +510 -0
- factoriax-0.1.0/factoriax/engine/__init__.py +1 -0
- factoriax-0.1.0/factoriax/engine/achievements.py +273 -0
- factoriax-0.1.0/factoriax/engine/actions.py +178 -0
- factoriax-0.1.0/factoriax/engine/constants.py +394 -0
- factoriax-0.1.0/factoriax/engine/crafting.py +182 -0
- factoriax-0.1.0/factoriax/engine/envs/__init__.py +9 -0
- factoriax-0.1.0/factoriax/engine/envs/base.py +455 -0
- factoriax-0.1.0/factoriax/engine/envs/common.py +217 -0
- factoriax-0.1.0/factoriax/engine/envs/easy_rocket.py +594 -0
- factoriax-0.1.0/factoriax/engine/envs/miner_curriculum.py +368 -0
- factoriax-0.1.0/factoriax/engine/envs/mining.py +87 -0
- factoriax-0.1.0/factoriax/engine/envs/registry.py +158 -0
- factoriax-0.1.0/factoriax/engine/envs/rocket.py +575 -0
- factoriax-0.1.0/factoriax/engine/envs/science_tiers.py +238 -0
- factoriax-0.1.0/factoriax/engine/envs/wrappers.py +691 -0
- factoriax-0.1.0/factoriax/engine/levels.py +1357 -0
- factoriax-0.1.0/factoriax/engine/machines.py +1030 -0
- factoriax-0.1.0/factoriax/engine/observations.py +787 -0
- factoriax-0.1.0/factoriax/engine/placement.py +605 -0
- factoriax-0.1.0/factoriax/engine/recipes.py +784 -0
- factoriax-0.1.0/factoriax/engine/renderer.py +682 -0
- factoriax-0.1.0/factoriax/engine/rewards.py +914 -0
- factoriax-0.1.0/factoriax/engine/state.py +247 -0
- factoriax-0.1.0/factoriax/engine/step.py +853 -0
- factoriax-0.1.0/factoriax/engine/tables.py +295 -0
- factoriax-0.1.0/factoriax/make.py +96 -0
- factoriax-0.1.0/factoriax/playground/__init__.py +1 -0
- factoriax-0.1.0/factoriax/playground/__main__.py +6 -0
- factoriax-0.1.0/factoriax/playground/app.py +67 -0
- factoriax-0.1.0/factoriax/playground/config.py +682 -0
- factoriax-0.1.0/factoriax/playground/editor/__init__.py +11 -0
- factoriax-0.1.0/factoriax/playground/editor/__main__.py +6 -0
- factoriax-0.1.0/factoriax/playground/editor/canvas.py +544 -0
- factoriax-0.1.0/factoriax/playground/editor/dialogs.py +1186 -0
- factoriax-0.1.0/factoriax/playground/editor/inventory_panel.py +390 -0
- factoriax-0.1.0/factoriax/playground/editor/main.py +1680 -0
- factoriax-0.1.0/factoriax/playground/editor/slot_display.py +84 -0
- factoriax-0.1.0/factoriax/playground/editor/state.py +853 -0
- factoriax-0.1.0/factoriax/playground/editor/toolbar.py +788 -0
- factoriax-0.1.0/factoriax/playground/menu/__init__.py +1 -0
- factoriax-0.1.0/factoriax/playground/menu/controls_menu.py +543 -0
- factoriax-0.1.0/factoriax/playground/menu/main_menu.py +219 -0
- factoriax-0.1.0/factoriax/playground/play/__init__.py +24 -0
- factoriax-0.1.0/factoriax/playground/play/__main__.py +10 -0
- factoriax-0.1.0/factoriax/playground/play/achievements.py +168 -0
- factoriax-0.1.0/factoriax/playground/play/game_ui.py +865 -0
- factoriax-0.1.0/factoriax/playground/play/launch_screen.py +560 -0
- factoriax-0.1.0/factoriax/playground/play/main.py +632 -0
- factoriax-0.1.0/factoriax/playground/play/play_state.py +65 -0
- factoriax-0.1.0/factoriax/playground/play/ui.py +2203 -0
- factoriax-0.1.0/factoriax/playground/ui/__init__.py +66 -0
- factoriax-0.1.0/factoriax/playground/ui/compositing.py +154 -0
- factoriax-0.1.0/factoriax/playground/ui/fonts.py +91 -0
- factoriax-0.1.0/factoriax/playground/ui/forms.py +162 -0
- factoriax-0.1.0/factoriax/playground/ui/icons.py +1646 -0
- factoriax-0.1.0/factoriax/playground/ui/labels.py +20 -0
- factoriax-0.1.0/factoriax/playground/ui/panels.py +761 -0
- factoriax-0.1.0/factoriax/playground/ui/primitives.py +100 -0
- factoriax-0.1.0/factoriax/playground/ui/scaling.py +106 -0
- factoriax-0.1.0/factoriax/playground/ui/theme.py +118 -0
- factoriax-0.1.0/factoriax/playground/ui/window.py +83 -0
- factoriax-0.1.0/pyproject.toml +137 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
docs/api/generated/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
#poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
#pdm.lock
|
|
117
|
+
#pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
#pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi
|
|
127
|
+
|
|
128
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
129
|
+
__pypackages__/
|
|
130
|
+
|
|
131
|
+
# Celery stuff
|
|
132
|
+
celerybeat-schedule
|
|
133
|
+
celerybeat.pid
|
|
134
|
+
|
|
135
|
+
# SageMath parsed files
|
|
136
|
+
*.sage.py
|
|
137
|
+
|
|
138
|
+
# Environments
|
|
139
|
+
.env
|
|
140
|
+
.envrc
|
|
141
|
+
.venv
|
|
142
|
+
env/
|
|
143
|
+
venv/
|
|
144
|
+
ENV/
|
|
145
|
+
env.bak/
|
|
146
|
+
venv.bak/
|
|
147
|
+
|
|
148
|
+
# Spyder project settings
|
|
149
|
+
.spyderproject
|
|
150
|
+
.spyproject
|
|
151
|
+
|
|
152
|
+
# Rope project settings
|
|
153
|
+
.ropeproject
|
|
154
|
+
|
|
155
|
+
# mkdocs documentation
|
|
156
|
+
/site
|
|
157
|
+
|
|
158
|
+
# mypy
|
|
159
|
+
.mypy_cache/
|
|
160
|
+
.dmypy.json
|
|
161
|
+
dmypy.json
|
|
162
|
+
|
|
163
|
+
# Pyre type checker
|
|
164
|
+
.pyre/
|
|
165
|
+
|
|
166
|
+
# pytype static type analyzer
|
|
167
|
+
.pytype/
|
|
168
|
+
|
|
169
|
+
# Cython debug symbols
|
|
170
|
+
cython_debug/
|
|
171
|
+
|
|
172
|
+
# PyCharm
|
|
173
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
174
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
175
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
176
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
177
|
+
#.idea/
|
|
178
|
+
|
|
179
|
+
# Abstra
|
|
180
|
+
# Abstra is an AI-powered process automation framework.
|
|
181
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
182
|
+
# Learn more at https://abstra.io/docs
|
|
183
|
+
.abstra/
|
|
184
|
+
|
|
185
|
+
# Visual Studio Code
|
|
186
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
187
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
188
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
189
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
190
|
+
# .vscode/
|
|
191
|
+
|
|
192
|
+
# Ruff stuff:
|
|
193
|
+
.ruff_cache/
|
|
194
|
+
|
|
195
|
+
# PyPI configuration file
|
|
196
|
+
.pypirc
|
|
197
|
+
|
|
198
|
+
# Cursor
|
|
199
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
200
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
201
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
202
|
+
.cursorignore
|
|
203
|
+
.cursorindexingignore
|
|
204
|
+
|
|
205
|
+
# Marimo
|
|
206
|
+
marimo/_static/
|
|
207
|
+
marimo/_lsp/
|
|
208
|
+
__marimo__/
|
|
209
|
+
|
|
210
|
+
# File types
|
|
211
|
+
*.mp4
|
|
212
|
+
*.png
|
|
213
|
+
*.npz
|
|
214
|
+
# Track the canonical sprite atlas. The renderer reads it at startup.
|
|
215
|
+
!factoriax/assets/atlas.png
|
|
216
|
+
# Track the README/docs title image.
|
|
217
|
+
!docs/_static/title_image.png
|
|
218
|
+
# Track figures that documentation pages embed. The docs build fails
|
|
219
|
+
# without them, because a page references a file that is not there.
|
|
220
|
+
!docs/**/_images/*.png
|
|
221
|
+
|
|
222
|
+
# Performance test logs
|
|
223
|
+
tests/performance/logs/
|
|
224
|
+
|
|
225
|
+
# Project specific
|
|
226
|
+
player_config.json
|
|
227
|
+
CLAUDE.md
|
|
228
|
+
craftax/
|
|
229
|
+
tmp_baselines/
|
|
230
|
+
experiments/
|
|
231
|
+
wandb/
|
|
232
|
+
levels/
|
|
233
|
+
checkpoints/
|
|
234
|
+
runs/
|
|
235
|
+
.claude/worktrees/
|
|
236
|
+
.claude/scheduled_tasks.lock
|
|
237
|
+
|
|
238
|
+
# Paper lives in its own repo; not tracked here
|
|
239
|
+
paper/
|
|
240
|
+
docs/profiling/traces/
|
|
241
|
+
|
|
242
|
+
# Profiler output
|
|
243
|
+
profiled.json
|
|
244
|
+
profiles/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mickey Beurskens
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
factoriax-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: factoriax
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A JAX-based grid environment for RL research
|
|
5
|
+
Project-URL: Homepage, https://github.com/mickeybeurskens/factoriax
|
|
6
|
+
Project-URL: Documentation, https://mickeybeurskens.github.io/factoriax/
|
|
7
|
+
Project-URL: Repository, https://github.com/mickeybeurskens/factoriax
|
|
8
|
+
Project-URL: Issues, https://github.com/mickeybeurskens/factoriax/issues
|
|
9
|
+
Author-email: Mickey Beurskens <m.r.m.beurskens@tue.nl>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE.md
|
|
12
|
+
Keywords: benchmark,environment,factorio,gpu,jax,reinforcement-learning
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: flax>=0.8.0
|
|
22
|
+
Requires-Dist: gymnax>=0.0.8
|
|
23
|
+
Requires-Dist: imageio[ffmpeg]>=2.33.0
|
|
24
|
+
Requires-Dist: jax>=0.9.1
|
|
25
|
+
Requires-Dist: numpy>=1.26.0
|
|
26
|
+
Requires-Dist: optax>=0.2.0
|
|
27
|
+
Requires-Dist: orjson>=3.11.7
|
|
28
|
+
Requires-Dist: pygame>=2.5.0
|
|
29
|
+
Provides-Extra: cuda
|
|
30
|
+
Requires-Dist: jax[cuda13]>=0.9.1; extra == 'cuda'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Factoriax
|
|
34
|
+
|
|
35
|
+
> "The Factory must grow!"
|
|
36
|
+
|
|
37
|
+
Factoriax is a GPU accelerated factory building simulator for reinforcement learning research in the style of the game [Factorio](https://www.factorio.com/), written in JAX.
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<img src="https://raw.githubusercontent.com/mickeybeurskens/factoriax/main/docs/_static/title_image.png"
|
|
41
|
+
alt="A Factoriax factory: miners on ore patches, belts that carry ore to furnaces and assemblers, and a player among them" />
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
[Read the documentation](https://mickeybeurskens.github.io/factoriax/)
|
|
45
|
+
for the tutorial, the API reference, and the design notes. To build the
|
|
46
|
+
documentation as HTML, run `cd docs && make html`.
|
|
47
|
+
|
|
48
|
+
## Why Factoriax?
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Factorio is quite a cool game with an enormous amount of emergent gameplay complexity, and it is interesting to use it as a benchmark to evaluate AI systems. However, even though the game is famous for being [carefully optimized](https://www.factorio.com/blog/post/fff-421), training Reinforcement Learning agents on the base game is very slow. Factoriax is basically a simplified version of the core Factorio game mechanics that can run millions of game ticks per second on higher end GPUs (as of writing), while also running quickly enough to train models on local laptop GPUs. This allows researchers to test their RL ideas in Factoriax at scale, while allowing students to get familiar with RL concepts without the need for enormous GPU clusters.
|
|
52
|
+
|
|
53
|
+
And honestly, Factorio is just a lot of fun. Even though the Factoriax implementation of the original game mechanics is quite minimal, I hope it does some justice to the original game.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
To install the most recent release from PyPi, run this command:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install factoriax
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
To install it with uv, run this command instead:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
uv add factoriax
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### GPU Support
|
|
70
|
+
|
|
71
|
+
Factoriax installs the CPU version of JAX by default. Read
|
|
72
|
+
[the JAX documentation](https://docs.jax.dev/en/latest/installation.html#installation)
|
|
73
|
+
to find the version of JAX for your hardware. If your system supports CUDA13,
|
|
74
|
+
run this command after you install Factoriax:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install "jax[cuda13]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
To do the same with uv, run this command:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
uv pip install "jax[cuda13]"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Most Recent Build For Research
|
|
87
|
+
|
|
88
|
+
Install an editable build if you want the most recent commit on main. Install
|
|
89
|
+
an editable build also if you want to change the source code of Factoriax
|
|
90
|
+
while you work on your own project.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
git clone https://github.com/mickeybeurskens/factoriax.git
|
|
94
|
+
pip install -e ./factoriax
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
To do the same with uv, run these commands:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/mickeybeurskens/factoriax.git
|
|
101
|
+
uv add --editable ./factoriax
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Development Build
|
|
105
|
+
|
|
106
|
+
The development build keeps the development packages in sync. Do not use it if
|
|
107
|
+
you include Factoriax as a dependency of your own project.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git clone https://github.com/mickeybeurskens/factoriax.git
|
|
111
|
+
uv sync
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`uv sync` removes the GPU version of JAX. To keep the GPU version, run this
|
|
115
|
+
command instead:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
uv sync --extra cuda
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Play The Game
|
|
122
|
+
|
|
123
|
+
Factoriax has a human playable interface, called the playground. It contains a human playable version of Factoriax and a level editor.
|
|
124
|
+
|
|
125
|
+
To open the playground, run this command:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
python -m factoriax.playground
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
More information is available [in the documentation](https://mickeybeurskens.github.io/factoriax/start_here/playing_manually.html).
|
|
132
|
+
|
|
133
|
+
## Build An Environment
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import jax
|
|
137
|
+
|
|
138
|
+
from factoriax.make import env_from_name
|
|
139
|
+
|
|
140
|
+
env, params = env_from_name("EasyRocket-v1")
|
|
141
|
+
obs, state = env.reset_env(jax.random.PRNGKey(0), params)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Three scenarios have an id: `MinerBootstrap-v1`, `EasyRocket-v1`, and
|
|
145
|
+
`Rocket-v1`. The function `factoriax.engine.envs.registry.list_scenarios`
|
|
146
|
+
returns each id with its specification.
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
To run the tests, the linter, and the documentation build, run these commands:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
uv run pytest
|
|
154
|
+
uv run ruff check factoriax tests
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Citation
|
|
158
|
+
|
|
159
|
+
Factoriax was initially submitted in a workshop paper at the 19th European Workshop on
|
|
160
|
+
Reinforcement Learning (EWRL 2026). If you use Factoriax in your research then please cite:
|
|
161
|
+
|
|
162
|
+
```bibtex
|
|
163
|
+
@inproceedings{beurskens2026factoriax,
|
|
164
|
+
title = {{Factoriax - A GPU-Accelerated Factory Building Simulator In The Style Of Factorio}},
|
|
165
|
+
author = {Beurskens, Mickey and Tomilin, Tristan and Sim{\~a}o, Thiago D.},
|
|
166
|
+
booktitle = {19th European Workshop on Reinforcement Learning (EWRL)},
|
|
167
|
+
year = {2026},
|
|
168
|
+
address = {Lille, France},
|
|
169
|
+
url = {https://ewrl-org.github.io/ewrl-2026/poster_148.html}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Factoriax
|
|
2
|
+
|
|
3
|
+
> "The Factory must grow!"
|
|
4
|
+
|
|
5
|
+
Factoriax is a GPU accelerated factory building simulator for reinforcement learning research in the style of the game [Factorio](https://www.factorio.com/), written in JAX.
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://raw.githubusercontent.com/mickeybeurskens/factoriax/main/docs/_static/title_image.png"
|
|
9
|
+
alt="A Factoriax factory: miners on ore patches, belts that carry ore to furnaces and assemblers, and a player among them" />
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
[Read the documentation](https://mickeybeurskens.github.io/factoriax/)
|
|
13
|
+
for the tutorial, the API reference, and the design notes. To build the
|
|
14
|
+
documentation as HTML, run `cd docs && make html`.
|
|
15
|
+
|
|
16
|
+
## Why Factoriax?
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Factorio is quite a cool game with an enormous amount of emergent gameplay complexity, and it is interesting to use it as a benchmark to evaluate AI systems. However, even though the game is famous for being [carefully optimized](https://www.factorio.com/blog/post/fff-421), training Reinforcement Learning agents on the base game is very slow. Factoriax is basically a simplified version of the core Factorio game mechanics that can run millions of game ticks per second on higher end GPUs (as of writing), while also running quickly enough to train models on local laptop GPUs. This allows researchers to test their RL ideas in Factoriax at scale, while allowing students to get familiar with RL concepts without the need for enormous GPU clusters.
|
|
20
|
+
|
|
21
|
+
And honestly, Factorio is just a lot of fun. Even though the Factoriax implementation of the original game mechanics is quite minimal, I hope it does some justice to the original game.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
To install the most recent release from PyPi, run this command:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install factoriax
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To install it with uv, run this command instead:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv add factoriax
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### GPU Support
|
|
38
|
+
|
|
39
|
+
Factoriax installs the CPU version of JAX by default. Read
|
|
40
|
+
[the JAX documentation](https://docs.jax.dev/en/latest/installation.html#installation)
|
|
41
|
+
to find the version of JAX for your hardware. If your system supports CUDA13,
|
|
42
|
+
run this command after you install Factoriax:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install "jax[cuda13]"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
To do the same with uv, run this command:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uv pip install "jax[cuda13]"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Most Recent Build For Research
|
|
55
|
+
|
|
56
|
+
Install an editable build if you want the most recent commit on main. Install
|
|
57
|
+
an editable build also if you want to change the source code of Factoriax
|
|
58
|
+
while you work on your own project.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/mickeybeurskens/factoriax.git
|
|
62
|
+
pip install -e ./factoriax
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To do the same with uv, run these commands:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/mickeybeurskens/factoriax.git
|
|
69
|
+
uv add --editable ./factoriax
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Development Build
|
|
73
|
+
|
|
74
|
+
The development build keeps the development packages in sync. Do not use it if
|
|
75
|
+
you include Factoriax as a dependency of your own project.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/mickeybeurskens/factoriax.git
|
|
79
|
+
uv sync
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`uv sync` removes the GPU version of JAX. To keep the GPU version, run this
|
|
83
|
+
command instead:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
uv sync --extra cuda
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Play The Game
|
|
90
|
+
|
|
91
|
+
Factoriax has a human playable interface, called the playground. It contains a human playable version of Factoriax and a level editor.
|
|
92
|
+
|
|
93
|
+
To open the playground, run this command:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
python -m factoriax.playground
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
More information is available [in the documentation](https://mickeybeurskens.github.io/factoriax/start_here/playing_manually.html).
|
|
100
|
+
|
|
101
|
+
## Build An Environment
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import jax
|
|
105
|
+
|
|
106
|
+
from factoriax.make import env_from_name
|
|
107
|
+
|
|
108
|
+
env, params = env_from_name("EasyRocket-v1")
|
|
109
|
+
obs, state = env.reset_env(jax.random.PRNGKey(0), params)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Three scenarios have an id: `MinerBootstrap-v1`, `EasyRocket-v1`, and
|
|
113
|
+
`Rocket-v1`. The function `factoriax.engine.envs.registry.list_scenarios`
|
|
114
|
+
returns each id with its specification.
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
To run the tests, the linter, and the documentation build, run these commands:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv run pytest
|
|
122
|
+
uv run ruff check factoriax tests
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Citation
|
|
126
|
+
|
|
127
|
+
Factoriax was initially submitted in a workshop paper at the 19th European Workshop on
|
|
128
|
+
Reinforcement Learning (EWRL 2026). If you use Factoriax in your research then please cite:
|
|
129
|
+
|
|
130
|
+
```bibtex
|
|
131
|
+
@inproceedings{beurskens2026factoriax,
|
|
132
|
+
title = {{Factoriax - A GPU-Accelerated Factory Building Simulator In The Style Of Factorio}},
|
|
133
|
+
author = {Beurskens, Mickey and Tomilin, Tristan and Sim{\~a}o, Thiago D.},
|
|
134
|
+
booktitle = {19th European Workshop on Reinforcement Learning (EWRL)},
|
|
135
|
+
year = {2026},
|
|
136
|
+
address = {Lille, France},
|
|
137
|
+
url = {https://ewrl-org.github.io/ewrl-2026/poster_148.html}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Factoriax: a JAX grid environment for reinforcement learning research.
|
|
2
|
+
|
|
3
|
+
The package holds four parts. :mod:`factoriax.engine` is the simulation, the
|
|
4
|
+
environments, and the wrappers. :mod:`factoriax.analysis` reads a recorded
|
|
5
|
+
rollout. :mod:`factoriax.playground` is the human interface, which is the
|
|
6
|
+
game and the level editor. :mod:`factoriax.assets` builds the sprite atlas.
|
|
7
|
+
|
|
8
|
+
Build an environment with :func:`factoriax.make.env_from_name`. Start the
|
|
9
|
+
playground with ``python -m factoriax.playground``.
|
|
10
|
+
|
|
11
|
+
This module holds no imports, so a training run pulls in the engine only, and
|
|
12
|
+
never pygame. Import from the defining module instead.
|
|
13
|
+
"""
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Tools for reading and drawing recorded episodes.
|
|
2
|
+
|
|
3
|
+
:class:`~factoriax.analysis.trajectory.Trajectory` is the shared input
|
|
4
|
+
format. Every plot in this package takes one.
|
|
5
|
+
|
|
6
|
+
Importing this package imports the five submodules listed in
|
|
7
|
+
``__all__``, and therefore matplotlib. The other modules
|
|
8
|
+
(``build_progression``, ``categories``, ``curriculum_strip``,
|
|
9
|
+
``graph_layout``, ``inventory``, ``recipe_graph``, ``recorder``, and
|
|
10
|
+
``utils``) are not re-exported here. Import them by their full path.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from . import actions, eval, milestones, state, video
|
|
14
|
+
from .trajectory import Trajectory
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"Trajectory",
|
|
18
|
+
"actions",
|
|
19
|
+
"eval",
|
|
20
|
+
"milestones",
|
|
21
|
+
"state",
|
|
22
|
+
"video",
|
|
23
|
+
]
|