WOW, ok so I began coding today by refactoring some of the base classes a bit again. Then I moved onto beginning the implementation of the ResourceMangerService ( Which is a Framework Service ).
I got the basics down and turned to drawing up the specifics of what was needed for the base implementation ( There is A LOT for this one. ) One of the things I came to was the fact I would need a new look up table inside this service for various reasons. And that was the rub. My current look up table inside the Element Manager Service is implemented with a vector class. I knew I would have to refactor this to use a hash table at some point and now that I was in need of another look up table it made sense to come up with a permanent solution rather then rewriting tons of search functions when the table implementation changed later.
A quick Google search revealed that neither STD or STL contained a hash table implementation. Not really upset by this I set out to create my own templated HashTable class. So ya… It turns out while the concept of template classes is pretty simple, there are A LOT of implementation quarks with them.
I finished the initial code of the HashTable class and the HashTableChainNode class in under an hour, debugging took probably 30 minutes or so. ( I’m getting real good with an obscene amount of pointer usage 😉 ) Then the instantiation and linking errors reared their ugly heads… and 6 hours later I sit before you a nearly broken man.
Yet a broken man with a working Hash Table implemented into his new Framework .
In other news, a few days ago I completed the first version of the Event struct and now have a keyboard triggered event poking a User object and that object responding to the event. Which is a pretty big step forward seeing as how this is an Event driven Framework.
So ya, the Framework is pretty much back where it started before I started coding today ( just with a nearly O( 1 ) look up implementation 😉 ) which is always kind of demoralizing after so much coding. But handle look ups are the name of the game here. So the backbone of the Framework has been greatly strengthened.
And I now know C++ class templating pretty well.
Next: The ResourceManagerService ( and graphics! )
I put in a good 6 hours today and got an ok amount accomplished. There was a good bit of refactoring and additions to the code base I worked on last time. But today’s focus was on user input.
I created the Mode Service Framework Service. In traditional event based frameworks this would be called the dispatcher. It takes input and generates and dispatches events to where they are supposed to go.
It is now to the point where I can receive keyboard input and perform an action specified by a class that inherits from the Mode base class. The big things that the Mode Service does is controls a stack of Modes. The idea is there are different situations that will require input to be handled differently.
So if say the program starts up with a GUI to select a file to load, mouse clicks will be dispatched to GUI components. Then once a 3D file is selected a new Mode will be pushed onto the stack. Now mouse input is used to rotate or move the 3D world.
The next step with this is designing the actual messages. I need to figure out exactly what is required for a versatile message struct which will be what is passed around inside the framework. Then my now working Mode Service can generate a message and dispatch it to an Element.
As you might imagine the design of the message / event struct is absolutely mission critical so I am taking some time to design it.
After that is all set up I will be moving onto the Resource Manger service and my Scene Graph!
Well the first day of Fall is here and production on Black Engines new Framework has begun in earnest. I spent 5 hours last night working on the Class hierarchy set up. The Framework now Initializes Framework Services.
As a test of the base Element class type ( EVERYTHING inside the Framework inherits from Element ). I created a User Entity ( The hierarchy goes: Element -> Entity -> User )
and then used the ElementLookUpService ( Which is a Framework Service, and which will probably be renamed to the ElementManagerService soon. ) to find the User Entity instance and report information from it.
This is a very critical step because this is pretty much the back bone of the entire framework, Object lookups that is. Right now the storage of the look up information is stored in a vector, obviously horribly inefficient. But I plan on designing and implementing a hash table for storage which should drastically decrease search times.
The next step is one of two things. I need an initial content loader, but that requires two services plus the beginnings of my scene graph implementation, so that will probably come later. The second is the SimulationModeService ( Which is a Framework Service ) which will handle input dispatch.
So hopefully I can cram some time into the next few days. My goal is to be back to where the engine is in v.5 by the end of October. We’ll see how that goes…