gamengine3d 1.20.0__tar.gz → 1.22.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.
Files changed (165) hide show
  1. gamengine3d-1.22.0/PKG-INFO +177 -0
  2. gamengine3d-1.22.0/README.md +156 -0
  3. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/__init__.py +1 -0
  4. gamengine3d-1.22.0/gamengine3d/assets/circular_crosshair.png +0 -0
  5. gamengine3d-1.22.0/gamengine3d/assets/plus_sign_crosshair.png +0 -0
  6. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/context.py +25 -3
  7. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/engine.py +289 -21
  8. gamengine3d-1.22.0/gamengine3d/examples/basics.py +66 -0
  9. gamengine3d-1.22.0/gamengine3d/examples/parkour.py +285 -0
  10. gamengine3d-1.22.0/gamengine3d/examples/player_movement.py +161 -0
  11. gamengine3d-1.22.0/gamengine3d/examples/reactor.py +526 -0
  12. gamengine3d-1.22.0/gamengine3d/examples/scripts/bouncer.py +18 -0
  13. gamengine3d-1.22.0/gamengine3d/examples/scripts/breaker_coil.py +17 -0
  14. gamengine3d-1.22.0/gamengine3d/examples/scripts/breaker_decoder.py +39 -0
  15. gamengine3d-1.22.0/gamengine3d/examples/scripts/breaker_gate.py +23 -0
  16. gamengine3d-1.22.0/gamengine3d/examples/scripts/breaker_shield.py +28 -0
  17. gamengine3d-1.22.0/gamengine3d/examples/scripts/coin.py +12 -0
  18. gamengine3d-1.22.0/gamengine3d/examples/scripts/collector.py +13 -0
  19. gamengine3d-1.22.0/gamengine3d/examples/scripts/confetti.py +27 -0
  20. gamengine3d-1.22.0/gamengine3d/examples/scripts/director.py +213 -0
  21. gamengine3d-1.22.0/gamengine3d/examples/scripts/drone.py +21 -0
  22. gamengine3d-1.22.0/gamengine3d/examples/scripts/horror_atmosphere.py +96 -0
  23. gamengine3d-1.22.0/gamengine3d/examples/scripts/interact.py +45 -0
  24. gamengine3d-1.22.0/gamengine3d/examples/scripts/orbiter.py +25 -0
  25. gamengine3d-1.22.0/gamengine3d/examples/scripts/player_controller.py +165 -0
  26. gamengine3d-1.22.0/gamengine3d/examples/scripts/pulse.py +22 -0
  27. gamengine3d-1.22.0/gamengine3d/examples/scripts/reactor_core.py +29 -0
  28. gamengine3d-1.22.0/gamengine3d/examples/scripts/spin.py +13 -0
  29. gamengine3d-1.22.0/gamengine3d/examples/scripts/sway.py +19 -0
  30. gamengine3d-1.22.0/gamengine3d/examples/scripts/void_guard.py +26 -0
  31. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/game_objects.py +389 -32
  32. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/helper.py +197 -2
  33. gamengine3d-1.22.0/gamengine3d/renderer.py +1294 -0
  34. gamengine3d-1.22.0/gamengine3d/shaders/__init__.py +0 -0
  35. gamengine3d-1.22.0/gamengine3d/shaders/default.frag +142 -0
  36. gamengine3d-1.22.0/gamengine3d/shaders/default.vert +43 -0
  37. gamengine3d-1.22.0/gamengine3d.egg-info/PKG-INFO +177 -0
  38. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d.egg-info/SOURCES.txt +25 -14
  39. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d.egg-info/requires.txt +4 -0
  40. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/pyproject.toml +43 -38
  41. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/setup.cfg +4 -4
  42. gamengine3d-1.20.0/PKG-INFO +0 -82
  43. gamengine3d-1.20.0/README.md +0 -64
  44. gamengine3d-1.20.0/gamengine3d/examples/basics.py +0 -11
  45. gamengine3d-1.20.0/gamengine3d/examples/from_obj.py +0 -14
  46. gamengine3d-1.20.0/gamengine3d/examples/load_scene.py +0 -12
  47. gamengine3d-1.20.0/gamengine3d/examples/messages_demo.py +0 -22
  48. gamengine3d-1.20.0/gamengine3d/examples/objects/icosahedron.obj +0 -271
  49. gamengine3d-1.20.0/gamengine3d/examples/player_movement.py +0 -84
  50. gamengine3d-1.20.0/gamengine3d/examples/save_scene.py +0 -53
  51. gamengine3d-1.20.0/gamengine3d/examples/scripts/cylinder.py +0 -23
  52. gamengine3d-1.20.0/gamengine3d/examples/scripts/message_receiver.py +0 -12
  53. gamengine3d-1.20.0/gamengine3d/examples/scripts/messanger_script.py +0 -10
  54. gamengine3d-1.20.0/gamengine3d/examples/scripts/player_movement.py +0 -97
  55. gamengine3d-1.20.0/gamengine3d/examples/scripts/settings.py +0 -6
  56. gamengine3d-1.20.0/gamengine3d/examples/scripts/solar_system.py +0 -43
  57. gamengine3d-1.20.0/gamengine3d/examples/solar_system.py +0 -11
  58. gamengine3d-1.20.0/gamengine3d/examples/the_everything_demo.py +0 -48
  59. gamengine3d-1.20.0/gamengine3d/renderer.py +0 -590
  60. gamengine3d-1.20.0/gamengine3d/shaders/default.frag +0 -136
  61. gamengine3d-1.20.0/gamengine3d/shaders/default.vert +0 -28
  62. gamengine3d-1.20.0/gamengine3d.egg-info/PKG-INFO +0 -82
  63. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/LICENSE.txt +0 -0
  64. {gamengine3d-1.20.0/gamengine3d/examples → gamengine3d-1.22.0/gamengine3d/assets}/__init__.py +0 -0
  65. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/cli.py +0 -0
  66. {gamengine3d-1.20.0/gamengine3d/examples/objects → gamengine3d-1.22.0/gamengine3d/examples}/__init__.py +0 -0
  67. {gamengine3d-1.20.0/gamengine3d/objects → gamengine3d-1.22.0/gamengine3d/examples/scripts}/__init__.py +0 -0
  68. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/obj_reader.py +0 -0
  69. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/0.obj +0 -0
  70. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/1.obj +0 -0
  71. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/2.obj +0 -0
  72. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/3.obj +0 -0
  73. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/4.obj +0 -0
  74. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/5.obj +0 -0
  75. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/6.obj +0 -0
  76. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/7.obj +0 -0
  77. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/8.obj +0 -0
  78. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/9.obj +0 -0
  79. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/A_capital.obj +0 -0
  80. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/B_capital.obj +0 -0
  81. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/C_capital.obj +0 -0
  82. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/D_capital.obj +0 -0
  83. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/E_capital.obj +0 -0
  84. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/F_capital.obj +0 -0
  85. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/G_capital.obj +0 -0
  86. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/H_capital.obj +0 -0
  87. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/I_capital.obj +0 -0
  88. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/J_capital.obj +0 -0
  89. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/K_capital.obj +0 -0
  90. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/L_capital.obj +0 -0
  91. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/M_capital.obj +0 -0
  92. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/N_capital.obj +0 -0
  93. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/O_capital.obj +0 -0
  94. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/P_capital.obj +0 -0
  95. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/Q_capital.obj +0 -0
  96. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/R_capital.obj +0 -0
  97. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/S_capital.obj +0 -0
  98. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/T_capital.obj +0 -0
  99. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/U_capital.obj +0 -0
  100. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/V_capital.obj +0 -0
  101. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/W_capital.obj +0 -0
  102. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/X_capital.obj +0 -0
  103. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/Y_capital.obj +0 -0
  104. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/Z_capital.obj +0 -0
  105. {gamengine3d-1.20.0/gamengine3d/shaders → gamengine3d-1.22.0/gamengine3d/objects}/__init__.py +0 -0
  106. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/a.obj +0 -0
  107. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/ampersand.obj +0 -0
  108. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/asterisk.obj +0 -0
  109. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/at.obj +0 -0
  110. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/b.obj +0 -0
  111. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/backslash.obj +0 -0
  112. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/brace_close.obj +0 -0
  113. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/brace_open.obj +0 -0
  114. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/bracket_close.obj +0 -0
  115. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/bracket_open.obj +0 -0
  116. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/c.obj +0 -0
  117. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/caret.obj +0 -0
  118. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/colon.obj +0 -0
  119. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/comma.obj +0 -0
  120. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/d.obj +0 -0
  121. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/dash.obj +0 -0
  122. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/dollar.obj +0 -0
  123. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/dot.obj +0 -0
  124. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/doublequote.obj +0 -0
  125. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/e.obj +0 -0
  126. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/equals.obj +0 -0
  127. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/exclamation.obj +0 -0
  128. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/f.obj +0 -0
  129. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/g.obj +0 -0
  130. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/greater.obj +0 -0
  131. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/h.obj +0 -0
  132. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/hash.obj +0 -0
  133. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/i.obj +0 -0
  134. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/j.obj +0 -0
  135. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/k.obj +0 -0
  136. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/l.obj +0 -0
  137. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/less.obj +0 -0
  138. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/m.obj +0 -0
  139. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/n.obj +0 -0
  140. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/o.obj +0 -0
  141. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/p.obj +0 -0
  142. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/paren_close.obj +0 -0
  143. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/paren_open.obj +0 -0
  144. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/percent.obj +0 -0
  145. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/plus.obj +0 -0
  146. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/q.obj +0 -0
  147. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/question.obj +0 -0
  148. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/r.obj +0 -0
  149. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/s.obj +0 -0
  150. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/semicolon.obj +0 -0
  151. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/singlequote.obj +0 -0
  152. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/slash.obj +0 -0
  153. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/t.obj +0 -0
  154. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/u.obj +0 -0
  155. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/underscore.obj +0 -0
  156. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/v.obj +0 -0
  157. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/w.obj +0 -0
  158. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/x.obj +0 -0
  159. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/y.obj +0 -0
  160. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/objects/z.obj +0 -0
  161. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/shaders/depth.frag +0 -0
  162. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d/shaders/depth.vert +0 -0
  163. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d.egg-info/dependency_links.txt +0 -0
  164. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d.egg-info/entry_points.txt +0 -0
  165. {gamengine3d-1.20.0 → gamengine3d-1.22.0}/gamengine3d.egg-info/top_level.txt +0 -0
@@ -0,0 +1,177 @@
1
+ Metadata-Version: 2.4
2
+ Name: gamengine3d
3
+ Version: 1.22.0
4
+ Summary: A Unity-like 3D engine in Python using pygame
5
+ Author-email: Samarth Javagal <samarthjavagal@gmail.com>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Topic :: Games/Entertainment
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE.txt
13
+ Requires-Dist: moderngl==5.12.0
14
+ Requires-Dist: numpy==2.3.3
15
+ Requires-Dist: pygame==2.6.1
16
+ Requires-Dist: pyrr==0.10.3
17
+ Provides-Extra: dev
18
+ Requires-Dist: build==1.6.1; extra == "dev"
19
+ Requires-Dist: twine==7.0.0; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # GamEngine3D
23
+
24
+ **A Unity-style 3D engine for Python.** Build interactive 3D worlds — rooms, puzzles, parkour courses, horror arenas — with clean Python and a few files of behavior scripts.
25
+
26
+ GamEngine3D wraps pygame + moderngl so you get a real OpenGL renderer (lighting, shadows, materials, a free camera) without fighting the graphics stack. You describe the scene; the engine renders it, lights it, and runs your scripts.
27
+
28
+ ```bash
29
+ pip install gamengine3d
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Try it in 10 seconds
35
+
36
+ Every install ships with playable demos. Pick one and press `W A S D` to move, `Space` to jump, `E` to interact, `M` to grab the mouse.
37
+
38
+ ```bash
39
+ gamengine3d demo basics # a quiet lit scene, easy on the eyes
40
+ gamengine3d demo player_movement # a first-person walking sim: coins, sprint, flashlight
41
+ gamengine3d demo parkour # leap floating discs over a bottomless pit — in the dark
42
+ gamengine3d demo reactor # a full mission: restart four breakers to restore the core
43
+ ```
44
+
45
+ Run `gamengine3d demo -h` to list everything. A display is required — demos open a real window.
46
+
47
+ ---
48
+
49
+ ## Your first scene
50
+
51
+ ```python
52
+ from gamengine3d import *
53
+
54
+ # 1. Initialize the engine
55
+ engine = Engine(1200, 800, background_color=Color.light_blue)
56
+
57
+ # 2. Create objects
58
+ floor = Cuboid(size=vector3d(5, 0.1, 5), color=Color.light_grey, name="Floor")
59
+ player = Cuboid(name="Player", color=Color.light_red,
60
+ size=vector3d(0.2), pos=vector3d(0, 1))
61
+
62
+ # 3. Give the scene some light
63
+ engine.add_light(Light(position=vector3d(0, 6, 0), color=Color.white, intensity=1.0))
64
+
65
+ # 4. Add objects to the engine
66
+ engine.add_object(floor)
67
+ engine.add_object(player)
68
+
69
+ # 5. Attach behavior to objects (movement, input, game logic)
70
+ player.attach("player_controller.py", engine.context)
71
+
72
+ # 6. Run it. dynamic_view=True gives you orbit / zoom / pan with the mouse.
73
+ engine.run(dynamic_view=True)
74
+ ```
75
+
76
+ That is the whole engine in six steps:
77
+
78
+ | Step | What it does |
79
+ | --- | --- |
80
+ | `Engine(...)` | Opens the window and the renderer (lights, shadows, camera). |
81
+ | `Cuboid(...)` | Any object — a box, sphere, cylinder, .obj mesh, or text. |
82
+ | `engine.add_light(...)` | Add point, directional, or area lights. |
83
+ | `engine.add_object(...)` | Put an object in the world. |
84
+ | `.attach("script.py", ctx)` | Attach behavior — see Scripting below. |
85
+ | `engine.run(...)` | Start the main loop. |
86
+
87
+ ---
88
+
89
+ ## What can you build? The demos
90
+
91
+ **`reactor`** — the showpiece. An 80-meter reactor hall with a dead core, four breaker stations, and a `director` script orchestrating the whole mission:
92
+ stare down the motion gate, reboot the shock coil, override the shield vault, decode the breach code — then watch the petals peel away and confetti rain.
93
+
94
+ **`parkour`** — a pitch-black arena over a void. Sixteen floating discs snake across the room while lamps stutter, void lights breathe, and a beating eye watches you climb to the summit.
95
+
96
+ **`player_movement`** — the classic first-person room: sprint, jump, collect eight glowing coins, watch the HUD count them, and check out the flashlight (press `F`).
97
+
98
+ **`basics`** — the minimal scene: floor, column, two spheres, warm lighting. The pace-setter for learning the API.
99
+
100
+ All demos are plain Python files in `gamengine3d/examples/` — copy one and start hacking.
101
+
102
+ ---
103
+
104
+ ## Building blocks
105
+
106
+ - **`Engine`** — owns rendering, lights, the main loop, scene save/load, and even raycasting (`pick_forward`, `pick_at_screen`).
107
+ - **Objects** — `Cuboid`, `Sphere`, `Cylinder`, `ObjModel` (load `.obj` files), `Text` (real 3D text, perfect for in-world HUDs), `ImageOverlay` (screen-space sprites).
108
+ - **`vector3d` / `vector2d` / `Color`** — friendly helpers; `Color.RGB(255, 200, 150)`, `Color.hex("#ffc896")`, or constants like `Color.light_blue`.
109
+ - **Lights** — `Light` (point) and `DirectionalLight`, each casting real-time shadows.
110
+
111
+ Every object has `pos`, `size/radius`, `rotation`, `color`, `visible`, and `emit` (glow without lighting) — and can be hidden but still collide.
112
+
113
+ ---
114
+
115
+ ## Scripting: bring it to life
116
+
117
+ Attach a Python file to any object, and the engine instantiates its class and calls `update(dt)` every frame. The class name must match the file (PascalCase): `player_controller.py` defines `PlayerController`.
118
+
119
+ ```python
120
+ # player_controller.py
121
+ from gamengine3d import *
122
+ import math
123
+
124
+ class PlayerController:
125
+ def __init__(self, obj, context):
126
+ self.obj = obj
127
+ self.context = context
128
+ self.speed = 4
129
+ self.context.on_key_held("up", callback=self.move_forward, dt=True)
130
+
131
+ def update(self, dt):
132
+ pass # called every frame
133
+
134
+ def move_forward(self, dt):
135
+ yaw = math.radians(self.obj.rotation.z)
136
+ forward = vector3d(-math.sin(yaw), 0, math.cos(yaw))
137
+ self.obj.pos += forward * self.speed * dt
138
+ ```
139
+
140
+ Scripts get everything through a shared **`Context`**:
141
+
142
+ - `on_key_press("e", fn)`, `on_key_held(...)`, `on_key_released(...)` — input, with optional `dt`.
143
+ - `add_delay(seconds, fn)` — schedule one-shot or repeating calls.
144
+ - `runtime_vars` — a serializable blackboard for cross-script state (e.g. `coil_powered`).
145
+ - `send_message(name, "msg")` → object-to-object messaging between scripts.
146
+
147
+ Attach to an object with `.attach(path, context)`, or to the whole engine with `engine.attach(path)` for scene-wide directors.
148
+
149
+ ---
150
+
151
+ ## Save and load scenes
152
+
153
+ Any scene is a plain JSON file — objects, lights, scripts, and context included.
154
+
155
+ ```python
156
+ engine.save_scene("my_scene.json")
157
+ ```
158
+
159
+ ```bash
160
+ gamengine3d load my_scene.json 1280x800 60 --dynamic-view
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Requirements & development
166
+
167
+ - **Python 3.11+** and a working OpenGL driver.
168
+ - Runtime deps (pinned): `pygame`, `moderngl`, `numpy`, `pyrr`.
169
+ - On hybrid laptops, the engine auto-prefers the discrete GPU; force a choice with `gpu="nvidia" | "intel"` on `Engine(...)` or the `GAMENGINE3D_GPU` env var.
170
+ - For development, use `uv`: `uv sync --extra dev` installs the runtime plus the release toolchain (`build`, `twine`).
171
+
172
+ ---
173
+
174
+ ### Links
175
+
176
+ - Full documentation: [GamEngine3D Package Docs](https://sites.google.com/view/samarthsprojects/python-packages/gamengine3d)
177
+ - The 2D sibling engine, `gamengine2d`, is also on PyPI.
@@ -0,0 +1,156 @@
1
+ # GamEngine3D
2
+
3
+ **A Unity-style 3D engine for Python.** Build interactive 3D worlds — rooms, puzzles, parkour courses, horror arenas — with clean Python and a few files of behavior scripts.
4
+
5
+ GamEngine3D wraps pygame + moderngl so you get a real OpenGL renderer (lighting, shadows, materials, a free camera) without fighting the graphics stack. You describe the scene; the engine renders it, lights it, and runs your scripts.
6
+
7
+ ```bash
8
+ pip install gamengine3d
9
+ ```
10
+
11
+ ---
12
+
13
+ ## Try it in 10 seconds
14
+
15
+ Every install ships with playable demos. Pick one and press `W A S D` to move, `Space` to jump, `E` to interact, `M` to grab the mouse.
16
+
17
+ ```bash
18
+ gamengine3d demo basics # a quiet lit scene, easy on the eyes
19
+ gamengine3d demo player_movement # a first-person walking sim: coins, sprint, flashlight
20
+ gamengine3d demo parkour # leap floating discs over a bottomless pit — in the dark
21
+ gamengine3d demo reactor # a full mission: restart four breakers to restore the core
22
+ ```
23
+
24
+ Run `gamengine3d demo -h` to list everything. A display is required — demos open a real window.
25
+
26
+ ---
27
+
28
+ ## Your first scene
29
+
30
+ ```python
31
+ from gamengine3d import *
32
+
33
+ # 1. Initialize the engine
34
+ engine = Engine(1200, 800, background_color=Color.light_blue)
35
+
36
+ # 2. Create objects
37
+ floor = Cuboid(size=vector3d(5, 0.1, 5), color=Color.light_grey, name="Floor")
38
+ player = Cuboid(name="Player", color=Color.light_red,
39
+ size=vector3d(0.2), pos=vector3d(0, 1))
40
+
41
+ # 3. Give the scene some light
42
+ engine.add_light(Light(position=vector3d(0, 6, 0), color=Color.white, intensity=1.0))
43
+
44
+ # 4. Add objects to the engine
45
+ engine.add_object(floor)
46
+ engine.add_object(player)
47
+
48
+ # 5. Attach behavior to objects (movement, input, game logic)
49
+ player.attach("player_controller.py", engine.context)
50
+
51
+ # 6. Run it. dynamic_view=True gives you orbit / zoom / pan with the mouse.
52
+ engine.run(dynamic_view=True)
53
+ ```
54
+
55
+ That is the whole engine in six steps:
56
+
57
+ | Step | What it does |
58
+ | --- | --- |
59
+ | `Engine(...)` | Opens the window and the renderer (lights, shadows, camera). |
60
+ | `Cuboid(...)` | Any object — a box, sphere, cylinder, .obj mesh, or text. |
61
+ | `engine.add_light(...)` | Add point, directional, or area lights. |
62
+ | `engine.add_object(...)` | Put an object in the world. |
63
+ | `.attach("script.py", ctx)` | Attach behavior — see Scripting below. |
64
+ | `engine.run(...)` | Start the main loop. |
65
+
66
+ ---
67
+
68
+ ## What can you build? The demos
69
+
70
+ **`reactor`** — the showpiece. An 80-meter reactor hall with a dead core, four breaker stations, and a `director` script orchestrating the whole mission:
71
+ stare down the motion gate, reboot the shock coil, override the shield vault, decode the breach code — then watch the petals peel away and confetti rain.
72
+
73
+ **`parkour`** — a pitch-black arena over a void. Sixteen floating discs snake across the room while lamps stutter, void lights breathe, and a beating eye watches you climb to the summit.
74
+
75
+ **`player_movement`** — the classic first-person room: sprint, jump, collect eight glowing coins, watch the HUD count them, and check out the flashlight (press `F`).
76
+
77
+ **`basics`** — the minimal scene: floor, column, two spheres, warm lighting. The pace-setter for learning the API.
78
+
79
+ All demos are plain Python files in `gamengine3d/examples/` — copy one and start hacking.
80
+
81
+ ---
82
+
83
+ ## Building blocks
84
+
85
+ - **`Engine`** — owns rendering, lights, the main loop, scene save/load, and even raycasting (`pick_forward`, `pick_at_screen`).
86
+ - **Objects** — `Cuboid`, `Sphere`, `Cylinder`, `ObjModel` (load `.obj` files), `Text` (real 3D text, perfect for in-world HUDs), `ImageOverlay` (screen-space sprites).
87
+ - **`vector3d` / `vector2d` / `Color`** — friendly helpers; `Color.RGB(255, 200, 150)`, `Color.hex("#ffc896")`, or constants like `Color.light_blue`.
88
+ - **Lights** — `Light` (point) and `DirectionalLight`, each casting real-time shadows.
89
+
90
+ Every object has `pos`, `size/radius`, `rotation`, `color`, `visible`, and `emit` (glow without lighting) — and can be hidden but still collide.
91
+
92
+ ---
93
+
94
+ ## Scripting: bring it to life
95
+
96
+ Attach a Python file to any object, and the engine instantiates its class and calls `update(dt)` every frame. The class name must match the file (PascalCase): `player_controller.py` defines `PlayerController`.
97
+
98
+ ```python
99
+ # player_controller.py
100
+ from gamengine3d import *
101
+ import math
102
+
103
+ class PlayerController:
104
+ def __init__(self, obj, context):
105
+ self.obj = obj
106
+ self.context = context
107
+ self.speed = 4
108
+ self.context.on_key_held("up", callback=self.move_forward, dt=True)
109
+
110
+ def update(self, dt):
111
+ pass # called every frame
112
+
113
+ def move_forward(self, dt):
114
+ yaw = math.radians(self.obj.rotation.z)
115
+ forward = vector3d(-math.sin(yaw), 0, math.cos(yaw))
116
+ self.obj.pos += forward * self.speed * dt
117
+ ```
118
+
119
+ Scripts get everything through a shared **`Context`**:
120
+
121
+ - `on_key_press("e", fn)`, `on_key_held(...)`, `on_key_released(...)` — input, with optional `dt`.
122
+ - `add_delay(seconds, fn)` — schedule one-shot or repeating calls.
123
+ - `runtime_vars` — a serializable blackboard for cross-script state (e.g. `coil_powered`).
124
+ - `send_message(name, "msg")` → object-to-object messaging between scripts.
125
+
126
+ Attach to an object with `.attach(path, context)`, or to the whole engine with `engine.attach(path)` for scene-wide directors.
127
+
128
+ ---
129
+
130
+ ## Save and load scenes
131
+
132
+ Any scene is a plain JSON file — objects, lights, scripts, and context included.
133
+
134
+ ```python
135
+ engine.save_scene("my_scene.json")
136
+ ```
137
+
138
+ ```bash
139
+ gamengine3d load my_scene.json 1280x800 60 --dynamic-view
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Requirements & development
145
+
146
+ - **Python 3.11+** and a working OpenGL driver.
147
+ - Runtime deps (pinned): `pygame`, `moderngl`, `numpy`, `pyrr`.
148
+ - On hybrid laptops, the engine auto-prefers the discrete GPU; force a choice with `gpu="nvidia" | "intel"` on `Engine(...)` or the `GAMENGINE3D_GPU` env var.
149
+ - For development, use `uv`: `uv sync --extra dev` installs the runtime plus the release toolchain (`build`, `twine`).
150
+
151
+ ---
152
+
153
+ ### Links
154
+
155
+ - Full documentation: [GamEngine3D Package Docs](https://sites.google.com/view/samarthsprojects/python-packages/gamengine3d)
156
+ - The 2D sibling engine, `gamengine2d`, is also on PyPI.
@@ -12,6 +12,7 @@ from .game_objects import (
12
12
  from .helper import (
13
13
  Color,
14
14
  vector3d,
15
+ vector2d,
15
16
  Light,
16
17
  DirectionalLight,
17
18
  )
@@ -10,9 +10,10 @@ class Functions:
10
10
  def __init__(self):
11
11
  self.save_scene = lambda filename: None
12
12
  self.load_scene = lambda filename: None
13
- self.draw_cube = lambda pos=vector3d.zero, size=vector3d(3), color=Color.light_blue: None
14
- self.draw_sphere = lambda pos=vector3d.zero, radius=2, color=Color.light_red, segments=32, rings=16: None
15
- self.draw_cylinder = lambda pos=vector3d.zero, length=2, radius=.5, color=Color.light_yellow, segments=32: None
13
+ self.draw_cube = lambda pos=vector3d.zero, size=vector3d(3), color=Color.light_blue, emit=False: None
14
+ self.is_near = lambda name1, name2, radius: None
15
+ self.draw_sphere = lambda pos=vector3d.zero, radius=2, color=Color.light_red, segments=32, rings=16, emit=False: None
16
+ self.draw_cylinder = lambda pos=vector3d.zero, length=2, radius=.5, color=Color.light_yellow, segments=32, emit=False: None
16
17
  self.add_light = lambda light: None
17
18
  self.add_object = lambda obj: None
18
19
  self.is_colliding_pos = lambda name, pos: None
@@ -20,6 +21,8 @@ class Functions:
20
21
  self.get_game_object = lambda name: None
21
22
  self.remove_object = lambda name: None
22
23
  self.remove_light = lambda name: None
24
+ self.load_image = lambda path, key: None
25
+ self.render_image = lambda key, position=vector3d.zero, scale=vector3d.one, rotation=0.0, flip_x=False, flip_y=False: None
23
26
 
24
27
  class Delay:
25
28
  def __init__(self, delay_time, callback):
@@ -197,6 +200,7 @@ class Context:
197
200
  self.game_objects: list[GameObject] = []
198
201
  self.mouse_sensitivity: float = 0.3
199
202
  self.pan_sensitivity: float = 0.005
203
+ self.mouse_look: bool = False
200
204
  self.fps: int | float = 0
201
205
  self.engine = None
202
206
  self.camera: Camera | None = None
@@ -213,12 +217,29 @@ class Context:
213
217
  self.runtime_vars = RuntimeVars()
214
218
  self.exit = False
215
219
  self.current_caller = None
220
+ self.crosshair = None
221
+ self.crosshair_rotation = None
222
+ self.crosshair_scale = None
223
+ self.crosshair_position = None
224
+ self.flip_crosshair_x = None
225
+ self.flip_crosshair_y = None
216
226
 
217
227
  def on_key_press(self, key, callback, args=None, dt=False):
218
228
  if args is None:
219
229
  args = []
220
230
  self.key_callbacks.append(KeyCallback(key, "pressed", callback, args, dt))
221
231
 
232
+ def set_mouse_look(self, enabled=True):
233
+ """Enable or disable FPS-style mouse look.
234
+
235
+ Sets the shared flag (read by the engine each frame) and toggles the
236
+ camera into free-look mode. Any script can call
237
+ ``context.set_mouse_look(True)``.
238
+ """
239
+ self.mouse_look = bool(enabled)
240
+ if self.camera is not None:
241
+ self.camera.set_mouse_look(enabled)
242
+
222
243
  def on_key_held(self, key, callback, args=None, dt=False):
223
244
  if args is None:
224
245
  args = []
@@ -283,6 +304,7 @@ class Context:
283
304
  def clear_caller(self):
284
305
  self.current_caller = None
285
306
 
307
+
286
308
  def send_message(self, target_name, message):
287
309
  target = self.functions.get_game_object(target_name)
288
310
  target.message(message=message, sender=self.current_caller.name)