Game States

In our upcoming release, game states will be in the same folder as main.cpp . We will provide the base for the following states:

  • Game loading
  • Game splash screen
  • Game master
  • Game credits

All of these are optional and we expect most people to just use the Game Master and Game Loading states, we wanted to make these in general use purpose for ourselves and those interested. Our game states are all child classes of "gpe::program_state" You can see our pending header file below:

#ifndef gpe_program_state_h
#define gpe_program_state_h

#include "gpe_common_includes.h"
#include "gpe_render_package_handler.h"

namespace gpe
//Program State base class
class program_state
std::string error_message;
int error_number;
bool error_occurred;
std::string state_name;
//These are used to easily transition from one state to another
std::string state_next_name;
std::string state_previous_name;
virtual ~program_state();
virtual void process_input() = 0;
virtual void apply_logic() = 0;
std::string get_state_name();
std::string get_state_name_next();
std::string get_state_name_previous();
virtual void render() = 0;
virtual void clean_up() = 0;
virtual void end_state() = 0;
virtual bool set_state_name_next( std::string s_name );
virtual bool set_state_name_previous( std::string s_name );
virtual void start_state() = 0;

#endif //gpe_program_state_h 


For those who hate math, please don't leave. 🙂 . In the "gpe/gpe_shapes.h/cpp" files we will support points2d, points3d, lines, triangles, rectangles, polygons.

SDL2 rendered triangles via scanlines

Our collision system currently only will support for circle/rectangle based collisions. We love seeing those crazy Box2D games, but we don't have the time nor imminent need to add that at this moment. We are polishing out the weird unfilled lines, but please note SDL2 wasn't meant for shape rendering on it's own...

Modular renderers, audio & input systems, etc

On the Projects left panel you can see your project structure.

This is how our editor is coded. For your game projects you can choose to add "pawgui", but we have yet to use it outside of the Game Editor.

For starters 1.40 comes with SDL2 methods "out of the box", but the engine can be modded in the main.cpp file to open things like metal, opengl, sfml, vulkan, etc. We have not begun extensive tests to make sure the "render pipeline" is not thrown off, but when we get further along our own game projects we will definitely investigate if more tweaks are needed to achieve full backend modulation.

Finally, build scripts.

For those who have seen our livestreams and on our discord you know our primary IDE is CodeBlocks. When we say build scripts, we mean any files you wish to autogenerate along with your GPE project to communicate to your own C++ IDE/compiler of your choice.

For people coming from scripting based languages or our older HTML5 JS version of Game Pencil, hitting build/run was easy. Now your projects require an IDE to run. There are plenty of free ones out there, so this shouldn't be a big problem. We love CodeBlocks, but there is Visual Code, DevC++, etc. We are doing out best to make as many build scripts as possible for 1.4.0 to ease this process, but if we miss any. We hope we as a community can have em provided in later downloads.

Thanks for your support!

There is more to come, but just wanted to provide a brief glance at all the changes we've made to make 2D C++ game development our way.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.