Guild Systems

Hi everyone, Hazelnut here. Interkarma has asked me to write a blog post about some of the work I have been doing recently, so for this post Daggerfall Workshop has been taken over by me! Muhahahaha… etc. I’m sure your regularly scheduled Interkarma posts will return soon, so don’t worry.

Anyway, allow me to introduce myself, you may know me from such features as horse riding, inventory upgrades, shopping, persistent state, icons, tavern rooms, ships and houses, as well as various other bits and bobs. So why did I spring up from nowhere and start contributing to DFU?

I bought Daggerfall on xmas after its release and played like crazy for 7 days until the end of the christmas break, then stopped. Because it’s such a huge game, never really got back into it for years due to lack of time & small children – until shortly before Morrowind came out. By then the game was simply far too dated for me to persevere, especially because I forgot about the WSAD option and I was using the default control scheme of stupid mouse pointer arrows to move. So I’ve actually never played beyond the first couple of character levels. Always wanted to, and do intend to once DF Unity is done. This is why I am absent for any discussion or work around the main quest! Spoilers! Yep even after all this time.

While the progress has been fantastic (Interkarma has Orc level stamina apparently) it’s a big project and takes a long time, and since I’m a software engineer for the past 2+ decades who now does software design so don’t get to write much code at work… I figured I’d see if I could contribute. Also my kids are all teenagers now, so I have more free time than I’ve had for 2 decades. I had no knowledge of Daggerfall and its data structures, hardly ever touched C# and never used Unity before, so it’s been quite a learning curve. Anyway, after I finished my work on ships, houses, shops and taverns I asked Interkarma what he thought I should tackle next and between us we decided it was time to implement guilds. I’d already done some work with the guild services menus, but now I needed to create the guild membership systems.

Guilds

Guilds in Daggerfall follow some common rules for promotion etc but offer different services and quests. The first thing to focus on was ranks and building some foundations that would make each guild easy to implement, allowing the common behavior to be shared. I also wanted to ensure that new guilds could be added by mods, as I was sure that several people in the community were keen to add new guilds having seen discussions on the forums, and I had some ideas of my own that would be best integrated into the base game by adding a new guild. I decided early on that the guild code should be designed to support modding from the start, and the only way to ensure this was to actually implement a guild mod early on to prove the concept.

So, quite a lot to take on. Fortunately I had 3 solid days free coming up to get started on this. The fighters guild is the simplest of them all so I started with that. First step was to test classic and see how guild membership worked with rank changes etc. To support modding, the guild classes are designed so that they know about the players membership status, rank, and what benefits and services the guild provides at that rank. Service and guild management code asks the guild class by calling the appropriate method when they need to know. They also supply guild specific messages to the ranking system which is shared. This means that a new guild can simply be added by implementing a new guild class and registering it with the guild manager.

Now by this time you could join the Fighters guild.

Join Fighters

Joining the Fighters

Next thing was to show the guild memberships in the affiliations section of the character sheet. This required orange text which I think isn’t used anywhere else in the game.

Affiliations

Affiliations

Next, I fleshed out the benefits and services being offered at each rank and integrated it with the service menu I had previously done, then moved on to detection of rank changes. For the time being this is being checked every 24 hours rather than the 28 days it’s supposed to be. Resting for a month in classic daggerfall to test rank changing was incredibly tedious, 99 hours at a time! Also, for now, you can rest in guild halls for free as soon as you join – so testing doesn’t require finding a nearby inn. To test I was modifying guild reputation in savefiles and then reloading. Once promotion, demotion and expulsion were all done and working for the fighers it was time to deal with the harder bits.

Temples

So, temples are guilds but complicated because it’s like a single guild (you can only join one Temple) in many ways and multiple guilds in others. Players get different benefits at different levels from each different Temple, and the guild system needed to be able to cope with this. Knightly Orders are similar, but a lot less complex because they don’t offer training and curing services. I decided that Temples would be a single guild, but with a Divine variable set to enable variations. Building this required changing quite a bit of what I had built for Fighters, but this was the point of tackling the most complex second. It may not sound difficult, but I found it tricky to enable temples to offer training to non-members (at a higher price) because the services system was hooked into guild membership. Solved this in a way that is not available to new guilds, but not worried because this is a unique feature of temples and is so joining one temple doesn’t prevent you from training at a different one.

Temple Training

Getting training when not a member

Proving the foundations

The next step was to prove the foundations were designed and build right by implementing the Mages guild. This took less than an hour, with most of the time spent finding the correct message id’s in text.rsc for joining and being promoted. The fact that it was so quick and easy let me know that I had things right. It had taken quite a lot of work, but the foundations were done.

Denied

Mages don’t want you

A New Guild

Now it was time to prove that a new guild could be built and added by a mod. This threw up quite a technical challenge – how to integrate a new guild into the game world. As you will be aware if you have followed Interkarma’s blog posts, Daggerfall Unity works off the original games data files. This means the game world is set in stone within these files. (contrary to some opinion, there is no runtime procedural generation – it was all done upfront) After much thought and looking through the DFU code which reads and parses the world data from original files, which I had not had much reason to look at before, I realised that this data could be saved to text files in JSON format by simply using the serializer that’s already used to create saved games. So, I created some console commands to dump Daggerfall block data into JSON files, with the thought that I could modify these files and have them override the original game data at runtime.

I’ll not go into too much depth here, if you are interested check out my Guild Mod tutorial thread: http://forums.dfworkshop.net/viewtopic.php?f=22&t=901

Anyway I got to the point where a building within a block had a completely new interior. See these before and after shots.

Before

Before the world data is overridden

After

After overriding the interior world data for this building

It was very successful, only requiring a couple of tweaks to the guild foundations in the core DFU codebase. Things were progressing very well, but I had to do some work with the mod code to enable all this to be packaged into a DFU mod file which took a while to figure out. I hope a lot of players find the Archaeologists guild mod a valuable addition to their DFU play experience. See my forum thread for more details: http://forums.dfworkshop.net/viewtopic.php?f=14&t=888

 

Questing and Reputation

The last piece of the puzle for guild foundations was to migrate the test quest dispensing over to the guild service code and have several managed pools of quests for each guild. To do this I modified the table structure for quest lists so that each quest could be restricted to members / non-members and also by guild reputation. Then it was fairly straightforward to add all the different guild quests and have the right ones selected from when you ask for a quest. Again some more work was required to enable quests and lists to be packaged into mods, which I proved by adding a single quest to the Archaeologists guild mod. Also I created a more general mechanism for adding quests to Daggerfall Unity from Interkarma’s suggestion to allow quest packs for pure quest mods so authors didn’t have to package a full mod.

This works by scanning the full directory tree under StreamingAssets/QuestPacks for quest list files named “QuestList-whatever.txt” and loading them into the guild quest pools. Jay_H will be releasing the guild quests he wrote last year as quest packs soon, so hopefully this will demonstrate how easy it is! (or possibly what needs to be re-worked, noooo)

There’s still more to do for non-quild quests, but for now the focus is just guilds. The last thing I put in place was for quest success / failure to modify the players guild reputation – I left this until last because it was so much easier to just edit this during testing. By default each guild quest successfully completed increases your rep with the guild faction by 5, and failing decreases by 2. However, some quests shown on UESP have different reputation changes.

e.g. http://en.uesp.net/wiki/Daggerfall:Still_More_Trouble_with_Orcs and http://en.uesp.net/wiki/Daggerfall:More_Trouble_with_Orcs

I don’t have any idea how this is done in classic, or even if it was ever implemented – much of the info on UESP seems to come from Daggerfall Chronicles which was written from intentions before the game was complete. So if anyone out there has any info on this, or is prepared to do some testing please drop by this thread on the forums and give me a clue: http://forums.dfworkshop.net/viewtopic.php?f=4&p=11032

So, there you have it, a brief story of my journey implementing guilds. Hope everyone enjoys them in the latest build, and please be sure to report any bugs you find!

 

Posted in Daggerfall Unity, Technical Content.

2 Comments

  1. Perfect! Awesome! Great job and article Hazelnut, thank you for your epic contributions to DFU!!

Comments are closed.