The main goal of MGF2 is to create a completely platform independent framework which I can call my own. Since I find writing graphics engines fun this framework will mostly be a graphics engine though it will breach into other areas (input, audio, etc) just not as in depth. So far it just runs on Windows, though in the future I'm hoping to port it to Linux and Xbox 360.
I want to make the framework future-proof by making it completely scalable. So that means everything has to be thread-safe, and it should distribute itself across cores automatically (be it 1, 2, or 32 cores) making as much use of each core as it can. Right now the code for doing this is in there, though I haven't stressed tested it yet.
I want the framework to be as flexible as possible. Accessing files will be done through interfaces (so the file may be stored in memory, compressed, or accessed over a network), and it should be possible to provide a custom memory allocator (who knows, maybe it will run on an architecture that requires this).
Just a minor thing that has always annoyed me. Multiple string formats! As far as I know, std::string doesn't provide anything for converting between ASCII/Unicode (which is actually really simple to do, but something I have always wanted it built into an = operator). So I wrote my own string class to overcome this problem:
String8 str = String16("my widestring");
With "String" (minus the size at the end) mapped to the compiler's default character size. Please, if you're writing your own string class, take this into consideration.
There is no fixed-function pipeline, and shaders are written in CG. Right now this ties down the framework to only platforms that support D3D or OpenGL, but it is a reasonable payoff for the flexibility this gives my engine. I personally don't see the framework running on anything that does not support shaders and I haven't planned for it yet, but if I really needed it to be so I could design a failsafe material system.
I use XML a lot aswell. Here is a vertex in my model format (I have an exporter than converts .X/.FBX meshes to .xml):
At first I thought this would make the file huge, but it's smaller compared to an equivilent model in .fbx format. If size does become an issue I could make a binary XML format. All resources are defined in XML (though binary data like textures are still stored in their native file formats, but the definition stating their resource name and file are in XML). You can have as many meshes, textures, sounds, materials stored in a single XML file, and I've designed it to be simple enough for a program to hook in their own resource loader (e.g. to load weapons, vehicles, or a map) from the same XML file.
The framework still is very young, though all the above I have implemented already. What I'm working on now are loading textures. Lighting isn't in yet, neither is any input code. I have a sample project (right now it's Pong, and when Pong is done it'll be Minesweeper) so I have a realworld idea of what the framework requires in order to create a working game (so I don't leave anything out in the early design, and I don't go off into tangents on something unneccesary).
I also have big plans for an online game (it's not very art heavy, nor does it use overly complicated logic, but I have a gut feeling it will be some-what popular) I plan to build with this framework (that is until I'm employeed and don't have time to work on it anymore).
No comments:
Post a Comment