C++ practice (Simple game engine)

Not about OpenMW? Just about Morrowind in general? Have some random babble? Kindly direct it here.
Locked
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

C++ practice (Simple game engine)

Post by lgromanowski »

Ace (SWE) wrote: I've decided to practice my C++ skills a bit, seeing as I've mostly been working with C# and other similar languages before.

With that goal in mind, I've written a simple 2D/3D game engine. (The GUI is not created by me)
Image

All I need now is something to use the engine for.
My original plan was to create a simple isometric tower defense game, which is why there's a tower in the background.

Any other suggestions?
Star-Demon wrote:
Ace (SWE) wrote:I've decided to practice my C++ skills a bit, seeing as I've mostly been working with C# and other similar languages before.

With that goal in mind, I've written a simple 2D/3D game engine. (The GUI is not created by me)

All I need now is something to use the engine for.
My original plan was to create a simple isometric tower defense game, which is why there's a tower in the background.

Any other suggestions?
What can your engine do? How is it structured?
Ace (SWE) wrote:
Star-Demon wrote:What can your engine do?
It can do 3D rendering with an OpenGL context and it has functions for drawing 2D as textured quads.
Star-Demon wrote:How is it structured?
It's split into separate frames, each of them having functions for handling events, updates and drawing.
In the example image;
There's one frame at the bottom that clears the screen with cornflower blue.
On top of that there's a frame that draws a spinning tower model.
Above that is the UI frame, which also handles mouse and keyboard events.
At the top there is a FPS/UPS (Updates Per Second) frame that stores the amount of updates and draws, updating it's text every second.

I'm going to see if I can get some more general contexts available to the frames, seeing as if you want something more than simple inputs and drawing, sound or networking for example, you'll have to write that into each frame needing it.
Star-Demon wrote: How about all the input handling, state handling, etc?
Ace (SWE) wrote:
Star-Demon wrote:How about all the input handling, state handling, etc?
I went with a simple native handler for input, so I only get basic mouse and keyboard state handling.
My state handler keeps a list of states and updates them in reverse, letting them decide when/if they block the content of an underlying state. The same happens with events, they too are run through it in reverse until one of the frames catches it.
At draw time the frame list is copied to a thread safe list and run through in the correct order after which the final image is displayed to screen.

Bear in mind that I have never before worked with the basics of a game engine, I didn't even know that the system I had created was called states.
Although, all things considered, my version of states isn't quite like the textbook examples.
Locked