Thursday, February 2, 2012

First Look

This week I have made good progress on my game engine. Last post I was working on the base of my component system. I have finished that up and made some other minor modifications. So far my game engine has three contexts, graphics, selector, and events. The graphics context takes care of everything drawn to the screen. The events contexts handles messages from the system to entities, and in between entities. The selector context allows me to define regions that are "selectable" to see if the user has click in a specific region.

So far this concept of Context-Component structure is going very well. It gives the flexibility, simplicity, and power that I need. Here is an example of creating an entity:


Entity* entitiy = createEntity("BOX",Transform(Vector2(0,0)) );
entity->attachComponent(new BoxSelector(150, 150));
entity->attachComponent(new SquareShape(150));

This will simply create a box in the middle of the screen 300 pixels wide, that when the user clicks on it, an event will be fired.

In order to test my game engine, I figured that it was time to make an actual game. I less than a day, I was able to make a simple Tic Tac Toe clone, called CircleSquare:


You can download the program here

No comments:

Post a Comment