Sunday, 26 October 2008

PsybrusEd Progress...

A few more days go by, a few more lines of code are written. I've mostly spent the week focusing on getting actions working correctly in the editor. As much as I wanted to put these into Python, theres still issues to resolve with the global interpreter lock so the actions may be updated from the engine's thread. This could probably be done by ticking the engine over when input events happen, rather than run it totally on a seperate thread, but that I'll wait for now.

Since the actions went in, so did undo and redo. Actually simpler than I first expected to implement! Just store an action history list, give them virtual undo/redo, and call these when an undo or redo is invoked! I'm going down the route of cloning objects when an action is performed on them, that way we can get back the exact object that we just modified, rather than transforming it back or whatever, potentially having errors creep in later on. Another advantage of doing this is the fact I can get away with writing one lump of code for undo and redo, and it work on any object:

   79 BcBool ActCsgBase::undo()

   80 {

   81     // Remove all added objects, and readd all removed ones again.

   82     ObjPtrList::iterator Iter;


   84     Iter = AddedObjects_.begin();

   85     while( Iter != AddedObjects_.end() )

   86     {

   87         ObjManagerState::pInstance()->removeObject( (*Iter) );

   88         ++Iter;

   89     }


   91     Iter = RemovedObjects_.begin();

   92     while( Iter != RemovedObjects_.end() )

   93     {

   94         ObjManagerState::pInstance()->addObject( (*Iter) );

   95         ++Iter;

   96     }

   97     return BcTrue;

   98 }

Save/load had also been 'sort of' implemented. This will be due an overhaul to use XML soon, rather than serialising the binary data of every object. Currently this is fine for me for quickly testing without rebuilding scenes to check out something! Probably going to be going down the LibXML route, rather than write my own library on this one, however one of my major concerns is file sizes will get pretty large, especially if I plan to save out undos and redos to preserve the users workspace.

Next task for me, sadly, is starting to do more of the GUI stuff, and tidying up the CSG operations so the world is stored as one object containing all the convex shapes, and operations as objects so they can be modified on the fly. Should have possibly done this from the beginning, but I wanted to get something quickly up and running to test out the CSG library to the full!

Anyways, a screenshot of it in its current state showing off 3 new lovely orthographic viewports:

Tuesday, 21 October 2008

CSG Ahoy!

The last attempt I had at writing a CSG library began to bore me a bit, so thats the main reason I put off PsybrusEd, besides my port to DirectX.

CSG has always been something I've glanced at thinking "Too... much... maths...", so I've always ran away screaming if I ever had to begin to touch on it in code. Tim, a friend of mine used to boggle my mind talking about B-Reps and CSG quite a bit, and various other brain melting topics along the lines of collision detection. Ah that old friend, collision detection, I wish I strangled you underwater and left you in that watery grave - you wouldn't have snuck back up on me again on a night of bordom! Was a nice thing that the only weapons required to defend myself were a nice vector class, a plane class, and a few more years experience in maths and programming.

Tonight, I decided to pick up my old CSG library - its a touch slow due to the abuse of STL internally to save on memory management, and exceptions all over the place - but luckily, it was commented well enough to read through and understand even given that its been a good few months since I started it. Anyways, the point I gave up on - intersect was flaky, and there was no subtract. A couple of hours later - success! I finally for both working, and began to tie it into PsybrusEd, as well as write editor states to keep everything tidy. Anyways, a few small shots of the editor in action, starting to take shape. First 3 images are in sequence, the final one is just a large area with multiple subtractions from it.

Sunday, 19 October 2008

Hello, and week of 'solitude' is over.

First of all, just like to say hey, cheers for reading, and welcome to my blog! Decided to set one up to keep track of my work, projects, and share things with the world.

The week of solitude, an idea gone wrong, but also to its purpose. After a stressful run at work, I decided to get myself away for a week - away from my house, friends, and work. Just something to give me some time to work on my own things, and see the family.

The week started out great - cracked open Notepad++, and st
arted work on the editor for my game engine, Psybrus. Oddly, the editor is called PsybrusEd. Got to work on getting my game data packer into a Python module for use by tools, and very swiftly put together a simple GUI interface using wxPython and wxFormBuilder.

And to the left is my bare basic Game Data popup, solely for building game data. Current implementation recurses the GameData folder to search for resources. This was originally done by the packer itself, however it's now been moved over to Python, and everything is in place ready to start on the SQLite implementation, rather than relying on SVN.

Once this was all done, Tuesday arrived. I decided that because of how poor my build times on a project I'm working on, I implemented versioning on resources, as well as caching them to a temp folder (C:\tmp at the moment) when build, so they can be reused if they have not changed. Currently using the resources time stamp for their version, however this is something that will change at a later date.

Tuesday began to get boring at this point, so I headed off for lunch with Tim and Martin, a couple of friends who work for a local games company. Just an excuse to get out of the bedroom and get a bit of exercise.

With Tuesday eventually out of the way, Wednesday came. I started to revive my old SWIG bindings for the engine from back when I was still using OpenGL. This took the most part of the day, but at the end of it I got the basic window setup - see above!

The next couple of days were pretty lazy days, mostly involving watching season 1 of American Dad, but towards the end of Friday I implemented texture compression using the nice Squish library before embarking on the rather short journey back home.

And now that the week is over, my hangover is gone, I'm in the process of tidying up my UI system and hooking it in with wxPython to some degree, ready to start implementing the camera controls of the editor!