Skip to content

MakeGraphics

Ngô Xuân Phong edited this page Jun 26, 2023 · 3 revisions

1. Overview of the graphics system:

1. Graphics interface:

  • It is a collection of images representing the game.
  • Each image depicts the (state) that the player observes from a personal perspective.
  • It is designed based on the state, meaning it visually represents the parameters of the state for the player to easily track the game's progress.

2. Interaction:

  • At each state, the player receives appropriate (actions) to use.
  • When selecting one of those actions, the graphics interface records it and transitions to the corresponding next state. In this new state, there will be another set of appropriate actions... and so on until the end of the game.

--> All (states) and actions used by the player are stored for later observation when a game ends.


2. Designing the graphics system:

  • Use the available template for the system.
  • Use the PIL library to process images.

1. Create the _render_func.py file and build the functions in the system:

  1. get_state_image function:
  • Input: state ( np.array 1D)
  • Output: Image representing the corresponding state
  1. get_description function:
  • Input: action ( float64)
  • Output: String describing the meaning of that action
  1. get_env_components function:
  • Input: ( None)
  • Output: An env_components object containing all components and information about the environment's state.
  1. get_main_player_state function:
  • Input: env_components, list_agent, list_data, action = None
  • Output: win, state, new_env_components
    • win: Does the player win or not?
    • state: The next state received by the main player
    • new_env_components: contains changes to the environment's components.

How to use the graphics system:

GraphicsGuide


  1. Observing a match played by an Agent:

GraphicsGuide

  1. Playing directly:
  • Set Agent = "human"

image