Oct 2, 2014

Progress Update October 2014


The last couple of months haven't been the best for the project, but I'm still moving forward, albeit at a slow pace.

I won't go into excessive detail, but I'll just mention that I was sick for about 4 weeks with the flu, which meant I was barely keeping it together enough to head into work on the good days before coming home exhausted and collapsing into bed. The bad days were... unpleasant. This means I didn't have many contact hours with the project in the past few months.

That said, what have I been working on recently? I decided to finally implement the virtual file system I've had as a TODO item for months.

Virtual File System


The virtual file system is there to allow you to reference files or resources using a virtual path, eg: "/textures/UI/border.png", and then resolve that to a concrete asset when needed. That file could be part of the standard path of the game's data folder, or it could be part of a packed resource file that contains many different files. By removing the reliance on hardcoded paths, patching (and maintaining the patches) for the game will be considerably easier.

To issue a patch, I'll provide a packed resource file that contains a file manifest, and that will automatically be included (and supersede) the already installed files. So the request to "/textures/UI/border.png" will be re-routed to the patch file instead of the original files.

This should also make developing and maintaining mods for the game relatively easy. I've converted approximately 50% of the file-loading code in the project to use the new virtual file system, and it appears to work quite well.

Scripting


Another thing I looked into was incorporating a scripting language into the project. I'd previously investigated this about 2 years ago, when I had a crack at introducing IronPython support. It took a while to get working and I converted some of my GUI creation code into python. But it seemed like I was struggling to find code that would make sense to convert, and it seemed easier for the interactions with the rest of the code if it was all in C#. So I eventually backed out the changes and went back to pure C#.

Jump forward a few years, and I now have an Entity Component System that runs the whole show, and adding a new "EntityScriptComponent" was pretty much trivial, and would allow entities to run custom code where needed. I decided to revisit my original thought on using Python, and looked around for some good .net compatible Lua implementations. NLua pretty much fit the bill and I had it up and running it 10 minutes or so.

So Bulldog now support scripting to a limited extent. For now, I've created hooks for OnSpawn(), OnDespawn() and OnGameTick() for entities themselves, but as I develop the game content further I'll expand on those as appropriate.

Parting Thoughts


I'd really like to get this Snapshot 10 finished, as I've been promising it for months now. I'm slowing reducing the list of bugs introduced by the refactoring brought about by the push for crafting, and am slowly bringing the project back to a more stable state. Soon.

No comments:

Post a Comment