The future.

I recently played around with my own library (see an earlier post about the sun effect) and I found it… well, lacking.  In my day job I do a lot of framework/library code for re-use amongst my co-workers and I’ve learned a great deal over the last few years of doing that professionally.  There’s a huge difference between writing a database/application framework and a graphics library, but, I’ve always been amazed how concepts from one architecture will map to another and as I developed Gorgon in my own time, I ported concepts to the framework code I write for my job and vice versa.  One major difference is that our framework code at the office is always evolving from project to project (granted, the pace of evolution has slowed somewhat), while Gorgon was written, and aside from bug-fixes, it never evolved because I never really used it except to prototype small things from time to time.  Until I wrote the Sun thingy….

What a fucking nightmare.

In writing the Sun test application, I decided to try my hand at putting together an editor for a top down space game.  I do these things you see, top down space games, I’m hung up on them, I have no idea why.  I think Solar Winds is to blame…  But I digress… I had began writing this thing.  It was coming together nicely (although the code was a fucking mess), and I had written a neat little 2D scene graph that could render multiple camera view points, have layers, etc… it was all quite neat.  But since I am incredibly busy at work my time on these types of things is limited at best and there would be vast stretches of time where I couldn’t work on it.  This led to a lot of trouble in keeping things organized and eventually I had to stop altogether because the complexity was incredibly stupid and my time was (and still is) incredibly limited. But upon reviewing the code to see if I could give another kick at the can, I realized that while it was a mess, and it had just some really bad code, it was incredibly modular.  And then I realized these modules were written to get around what I felt were design flaws in Gorgon.

I ran into issues at the beginning of development almost immediately when I found that one of my image loading functions was poorly designed, and, had a fatal flaw.  Luckily I was able to work around that without changing Gorgon itself.  Then I went to use my file system code…  man… fuck… let me tell you, why I thought -that- was a good idea (i.e. the entire idea of Gorgon’s “filesystems”, not just the use of it), I’ll never know.  So I wrote file system code that was more in line with what I consider to be better resource loading.  And what I had come up with was very similar to another open source library called PhysicsFS, which I felt was a great idea.  Load from any data source (zip file, folder, etc…) but from a unified virtual file system which didn’t give two shits where the data was stored.  Then I realized that I’d need plug-ins to load the file system providers and Gorgon’s plug-in system was… well, it’s shit.  And it’s annoying, so I wrote a new plug-in system which was more abstracted and provided more control to the developer.

When I revisited the sun app code, I thought about what I was doing and how Gorgon might benefit from a change to some of its sub systems.  So, I decided a little while ago that I would attempt to put these into Gorgon.  But upon reviewing my code in Gorgon, I realized there was a lot (well, actually, every goddamn thing)  of code that could use a revamp to be a lot more modular and far more flexible.

Dorian (branch 2.x)

And so, I started my refactoring and redesign of Gorgon.  I’ve put it into a branch called Dorian (like the musical mode) and this will be the 2.x version of Gorgon.  I’ve made some pretty sweeping changes already and it’s incredibly unstable, and I really really really don’t recommend that you even attempt to use it.  In fact, you can’t really use it since I’ve stripped out all the rendering code.

If you’re like me then you’ll abhor change.  And if that’s the case, then you will abso-fucking-lutely HATE this.  The structure of the library and its code will be completely different from what you might be used to.  Again, it’s going to be more modular and hopefully more logical, and things will not at all be even remotely familiar to you.  To those who are of the “pre-order cancelled!!!!11!!1one!11!” mindset, I have this to say: “Fuck off.  My library, my right to change it.  Go use v1.x if you don’t want this one, or better yet use one of the more awesome alternatives out there.

Now, if you’re still here, then you’re either very stubborn or you don’t care.  Regardless, I’m hoping I can provide a better (more robust) interface for your 2D (at least for now) needs.

I’m also a filthy liar.

This is true, I have a pretty bad tendency (like most developers) to start up a project, work on it for a while and then never look at it again.  How Gorgon actually got out the door, is beyond me.  I can’t and will not promise that I’ll complete this endeavour.  If it happens, it’ll be announced on the front page and on the facebooks.  If it doesn’t, you can forget I ever posted this.

Where are you now?

I’m still very early in the development and planning stage.  Right now I have most of the old code stripped out of the Gorgon static class, and have kept a bare bones object for use as the starting point.  As for specifics:

  • I’ve put in the new plug-in system.
  • A new input system, which will support multiple mice and keyboards.
  • A new raw input plug-in for that input system.
  • Put the UI code that was in the DialogHelper.DLL into the main library.
  • Changed the idle loop code to be a straight delegate as opposed to an event.
  • Put in MUCH better collections that implement IList, IDictionary, etc… and they’re based on…
  • A new INamed object interface (this was one of the pains in my ass when writing the Sun thing).
  • And some other stuff that I can’t remember now…

All told my goal at this point is to make the Gorgon DLL be used for nothing more than set up and tear down of the library.  No graphics code, just interfaces for plug-ins and the bare minimum to get things started.  I will make it so the user will require external libraries and/or plug-ins to do anything specialized.  This way, the user is able to swap things in and out.  Don’t like the 2D stuff?  Think you can do better?  Then write a new 2D renderer and drop it in.  Don’t like the input system?  Again, write a new one based on DirectInput or whatever and drop it in.  It’s all about being flexible, and that’s what I intend to do with Gorgon, make it flexible.  I also intend on exposing the low level rendering to the user as an option, instead of being forced to only use the high level things like sprites and render targets through Gorgon’s interfaces, I want to make it possible for the user to be able to go “under the hood” as it were.  Of course, I do plan on building the 2D stuff on top of this renderer, so you still have the higher level stuff if you need it.

Anyway, this is really long and the missus is about to get home and it’s our anniversary, so I’m out.  If you have any comments, feel free to leave them.  Or don’t.  I don’t care.