Metadata-Version: 2.4
Name: Three-dimensional-Games
Version: 0.3.0
Summary: A powerful yet simple 3D game engine for Python - combines Ursina's simplicity with Panda3D's power
Author-email: Your Name <your.email@example.com>
License: MIT License
        
        Copyright (c) 2026
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/yourusername/Three-dimensional-Games
Project-URL: Bug Tracker, https://github.com/yourusername/Three-dimensional-Games/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: panda3d>=1.10.13
Requires-Dist: Pillow>=9.0.0
Provides-Extra: voice
Requires-Dist: pyaudio>=0.2.13; extra == "voice"
Requires-Dist: openai-whisper>=20231117; extra == "voice"
Requires-Dist: SpeechRecognition>=3.10.0; extra == "voice"
Requires-Dist: pyttsx3>=2.90; extra == "voice"
Provides-Extra: gamepad
Requires-Dist: inputs>=0.5; extra == "gamepad"
Provides-Extra: full
Requires-Dist: Three-dimensional-Games[gamepad,voice]; extra == "full"
Dynamic: license-file

# Three-dimensional-Games

### 比 Ursina 更简洁、比 Panda3D 更好用的 Python 3D 游戏引擎 ✨

```python
from three_dimensional_games import *

game = init(title="我的 3D 游戏")            # 开头：初始化

ground = Entity(model='plane', texture='grass', scale=(50, 1, 50), collider='box')
player = FirstPerson()                      # 第一人称（也有 SecondPerson / ThirdPerson）
player.position = (0, 3, 0)

run()                                       # 结尾：启动
```

## 安装
```bash
pip install Three-dimensional-Games
```

导入时用下划线写法：`import three_dimensional_games` 或 `from three_dimensional_games import *`。

## 核心特点

| 特点 | Three-dimensional-Games | Ursina | Panda3D |
|------|-------------------------|--------|---------|
| 初始化 | 一行 `game = init()` | `app = Ursina()` | 手动一堆设置 |
| 启动 | 一行 `run()` | `app.run()` | `base.run()` |
| 内置贴图 | ✅ 53 种 | ~20 种 | 几乎没有 |
| 内置模型 | ✅ cube/plane/quad/cylinder/cone | 少量 | 需自备 |
| 联机模块 | ✅ 一行开房（公网/局域网） | ❌ 自己写 | ❌ 自己写 |
| 第一/二/三人称 | ✅ 三个都有 | 只有第一人称 | 自己写 |
| 物理重力+碰撞 | ✅ 内置刚体与碰撞解算 | 部分 | 复杂 |
| 补间动画 | ✅ 任意属性都能补间 | 有（仅位置/缩放等） | 自己写 |
| 粒子系统 | ✅ 内置 | 无原生 | 自己搭 |
| 音效模块 | ✅ 内置，还能纯代码发声 | 有 | 有 |
| 触发区 | ✅ 内置 | 无原生 | 自己写 |
| 存档读档 | ✅ 一个 json 存全场景 | 无原生 | 自己写 |
| 公网 UPnP 穿透 | ✅ 自动 | ❌ | ❌ |
| 局域网自动发现 | ✅ 有 | ❌ | ❌ |

## 常用功能速查

### 初始化与启动
```python
game = init(title="游戏名", window_size=(1280, 720), show_fps=True)
...
run()
```

### 三种视角
```python
player = FirstPerson()    # FPS，WASD 走、空格跳、鼠标转视角
player = SecondPerson()   # 第二人称（反向视角）
player = ThirdPerson()    # 第三人称追尾视角
```

### 物理（重力、掉落、碰撞）
```python
ground = Entity(model='plane', scale=(50, 1, 50), collider='box')   # 静态地面
box = Entity(model='cube', position=(0, 5, 0), collider='box', mass=1)  # 会掉下来的箱子
hit = raycast(player.position, (0, -1, 0), distance=10)   # 射线检测，可用来瞄准
```

### 联机
```python
host(public=False, port=5555)   # False = 局域网联机；True = 公网联机
connect("192.168.1.100")        # 加入别人的房间
```

### 补间动画
```python
box.animate('position', (5, 2, 0), duration=1.0, curve='ease_in_out')
box.animate_rotation((0, 360, 0), duration=4, loop=True)
animate_color(box, color.red, duration=0.5)
```

### 粒子
```python
sparks = Particles(texture='particle_spark', num_particles=60, speed=6, gravity=(0, -8, 0))
sparks.burst(player.position)      # 炸一把
sparks.start(follow=player)        # 持续跟随发射
```

### 音效（不需要素材也能响）
```python
jump = Audio('sounds/jump.ogg')    # 用音频文件
jump.play()
beep(660, 0.12)                    # 纯代码合成提示音
bgm = Music('sounds/bgm.ogg', volume=0.4); bgm.play()
```

### 触发区
```python
on_enter((0, 1, 10), (4, 4, 4), lambda: print("过关！"))
```

### 存档 / 读档
```python
save("save1.json", data={"score": 120, "level": 3})   # 存下全场景位置+进度数据
payload = load("save1.json")                          # 读回来
print(payload["data"]["score"])                       # 120

save_slot(1)        # 存到第 1 个槽位（saves/1.json）
load_slot(1)        # 读第 1 个槽位
list_saves()        # 看看有哪些存档
```

## 内置贴图（53 种，比 Ursina 更多）

- 自然：`grass` `dirt` `stone` `rock` `cliff` `sand` `snow` `lava` `water` `mud` `gravel` `moss`
- 建筑：`brick` `concrete` `tile` `marble` `road` `path` `grid`
- 材质：`wood` `metal` `leather` `fabric` `carpet` `diamond_plate` `cracked_glass`
- 颜色：`red` `green` `blue` `yellow` `cyan` `magenta` `gray` `white` `black`
- 天空与渐变：`sky` `clouds` `gradient` `radial_gradient` `clouds`
- 噪声：`noise` `perlin`
- UI：`button` `button_hover` `button_pressed` `panel` `border` `circle`
- 粒子：`particle_circle` `particle_smoke` `particle_spark` `particle_star`
- 其他：`white_cube` `checkerboard`

## 内置模型

`cube`、`plane`、`quad`、`cylinder`、`cone`，另外 `load_model()` 可加载外部的 `.egg/.bam/.gltf` 模型。

## 许可

MIT License
