So I’ve been trying to program my own 2D game engine, generally because I want to get better at maths and this feels like a very practical way of doing it, for example I didn’t understand exactly what a quadratic was, nor how vectors, matrices, normals, dot products, cartesean distances and much more worked in a practical sense. I taught myself to program as a teenager, but never had a very good maths education nor did I go to university, I’m an entirely self taught shop!
So I took an effort at writing a game engine, I’m already familiar with concepts such as the virtual function table, classes, polymorphism, inheritance, callbacks, queues, vectors, FIFO, FILO, threading, thunking, patching, signalling, etc etc, purely through programming my own software, some of which you may see on this blog, when I get around to writing up about it anyway, I get the concept of textures and rendering – where you’re tracing from a camera what the projection can see and painting a sample of the visible texel? as a pixel on the render buffer.
So firstly, how exactly do I represent a scene in a game, I guess I have Objects and those have a relative position to something else, like how I’m relative to my office chair (currently sitting on it) or my car is relative to the garage, or my bedroom is relative to the earth on which it sits.
I really really struggled with separating the render code from the game update step, especially with the rendering pipeline transformations, it seems that matricies essentially act like a transformation pipeline for a vector. I have C_Dude, dude is at 10,10,10 relative to his scene parent C_Room. I traverse the local transformation table backwards and compute the left to right? transformation through a matrix.
it defines a base Node object, and the scene is created with a graph of Node derived objects as parents or children in a tree! Simple!
I have partial opengl render support as I wanted to support the concept of scale, as well as a functioning camera and HUD objects
Check it out at https://github.com/orible/SDLShooterGame