Subscribe via Email

Sunday, April 17, 2016

morris_AIMA [#2]: We've Got Graphics

I've spent the last while working on the Visualizer side of the project in which will aid in displaying a given environment state.
The Visualizer is not meant to be supportive for heavy interaction, but rather some semi-complex container that will show a specific environment state in all it's glory. Starting off with TileEnvironment support, we've got a basic prototype of the visualizer system: 

Here is a 5x5 grid display, with some optional debug information at the top left. The dimensions are easily customizable as seen here: 
10x10 Tilegrid
A larger grid will keep the same 1000x1000 pixel display but just adjust all tiles to be of relative size. Also notice the "NULL ENTITY" labels. This is the beginning of an Actor/Agent system to display the entities that may exist in an environment. The NULL entity is the default/last resort generated if you try to display some nonexistent object or add an abstract VisualEntity object to the scene.

2x1 Tilegrid
More importantly the grid is adjustable for uneven dimensions.

QT Graphics Support

I initially attempted to use purely Opengl to create graphics; but encountered issues with supported OOP principles and avoiding some ugly hacks with C. Thus QT was found. I've used the QTGraphics library involving the Scene/View/Widget system for dynamically updating a scene and then rendering it in the view. 
Read more about QTGraphics HERE

This framework allows me to map coordinates relative to parent objects, meaning a visualizer of 1000x1000 pixels could be a 10x10 grid, meaning each tile is 100x100. Now things get complicated however, as it may become a pain to draw within each tile precisely, so now each tile has it's own relative coordinate system. When an Entity is drawn in tile (X,Y) then the coordinates (0,0) will place our Entity in the top left corner of tile (X,Y), and the tile (X,Y) has some coordinates relative to the 1000x1000 window. 


  1. Graphic display support implemented with a TileGrid and QT library support
  2. Hierarchy of VisualEntity items that will be displayable in grid.
  3. Basic simulation module implementation for handling cycle timing

Plans & Goals

  1. Support for multiple types of objects to be rendered in environment easily, some sort of factory support.
  2. Ability to generate visualizer state from a JSON string generated via the Environment module. This will allow for me to then focus on the AI logic in the Environment, knowing that through an adapter I can communicate with the Visualizer and display the environment state nicely. 
  3. Update git repository with documentation cycle phase/design how a cycle will progress and design it in a non-disgusting way. 
I'm somehow making time to work on this, squeezing any brief moment of breathing room into designing this project (ie my showers now take a solid 40 minutes...). As other posts will indicate, I'm going to be quite busy with the Taiwan trip coming up; but I'll make it work! 

No comments:

Post a Comment

Please feel free to give feedback/criticism, or other suggestions! (be gentle)

Subscribe to Updates via Email