tinyecs-compsys-dynamics 0.0.1__tar.gz → 0.0.2__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.
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinyecs-compsys-dynamics
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Dynamics component and system library for tinyecs
5
5
  Author-email: Michael Lamertz <michael.lamertz@gmail.com>
6
6
  License-Expression: MIT
7
- Project-URL: homepage, https://github.com/dickerdackel/tinyecs-compsys/dynamics
8
- Project-URL: bugtracker, https://github.com/DickerDackel/tinyecs-compsys/dynamics/issues
7
+ Project-URL: homepage, https://github.com/dickerdackel/tinyecs-compsys-dynamics
8
+ Project-URL: bugtracker, https://github.com/DickerDackel/tinyecs-compsys-dynamics/issues
9
9
  Classifier: Development Status :: 3 - Alpha
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Games/Entertainment
@@ -13,41 +13,49 @@ Classifier: Topic :: Software Development :: Libraries :: pygame
13
13
  Description-Content-Type: text/x-rst
14
14
  License-File: LICENSE
15
15
  Requires-Dist: aenum
16
- Requires-Dist: pyglm
17
16
  Requires-Dist: pgcooldown
17
+ Requires-Dist: pyglm
18
+ Requires-Dist: tinyecs>=0.5.0
18
19
  Requires-Dist: tinyecs-compsys
20
+ Requires-Dist: tinyecs-compsys-base
19
21
  Dynamic: license-file
20
22
 
21
23
  tinyecs-compsys-dynamics
22
24
  ========================
23
25
 
24
- Thise are some very basic and framework independent components.
26
+ ``tinyecs.compsys.dynamics`` provides systems and components dealing with
27
+ graphic backend independent entity dynamics.
25
28
 
26
29
  Synopsis
27
30
  --------
28
31
 
29
- .. code:: python
32
+ This package relies on registered component IDs from ``tinyecs-compsys-base``.
33
+ It should not be used standalone, but instead be automatically detected and
34
+ registered with the top level ``tinyecs.compsys`` package.
30
35
 
31
- from tinyecs.compsys.dynamics import ...
36
+ .. code:: python
32
37
 
33
- Usage
34
- -----
38
+ import tinyecs.compsys as cs
35
39
 
36
- This package contains platform independent components and systems regarding
37
- entity dynamics.
40
+ cs.register()
38
41
 
39
42
  Installation
40
43
  ------------
41
44
 
42
- Installation instructions + requirements (should come automagically with
43
- pyproject.toml)
45
+ It's up to you, if you install the currently provided `compsys` packages from
46
+ `tinyecs` by using
47
+
48
+ .. code:: console
49
+
50
+ pip install tinyecs[base,dynamics]
51
+
52
+ or include them by adding specific dependencies:
44
53
 
45
54
  .. code:: console
46
55
 
47
- pip install tinyecs[dynamics]
48
- # or
49
56
  pip install tinyecs
50
57
  pip install tinyecs-compsys
58
+ pip install tinyecs-compsys-base
51
59
  pip install tinyecs-compsys-dynamics
52
60
 
53
61
  Support / Contributing
@@ -55,7 +63,7 @@ Support / Contributing
55
63
 
56
64
  Issues can be opened on `github issues`_
57
65
 
58
- .. _github issues: https://forgejo.indieandmore.photography/dickerdackel/tinyecs-compsys/issues
66
+ .. _github issues: https://github.com/dickerdackel/tinyecs-compsys-dynamics/issues
59
67
 
60
68
 
61
69
  License
@@ -0,0 +1,52 @@
1
+ tinyecs-compsys-dynamics
2
+ ========================
3
+
4
+ ``tinyecs.compsys.dynamics`` provides systems and components dealing with
5
+ graphic backend independent entity dynamics.
6
+
7
+ Synopsis
8
+ --------
9
+
10
+ This package relies on registered component IDs from ``tinyecs-compsys-base``.
11
+ It should not be used standalone, but instead be automatically detected and
12
+ registered with the top level ``tinyecs.compsys`` package.
13
+
14
+ .. code:: python
15
+
16
+ import tinyecs.compsys as cs
17
+
18
+ cs.register()
19
+
20
+ Installation
21
+ ------------
22
+
23
+ It's up to you, if you install the currently provided `compsys` packages from
24
+ `tinyecs` by using
25
+
26
+ .. code:: console
27
+
28
+ pip install tinyecs[base,dynamics]
29
+
30
+ or include them by adding specific dependencies:
31
+
32
+ .. code:: console
33
+
34
+ pip install tinyecs
35
+ pip install tinyecs-compsys
36
+ pip install tinyecs-compsys-base
37
+ pip install tinyecs-compsys-dynamics
38
+
39
+ Support / Contributing
40
+ ----------------------
41
+
42
+ Issues can be opened on `github issues`_
43
+
44
+ .. _github issues: https://github.com/dickerdackel/tinyecs-compsys-dynamics/issues
45
+
46
+
47
+ License
48
+ -------
49
+
50
+ This software is provided under the MIT license.
51
+
52
+ See LICENSE file for details.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "tinyecs-compsys-dynamics"
3
3
  description = "Dynamics component and system library for tinyecs"
4
- version = "0.0.1"
4
+ version = "0.0.2"
5
5
  readme = "README.rst"
6
6
 
7
7
  authors = [
@@ -20,14 +20,16 @@ license-files = ["LICENSE"]
20
20
 
21
21
  dependencies = [
22
22
  'aenum',
23
- 'pyglm',
24
23
  'pgcooldown',
24
+ 'pyglm',
25
+ 'tinyecs >= 0.5.0',
25
26
  'tinyecs-compsys',
27
+ 'tinyecs-compsys-base',
26
28
  ]
27
29
 
28
30
  [project.urls]
29
- homepage = "https://github.com/dickerdackel/tinyecs-compsys/dynamics"
30
- bugtracker = "https://github.com/DickerDackel/tinyecs-compsys/dynamics/issues"
31
+ homepage = "https://github.com/dickerdackel/tinyecs-compsys-dynamics"
32
+ bugtracker = "https://github.com/DickerDackel/tinyecs-compsys-dynamics/issues"
31
33
 
32
34
  [build-system]
33
35
  requires = ["setuptools"]
@@ -23,8 +23,8 @@ extend_enum(Comp, 'LERP_POSITION')
23
23
  extend_enum(Comp, 'LERP_SCALE')
24
24
  extend_enum(Comp, 'MOMENTUM')
25
25
  extend_enum(Comp, 'PRSA')
26
- extend_enum(Comp, 'TRACK_PROPNAV')
27
26
  extend_enum(Comp, 'TRACK_DIRECT')
27
+ extend_enum(Comp, 'TRACK_PROPNAV')
28
28
 
29
29
 
30
30
  @dataclass
@@ -96,7 +96,7 @@ class TrackPropNav:
96
96
  """Configuration data for proportional navigation tracking
97
97
 
98
98
  :param target: EntityID of the target to track
99
- :param allowed_angle: The angle the entity can turn between steps
99
+ :param allowed_angle: The turn rate limit in degrees over one second
100
100
  :param splash_radius: Distance at which the target is considered caught
101
101
 
102
102
  """
@@ -124,6 +124,7 @@ def sys_aim_at(eid: EntityID, prsa: PRSA, aim_at: EntityID) -> None:
124
124
 
125
125
  :param eid: The entity ID
126
126
  :param prsa: The PRSA transform object of the entity
127
+ :param aim_at: The target entity this entity is pointing towards
127
128
 
128
129
  """
129
130
 
@@ -136,6 +137,10 @@ def sys_align_momentum(eid: EntityID, prsa: PRSA, momentum: vec2, align_momentum
136
137
  """Align the entity with its own momentum.
137
138
 
138
139
  :param eid: The entity ID
140
+ :param prsa: The PRSA transform object of the entity
141
+ :param momentum: The momentum of the entity
142
+ :param align_momentum: The marker component to align this entity with its momentum
143
+ The existence of this component alone is sufficient, its value is ignored
139
144
 
140
145
  """
141
146
 
@@ -148,6 +153,8 @@ def sys_align_with(eid: EntityID, prsa: PRSA, align_with: EntityID) -> None:
148
153
  """Align rotation with rotation of parent.
149
154
 
150
155
  :param eid: The entity ID
156
+ :param prsa: The PRSA transform object of the entity
157
+ :param align_with: The entity ID with which this entity aligns
151
158
 
152
159
  """
153
160
 
@@ -159,6 +166,9 @@ def sys_anchor(eid: EntityID, prsa: PRSA, anchor: Anchor) -> None:
159
166
  """Position the entity relative to its parent.
160
167
 
161
168
  :param eid: The entity ID
169
+ :param prsa: The PRSA transform object of the entity
170
+ :param anchor: The Anchor component containing the parent entity ID and an
171
+ offset vector
162
172
 
163
173
  """
164
174
 
@@ -172,7 +182,7 @@ def sys_friction(eid: EntityID, momentum: vec2, friction: float, *, dt: float) -
172
182
  """Apply friction to the momentum.
173
183
 
174
184
  :param eid: The entity ID
175
- :param eid: The momentum of the entity
185
+ :param momentum: The momentum of the entity
176
186
  :param friction: The friction to apply
177
187
  :param dt: Deltatime
178
188
 
@@ -187,10 +197,9 @@ def sys_friction(eid: EntityID, momentum: vec2, friction: float, *, dt: float) -
187
197
 
188
198
 
189
199
  def sys_gravity(eid: EntityID, momentum: vec2, gravity: vec2, *, dt: float) -> None:
190
- """Apply gavity to both momentum and position.
200
+ """Apply gravity to momentum.
191
201
 
192
202
  :param eid: The entity ID
193
- :param prsa: The PRSA transform object of the entity
194
203
  :param momentum: The momentum of the entity
195
204
  :param gravity: The world gravity to apply
196
205
  :param dt: Delta time
@@ -205,12 +214,13 @@ def sys_lerp_alpha(eid: EntityID, lerp: LerpThing, prsa: PRSA) -> None:
205
214
 
206
215
  :param eid: The entity ID
207
216
  :param lerp: A `pgcooldown.LerpThing` for the alpha change.
217
+ :param prsa: The PRSA transform object of the entity
208
218
 
209
219
  """
210
220
 
211
221
  prsa.alpha = lerp()
212
222
  if lerp.finished():
213
- ecs.remove_component(Comp.LERP_ALPHA)
223
+ ecs.remove_component(eid, Comp.LERP_ALPHA)
214
224
 
215
225
 
216
226
  def sys_lerp_angle(eid: EntityID, lerp: LerpThing, prsa: PRSA) -> None:
@@ -218,33 +228,35 @@ def sys_lerp_angle(eid: EntityID, lerp: LerpThing, prsa: PRSA) -> None:
218
228
 
219
229
  :param eid: The entity ID
220
230
  :param lerp: A `pgcooldown.LerpThing` for the rotation change.
231
+ :param prsa: The PRSA transform object of the entity
221
232
 
222
233
  """
223
234
 
224
235
  prsa.rotation = lerp()
225
236
  if lerp.finished():
226
- ecs.remove_component(Comp.LERP_ANGLE)
237
+ ecs.remove_component(eid, Comp.LERP_ANGLE)
227
238
 
228
239
 
229
240
  def sys_lerp_momentum(eid: EntityID, lerp: LerpThing, momentum: vec2) -> None:
230
- """Lerp the scale of the entity.
241
+ """Lerp the momentum magnitude of the entity.
231
242
 
232
243
  :param eid: The entity ID
233
244
  :param lerp: A `pgcooldown.LerpThing` for the momentum change.
245
+ :param momentum: The momentum of the entity
234
246
 
235
247
  """
236
248
 
237
249
  momentum.xy = glm.normalize(momentum) * lerp()
238
250
  if lerp.finished():
239
- ecs.remove_component(Comp.LERP_MOMENTUM)
251
+ ecs.remove_component(eid, Comp.LERP_MOMENTUM)
240
252
 
241
253
 
242
- def sys_lerp_position(eid: EntityID, prsa: PRSA, lerp: LerpPosition):
254
+ def sys_lerp_position(eid: EntityID, lerp: LerpPosition, prsa: PRSA):
243
255
  """Update position based on a LerpPosition object.
244
256
 
245
257
  :param eid: The entity ID
246
- :param prsa: The PRSA transform object of the entity
247
258
  :param lerp: The ``LerpPosition`` object tracking the distance
259
+ :param prsa: The PRSA transform object of the entity
248
260
 
249
261
  .. note:: Moving an object with this method conflicts doing it by momentum.
250
262
  """
@@ -260,12 +272,13 @@ def sys_lerp_scale(eid: EntityID, lerp: LerpThing, prsa: PRSA) -> None:
260
272
 
261
273
  :param eid: The entity ID
262
274
  :param lerp: A `pgcooldown.LerpThing` for the scale change.
275
+ :param prsa: The PRSA transform object of the entity
263
276
 
264
277
  """
265
278
 
266
279
  prsa.scale = lerp()
267
280
  if lerp.finished():
268
- ecs.remove_component(Comp.LERP_SCALE)
281
+ ecs.remove_component(eid, Comp.LERP_SCALE)
269
282
 
270
283
 
271
284
  def sys_momentum(eid: EntityID, prsa: PRSA, momentum: vec2, *, dt: float) -> None:
@@ -281,20 +294,20 @@ def sys_momentum(eid: EntityID, prsa: PRSA, momentum: vec2, *, dt: float) -> Non
281
294
  prsa.pos += momentum * dt
282
295
 
283
296
 
284
- def sys_track_direct(eid: EntityID, prsa: PRSA, momentum: vec2, target: TrackDirect) -> None:
297
+ def sys_track_direct(eid: EntityID, prsa: PRSA, momentum: vec2, track: TrackDirect) -> None:
285
298
  """Track another target, make the momentum point directly towards it.
286
299
 
287
300
  :param eid: The entity ID
288
301
  :param prsa: The PRSA transform object of the entity
289
302
  :param momentum: The momentum of the entity
290
- :param target: The entity ID of the target
303
+ :param track: The configuration object for the targeting
291
304
 
292
305
  """
293
306
 
294
- pprsa = ecs.comp_of_eid(target, Comp.PRSA)
307
+ pprsa = ecs.comp_of_eid(track.target, Comp.PRSA)
295
308
  delta = pprsa.pos - prsa.pos
296
309
 
297
- if glm.length(delta) < 32:
310
+ if glm.length(delta) < track.splash_radius:
298
311
  ecs.add_component(eid, Comp.IS_KILLED, True)
299
312
  return
300
313
 
@@ -304,19 +317,19 @@ def sys_track_direct(eid: EntityID, prsa: PRSA, momentum: vec2, target: TrackDir
304
317
  momentum.xy = direction.xy
305
318
 
306
319
 
307
- def sys_track_propnav(eid: EntityID, prsa: PRSA, momentum: vec2, prop_nav: TrackPropNav, *, dt: float):
320
+ def sys_track_propnav(eid: EntityID, prsa: PRSA, momentum: vec2, track: TrackPropNav, *, dt: float):
308
321
  """Make the entity track another entity by proportional navigation.
309
322
 
310
323
  :param eid: The entity ID
311
324
  :param prsa: The PRSA transform object of the entity
312
325
  :param momentum: The momentum of the entity
313
- :param prop_nav: The configuration object for the targetting
326
+ :param track: The configuration object for the targeting
314
327
  :param dt: Delta time
315
328
 
316
329
  """
317
330
 
318
331
  position = prsa.pos
319
- pprsa = ecs.comp_of_eid(prop_nav.target, Comp.PRSA)
332
+ pprsa = ecs.comp_of_eid(track.target, Comp.PRSA)
320
333
  target = pprsa.pos
321
334
 
322
335
  def normalize(phi):
@@ -326,21 +339,21 @@ def sys_track_propnav(eid: EntityID, prsa: PRSA, momentum: vec2, prop_nav: Track
326
339
  angle = _angle_of(los)
327
340
  los_phi = normalize(angle)
328
341
 
329
- if glm.length(los) < 8:
342
+ if glm.length(los) < track.splash_radius:
330
343
  ecs.add_component(eid, Comp.IS_KILLED, True)
331
344
  return
332
345
 
333
- if prop_nav._prev_los is None:
334
- prop_nav._prev_los = los_phi
346
+ if track._prev_los is None:
347
+ track._prev_los = los_phi
335
348
  return
336
349
 
337
- delta_phi = normalize(prop_nav._prev_los - los_phi)
350
+ delta_phi = normalize(track._prev_los - los_phi)
338
351
  if delta_phi == 0:
339
352
  return
340
353
 
341
- prop_nav._prev_los = los_phi
354
+ track._prev_los = los_phi
342
355
 
343
- rotation = min(prop_nav.allowed_angle * dt, abs(delta_phi))
356
+ rotation = min(track.allowed_angle * dt, abs(delta_phi))
344
357
  rad = glm.radians(rotation)
345
358
  new_momentum = glm.rotate(momentum, copysign(rad, delta_phi))
346
359
  momentum.xy = new_momentum.xy
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinyecs-compsys-dynamics
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Dynamics component and system library for tinyecs
5
5
  Author-email: Michael Lamertz <michael.lamertz@gmail.com>
6
6
  License-Expression: MIT
7
- Project-URL: homepage, https://github.com/dickerdackel/tinyecs-compsys/dynamics
8
- Project-URL: bugtracker, https://github.com/DickerDackel/tinyecs-compsys/dynamics/issues
7
+ Project-URL: homepage, https://github.com/dickerdackel/tinyecs-compsys-dynamics
8
+ Project-URL: bugtracker, https://github.com/DickerDackel/tinyecs-compsys-dynamics/issues
9
9
  Classifier: Development Status :: 3 - Alpha
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Games/Entertainment
@@ -13,41 +13,49 @@ Classifier: Topic :: Software Development :: Libraries :: pygame
13
13
  Description-Content-Type: text/x-rst
14
14
  License-File: LICENSE
15
15
  Requires-Dist: aenum
16
- Requires-Dist: pyglm
17
16
  Requires-Dist: pgcooldown
17
+ Requires-Dist: pyglm
18
+ Requires-Dist: tinyecs>=0.5.0
18
19
  Requires-Dist: tinyecs-compsys
20
+ Requires-Dist: tinyecs-compsys-base
19
21
  Dynamic: license-file
20
22
 
21
23
  tinyecs-compsys-dynamics
22
24
  ========================
23
25
 
24
- Thise are some very basic and framework independent components.
26
+ ``tinyecs.compsys.dynamics`` provides systems and components dealing with
27
+ graphic backend independent entity dynamics.
25
28
 
26
29
  Synopsis
27
30
  --------
28
31
 
29
- .. code:: python
32
+ This package relies on registered component IDs from ``tinyecs-compsys-base``.
33
+ It should not be used standalone, but instead be automatically detected and
34
+ registered with the top level ``tinyecs.compsys`` package.
30
35
 
31
- from tinyecs.compsys.dynamics import ...
36
+ .. code:: python
32
37
 
33
- Usage
34
- -----
38
+ import tinyecs.compsys as cs
35
39
 
36
- This package contains platform independent components and systems regarding
37
- entity dynamics.
40
+ cs.register()
38
41
 
39
42
  Installation
40
43
  ------------
41
44
 
42
- Installation instructions + requirements (should come automagically with
43
- pyproject.toml)
45
+ It's up to you, if you install the currently provided `compsys` packages from
46
+ `tinyecs` by using
47
+
48
+ .. code:: console
49
+
50
+ pip install tinyecs[base,dynamics]
51
+
52
+ or include them by adding specific dependencies:
44
53
 
45
54
  .. code:: console
46
55
 
47
- pip install tinyecs[dynamics]
48
- # or
49
56
  pip install tinyecs
50
57
  pip install tinyecs-compsys
58
+ pip install tinyecs-compsys-base
51
59
  pip install tinyecs-compsys-dynamics
52
60
 
53
61
  Support / Contributing
@@ -55,7 +63,7 @@ Support / Contributing
55
63
 
56
64
  Issues can be opened on `github issues`_
57
65
 
58
- .. _github issues: https://forgejo.indieandmore.photography/dickerdackel/tinyecs-compsys/issues
66
+ .. _github issues: https://github.com/dickerdackel/tinyecs-compsys-dynamics/issues
59
67
 
60
68
 
61
69
  License
@@ -7,5 +7,4 @@ src/tinyecs_compsys_dynamics.egg-info/PKG-INFO
7
7
  src/tinyecs_compsys_dynamics.egg-info/SOURCES.txt
8
8
  src/tinyecs_compsys_dynamics.egg-info/dependency_links.txt
9
9
  src/tinyecs_compsys_dynamics.egg-info/requires.txt
10
- src/tinyecs_compsys_dynamics.egg-info/top_level.txt
11
- tests/test_FIXME.py
10
+ src/tinyecs_compsys_dynamics.egg-info/top_level.txt
@@ -1,4 +1,6 @@
1
1
  aenum
2
- pyglm
3
2
  pgcooldown
3
+ pyglm
4
+ tinyecs>=0.5.0
4
5
  tinyecs-compsys
6
+ tinyecs-compsys-base
@@ -1,46 +0,0 @@
1
- tinyecs-compsys-dynamics
2
- ========================
3
-
4
- Thise are some very basic and framework independent components.
5
-
6
- Synopsis
7
- --------
8
-
9
- .. code:: python
10
-
11
- from tinyecs.compsys.dynamics import ...
12
-
13
- Usage
14
- -----
15
-
16
- This package contains platform independent components and systems regarding
17
- entity dynamics.
18
-
19
- Installation
20
- ------------
21
-
22
- Installation instructions + requirements (should come automagically with
23
- pyproject.toml)
24
-
25
- .. code:: console
26
-
27
- pip install tinyecs[dynamics]
28
- # or
29
- pip install tinyecs
30
- pip install tinyecs-compsys
31
- pip install tinyecs-compsys-dynamics
32
-
33
- Support / Contributing
34
- ----------------------
35
-
36
- Issues can be opened on `github issues`_
37
-
38
- .. _github issues: https://forgejo.indieandmore.photography/dickerdackel/tinyecs-compsys/issues
39
-
40
-
41
- License
42
- -------
43
-
44
- This software is provided under the MIT license.
45
-
46
- See LICENSE file for details.
@@ -1,12 +0,0 @@
1
- import pytest
2
-
3
- from contextlib import nullcontext as does_not_raise
4
-
5
-
6
- def test_FIXME():
7
- assert True is True
8
- ...
9
-
10
- with pytest.raises(FIXME_ExpectedException_FIXME) as e: # noqa
11
- FIXME_function_expected_to_raise_exception() # noqa
12
- assert 'FIXME_string_expected_in_exception' in str(e.value)