Advertisement

The requirements and aspects of creating a Game Manager/Screen Manager class file

Started by October 30, 2013 01:23 PM
1 comment, last by Datamancer 11 years, 3 months ago

I made this thread to ask exactly what and how to make a class file for a game that controls all of the different screens and events. I'm still somewhat new to programming and game making so I've been watching a few game making tutorials in C++ but all they do is tell you EXACTLY how to put the code in without exactly teaching you what it does and how it works, that's a problem as I don't want to just make a game by copying someone else's exact code, I'd rather then just get his/her source code for his/her game engine. I wish to learn what all the processes in the code are doing or at least the basics.

I wish to make a 2D Platformer using SFML as my API if that helps at all.

I'm sure pretty soon someone will jump in to tell you how to make your overengineered GameStateManager class that depends on a StateMachine class, but that is all just fluff.

You could simply make a short function to call a different function with its own gameloop to input/update/draw any of the screens, these return some value that tells you which screen is next. Or place a switch statement into the gameloop, save the return value from one of the functions (that are this time just handling a single frame for one of the screens) in a variable and use it next frame.

Advertisement
Hey Sleepy,

From what you describe you are looking for a game state system. A screen manager tends to be something different (depending on who you ask). Anyways, you will usually want a class that represents a game state. This includes routines like update, draw, etc. You will also want a class that manages the states. A common implementation uses a vector of game state objects and has routines for adding, removing, starting game states, etc. You would then inherit from the base game state class and implement the actual states -- play, menu, pause, etc.

Here is an example:
http://gamedevgeek.com/tutorials/managing-game-states-in-c/

@EDIT - Winter is also correct - there are several ways to go about this subject.

Posted from my iPhone 5

"The code you write when you learn a new language is shit.
You either already know that and you are wise, or you don’t realize it for many years and you are an idiot. Either way, your learning code is objectively shit." - L. Spiro

"This is called programming. The art of typing shit into an editor/IDE is not programming, it's basically data entry. The part that makes a programmer a programmer is their problem solving skills." - Serapth

"The 'friend' relationship in c++ is the tightest coupling you can give two objects. Friends can reach out and touch your privates." - frob

This topic is closed to new replies.

Advertisement