Jump to content
  • Advertisement
  • entries
  • comments
  • views

The layers of the framework for a game

Sign in to follow this  


Getting back into coding after a few weeks leave was a bit rough, but I managed to get the windowing and some basic game state code in place.

My plan is to split the code up into the following layers: Main, App, Systems, and Game State.

The main layer is pretty much just WinMain(). It handles the creation of the app layer and starts the main loop.

The app layer is responsible for the program's instance handle, the main loop, and the message pump. It also handles creation of the systems layer and manages changing the game state.

The systems layer is responsible for setting up and providing access to the various required systems such as audio output, networking, graphics, file I/O, etc. The systems are constants ie. new ones aren't created and old ones aren't removed in between game states. All game states will require a window, rendering, file I/O, and the rest, so these are all setup once and access to them is granted through the systems layer. This also makes changing game states and shutting down easier, since only a single thing needs to be shared or shutdown, rather than many things.

The game state is where all the interesting stuff happens. Resources are loaded, swords and monsters are drawn and animated, damage is dealt, the GUI is drawn and managed, etc. This will likely be broken up even further.

The systems and game state "layers" are actually more like components; one doesn't contain the other. I may decide to use that terminology instead in the future.

[size="1"]Reposted from http://invisiblegdev.blogspot.com/
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!