The 2D Game Engine.
In this post I'm going to tell you how I imagined a 2D game engine and what my thoughts until now are.
OK first what do I want to do:
I want an Game Engine that you can use in AHK, that:
- Is Easy to use and understand.
- Is fast.
- Supports both MCode and plainAHK programming.
- And uses Class syntax.
It should be using the WinAPI, GDI/GDI+, OpenGL and OpenAL.
In order to realize this I think we should keep everything in memory and not in AHK Variables.
A Class should be used to communicate between the Memory stuff and AHK.
From now on I will call this "Memory Stuff" Game Struct.
It contains every piece of information that is needed by the engine excepting local variables and the class itself.
When I'm talking of the Game Struct I actually mean a struct pointing to other structs pointing to other structs and pointing to other structs.
So you can differ them in levels (dunno the proper word):
- Game Struct
- World Struct
- Type/Class Struct
- Object Struct
Each level is different than the one above.
The Game Struct contains a pointer to the Functionptrlist, a pointer to the World Struct and a pointer to a list of Type Structs.
The World Struct is mostly defined by the user but it also contains information about the engine.
The Type Struct contains a pointer to the Type Class Struct, and a list of pointers to objects.
The Type Class Struct can be altered by the User. It should contain every Information which all the Object of this type have in common.
Each Object contains the information that is needed to display it on screen, also the user should be able to modify this struct.
E.G. An Object has the Type Bird. Each Object Struct contains Information about the x/y coordinate and the rotation, but it also contains the current HP.
Its Type Class Struct contains its MaxHP.
If you didn't understand everything just ask.
Also here is a picture of what I just said.