Rendering Specifications¶
Scope¶
This doc specifies the software to meet the requirements in the Visualization requirements doc.
References¶
Interfaces¶
Interface with Environment Component¶
- Environment produces the Env Snapshot data structure (TBD)
- Renderer reads the Env Snapshot
- Connection between Env and Renderer, either:
- Environment “invokes” the renderer in-process
- Renderer “connects” to the environment
- Eg Env acts as a server, Renderer as a client
- Either
- The Env sends a Snapshot to the renderer and waits for rendering
- Or:
- The Env puts snapshots into a rendering queue
- The renderer blocks / waits on the queue, waiting for a new snapshot to arrive
- If several snapshots are waiting, delete and skip them and just render the most recent
- Delete the snapshot after rendering
- Optionally
- Render every frame / time step
- Or, render frames without blocking environment
- Render frames in separate process / thread
Environment Snapshot¶
Data Structure¶
A definitions of the data structure is to be defined in Core requirements or Interfaces doc.
Example only¶
Top-level dictionary
- World nd-array
- Each element represents available transitions in a cell
- List of agents
- Agent location, orientation, movement (forward / stop / turn?)
- Observation
- Rectangular observation
- Maybe just dimensions - width + height (ie no need for contents)
- Can be highlighted in display as per minigrid
- Tree-based observation
- TBD
- Rectangular observation
Existing Tools / Libraries¶
- Pygame
- Very easy to use. Like dead simple to add sprites etc. Link
- No inbuilt support for threads/processes. Does get faster if using pypy/pysco.
- PyQt
- Somewhat simple, a little more verbose to use the different modules.
- Multi-threaded via QThread! Yay! (Doesn’t block main thread that does the real work), Link
How to structure the code¶
- Define draw functions/classes for each primitive
- Primitives: Agents (Trains), Railroad, Grass, Houses etc.
- Background. Initialize the background before starting the episode.
- Static objects in the scenes, directly draw those primitives once and cache.
Proposed Interfaces¶
To-be-filled