Daggerfall Unity – More Progress

Just a quick update today. I’ve been hard at work on Daggerfall Tools for Unity, adding caching, mesh combining, texture atlasing, ground planes, material sharing, and lots of small tweaks to vastly improve load times and reduce draw calls. I’m almost ready for first release build now. I just want to get in climate swaps and kill some bugs. Oh, and I need to write a manual as well.

dfunity-41

dfunity-41-3 dfunity-41-4

 

 

 

Latest source code code is on the SVN now: https://code.google.com/p/daggerfall-unity/

 

Daggerfall Unity – Cities

The code to import cities is now working, and crikey does it need some improvement. Importing a full city into Unity takes around 10 seconds (compared to less than 1 second in Daggerfall Modelling) and results in a massive scene hierarchy requiring over 5000 draw calls per frame! Obviously this won’t be good enough for a final version. I don’t even have ground planes in yet…

dfunity-city1

The good news is this can be easily improved. Daggerfall Modelling made heavy use of caching, batching, mesh combining, and texture atlasing. I can do the same in Unity to bring those numbers right down. However, I will leave in the ability to import fully atomic scenes in case someone wants to see the native layout without regard to performance. Actually, I think even that can be streamlined. Lots of work to do, but I think I’m on track to finish in a few months as planned.

Edit: I implemented basic caching and mesh combining, and performance is great again. Even the fully atomic scenes load in a few seconds and only require a few hundred draw calls in heavy environments. Unity’s dynamic batching is really awesome. This will get even better once I implement atlasing.

One more thing, the source code is now online. I’ll be updating this every day or so. If you’re really keen you can grab the code and copy it into a Unity project to play with. However if you wait a few days, I’ll create a .unitypackage for download with a manual included.

https://code.google.com/p/daggerfall-unity

 

Daggerfall Unity Update

I’ve completed the first pass at porting code over to Unity. I now have textured models, city blocks, dungeon blocks, and flat objects working. I could lay out complete cities and dungeons at this stage, but want to do some code tidy-up first. Overall, I’m very happy with progress considering I only started work on this a few days ago.

There is a lot of Unity-specific work to go. I need to flesh out editor scripts and add options controlling how scene data is spawned. In case you’re wondering, everything is created procedurally from game files directly within the editor with a single click. After that it just works like a normal scene. The same could be done directly from code as well. Check out the new screens below.

dfunity-rdb dfunity-rdb2 dfunity-rmb dfunity-rmb2

 

In the last screenshot, you can see realtime shadows acting on the scene. Even the flats are casting and receiving shadows. This is using a standard cutout shader, which works in both forward & deferred.

Right now the scenes are built very atomically (from very small pieces). This is perfect for seeing how everything is put together and mucking about with the individual pieces. However it won’t be optimal for real-time uses. One of the options I’m planning will combine meshes and textures sensibly to minimise draw calls and state changes.

Check back in a few days for another update. The next update will include the first release for you to play with.

Daggerfall Tools For Unity

Since leaving the Workshop, I’ve been using Unity a good bit for other projects. It occurred to me the other day it should be trivial to drop my Daggerfall library (Daggerfall Connect) into Unity as everything was written in very portable C#. A few hours later, I had Daggerfall models firing up in Unity.

Scourg Barrow exterior in Unity

Scourg Barrow exterior in Unity.

It’s only a small step from here to spawning entire game-ready cities and dungeons in Unity. For the most part, this can be done using layout code I’ve already written for Daggerfall Modelling. I’d just need to refactor for Unity and build some editor scripts to hold it all together.

Based on this, I’ve decided to repackage the useful parts of Daggerfall Connect and Daggerfall Modelling into a small suite of scripts for Unity developers. As usual, this will be free and open source for everyone.

This doesn’t mean I’m returning to the Workshop full-time. I’ll only be allocating a few months of spare time for this project. I just think it would be great to see all the code I’ve written over the years being put to use by someone, and what better way to wrap up my years with Daggerfall than making one final tool available for a game engine anyone can use?

Let me know what you think! Is there something particular you’d like to see in Daggerfall Unity? If you’re a Unity developer and want to contribute, I would be more than happy to share access to the SVN (will be setting this up soon) to people with the right skillset.

DF Modelling – Crash On Startup

Just a quick post for anyone experiencing a crash on startup in Daggerfall Modelling 0.8. To run this application, you will need the following prerequisites installed:

1. Microsoft .NET Framework 2.0
Note: Only required for Windows XP.
http://www.microsoft.com/en-au/download/details.aspx?id=1639

2. Microsoft XNA Framework Redistributable 3.1
Note: This version is always required even if you have a later version of XNA installed.
http://www.microsoft.com/en-au/download/details.aspx?id=15163

I hope that is helpful for anyone trying to use Daggerfall Modelling and have not been able to get started.

The Future

I had an awakening recently. My wife commented that she enjoys more of my company when I’m busy in real-life because I put my hobbies on hold. We ended up discussing just how much time I pour into my hobby projects, especially those relating to Daggerfall.

On a normal night, I will come home from work and spend an hour or two with my family, then spend the rest of my night coding. On weekends, I start coding after breakfast and continue right into the small hours of the next morning.

During intense periods of real-life work (such as now after end of financial year), things are different. There’s just too much going on to spend time with my hobbies. The result is that I spend more free time with my family and less time stressing over self-imposed goals and deadlines. It goes without saying that my family loves me. To discover that any respite from my hobby projects is time they look forward to was a devastating realisation.

Some of my hobbies, including Daggerfall, have been in my life since I was a single man in my early 20s. I’ve carried these extra work habits forward into my adult life and not paid enough attention to how it might be affecting those around me.

So here’s the problem. I’m spending all of this time doing something I enjoy without much regard for my loved ones. They let me get away with it because I’m a motivated person and they know how important it is for me to keep busy. But this isn’t crunch time on a commercial project with others counting on me. These hobbies aren’t part of my income. None of this extra work contributes to our future, or pays the mortgage, or puts food on the table. It’s just extra work (substantial extra work) I take on because I like to extend myself, learn, and push against my limits. Up to a point these are desirable qualities, but I have taken things past that point by a wide margin. The only word I can properly give to my behaviour now is ‘selfishness’.

And the sad part is not many people really care about what I’m doing. Probably a few hundred are casually interested, and a much smaller number are actively excited by my work. There’s a genuine imbalance between the time I’ve taken away from my family and how much value that time has to the world at large. I’m spending valuable emotional coin in exchange for a currency of much lower value.

So now that you understand my reasoning, I want to let you all know that I’ve reached the decision to permanently step away from my Daggerfall projects. It’s time to do something different. From today, I will cease all work relating to Daggerfall Workshop and Ruins of Hill Deep. This is something I need to do as part of growing up and nurturing the things in life that will be most valuable to me as I grow older.

I apologise to anyone disappointed by this decision, and I hope you understand. I also want to thank everyone who has supported me over the years with encouragement and kind words. This is the greatest online community I’ve been a part of, filled with genuinely intelligent and passionate people. I’m going to miss you all.

Gavin.