Three-dimensional-Games 0.3.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.
- three_dimensional_games-0.3.0/LICENSE +21 -0
- three_dimensional_games-0.3.0/PKG-INFO +184 -0
- three_dimensional_games-0.3.0/README.md +128 -0
- three_dimensional_games-0.3.0/Three_dimensional_Games.egg-info/PKG-INFO +184 -0
- three_dimensional_games-0.3.0/Three_dimensional_Games.egg-info/SOURCES.txt +38 -0
- three_dimensional_games-0.3.0/Three_dimensional_Games.egg-info/dependency_links.txt +1 -0
- three_dimensional_games-0.3.0/Three_dimensional_Games.egg-info/requires.txt +14 -0
- three_dimensional_games-0.3.0/Three_dimensional_Games.egg-info/top_level.txt +1 -0
- three_dimensional_games-0.3.0/pyproject.toml +53 -0
- three_dimensional_games-0.3.0/setup.cfg +4 -0
- three_dimensional_games-0.3.0/setup.py +5 -0
- three_dimensional_games-0.3.0/three_dimensional_games/__init__.py +256 -0
- three_dimensional_games-0.3.0/three_dimensional_games/animation.py +321 -0
- three_dimensional_games-0.3.0/three_dimensional_games/application.py +350 -0
- three_dimensional_games-0.3.0/three_dimensional_games/audio.py +208 -0
- three_dimensional_games-0.3.0/three_dimensional_games/builtin_textures.py +606 -0
- three_dimensional_games-0.3.0/three_dimensional_games/camera.py +16 -0
- three_dimensional_games-0.3.0/three_dimensional_games/color.py +160 -0
- three_dimensional_games-0.3.0/three_dimensional_games/entity.py +494 -0
- three_dimensional_games-0.3.0/three_dimensional_games/gamepad.py +330 -0
- three_dimensional_games-0.3.0/three_dimensional_games/input.py +145 -0
- three_dimensional_games-0.3.0/three_dimensional_games/mesh.py +3 -0
- three_dimensional_games-0.3.0/three_dimensional_games/models.py +246 -0
- three_dimensional_games-0.3.0/three_dimensional_games/network.py +722 -0
- three_dimensional_games-0.3.0/three_dimensional_games/particles.py +191 -0
- three_dimensional_games-0.3.0/three_dimensional_games/physics.py +430 -0
- three_dimensional_games-0.3.0/three_dimensional_games/prefabs/__init__.py +11 -0
- three_dimensional_games-0.3.0/three_dimensional_games/prefabs/first_person.py +153 -0
- three_dimensional_games-0.3.0/three_dimensional_games/prefabs/second_person.py +154 -0
- three_dimensional_games-0.3.0/three_dimensional_games/prefabs/sky.py +51 -0
- three_dimensional_games-0.3.0/three_dimensional_games/prefabs/third_person.py +194 -0
- three_dimensional_games-0.3.0/three_dimensional_games/raycaster.py +571 -0
- three_dimensional_games-0.3.0/three_dimensional_games/saveload.py +219 -0
- three_dimensional_games-0.3.0/three_dimensional_games/scene.py +141 -0
- three_dimensional_games-0.3.0/three_dimensional_games/texture.py +6 -0
- three_dimensional_games-0.3.0/three_dimensional_games/trigger.py +159 -0
- three_dimensional_games-0.3.0/three_dimensional_games/ui.py +305 -0
- three_dimensional_games-0.3.0/three_dimensional_games/util.py +215 -0
- three_dimensional_games-0.3.0/three_dimensional_games/vector.py +383 -0
- three_dimensional_games-0.3.0/three_dimensional_games/voice.py +490 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Three-dimensional-Games
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A powerful yet simple 3D game engine for Python - combines Ursina's simplicity with Panda3D's power
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/yourusername/Three-dimensional-Games
|
|
29
|
+
Project-URL: Bug Tracker, https://github.com/yourusername/Three-dimensional-Games/issues
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Topic :: Games/Entertainment
|
|
39
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
+
Requires-Python: >=3.8
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: panda3d>=1.10.13
|
|
45
|
+
Requires-Dist: Pillow>=9.0.0
|
|
46
|
+
Provides-Extra: voice
|
|
47
|
+
Requires-Dist: pyaudio>=0.2.13; extra == "voice"
|
|
48
|
+
Requires-Dist: openai-whisper>=20231117; extra == "voice"
|
|
49
|
+
Requires-Dist: SpeechRecognition>=3.10.0; extra == "voice"
|
|
50
|
+
Requires-Dist: pyttsx3>=2.90; extra == "voice"
|
|
51
|
+
Provides-Extra: gamepad
|
|
52
|
+
Requires-Dist: inputs>=0.5; extra == "gamepad"
|
|
53
|
+
Provides-Extra: full
|
|
54
|
+
Requires-Dist: Three-dimensional-Games[gamepad,voice]; extra == "full"
|
|
55
|
+
Dynamic: license-file
|
|
56
|
+
|
|
57
|
+
# Three-dimensional-Games
|
|
58
|
+
|
|
59
|
+
### 比 Ursina 更简洁、比 Panda3D 更好用的 Python 3D 游戏引擎 ✨
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from three_dimensional_games import *
|
|
63
|
+
|
|
64
|
+
game = init(title="我的 3D 游戏") # 开头:初始化
|
|
65
|
+
|
|
66
|
+
ground = Entity(model='plane', texture='grass', scale=(50, 1, 50), collider='box')
|
|
67
|
+
player = FirstPerson() # 第一人称(也有 SecondPerson / ThirdPerson)
|
|
68
|
+
player.position = (0, 3, 0)
|
|
69
|
+
|
|
70
|
+
run() # 结尾:启动
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 安装
|
|
74
|
+
```bash
|
|
75
|
+
pip install Three-dimensional-Games
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
导入时用下划线写法:`import three_dimensional_games` 或 `from three_dimensional_games import *`。
|
|
79
|
+
|
|
80
|
+
## 核心特点
|
|
81
|
+
|
|
82
|
+
| 特点 | Three-dimensional-Games | Ursina | Panda3D |
|
|
83
|
+
|------|-------------------------|--------|---------|
|
|
84
|
+
| 初始化 | 一行 `game = init()` | `app = Ursina()` | 手动一堆设置 |
|
|
85
|
+
| 启动 | 一行 `run()` | `app.run()` | `base.run()` |
|
|
86
|
+
| 内置贴图 | ✅ 53 种 | ~20 种 | 几乎没有 |
|
|
87
|
+
| 内置模型 | ✅ cube/plane/quad/cylinder/cone | 少量 | 需自备 |
|
|
88
|
+
| 联机模块 | ✅ 一行开房(公网/局域网) | ❌ 自己写 | ❌ 自己写 |
|
|
89
|
+
| 第一/二/三人称 | ✅ 三个都有 | 只有第一人称 | 自己写 |
|
|
90
|
+
| 物理重力+碰撞 | ✅ 内置刚体与碰撞解算 | 部分 | 复杂 |
|
|
91
|
+
| 补间动画 | ✅ 任意属性都能补间 | 有(仅位置/缩放等) | 自己写 |
|
|
92
|
+
| 粒子系统 | ✅ 内置 | 无原生 | 自己搭 |
|
|
93
|
+
| 音效模块 | ✅ 内置,还能纯代码发声 | 有 | 有 |
|
|
94
|
+
| 触发区 | ✅ 内置 | 无原生 | 自己写 |
|
|
95
|
+
| 存档读档 | ✅ 一个 json 存全场景 | 无原生 | 自己写 |
|
|
96
|
+
| 公网 UPnP 穿透 | ✅ 自动 | ❌ | ❌ |
|
|
97
|
+
| 局域网自动发现 | ✅ 有 | ❌ | ❌ |
|
|
98
|
+
|
|
99
|
+
## 常用功能速查
|
|
100
|
+
|
|
101
|
+
### 初始化与启动
|
|
102
|
+
```python
|
|
103
|
+
game = init(title="游戏名", window_size=(1280, 720), show_fps=True)
|
|
104
|
+
...
|
|
105
|
+
run()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 三种视角
|
|
109
|
+
```python
|
|
110
|
+
player = FirstPerson() # FPS,WASD 走、空格跳、鼠标转视角
|
|
111
|
+
player = SecondPerson() # 第二人称(反向视角)
|
|
112
|
+
player = ThirdPerson() # 第三人称追尾视角
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 物理(重力、掉落、碰撞)
|
|
116
|
+
```python
|
|
117
|
+
ground = Entity(model='plane', scale=(50, 1, 50), collider='box') # 静态地面
|
|
118
|
+
box = Entity(model='cube', position=(0, 5, 0), collider='box', mass=1) # 会掉下来的箱子
|
|
119
|
+
hit = raycast(player.position, (0, -1, 0), distance=10) # 射线检测,可用来瞄准
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 联机
|
|
123
|
+
```python
|
|
124
|
+
host(public=False, port=5555) # False = 局域网联机;True = 公网联机
|
|
125
|
+
connect("192.168.1.100") # 加入别人的房间
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 补间动画
|
|
129
|
+
```python
|
|
130
|
+
box.animate('position', (5, 2, 0), duration=1.0, curve='ease_in_out')
|
|
131
|
+
box.animate_rotation((0, 360, 0), duration=4, loop=True)
|
|
132
|
+
animate_color(box, color.red, duration=0.5)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 粒子
|
|
136
|
+
```python
|
|
137
|
+
sparks = Particles(texture='particle_spark', num_particles=60, speed=6, gravity=(0, -8, 0))
|
|
138
|
+
sparks.burst(player.position) # 炸一把
|
|
139
|
+
sparks.start(follow=player) # 持续跟随发射
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 音效(不需要素材也能响)
|
|
143
|
+
```python
|
|
144
|
+
jump = Audio('sounds/jump.ogg') # 用音频文件
|
|
145
|
+
jump.play()
|
|
146
|
+
beep(660, 0.12) # 纯代码合成提示音
|
|
147
|
+
bgm = Music('sounds/bgm.ogg', volume=0.4); bgm.play()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 触发区
|
|
151
|
+
```python
|
|
152
|
+
on_enter((0, 1, 10), (4, 4, 4), lambda: print("过关!"))
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 存档 / 读档
|
|
156
|
+
```python
|
|
157
|
+
save("save1.json", data={"score": 120, "level": 3}) # 存下全场景位置+进度数据
|
|
158
|
+
payload = load("save1.json") # 读回来
|
|
159
|
+
print(payload["data"]["score"]) # 120
|
|
160
|
+
|
|
161
|
+
save_slot(1) # 存到第 1 个槽位(saves/1.json)
|
|
162
|
+
load_slot(1) # 读第 1 个槽位
|
|
163
|
+
list_saves() # 看看有哪些存档
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 内置贴图(53 种,比 Ursina 更多)
|
|
167
|
+
|
|
168
|
+
- 自然:`grass` `dirt` `stone` `rock` `cliff` `sand` `snow` `lava` `water` `mud` `gravel` `moss`
|
|
169
|
+
- 建筑:`brick` `concrete` `tile` `marble` `road` `path` `grid`
|
|
170
|
+
- 材质:`wood` `metal` `leather` `fabric` `carpet` `diamond_plate` `cracked_glass`
|
|
171
|
+
- 颜色:`red` `green` `blue` `yellow` `cyan` `magenta` `gray` `white` `black`
|
|
172
|
+
- 天空与渐变:`sky` `clouds` `gradient` `radial_gradient` `clouds`
|
|
173
|
+
- 噪声:`noise` `perlin`
|
|
174
|
+
- UI:`button` `button_hover` `button_pressed` `panel` `border` `circle`
|
|
175
|
+
- 粒子:`particle_circle` `particle_smoke` `particle_spark` `particle_star`
|
|
176
|
+
- 其他:`white_cube` `checkerboard`
|
|
177
|
+
|
|
178
|
+
## 内置模型
|
|
179
|
+
|
|
180
|
+
`cube`、`plane`、`quad`、`cylinder`、`cone`,另外 `load_model()` 可加载外部的 `.egg/.bam/.gltf` 模型。
|
|
181
|
+
|
|
182
|
+
## 许可
|
|
183
|
+
|
|
184
|
+
MIT License
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Three-dimensional-Games
|
|
2
|
+
|
|
3
|
+
### 比 Ursina 更简洁、比 Panda3D 更好用的 Python 3D 游戏引擎 ✨
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from three_dimensional_games import *
|
|
7
|
+
|
|
8
|
+
game = init(title="我的 3D 游戏") # 开头:初始化
|
|
9
|
+
|
|
10
|
+
ground = Entity(model='plane', texture='grass', scale=(50, 1, 50), collider='box')
|
|
11
|
+
player = FirstPerson() # 第一人称(也有 SecondPerson / ThirdPerson)
|
|
12
|
+
player.position = (0, 3, 0)
|
|
13
|
+
|
|
14
|
+
run() # 结尾:启动
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
```bash
|
|
19
|
+
pip install Three-dimensional-Games
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
导入时用下划线写法:`import three_dimensional_games` 或 `from three_dimensional_games import *`。
|
|
23
|
+
|
|
24
|
+
## 核心特点
|
|
25
|
+
|
|
26
|
+
| 特点 | Three-dimensional-Games | Ursina | Panda3D |
|
|
27
|
+
|------|-------------------------|--------|---------|
|
|
28
|
+
| 初始化 | 一行 `game = init()` | `app = Ursina()` | 手动一堆设置 |
|
|
29
|
+
| 启动 | 一行 `run()` | `app.run()` | `base.run()` |
|
|
30
|
+
| 内置贴图 | ✅ 53 种 | ~20 种 | 几乎没有 |
|
|
31
|
+
| 内置模型 | ✅ cube/plane/quad/cylinder/cone | 少量 | 需自备 |
|
|
32
|
+
| 联机模块 | ✅ 一行开房(公网/局域网) | ❌ 自己写 | ❌ 自己写 |
|
|
33
|
+
| 第一/二/三人称 | ✅ 三个都有 | 只有第一人称 | 自己写 |
|
|
34
|
+
| 物理重力+碰撞 | ✅ 内置刚体与碰撞解算 | 部分 | 复杂 |
|
|
35
|
+
| 补间动画 | ✅ 任意属性都能补间 | 有(仅位置/缩放等) | 自己写 |
|
|
36
|
+
| 粒子系统 | ✅ 内置 | 无原生 | 自己搭 |
|
|
37
|
+
| 音效模块 | ✅ 内置,还能纯代码发声 | 有 | 有 |
|
|
38
|
+
| 触发区 | ✅ 内置 | 无原生 | 自己写 |
|
|
39
|
+
| 存档读档 | ✅ 一个 json 存全场景 | 无原生 | 自己写 |
|
|
40
|
+
| 公网 UPnP 穿透 | ✅ 自动 | ❌ | ❌ |
|
|
41
|
+
| 局域网自动发现 | ✅ 有 | ❌ | ❌ |
|
|
42
|
+
|
|
43
|
+
## 常用功能速查
|
|
44
|
+
|
|
45
|
+
### 初始化与启动
|
|
46
|
+
```python
|
|
47
|
+
game = init(title="游戏名", window_size=(1280, 720), show_fps=True)
|
|
48
|
+
...
|
|
49
|
+
run()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 三种视角
|
|
53
|
+
```python
|
|
54
|
+
player = FirstPerson() # FPS,WASD 走、空格跳、鼠标转视角
|
|
55
|
+
player = SecondPerson() # 第二人称(反向视角)
|
|
56
|
+
player = ThirdPerson() # 第三人称追尾视角
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 物理(重力、掉落、碰撞)
|
|
60
|
+
```python
|
|
61
|
+
ground = Entity(model='plane', scale=(50, 1, 50), collider='box') # 静态地面
|
|
62
|
+
box = Entity(model='cube', position=(0, 5, 0), collider='box', mass=1) # 会掉下来的箱子
|
|
63
|
+
hit = raycast(player.position, (0, -1, 0), distance=10) # 射线检测,可用来瞄准
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 联机
|
|
67
|
+
```python
|
|
68
|
+
host(public=False, port=5555) # False = 局域网联机;True = 公网联机
|
|
69
|
+
connect("192.168.1.100") # 加入别人的房间
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 补间动画
|
|
73
|
+
```python
|
|
74
|
+
box.animate('position', (5, 2, 0), duration=1.0, curve='ease_in_out')
|
|
75
|
+
box.animate_rotation((0, 360, 0), duration=4, loop=True)
|
|
76
|
+
animate_color(box, color.red, duration=0.5)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 粒子
|
|
80
|
+
```python
|
|
81
|
+
sparks = Particles(texture='particle_spark', num_particles=60, speed=6, gravity=(0, -8, 0))
|
|
82
|
+
sparks.burst(player.position) # 炸一把
|
|
83
|
+
sparks.start(follow=player) # 持续跟随发射
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 音效(不需要素材也能响)
|
|
87
|
+
```python
|
|
88
|
+
jump = Audio('sounds/jump.ogg') # 用音频文件
|
|
89
|
+
jump.play()
|
|
90
|
+
beep(660, 0.12) # 纯代码合成提示音
|
|
91
|
+
bgm = Music('sounds/bgm.ogg', volume=0.4); bgm.play()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 触发区
|
|
95
|
+
```python
|
|
96
|
+
on_enter((0, 1, 10), (4, 4, 4), lambda: print("过关!"))
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 存档 / 读档
|
|
100
|
+
```python
|
|
101
|
+
save("save1.json", data={"score": 120, "level": 3}) # 存下全场景位置+进度数据
|
|
102
|
+
payload = load("save1.json") # 读回来
|
|
103
|
+
print(payload["data"]["score"]) # 120
|
|
104
|
+
|
|
105
|
+
save_slot(1) # 存到第 1 个槽位(saves/1.json)
|
|
106
|
+
load_slot(1) # 读第 1 个槽位
|
|
107
|
+
list_saves() # 看看有哪些存档
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 内置贴图(53 种,比 Ursina 更多)
|
|
111
|
+
|
|
112
|
+
- 自然:`grass` `dirt` `stone` `rock` `cliff` `sand` `snow` `lava` `water` `mud` `gravel` `moss`
|
|
113
|
+
- 建筑:`brick` `concrete` `tile` `marble` `road` `path` `grid`
|
|
114
|
+
- 材质:`wood` `metal` `leather` `fabric` `carpet` `diamond_plate` `cracked_glass`
|
|
115
|
+
- 颜色:`red` `green` `blue` `yellow` `cyan` `magenta` `gray` `white` `black`
|
|
116
|
+
- 天空与渐变:`sky` `clouds` `gradient` `radial_gradient` `clouds`
|
|
117
|
+
- 噪声:`noise` `perlin`
|
|
118
|
+
- UI:`button` `button_hover` `button_pressed` `panel` `border` `circle`
|
|
119
|
+
- 粒子:`particle_circle` `particle_smoke` `particle_spark` `particle_star`
|
|
120
|
+
- 其他:`white_cube` `checkerboard`
|
|
121
|
+
|
|
122
|
+
## 内置模型
|
|
123
|
+
|
|
124
|
+
`cube`、`plane`、`quad`、`cylinder`、`cone`,另外 `load_model()` 可加载外部的 `.egg/.bam/.gltf` 模型。
|
|
125
|
+
|
|
126
|
+
## 许可
|
|
127
|
+
|
|
128
|
+
MIT License
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Three-dimensional-Games
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A powerful yet simple 3D game engine for Python - combines Ursina's simplicity with Panda3D's power
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/yourusername/Three-dimensional-Games
|
|
29
|
+
Project-URL: Bug Tracker, https://github.com/yourusername/Three-dimensional-Games/issues
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Topic :: Games/Entertainment
|
|
39
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
+
Requires-Python: >=3.8
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: panda3d>=1.10.13
|
|
45
|
+
Requires-Dist: Pillow>=9.0.0
|
|
46
|
+
Provides-Extra: voice
|
|
47
|
+
Requires-Dist: pyaudio>=0.2.13; extra == "voice"
|
|
48
|
+
Requires-Dist: openai-whisper>=20231117; extra == "voice"
|
|
49
|
+
Requires-Dist: SpeechRecognition>=3.10.0; extra == "voice"
|
|
50
|
+
Requires-Dist: pyttsx3>=2.90; extra == "voice"
|
|
51
|
+
Provides-Extra: gamepad
|
|
52
|
+
Requires-Dist: inputs>=0.5; extra == "gamepad"
|
|
53
|
+
Provides-Extra: full
|
|
54
|
+
Requires-Dist: Three-dimensional-Games[gamepad,voice]; extra == "full"
|
|
55
|
+
Dynamic: license-file
|
|
56
|
+
|
|
57
|
+
# Three-dimensional-Games
|
|
58
|
+
|
|
59
|
+
### 比 Ursina 更简洁、比 Panda3D 更好用的 Python 3D 游戏引擎 ✨
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from three_dimensional_games import *
|
|
63
|
+
|
|
64
|
+
game = init(title="我的 3D 游戏") # 开头:初始化
|
|
65
|
+
|
|
66
|
+
ground = Entity(model='plane', texture='grass', scale=(50, 1, 50), collider='box')
|
|
67
|
+
player = FirstPerson() # 第一人称(也有 SecondPerson / ThirdPerson)
|
|
68
|
+
player.position = (0, 3, 0)
|
|
69
|
+
|
|
70
|
+
run() # 结尾:启动
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 安装
|
|
74
|
+
```bash
|
|
75
|
+
pip install Three-dimensional-Games
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
导入时用下划线写法:`import three_dimensional_games` 或 `from three_dimensional_games import *`。
|
|
79
|
+
|
|
80
|
+
## 核心特点
|
|
81
|
+
|
|
82
|
+
| 特点 | Three-dimensional-Games | Ursina | Panda3D |
|
|
83
|
+
|------|-------------------------|--------|---------|
|
|
84
|
+
| 初始化 | 一行 `game = init()` | `app = Ursina()` | 手动一堆设置 |
|
|
85
|
+
| 启动 | 一行 `run()` | `app.run()` | `base.run()` |
|
|
86
|
+
| 内置贴图 | ✅ 53 种 | ~20 种 | 几乎没有 |
|
|
87
|
+
| 内置模型 | ✅ cube/plane/quad/cylinder/cone | 少量 | 需自备 |
|
|
88
|
+
| 联机模块 | ✅ 一行开房(公网/局域网) | ❌ 自己写 | ❌ 自己写 |
|
|
89
|
+
| 第一/二/三人称 | ✅ 三个都有 | 只有第一人称 | 自己写 |
|
|
90
|
+
| 物理重力+碰撞 | ✅ 内置刚体与碰撞解算 | 部分 | 复杂 |
|
|
91
|
+
| 补间动画 | ✅ 任意属性都能补间 | 有(仅位置/缩放等) | 自己写 |
|
|
92
|
+
| 粒子系统 | ✅ 内置 | 无原生 | 自己搭 |
|
|
93
|
+
| 音效模块 | ✅ 内置,还能纯代码发声 | 有 | 有 |
|
|
94
|
+
| 触发区 | ✅ 内置 | 无原生 | 自己写 |
|
|
95
|
+
| 存档读档 | ✅ 一个 json 存全场景 | 无原生 | 自己写 |
|
|
96
|
+
| 公网 UPnP 穿透 | ✅ 自动 | ❌ | ❌ |
|
|
97
|
+
| 局域网自动发现 | ✅ 有 | ❌ | ❌ |
|
|
98
|
+
|
|
99
|
+
## 常用功能速查
|
|
100
|
+
|
|
101
|
+
### 初始化与启动
|
|
102
|
+
```python
|
|
103
|
+
game = init(title="游戏名", window_size=(1280, 720), show_fps=True)
|
|
104
|
+
...
|
|
105
|
+
run()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 三种视角
|
|
109
|
+
```python
|
|
110
|
+
player = FirstPerson() # FPS,WASD 走、空格跳、鼠标转视角
|
|
111
|
+
player = SecondPerson() # 第二人称(反向视角)
|
|
112
|
+
player = ThirdPerson() # 第三人称追尾视角
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 物理(重力、掉落、碰撞)
|
|
116
|
+
```python
|
|
117
|
+
ground = Entity(model='plane', scale=(50, 1, 50), collider='box') # 静态地面
|
|
118
|
+
box = Entity(model='cube', position=(0, 5, 0), collider='box', mass=1) # 会掉下来的箱子
|
|
119
|
+
hit = raycast(player.position, (0, -1, 0), distance=10) # 射线检测,可用来瞄准
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 联机
|
|
123
|
+
```python
|
|
124
|
+
host(public=False, port=5555) # False = 局域网联机;True = 公网联机
|
|
125
|
+
connect("192.168.1.100") # 加入别人的房间
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 补间动画
|
|
129
|
+
```python
|
|
130
|
+
box.animate('position', (5, 2, 0), duration=1.0, curve='ease_in_out')
|
|
131
|
+
box.animate_rotation((0, 360, 0), duration=4, loop=True)
|
|
132
|
+
animate_color(box, color.red, duration=0.5)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 粒子
|
|
136
|
+
```python
|
|
137
|
+
sparks = Particles(texture='particle_spark', num_particles=60, speed=6, gravity=(0, -8, 0))
|
|
138
|
+
sparks.burst(player.position) # 炸一把
|
|
139
|
+
sparks.start(follow=player) # 持续跟随发射
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 音效(不需要素材也能响)
|
|
143
|
+
```python
|
|
144
|
+
jump = Audio('sounds/jump.ogg') # 用音频文件
|
|
145
|
+
jump.play()
|
|
146
|
+
beep(660, 0.12) # 纯代码合成提示音
|
|
147
|
+
bgm = Music('sounds/bgm.ogg', volume=0.4); bgm.play()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 触发区
|
|
151
|
+
```python
|
|
152
|
+
on_enter((0, 1, 10), (4, 4, 4), lambda: print("过关!"))
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 存档 / 读档
|
|
156
|
+
```python
|
|
157
|
+
save("save1.json", data={"score": 120, "level": 3}) # 存下全场景位置+进度数据
|
|
158
|
+
payload = load("save1.json") # 读回来
|
|
159
|
+
print(payload["data"]["score"]) # 120
|
|
160
|
+
|
|
161
|
+
save_slot(1) # 存到第 1 个槽位(saves/1.json)
|
|
162
|
+
load_slot(1) # 读第 1 个槽位
|
|
163
|
+
list_saves() # 看看有哪些存档
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 内置贴图(53 种,比 Ursina 更多)
|
|
167
|
+
|
|
168
|
+
- 自然:`grass` `dirt` `stone` `rock` `cliff` `sand` `snow` `lava` `water` `mud` `gravel` `moss`
|
|
169
|
+
- 建筑:`brick` `concrete` `tile` `marble` `road` `path` `grid`
|
|
170
|
+
- 材质:`wood` `metal` `leather` `fabric` `carpet` `diamond_plate` `cracked_glass`
|
|
171
|
+
- 颜色:`red` `green` `blue` `yellow` `cyan` `magenta` `gray` `white` `black`
|
|
172
|
+
- 天空与渐变:`sky` `clouds` `gradient` `radial_gradient` `clouds`
|
|
173
|
+
- 噪声:`noise` `perlin`
|
|
174
|
+
- UI:`button` `button_hover` `button_pressed` `panel` `border` `circle`
|
|
175
|
+
- 粒子:`particle_circle` `particle_smoke` `particle_spark` `particle_star`
|
|
176
|
+
- 其他:`white_cube` `checkerboard`
|
|
177
|
+
|
|
178
|
+
## 内置模型
|
|
179
|
+
|
|
180
|
+
`cube`、`plane`、`quad`、`cylinder`、`cone`,另外 `load_model()` 可加载外部的 `.egg/.bam/.gltf` 模型。
|
|
181
|
+
|
|
182
|
+
## 许可
|
|
183
|
+
|
|
184
|
+
MIT License
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
Three_dimensional_Games.egg-info/PKG-INFO
|
|
6
|
+
Three_dimensional_Games.egg-info/SOURCES.txt
|
|
7
|
+
Three_dimensional_Games.egg-info/dependency_links.txt
|
|
8
|
+
Three_dimensional_Games.egg-info/requires.txt
|
|
9
|
+
Three_dimensional_Games.egg-info/top_level.txt
|
|
10
|
+
three_dimensional_games/__init__.py
|
|
11
|
+
three_dimensional_games/animation.py
|
|
12
|
+
three_dimensional_games/application.py
|
|
13
|
+
three_dimensional_games/audio.py
|
|
14
|
+
three_dimensional_games/builtin_textures.py
|
|
15
|
+
three_dimensional_games/camera.py
|
|
16
|
+
three_dimensional_games/color.py
|
|
17
|
+
three_dimensional_games/entity.py
|
|
18
|
+
three_dimensional_games/gamepad.py
|
|
19
|
+
three_dimensional_games/input.py
|
|
20
|
+
three_dimensional_games/mesh.py
|
|
21
|
+
three_dimensional_games/models.py
|
|
22
|
+
three_dimensional_games/network.py
|
|
23
|
+
three_dimensional_games/particles.py
|
|
24
|
+
three_dimensional_games/physics.py
|
|
25
|
+
three_dimensional_games/raycaster.py
|
|
26
|
+
three_dimensional_games/saveload.py
|
|
27
|
+
three_dimensional_games/scene.py
|
|
28
|
+
three_dimensional_games/texture.py
|
|
29
|
+
three_dimensional_games/trigger.py
|
|
30
|
+
three_dimensional_games/ui.py
|
|
31
|
+
three_dimensional_games/util.py
|
|
32
|
+
three_dimensional_games/vector.py
|
|
33
|
+
three_dimensional_games/voice.py
|
|
34
|
+
three_dimensional_games/prefabs/__init__.py
|
|
35
|
+
three_dimensional_games/prefabs/first_person.py
|
|
36
|
+
three_dimensional_games/prefabs/second_person.py
|
|
37
|
+
three_dimensional_games/prefabs/sky.py
|
|
38
|
+
three_dimensional_games/prefabs/third_person.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
three_dimensional_games
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "Three-dimensional-Games"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Your Name", email="your.email@example.com" }
|
|
10
|
+
]
|
|
11
|
+
description = "A powerful yet simple 3D game engine for Python - combines Ursina's simplicity with Panda3D's power"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = { file="LICENSE" }
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.8",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Topic :: Games/Entertainment",
|
|
25
|
+
"Topic :: Multimedia :: Graphics :: 3D Rendering",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"panda3d>=1.10.13",
|
|
30
|
+
"Pillow>=9.0.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
voice = [
|
|
35
|
+
"pyaudio>=0.2.13",
|
|
36
|
+
"openai-whisper>=20231117",
|
|
37
|
+
"SpeechRecognition>=3.10.0",
|
|
38
|
+
"pyttsx3>=2.90",
|
|
39
|
+
]
|
|
40
|
+
gamepad = [
|
|
41
|
+
"inputs>=0.5",
|
|
42
|
+
]
|
|
43
|
+
full = [
|
|
44
|
+
"Three-dimensional-Games[voice,gamepad]",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
"Homepage" = "https://github.com/yourusername/Three-dimensional-Games"
|
|
49
|
+
"Bug Tracker" = "https://github.com/yourusername/Three-dimensional-Games/issues"
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.packages.find]
|
|
52
|
+
where = ["."]
|
|
53
|
+
include = ["three_dimensional_games*"]
|