Skip to content

[FEATURE GROUP] Implementing multicore/multiprocessing #9

@cmorman89

Description

@cmorman89

Input, printing/rendering, game logic will likely each benefit from moving to their own threads.

Ideas:

  • Input thread will allow nonblocking interaction
    • Required for responsible gameplay
  • Game logic thread will process game changes
    • Process the rules generating each layer from objects
  • Compositor can merge engine output
    • Merge the layers into a single layer in parallel as they are generated
  • Renderer can be calculating buffers from last composition
    • While printing the last frame, the renderer can be preparing the new frame deltas in parallel
  • Printer can be printing to the terminal
    • Very slow, makes the entire game logic and render calculations wait otherwise

Additional Context

Note: These are untested, and can just as easily degrade performance. Each must be carefully evaluated before widespread use.

+--------------------+    +--------------------+    +--------------------+
|   Input Thread     |    | Game Logic Thread  |    | Compositor Thread  |
| (Non-blocking I/O) |    | (State Updates)    |    | (Layer Merging)    |
+--------------------+    +--------------------+    +--------------------+
           \                       |                        |
            \                      v                        |
             \        +--------------------+                |
              \-----> |   Renderer Thread   | <-------------/
                      | (Buffer Generation) |
                      +--------------------+
                               |
                               v
                      +--------------------+
                      |   Printer Thread   |
                      | (Terminal Output)  |
                      +--------------------+

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions