Saturday, June 27, 2015

Graphics and Events

The graphics engine is underway. There's three pieces to it. First is the graphics component that does the actual rendering, scene management and all the fancy stuff you heard about. Then there is the game-side of the engine where events are generated and processed before being sent off to the actual renderer. The third is the UI. This part sits separate from the game and rendering portions so that user input can be taken in at any time and then processed by the game (to take in commands) and to the rendering (to update the what the user sees).

Currently, the game engine is built to produce events from a unit moving to a tree being chopped down. That's sent off to the test-engine for now, until the rendering engine is built, and then you get to see some magical updates. People carrying rocks, balls of water, shiny rocks, heavy rocks, dark rocks and other stuff. It's the stone age, expect lots of rocks.

With the use of events, I can then move all the graphics code into one spot, the graphics component of the game engine and thus put it into a single class. This makes it easy when I want to switch to the real graphics engine and also centralizes the graphics code. Everyone else is just producing messages to be consumed by whatever component does the listening. It also allows multiplexing!

Here's a sample of the current generated world, all random whenever you start a new game, with graphic entities built via events!

No comments:

Post a Comment