From 2e90479a329fe16223c0333092bb18d4275650ca Mon Sep 17 00:00:00 2001 From: Evan Hemsley <2342303+ehemsley@users.noreply.github.com> Date: Tue, 11 Jun 2019 12:25:21 -0700 Subject: [PATCH] add graph for collision system --- content/pong/ball/bouncing/design.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/content/pong/ball/bouncing/design.md b/content/pong/ball/bouncing/design.md index 629b84c..ce7712d 100644 --- a/content/pong/ball/bouncing/design.md +++ b/content/pong/ball/bouncing/design.md @@ -30,7 +30,19 @@ We already have MotionMessages. Let's keep those, but redirect them slightly. We Let's have the MotionEngine consolidate all the MotionMessages per-component, send out an UpdatePositionMessage with that final delta, but then also send out a CollisionCheckMessage for everything that has a BoundingBoxComponent. -Finally, a CollisionDispatchEngine figures out what two kinds of objects collided and emits a Message in response. We can then implement Engines that read each of those kinds of Messages. +Finally, a CollisionDispatchEngine figures out what two kinds of objects collided and emits a Message in response. We can then implement various collision resolution Engines that read each of those kinds of Messages. For example, a BallWallCollisionMessage would be handled by a BallWallCollisionEngine. + +{{}} +graph TD; +Engines(Various Engines) -->|MotionMessage| MotionEngine[MotionEngine] +MotionEngine -->|CollisionCheckMessage| CollisionCheckEngine[CollisionCheckEngine] +CollisionCheckEngine -->|CollisionMessage| CollisionDispatchEngine[CollisionDispatchEngine] +CollisionDispatchEngine -->|BallWallCollisionMessage| BallWallCollisionEngine[BallWallCollisionEngine] +CollisionDispatchEngine -->|BallPaddleCollisionMessage| BallPaddleCollisionEngine[BallPaddleCollisionEngine] +BallWallCollisionEngine -->|UpdatePositionMessage| UpdatePositionEngine +BallPaddleCollisionEngine -->|UpdatePositionMessage| UpdatePositionEngine +MotionEngine -->|UpdatePositionMessage| UpdatePositionEngine +{{< /mermaid >}} Whew! That's a lot! You might be wondering why we're doing all this work just to get some objects reacting to each other.