Gray-Time-Kid commited on
Commit
2088b2e
·
verified ·
1 Parent(s): df3dddb

Delete event_driven_system.json

Browse files
Files changed (1) hide show
  1. event_driven_system.json +0 -642
event_driven_system.json DELETED
@@ -1,642 +0,0 @@
1
- {
2
- "eventDrivenSystem": {
3
- "metadata": {
4
- "version": "1.0.0",
5
- "lastModified": "2024-02-02",
6
- "description": "Event-driven architecture for ShooterGTU game",
7
- "author": "FeadHD",
8
- "dependencies": {
9
- "required": [
10
- {
11
- "name": "Phaser",
12
- "version": "3.x",
13
- "purpose": "Game engine and event system foundation"
14
- }
15
- ],
16
- "optional": [
17
- {
18
- "name": "WebFont",
19
- "version": "1.x",
20
- "purpose": "Font loading for UI elements"
21
- }
22
- ]
23
- }
24
- },
25
- "core": {
26
- "ServiceContainer": {
27
- "id": "servicecontainer_01",
28
- "role": "Dependency Injection Container",
29
- "location": "managers/core/ServiceContainer.js",
30
- "extends": null,
31
- "imports": [],
32
- "emits": [],
33
- "listensTo": [],
34
- "features": [
35
- "Centralized service registry",
36
- "Dependency injection support",
37
- "Global singleton pattern"
38
- ],
39
- "methods": {
40
- "register": "Register new services with unique keys",
41
- "get": "Retrieve services by their keys"
42
- },
43
- "dependencies": {
44
- "core": [],
45
- "managers": [],
46
- "runtime": {
47
- "required": [],
48
- "optional": []
49
- },
50
- "assets": {}
51
- },
52
- "notes": [
53
- "Core foundation for dependency injection",
54
- "Enables loose coupling between components",
55
- "Facilitates service location and management"
56
- ],
57
- "usedBy": [
58
- "BaseManager",
59
- "ManagerFactory",
60
- "All manager classes through inheritance"
61
- ],
62
- "creates": [],
63
- "events": {}
64
- },
65
- "BaseManager": {
66
- "id": "basemanager_01",
67
- "role": "Base Manager Class",
68
- "location": "managers/core/BaseManager.js",
69
- "extends": null,
70
- "imports": ["ServiceContainer"],
71
- "emits": [],
72
- "listensTo": [],
73
- "features": [
74
- "Base dependency injection functionality",
75
- "Common manager utilities",
76
- "Scene access methods"
77
- ],
78
- "methods": {
79
- "getScene": "Access current game scene",
80
- "getManager": "Get other manager instances"
81
- },
82
- "dependencies": {
83
- "core": ["ServiceContainer"],
84
- "managers": [],
85
- "runtime": {
86
- "required": ["Phaser.Scene"],
87
- "optional": []
88
- },
89
- "assets": {}
90
- },
91
- "notes": [
92
- "Base class for all managers",
93
- "Provides dependency injection support",
94
- "Manages service access and scene references"
95
- ],
96
- "extendedBy": [
97
- "EventManager",
98
- "UIManager",
99
- "EntityManager",
100
- "GameStateManager",
101
- "HazardManager",
102
- "CollisionManager",
103
- "EnemyManager"
104
- ],
105
- "creates": [],
106
- "events": {},
107
- "usedBy": []
108
- },
109
- "EventManager": {
110
- "id": "eventmanager_01",
111
- "role": "Central Event Bus",
112
- "location": "managers/core/EventManager.js",
113
- "extends": "BaseManager",
114
- "imports": ["BaseManager"],
115
- "emits": [
116
- "SCENE_READY",
117
- "GAME_STATE_INITIALIZED"
118
- ],
119
- "listensTo": [],
120
- "features": [
121
- "Extends BaseManager for dependency injection",
122
- "Provides GameEvents constants",
123
- "Handles event registration and emission",
124
- "Manages event lifecycle and cleanup"
125
- ],
126
- "methods": {
127
- "on": "Register event handler",
128
- "once": "Register one-time event handler",
129
- "emit": "Emit event with data",
130
- "off": "Remove specific event handler",
131
- "removeAllListeners": "Remove all handlers for event",
132
- "destroy": "Clean up all event handlers"
133
- },
134
- "dependencies": {
135
- "core": ["Phaser.Events"],
136
- "managers": [],
137
- "runtime": {
138
- "required": ["Phaser.Events.EventEmitter"],
139
- "optional": []
140
- },
141
- "assets": {}
142
- },
143
- "notes": [
144
- "Core component responsible for all event communication",
145
- "Uses Phaser's event system under the hood",
146
- "Implements cleanup to prevent memory leaks"
147
- ],
148
- "creates": [],
149
- "usedBy": [],
150
- "extendedBy": [],
151
- "events": {
152
- "entityLifecycle": [
153
- "PLAYER_DEATH",
154
- "PLAYER_RESPAWN",
155
- "ENEMY_DEATH",
156
- "ENEMY_SPAWN",
157
- "BOSS_SPAWN",
158
- "BOSS_PHASE_CHANGE"
159
- ],
160
- "gameplayState": [
161
- "SCORE_CHANGE",
162
- "HEALTH_CHANGE",
163
- "CHECKPOINT_REACHED",
164
- "GAME_OVER",
165
- "HAZARD_COLLISION",
166
- "GAME_STATE_INITIALIZED",
167
- "GAME_STATE_CHANGED",
168
- "PLAYER_HP_CHANGED"
169
- ],
170
- "entityEvents": [
171
- "ENEMY_HEALTH_CHANGED",
172
- "ENTITY_ADDED",
173
- "ENTITY_REMOVED"
174
- ],
175
- "itemEvents": [
176
- "ITEM_PICKUP",
177
- "ITEM_USE",
178
- "POWERUP_START",
179
- "POWERUP_END"
180
- ],
181
- "systemEvents": [
182
- "SCENE_READY",
183
- "RESOURCES_LOADED",
184
- "ERROR_OCCURRED"
185
- ]
186
- }
187
- }
188
- },
189
- "hierarchy": {
190
- "sceneLayer": {
191
- "WayneWorld": {
192
- "id": "wayneworld_01",
193
- "role": "Game Level Scene 1",
194
- "location": "scenes/WayneWorld.js",
195
- "extends": "BaseScene",
196
- "imports": ["ManagerFactory"],
197
- "emits": [],
198
- "listensTo": ["SCENE_READY", "GAME_STATE_INITIALIZED"],
199
- "features": [
200
- "Main game level implementation",
201
- "Level-specific logic and events",
202
- "Asset management and scene setup"
203
- ],
204
- "methods": {
205
- "create": "Initialize level and assets",
206
- "update": "Handle game loop logic",
207
- "destroy": "Clean up resources"
208
- },
209
- "dependencies": {
210
- "core": ["Phaser.Scene", "BaseScene"],
211
- "managers": ["EntityManager", "GameStateManager", "UIManager"],
212
- "assets": {
213
- "sprites": ["GtuTileset"],
214
- "backgrounds": ["bg-1", "bg-2", "bg-3", "bg-4", "bg-5", "bg-6", "bg-7", "bg-8", "bg-9"]
215
- },
216
- "runtime": {
217
- "required": [],
218
- "optional": []
219
- }
220
- },
221
- "notes": [
222
- "Main game level implementation",
223
- "Handles level-specific logic and events"
224
- ],
225
- "usedBy": [],
226
- "creates": [],
227
- "events": {},
228
- "extendedBy": []
229
- },
230
- "BaseScene": {
231
- "id": "basescene_01",
232
- "role": "Base Scene Template",
233
- "location": "scenes/BaseScene.js",
234
- "extends": "Phaser.Scene",
235
- "imports": [
236
- "ManagerFactory",
237
- "EventManager"
238
- ],
239
- "emits": [
240
- "SCENE_READY",
241
- "GAME_STATE_INITIALIZED"
242
- ],
243
- "listensTo": [],
244
- "features": [
245
- "Base scene template for all game scenes",
246
- "Provides basic scene functionality"
247
- ],
248
- "methods": {
249
- "create": "Initialize scene and assets",
250
- "update": "Handle game loop logic",
251
- "destroy": "Clean up resources"
252
- },
253
- "dependencies": {
254
- "core": ["Phaser.Scene"],
255
- "managers": ["ManagerFactory", "EventManager"],
256
- "runtime": {
257
- "required": ["Phaser.Game"],
258
- "optional": []
259
- },
260
- "assets": {}
261
- },
262
- "notes": [
263
- "Base scene template for all game scenes",
264
- "Provides basic scene functionality"
265
- ],
266
- "usedBy": [],
267
- "creates": [],
268
- "events": {},
269
- "extendedBy": []
270
- }
271
- },
272
- "managerLayer": {
273
- "ManagerFactory": {
274
- "id": "managerfactory_01",
275
- "role": "Manager Creation and DI Container",
276
- "location": "managers/ManagerFactory.js",
277
- "extends": null,
278
- "imports": ["EventManager"],
279
- "emits": [],
280
- "listensTo": [],
281
- "features": [
282
- "Handles dependency injection",
283
- "Manager lifecycle control",
284
- "Singleton pattern implementation"
285
- ],
286
- "methods": {
287
- "createManager": "Create new manager instance",
288
- "getManager": "Get existing manager instance",
289
- "destroyManager": "Clean up manager instance"
290
- },
291
- "dependencies": {
292
- "core": ["Phaser.Scene"],
293
- "managers": ["EventManager"],
294
- "runtime": {
295
- "required": ["Phaser.Scene", "EventManager"],
296
- "optional": []
297
- },
298
- "assets": {}
299
- },
300
- "notes": [
301
- "Handles dependency injection and manager lifecycle",
302
- "Ensures proper initialization order",
303
- "Maintains singleton instances of managers"
304
- ],
305
- "usedBy": [],
306
- "creates": [
307
- "EventManager",
308
- "UIManager",
309
- "Player",
310
- "EntityManager",
311
- "GameStateManager",
312
- "HazardManager",
313
- "CollisionManager",
314
- "EnemyManager"
315
- ],
316
- "events": {}
317
- }
318
- },
319
- "componentLayer": {
320
- "emitters": {
321
- "Player": {
322
- "id": "player_01",
323
- "role": "Player Entity Controller",
324
- "location": "components/Player.js",
325
- "extends": "Phaser.GameObjects.Sprite",
326
- "imports": ["EventManager"],
327
- "emits": [
328
- "PLAYER_DEATH",
329
- "HEALTH_CHANGE",
330
- "PLAYER_HP_CHANGED"
331
- ],
332
- "listensTo": ["HAZARD_COLLISION"],
333
- "features": [
334
- "Handles player input and state",
335
- "Manages player animations and physics",
336
- "Emits events for player state changes"
337
- ],
338
- "methods": {
339
- "update": "Handle player movement and animation",
340
- "destroy": "Clean up player resources"
341
- },
342
- "dependencies": {
343
- "core": ["Phaser.GameObjects.Sprite", "Phaser.Input"],
344
- "managers": ["EventManager"],
345
- "runtime": {
346
- "required": ["Phaser.Physics", "EventManager"],
347
- "optional": ["ProceduralSoundGenerator"]
348
- },
349
- "assets": {
350
- "sprites": {
351
- "player": {
352
- "dimensions": "48x48",
353
- "animations": [
354
- {"name": "idle", "frames": 4},
355
- {"name": "walk", "frames": 6},
356
- {"name": "jump", "frames": 1},
357
- {"name": "death", "frames": 8},
358
- {"name": "fall", "frames": 1},
359
- {"name": "roll", "frames": 3}
360
- ]
361
- }
362
- },
363
- "audio": ["hit.wav"]
364
- }
365
- },
366
- "notes": [
367
- "Handles player input and state",
368
- "Manages player animations and physics",
369
- "Emits events for player state changes"
370
- ],
371
- "usedBy": [],
372
- "creates": [],
373
- "events": {}
374
- },
375
- "EntityManager": {
376
- "id": "entitymanager_01",
377
- "role": "Entity Lifecycle Manager",
378
- "location": "managers/EntityManager.js",
379
- "extends": "BaseManager",
380
- "imports": ["EventManager"],
381
- "emits": [
382
- "ENTITY_ADDED",
383
- "ENTITY_REMOVED"
384
- ],
385
- "listensTo": ["ENEMY_DEATH", "PLAYER_DEATH"],
386
- "features": [
387
- "Manages entity lifecycle and state",
388
- "Handles entity creation and removal",
389
- "Emits events for entity state changes"
390
- ],
391
- "methods": {
392
- "addEntity": "Add new entity to the game",
393
- "removeEntity": "Remove entity from the game",
394
- "update": "Handle entity updates"
395
- },
396
- "dependencies": {
397
- "core": ["BaseManager"],
398
- "managers": ["EventManager"],
399
- "components": ["Player", "Enemy"],
400
- "runtime": {
401
- "required": ["Phaser.GameObjects.Group"],
402
- "optional": []
403
- },
404
- "assets": {}
405
- },
406
- "notes": [
407
- "Manages entity lifecycle and state",
408
- "Handles entity creation and removal",
409
- "Emits events for entity state changes"
410
- ],
411
- "usedBy": [],
412
- "creates": [],
413
- "events": {}
414
- },
415
- "GameStateManager": {
416
- "id": "gamestatemanager_01",
417
- "role": "Game State Controller",
418
- "location": "managers/GameStateManager.js",
419
- "extends": "BaseManager",
420
- "imports": ["EventManager"],
421
- "emits": [
422
- "GAME_STATE_CHANGED",
423
- "GAME_STATE_INITIALIZED"
424
- ],
425
- "listensTo": ["PLAYER_DEATH", "BOSS_SPAWN"],
426
- "features": [
427
- "Manages game state and transitions",
428
- "Handles game state initialization",
429
- "Emits events for game state changes"
430
- ],
431
- "methods": {
432
- "initialize": "Initialize game state",
433
- "update": "Handle game state updates",
434
- "destroy": "Clean up game state resources"
435
- },
436
- "dependencies": {
437
- "core": ["BaseManager"],
438
- "managers": ["EventManager", "UIManager"],
439
- "runtime": {
440
- "required": [],
441
- "optional": []
442
- },
443
- "assets": {}
444
- },
445
- "notes": [
446
- "Manages game state and transitions",
447
- "Handles game state initialization",
448
- "Emits events for game state changes"
449
- ],
450
- "usedBy": [],
451
- "creates": [],
452
- "events": {}
453
- },
454
- "HazardManager": {
455
- "id": "hazardmanager_01",
456
- "role": "Hazard Controller",
457
- "location": "managers/HazardManager.js",
458
- "extends": "BaseManager",
459
- "imports": ["EventManager"],
460
- "emits": [
461
- "HAZARD_COLLISION"
462
- ],
463
- "listensTo": [],
464
- "features": [
465
- "Manages hazard creation and removal",
466
- "Handles hazard collision detection",
467
- "Emits events for hazard collisions"
468
- ],
469
- "methods": {
470
- "addHazard": "Add new hazard to the game",
471
- "removeHazard": "Remove hazard from the game",
472
- "update": "Handle hazard updates"
473
- },
474
- "dependencies": {
475
- "core": ["BaseManager", "Phaser.Physics"],
476
- "managers": ["EventManager", "CollisionManager"],
477
- "runtime": {
478
- "required": ["Phaser.Physics.Arcade"],
479
- "optional": []
480
- },
481
- "assets": {}
482
- },
483
- "notes": [
484
- "Manages hazard creation and removal",
485
- "Handles hazard collision detection",
486
- "Emits events for hazard collisions"
487
- ],
488
- "usedBy": [],
489
- "creates": [],
490
- "events": {}
491
- },
492
- "EnemyManager": {
493
- "id": "enemymanager_01",
494
- "role": "Enemy Controller",
495
- "location": "managers/EnemyManager.js",
496
- "extends": "BaseManager",
497
- "imports": ["EventManager"],
498
- "emits": [
499
- "ENEMY_DEATH",
500
- "ENEMY_SPAWN",
501
- "ENEMY_HEALTH_CHANGED"
502
- ],
503
- "listensTo": ["PLAYER_DEATH", "GAME_STATE_CHANGED"],
504
- "features": [
505
- "Manages enemy creation and removal",
506
- "Handles enemy AI and behavior",
507
- "Emits events for enemy state changes"
508
- ],
509
- "methods": {
510
- "addEnemy": "Add new enemy to the game",
511
- "removeEnemy": "Remove enemy from the game",
512
- "update": "Handle enemy updates"
513
- },
514
- "dependencies": {
515
- "core": ["BaseManager", "Phaser.Physics"],
516
- "managers": ["EventManager", "CollisionManager"],
517
- "assets": {
518
- "sprites": {
519
- "enemy": {
520
- "dimensions": "48x48",
521
- "animations": ["idle", "attack", "death"]
522
- }
523
- }
524
- },
525
- "runtime": {
526
- "required": ["Phaser.Physics.Arcade"],
527
- "optional": []
528
- }
529
- },
530
- "notes": [
531
- "Manages enemy creation and removal",
532
- "Handles enemy AI and behavior",
533
- "Emits events for enemy state changes"
534
- ],
535
- "usedBy": [],
536
- "creates": [],
537
- "events": {}
538
- },
539
- "CollisionManager": {
540
- "id": "collisionmanager_01",
541
- "role": "Collision Handler",
542
- "location": "managers/CollisionManager.js",
543
- "extends": "BaseManager",
544
- "imports": ["EventManager"],
545
- "emits": [
546
- "HAZARD_COLLISION"
547
- ],
548
- "listensTo": ["ENTITY_ADDED", "ENTITY_REMOVED"],
549
- "features": [
550
- "Handles collision detection and response",
551
- "Manages collision groups and masks",
552
- "Emits events for collisions"
553
- ],
554
- "methods": {
555
- "checkCollisions": "Check for collisions between entities",
556
- "handleCollision": "Handle collision response",
557
- "update": "Handle collision updates"
558
- },
559
- "dependencies": {
560
- "core": ["BaseManager", "Phaser.Physics"],
561
- "managers": ["EventManager", "EntityManager"],
562
- "runtime": {
563
- "required": ["Phaser.Physics.Arcade"],
564
- "optional": []
565
- },
566
- "assets": {}
567
- },
568
- "notes": [
569
- "Handles collision detection and response",
570
- "Manages collision groups and masks",
571
- "Emits events for collisions"
572
- ],
573
- "usedBy": [],
574
- "creates": [],
575
- "events": {}
576
- }
577
- },
578
- "listeners": {
579
- "UIManager": {
580
- "id": "uimanager_01",
581
- "role": "UI State Manager",
582
- "location": "managers/UIManager.js",
583
- "extends": "BaseManager",
584
- "imports": ["EventManager"],
585
- "emits": [],
586
- "listensTo": [
587
- "HEALTH_CHANGE",
588
- "SCORE_CHANGE",
589
- "GAME_STATE_CHANGED",
590
- "PLAYER_HP_CHANGED"
591
- ],
592
- "features": [
593
- "Manages UI state and updates",
594
- "Handles UI events and input",
595
- "Listens to game state changes"
596
- ],
597
- "methods": {
598
- "updateUI": "Update UI state",
599
- "handleInput": "Handle UI input",
600
- "destroy": "Clean up UI resources"
601
- },
602
- "dependencies": {
603
- "core": ["BaseManager"],
604
- "managers": ["EventManager"],
605
- "assets": {
606
- "fonts": ["Gameplay.ttf", "Retronoid"],
607
- "audio": ["confirmation.mp3"]
608
- },
609
- "runtime": {
610
- "required": ["WebFont"],
611
- "optional": []
612
- }
613
- },
614
- "notes": [
615
- "Manages UI state and updates",
616
- "Handles UI events and input",
617
- "Listens to game state changes"
618
- ],
619
- "usedBy": [],
620
- "creates": [],
621
- "events": {}
622
- }
623
- }
624
- }
625
- },
626
- "systemNotes": [
627
- "Event-driven architecture ensures loose coupling between components",
628
- "Managers use dependency injection for better testability",
629
- "Event system supports both sync and async event handling",
630
- "Components can be both emitters and listeners",
631
- "Event naming follows consistent convention: CATEGORY_ACTION",
632
- "All events are documented in GameEvents constant"
633
- ],
634
- "bestPractices": [
635
- "Always use GameEvents constants instead of string literals",
636
- "Clean up event listeners in destroy() methods",
637
- "Avoid circular event dependencies",
638
- "Document all new events in GameEvents",
639
- "Use typed event payloads for better maintainability"
640
- ]
641
- }
642
- }