I’m thinking very hard about integrating the Bullet Collision detection and physics API. This will solve some of the hard problems and create new ones, but it will be a very forward-looking thing to do. I can either make my characters full physics characters (unlikely), or I can re-use the collision detection routines at least. Main reason I want to do this is to have lots of spectacular exploding stuff in the game :-). Physics objects are always fun to interact with, which we know from Half-Life 2 and World of Goo. I think the first milestone and demo will be some simple objects moving around on the screen colliding with each other. This will require a Bullet integration, some basic OpenGL calls, and some internal controllers to have been defined.
I didn’t make this, but it shows what is possible with Bullet.
Edit 2: I think what’s really more evil in writing software is becoming religious and dependent on rules. A well-balanced approach uses the right tool for the job, and static code lends itself to many benefits. I didn’t see before that it is fairly simple to initialize a singleton with a mock implementation, but the whole thing still feels dirty.
The singleton pattern is pure evil. I hope as long as I live I’m not forced to call out to code via a global static reference. Or if I am, I hope to not have to pretend it’ll be modular and reusable, too. Dependency injection is the new hotness.
I want to write a free game engine for C++, OOP, and OpenGL practice and fun. I’ve had some experience in coding in XNA and in a commercial game engine, and I’ve got some ideas about how to do this easily and correctly. So far, I’ve got a few lines of code implementing a scene graph and the beginnings of the GameMaster Singleton that will manage the game. The eventual goal is to get a nice open-source code base for people to build fun and fast games, and I will hopefully implement a game of my own. There is a real lack of fighting games in open-source land, and I think I want to make one that’s better than those terrible mugen hacks. I’m starting with the SFML library, which has some neat features implemented in a nice OOP way. I’ll also need to do some OpenGL coding, and maybe eventually some shaders (optimistic). Also looking at ASSIMP for 3d models handling.
The basic data structure is a scene graph. There’s a general node class that specific node types subclass in order to implement their specific methods. I’m using a lot of virtual functions to let the nodes take care of themselves when possible and give a clean interface to controlling functions. Also, it simplifies things like rotation and transformation. The transformation matrix on a node comes from multiplying all transformation matrices of parents. I can easily propagate the results down the nodes and reuse my results for quick computation. After trying to implement some basic functions, I decided I need an easy way to climb up the scene graph and have nodes notify each other of events. The issue arose when I contemplated node deletion. I’d have to delete it from memory and remove the entry from the parent node’s child list. I’d also have to delete all of its children. I wanted a nice generalized way, so I came up with a simple message passing queue stored in the GameMaster where objects can push a simple struct, which gives all control to something with a top-down view. Now I can have the GameMaster initiate a recursive search for nodes that need to be deleted, and it’ll be clean and easy. I think this idea will give advantages when implementing things like collision detection and networking.
Hopefully I can get some screenshots and videos up, that’s the fun part of this kind of project, but I have to learn OpenGL first 🙂