Gymnasium RL environment wrapping the 3D-Game raylib FPS as a headless native environment
Project description
Ethosoft
A Gymnasium environment wrapping 331uw13/3D-Game — a raylib/C first-person shooter with procedural voxel terrain — as a headless, steppable RL environment.
The game runs off-screen (no visible window), driven one fixed timestep
(1/60s) at a time by actions from Python, via a small native library
(game3denv.dll) built from the game's own C source plus a thin env API
(see src/env/ in the main repo). No game-logic files were modified to make
this possible — see src/env/env_shim.c for how input is injected instead.
import gymnasium as gym
import ethosoft # registers "Game3D-v0"
env = gym.make("Game3D-v0")
obs, info = env.reset()
for _ in range(1000):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.close()
Spaces
- Action (
Dict):move(MultiBinary(4): forward/back/left/right),run,jump,shoot,aim(Discrete(2)),look(Box(-1, 1, (2,))mouse-look delta, scaled bylook_scale). - Observation (
Dict):rgb(Box(0, 255, (H, W, 3), uint8)off-screen render, resolution fromgame.cfg),vector(Box(-inf, inf, (12,)): health fraction, armor fraction, xp, total kills, position xyz, yaw, pitch, onground, nearest enemy distance in the current chunk, nearest enemy alive). - Reward:
Δhealth * 0.1 + Δkills * 10 + 0.01per step,-50on death. terminatedwhen the player dies;truncatedaftermax_episode_steps(default 2000, set viaGame3DEnv(max_episode_steps=...)).
Scope (v0.1)
- Same procedurally generated world persists across episodes in a process;
reset()respawns the player, it does not regenerate terrain. - Inventory, NPC dialogue, and item crafting are not part of the action/ observation space yet.
- Only one
Game3DEnvmay be alive per process (the native library holds a single global game state) — use separate processes to parallelize. - Prebuilt binary ships for Windows x64 only. On Linux/macOS, build
game3denv.soyourself from the main repo (mingw32-make envlibon Windows or the equivalent GCC/Make invocation using the Makefile'senvlibtarget on Linux/macOS with raylib installed) and drop it intoethosoft/native/alongsideres/,weapons_cfg/, andgame.cfg.
License
GPL-3.0-or-later, same as the upstream game (raylib itself is zlib-licensed).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ethosoft-0.1.0.tar.gz.
File metadata
- Download URL: ethosoft-0.1.0.tar.gz
- Upload date:
- Size: 6.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
988c2db3958bf06bc42fe579589010d8e5948cda10af99d1671774ab576e7bb9
|
|
| MD5 |
1424ab6ace3c6628caec6de9fb596bdd
|
|
| BLAKE2b-256 |
38105fb884b51162604bda96bfd14f4d7f47afaa69a214ff1418b78a5567ed2a
|
File details
Details for the file ethosoft-0.1.0-py3-none-win_amd64.whl.
File metadata
- Download URL: ethosoft-0.1.0-py3-none-win_amd64.whl
- Upload date:
- Size: 6.7 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1900029b11a63f9d2faf4c6f7e2664d7f6f2d7a08a8e020d7d4157af74f598b
|
|
| MD5 |
ca945d3664573a40c716e7940b529572
|
|
| BLAKE2b-256 |
ceeec218efd5406cfb27c8235d0364c7d0e4bc387f8cec85037e8656f2b0366f
|