A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Show off your mod creations or just a work in progress.
Post Reply
Zarrgon66
Posts: 14
Joined: Sun Apr 14, 2019 2:27 pm

A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Post by Zarrgon66 » Fri Mar 20, 2020 12:07 am

Hi, I am GDI student currently preparing for the FMP [Final Major Project], the project must use nothing I personally have worked on before and I can not use assets from other sources unless they are made by colleagues that I have made an evidenced agreement with, code resources like unity plugins are fine as long as they are credited to there original creators and are visibility acknowledged as such, I asked if using Daggerfall Unity's source as a base was ok and they told me I could as long as I didn't make a 1-1 copy of the code and suitability changed any code I took inspiration from. I want to make an RPG like but due to my unfamiliarity with this process and my basic Code knowledge [I'm a Designer and production lead with a focus on narrativisim by specialisim] I'm a little stuck on where to start and how to get the parts of the code I want to learn from to work for testing purposes.

Any advice, resources or other direction on this matter will be greatly appreciated.

User avatar
pango
Posts: 2192
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Post by pango » Fri Mar 20, 2020 8:11 pm

Hi Zarrgon66,
I'm not totally convinced you'll be able to repurpose code with "basic code knowledge", I think it will require to understand quite well the code you want to adapt, and then extracting only a part of some code will also take some skill and dedication. Hopefully I'm wrong, or I did not understand correctly your coding mastery.
Anyway, if you want to repurpose something, it'd better be somewhat unusual or even innovative code; I think there's enough sources of free to peruse general purpose code around...
So what code is worth a look in Daggerfall Unity, well certainly several (but that's where my knowledge and taste may matter):
  • Loading resources from classic Daggerfall assets: I assume you can't use Bethesda assets in your project, so this part is useless to you;
  • Modding capabilities: it's a great feature, but technical, I'm not sure that's the kind of thing you can showcase in the kind of project you're asked for;
  • Graphic rendering: I think DFU does nothing too fancy, there's some shader work and stuff, but nothing out of the ordinary I think;
  • World streaming: Daggerfall world is massive, and terrain and everything above it has to be loaded/discarded as you move around. I assume not that many Unity games do that;
  • UI: DFU reimplements a GUI layer to better match original, stuff like inventory is certainly necessary for any RPG, but the ergonomy matches classic inventory so is certainly dated;
  • Character creation: one of the deepest character creation procedure even implemented, but of course it's interesting because of all the character traits that are implemented in the game;
  • Combat system: it's dice-rolls based, and is mostly numbers crunching, again something quite old school;
  • Magic/Effects system: it has been designed to be extended, so that could be something worth studying;
  • Quests system: the most delicate piece of machinery in DFU, that's also certainly something worth studying, but i've yet to do that myself, it seems rather complex.
  • Physics: Daggerfall has some unusual mechanics like climbing, but nothing fancy like physics simulation or breakable environment
  • Enemies AI: they have a hardcoded fitting AI, but nowhere near state of the art
That's all I can think of right now...
Last edited by pango on Fri Mar 20, 2020 11:08 pm, edited 1 time in total.
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

l3lessed
Posts: 254
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Post by l3lessed » Fri Mar 20, 2020 10:55 pm

Welcome, and yes, to get into the base level engine and begin re-purposing it, you need to understand object language very well. The engine is extremely interconnected via object language, and you must track changes through numerous scripts when even changing a single variable or adding anything.

As pango suggest, I would start, if you still want to, by looking at and understanding how the individual scripts, game components, and code communicate and work to create the base that runs the game. I can direct you to combat, animation, and some movement based discussions and code, as I am currently working on a project that re-purposes the base engine to update the animation system into some thing that looks and feels more modern.

In-depth project and discussion on combat and animation system and related code: viewtopic.php?f=14&t=2533

A very in-depth breakdown of the combat system and animation system and how they work together to create what happens on the screen: viewtopic.php?f=22&t=2508

In-depth discussion, with visual flow chart, of the fps animation system and all related script files the control and run it: viewtopic.php?f=22&t=2554

Outside these areas of the engine and these posts, I can't tell you allot without looking at the code itself. Have fun though and see what you can do. When I started, I had been coding for a long time, but I had never done C# or such a heavy object orientated code, but I learned allot and am close to releasing my first large project.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Zarrgon66
Posts: 14
Joined: Sun Apr 14, 2019 2:27 pm

Re: A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Post by Zarrgon66 » Mon Mar 23, 2020 11:43 pm

Hi, sorry for the late reply been coronavirus prepping, I am primarily looking to try and replicate the world streaming/dungeon, the quest system and character creation/sheet mechanics as that's what my FMP is centred around. thank you for the links but is there no one on the forum that is familiar with theses mechanics or any modding or technical guides or tools you can recommend?

l3lessed
Posts: 254
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Post by l3lessed » Tue Mar 24, 2020 3:52 am

I personally can't. All I can recommend is breaking down the script files yourself, using what you can, and building what you need. Some one more technical could probably answer better than me, but this is an engine from 1992, so there is nothing support wise outside the code itself, this great communities existing knowledge, and the wonderful modding system provided by the developers who rebuilt it for unity.
My Skyrim Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

BadLuckBurt
Posts: 431
Joined: Sun Nov 05, 2017 8:30 pm

Re: A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Post by BadLuckBurt » Tue Mar 24, 2020 5:06 am

Zarrgon66 wrote:
Mon Mar 23, 2020 11:43 pm
Hi, sorry for the late reply been coronavirus prepping, I am primarily looking to try and replicate the world streaming/dungeon, the quest system and character creation/sheet mechanics as that's what my FMP is centred around. thank you for the links but is there no one on the forum that is familiar with theses mechanics or any modding or technical guides or tools you can recommend?
I'm not sure it's feasible for one person to do this but here is what I know about the world streaming / dungeons mostly:

General
It helps to view DFU as a layer between classic Daggerfall files / data and Unity. That is severely underselling it because it's much more than that as you may well prove if you decide to go through with repurposing :) Because it sits between Unity's core and classic DF files, the input (classic file reading) can theoretically be swapped out for anything you like as long as you accommodate the data that the code requires to be able to work.

If you are going to study the code, it will help to be familiar with the original file / data structures: https://en.uesp.net/wiki/Daggerfall:Hacking_Guide

World Streaming
As for the world streaming / dungeon stuff, DFU is a bit odd when it comes to that. As stated, the terrain is generated on the fly, not just the streaming bit but all the height differences and ground features as well. Classic Daggerfall has 2 heightmaps, a 'small' one that's a greyscale 1000x500 pixels image and a larger one that is also greyscale and 5000x2500 pixels in size.

Locations in Daggerfall (located in MAPS.BSA) can all be placed in a 1000x500 grid which corresponds to the small map as well as the travelmap. During terrain generation, the pixels from the small map are referred to as map pixels. The large one is a noise map but has a strange grid overlaid on top of it.

The pixels in the small map correspond to roughly 800x800meter tiles, the pixels in the large one consequently to 160x160meter tiles. The default terrain sampler in DFU starts out by bicubic sampling the small and large maps, using the resulting height value as a starting point, it does this 128x128 times per map pixel while adding procedural noise for additional detail.

On top of that there is a climate map (also 1000x500) that determines which terrain textures and nature billboards will be rendered.

These two combined roughly account for the way terrain is handled in Daggerfall. Since the original files WOODS.WLD and CLIMATE.PAK are read at runtime, it would be possible to circumvent that and directly feed the terrain sampler your own data set as long as you either alter the render code enough or mimic the expected data values.

Dungeons
Dungeons are comprised of so-called RDB blocks which describe the layout of models, billboards and settings for activators etc. You can dump these data structure from the console within DFU. Check under Assets\Game\Addons\UnityConsole\Console\Scripts\DefaultCommands.cs in DFUs source. The data gets dumped as JSON format and is relatively easy to figure out. Hazelnut has set up a system to override existing and add new locations: viewtopic.php?f=22&t=2857.

It is possible to create custom dungeon layouts but there are no tools available, I have started creating a workable solution for myself through Blender and Python scripting but that is nowhere near ready.

Quests
I'm not all too familiar with quests so to explain the nitty gritty will be up to others but, again courtesy of Hazelnut, it is possible to add custom guilds with quest packs: viewtopic.php?f=22&t=901

Character creation / sheet
Not my area at all, sorry

TLDR: What you want to do can probably be done but will be a lot of work, especially for one person.

Zarrgon66
Posts: 14
Joined: Sun Apr 14, 2019 2:27 pm

Re: A inquiry by a Game Design Student on the matter of documentaion reguarding source code repurposing

Post by Zarrgon66 » Sun Mar 29, 2020 10:53 pm

thank you all for the replies, I now have enough reference guides on the basics to get started, however, I still need some pointers in regards to areas such as the character creation/stat and skills systems [I don't want to use it I want to be able to just understand it so I can create my own variation relevant to the project I'm making] as well as a recommendation for a guide on understanding object language.

Post Reply