Wednesday, April 29, 2009

Custom Object Overlays

I've been working on adding overlays to the editor lately. Here is the design of the actual overlay that I'll be using

This will appear over objects whenever you hover over them. Any type of information will easily be displayed inside of the overlay. This will allow any object to display detailed information about itself to hopefully make it easier to find objects inside of the scene. The overlay can be toggled on and off in case it's getting in the way. It'll follow the mouse cursor around and will be shifted slightly offset as to not get in the way.

The system should be pretty automatic by allowing an OpenGL style Begin/AddTitle/AddBody/End style so the actual layout algorithm should be hidden from the user. I'll be integrating this into the actual editor over the next few days. I've also spent a bit of time scheduling out a task list for myself which should help out with getting stuff done on a regular basis. I've been really busy at home recently so I haven't done much coding in the past few weeks. That'll be changing.

Monday, April 20, 2009

MVC Patterns

I've gone back and finally implemented a model-view-controller system in my editor. I have had plans on doing this for over a year and some now but I finally got around to doing it. Basically, all of my data and algorithms on said data are stored inside of the 'model' while the 'view' of that data in terms of what the editor wants have been broken apart. The collision data for instance is something that belongs in the view since it's an interpretation of the model and only the editor cares about that. The mesh name that an entity is using belongs in the model since it is an integral part of the data. The graphical data associated with that is handled by the view since different 3D engines might represent that 3D model differently.

What this allows me to do is to work with my entire scene without having to load a 3D engine. This will work out great for tools since they can have the typed data that they want without having all of the graphical parts associated with it. We can attach different views as well for different applications.

The other important thing this allows me to do is unit test my business logic separate from my UI interactions. For example, I can now test that my terrain modeling tools provide the proper deformations or material modifications since the graphics engine doesn't need to be loaded. As I've already built up a small testing suite in NUnit, this works out really well. I can make sure that the only parts to break in the future are the UI components. If a bug is reported that is related to the business algorithms, I can fix it, write a unit test for it, and it'll never make it into the build again.

This has broken a few things that require refactoring but it'll be worth it in the end. Unit testing has proven invaluable for finding bugs in other parts that I believed my current changes couldn't possibly affect.

I'm also working on the actual resource management system again for my editor which should be pretty kick ass. I had a primitive version of what I wanted done a long time ago but I want to spend some more time on it again. It should allow for a pretty nice work flow.

Thanks to someone at work for reminding me that there is at least 1 person out there reading this. It's also nice to just have some place to ramble my thoughts off.