1. Since my 4e5 game will be slightly fantasy based, and I'm going for a graphical style similar to Warcraft3, I figured I'd just write a loader for Warcraft3 models to use as temp art. So said, so started. Unfortunately, the format is barely documented. I did find one document which describes all the blocks, though not what they are for. Bar a few errors in that, I've been able to load the static base mesh, and am now in progress of loading the bones for the animation (I think). Will post screenies once I've actually added code to convert to my internal model format.
2. Abstracting renderer into DLL. I've always wanted to try this, so I decided to give it a go. My renderer was already quite self-contained because I work for multiple platforms, so it shouldn't be too much of a problem. I got the basic D3D sample off internet, and made it into a DLL. With a little help from Dave with compiling it, it seems to work. It doesn't do much yet, but it does work.
3. Something else I've been thinking a lot about lately is materials and vertex streams. Since my code is meant to work on machines which differ in power greatly, I need to get this right else it'll be a mess in client code. My current idea is to keep models and materials internal to the rendering system (which is modular) since it wouldn't usually be needed outside of that. I'm not going to worry about physics just yet [grin].
4. I've been using RakNet to add some multiplayer to my 4e5 entry. It'll make it easier to test the gamelogic and balancing while there is no AI yet. Connecting works, next step is to actually share the commands.
5. boost::any rocks! I figured I needed something to allow me to pass some arbitrary data into the DLLs for setup routines. I vaguely remembered boost had something, so I did a quick search. It turns out boost::any is exactly what I needed. Observe:
PropertyList:
#include #include #include class PropertyList{public: void Insert( const std::string& name, boost::any value ) { propertyMap_[name] = value; } void Remove( const std::string& name ) { std::map::iterator iter = propertyMap_.find(name); if(iter!=propertyMap_.end()) propertyMap_.erase(iter); } template< class T > bool GetValue( const std::string& name, T& value ) { std::map::const_iterator iter = propertyMap_.find(name); if(iter!=propertyMap_.end()) { try { value = boost::any_cast(iter->second); return true; } catch(const boost::bad_any_cast &) { return false; } } else return false; }private: std::map propertyMap_;};
Usage:
PropertyList myList;myList.Insert("astring", std::string("mytext"));myList.Insert("anint", 5);myList.Insert("afloat", 3.5f);std::string st;int i;float f;double d;bool success = myList.GetValue("astring", st); // returns truesuccess = myList.GetValue("afloat", d); // returns false, and doesn't modify dsuccess = myList.GetValue("anint", i); // returns truesuccess = myList.GetValue("adouble", d); // returns false, and doesn't modify dmyList.Remove("astring");myList.GetValue("astring", st); // returns false, since astring removedmyList.Remove("me"); // no-op since "me" isn't there
It allows you to store any data in the PropertyList and access it extremely easily.