Getting Started - Daggerfall Workshop · Daggerfall Tools for Unity Tutorial Getting Started V1.6.x...
Transcript of Getting Started - Daggerfall Workshop · Daggerfall Tools for Unity Tutorial Getting Started V1.6.x...
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Getting Started
Introduction
In this tutorial, we will create a new project, import Daggerfall Tools for Unity, and setup an empty
scene. These steps will be common to starting all basic and intermediate tutorials. Only a beginner
level of Unity knowledge is assumed and most steps will be described in detail.
After this tutorial, there follows several pages of reference for components making up the
foundation of Daggerfall Tools for Unity. Please refer back to this document any time you need help
setting up a new scene or more information on a specific component.
Prerequisites
Before using Daggerfall Tools for Unity, you will need the following:
1. A full install of Daggerfall. You can download a Daggerfall installer for free from the
following sites:
http://wiwiki.wiwiland.net/index.php?title=Daggerfall_:_DaggerfallSetup_EN
http://www.elderscrolls.com/daggerfall/
http://www.uesp.net/wiki/Daggerfall:Files
2. Unity 5.4.0f3 or later.
http://unity3d.com/unity/download
3. Latest Daggerfall Tools for Unity 1.6 release. You must unzip the archive after downloading.
Alternatively, you can clone or download full project from GitHub (links in header).
http://www.dfworkshop.net/projects/daggerfall-tools-for-unity/
4. Optional, but highly recommended is Daggerfall Modelling. This Windows-only exploring
tool allows you to quickly search for and browse Daggerfall models, blocks, and locations. It
will be very useful until similar search features are implemented in Daggerfall Tools for
Unity.
http://www.dfworkshop.net/?page_id=1045 (Download).
https://code.google.com/p/daggerfallconnect/wiki/DaggerfallModelling (Online Manual).
Note: Also install Daggerfall Modelling prerequisites as described in Online Manual link.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Setting Up
Create Project
1. At the Unity splash screen, create a new 3D project. You can also start a new project inside
Unity using File > New Project. Call the project whatever you like.
2. When your new project is open, import the latest “Daggerfall Tools for Unity.unitypackage”
using Assets > Import Package > Custom Package and browse to location of extracted
package.
Set .NET 2.0 Level
If you imported the asset package, you will notice an exception in the console.
This is because the mod system needs full access to .NET 2.0 and new projects use .NET 2.0 Subset
by default. To fix this:
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
1. Click menu Edit > Project Settings > Player.
2. Under Other Settings > Optimization change Api Compatibility Level to the full version of
.NET 2.0.
Prepare Scene
An empty scene has been prepared for you in Assets/Scenes called BasicScene. Following is how to
setup a new scene from scratch, you can skip this if using BasicScene.
1. Delete the default Main Camera and Directional Light objects from your Hierarchy panel.
The scene Hierarchy should be completely empty.
2. Save your scene using File > Save Scene. Call the scene whatever you like.
3. Drag the DaggerfallUnity prefab from Daggerfall Unity/Prefabs folder into your Hierarchy.
This will create a blue DaggerfallUnity prefab in your scene with all default settings.
4. Drag the PlayerStandalone prefab from Daggerfall Unity/Prefabs/Player folder into your
Hierarchy.
Prepare Lighting and Quality
1. Click menu Window > Lighting to open the Lighting window and configure settings to match
image below. You can change the Skybox setting by clicking circle to the right of input field
and selecting “None”.
To summarise settings:
Disable Skybox
Set Ambient Source to Color
Set Ambient Color to R=0.3, G=0.3, B=0.3
Disable Precomputed Realtime GI
Disable Baked GI
Disable Fog
Disable Auto in Other Settings
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
2. Click Ambient Color field and set RGB values to 0.3, 0.3, 0.3 like below. You can change
these values later if you feel your scenes are too dark or too bright.
3. Click menu Edit > Project Settings > Player. Change the Rendering Path to Deferred. All
other settings can stay at defaults. The Deferred rendering path is highly recommended for
Daggerfall as it uses many small, dynamic point lights.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
4. Click menu Edit > Project Settings > Quality and ensure Fantastic is selected.
5. Finally, save your scene using File > Save Scene.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Setting Arena2 Folder
Before working with Daggerfall’s binary files, we must direct Daggerfall Tools for Unity to your
Daggerfall installation’s Arena2 folder.
Note: If you’ve previously played Daggerfall Unity on this PC, then your Arena2 path may be setup
automatically for you.
1. Select DaggerfallUnity in Hierarchy.
2. In your Inspector, locate the Daggerfall Unity (Script) component and click Browse to point
Daggerfall Tools for Unity to your Daggerfall installation’s Arena2 folder. This is where all of
the game files such as textures, models, and layouts are stored.
3. The DaggerfallUnity component will be fully populated with prefab defaults. You should now
have an empty scene similar to below.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Setup Input
The demo player controller requires your project to configure a Run input key. If no Run input is
found, the controller will be unable to toggle between running and walking.
First, we’ll create the Run key binding. Click Edit > Project Settings > Input to display the
InputManager settings in your Inspector panel. Expand the Axes group and increment sizes by 1. For
example, if this was 10 then increment to 11 and hit Enter to apply. Your new value will be at the
bottom of list.
Next, setup your new Run input by typing in the values precisely as shown below.
You might also want to invert your mouse-look axis. To accomplish this expand your
PlayerStandalone object in Hierarchy then select Camera. Locate the Player Mouse Look (Script)
component in Inspector and select Invert Mouse Y if this is your preference.
This concludes the Getting Started tutorial. The following pages contain reference information for
Daggerfall Tools for Unity and related components.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Reference
The DaggerfallUnity Singleton
DaggerfallUnity is a singleton object. There must only be one DaggerfallUnity GameObject in the
scene at any time and multiple instances will throw an error message. Programmers can locate the
DaggerfallUnity singleton at any time using the following static property in code.
DaggerfallUnity myInstance = DaggerfallUnity.Instance
You can use the singleton object to layout entire scenes at runtime. You can also use the underlying
API to query almost all of Daggerfall’s file formats and import native data into Unity-friendly formats.
DaggerfallUnity Components
The DaggerfallUnity GameObject consists of multiple components. On the following pages, we will
review these components and their options.
Above: The main components of Daggerfall Tools for Unity.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Material Reader
The Material Reader is a required component of DaggerfallUnity. This script handles importing and
converting Daggerfall textures to Unity Materials. The settings control how materials are processed
during import. All materials are created using the Standard Shader where possible.
Atlas Textures. Combines billboards, ground textures, and animated textures into an atlas
for improved efficiency. Currently, animated textures must be atlased for animations to play.
It is recommended to always have this option enabled.
MipMaps. Control generation of mipmap textures on generated materials.
Sharpen. Automatically sharpen imported texture maps. Increases import time.
Normal Textures. Automatically generates normal maps for materials with a variable
strength setting. Increases import time.
Compress Sky Textures. Enables texture compression for sky textures.
Main Filter Mode. Change your desired filter mode of imported textures. The options are
Point, Bilinear, and Trilinear. This setting will be applied when materials are imported.
Sky Filter Mode. Set your desired filter mode of sky textures.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Alpha Texture Format. Set your desired texture format of textures with some transparent
parts, such as billboard sprites. This gives you some control over the internal format and size
of imported alpha texture maps.
Non-Alpha Texture Format. Set your desired texture format of textures that contain no
transparent parts, such as building and ground textures.
Window Colour & Brightness. These options are for setting window colour and brightness
(from 0.0 to 1.0) for window styles. You can set individual options for Day, Night, Fog, and
Custom windows.
The Clear Material Cache button can be used to purge the internal material cache used by Material
Reader. This is used when changing material settings before re-importing scenes or debugging
importer behaviour.
Note: This cache is not serialized and will not persist through starting and stopping Play mode or
closing and re-opening Unity. This may change in a future release.
Mesh Reader
The Mesh Reader is another required component of DaggerfallUnity. This script handles import and
conversion of Daggerfall’s 3D models to Unity’s own Mesh format. It also has several code helpers
for importing other types of mesh resources, such as properly scaled billboard quads. There are only
a few controls for Mesh Reader at this time.
Add Mesh Tangents. This option calculates tangents for Daggerfall models as they are
imported. Tangents are required for the Standard Shader. It is recommended this option is
always enabled.
Add Lightmap UVs. This option creates a secondary UV channel, required for lightmapping
environments with tiling textures. Enabling this option will greatly increase import times. It’s
not recommended to use this option unless lightmaps are required. Under most
circumstances, it is recommend to leave this option disabled and use Deferred path.
The Clear Mesh Cache button will clear the internal mesh cache used by Mesh Reader. This is used
when changing mesh settings before re-importing scene or debugging importer behaviour.
Note: This cache is not serialized and will not persist through starting and stopping Play mode or
closing and re-opening Unity. This may change in a future release.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Sound Reader
The Sound Reader script handles import and conversion of Daggerfall’s audio sound effects. There
are no editor options for the Sound Reader at this time.
World Time
The World Time component is a complete Daggerfall-styled Tamrielic calendar. It is instrumental in
automating seasons and time of day operations.
Year, Month, Day, Hour, Minute, Second are individual units of current time. Values are
zero-based and in 24-hour time. Out of range values will flow into next time unit.
Time Scale scales the speed at which Tamrielic time elapses and is unrelated to Unity’s
internal time scale. The default time scale is 10.
Show Debug String draws a simple time string at top-left of screen while game in running.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Daggerfall Unity
The main component is the Daggerfall Unity script itself. There are many options exposed here to
control how content will be imported in editor and at runtime. This section will be broken down into
the individual parts of Daggerfall Unity.
Arena2 Path
This is where you set the path to your Daggerfall installation’s Arena2 folder.
Arena2 Path. Is the path to the Arena2 folder on your computer. This path is for
development only and should not be relied on for builds. See the Distributing Builds
intermediate tutorial for more information on creating standalone builds with Daggerfall
Tools for Unity.
Browse. Allows you to browse for a new Arena2 folder.
Clear. Will empty the Arena2 path. This is used before creating certain standalone builds.
Performance Options
These settings will directly impact the performance of your imported scenes. It is recommended to
always leave these settings enabled, except for testing purposes.
Set Static Flags. Sets appropriate objects as static. Ignores billboards and dynamic objects.
Combine RMB. Combines models in RMB blocks (city blocks) to reduce draw calls and
increase efficiency of scene. Will otherwise maintain the same native scene layout as
Daggerfall. It is recommended to leave this enabled.
Combine RDB. Combines models in RDB blocks (dungeon blocks) as above. It is
recommended to leave this enabled.
Batch Billboards. Uses a fast geometry shader for billboard objects. This setting is ignored
for streaming world scenes where billboard geometry shader is always enabled.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Import Options
These settings control how content is imported.
Add Colliders. Adds a mesh or box collider to imported objects. Daggerfall’s meshes are very
simple, about the complexity of normal physics meshes. This option should be left enabled.
RMB Ground Plane. Imports a tilemapped ground quad for every RMB block object. This
settings is ignored by the streaming world where the terrain tilemap is always used.
Close City Gates. This setting will import cities with city gates closed. You can also toggle city
gates open/closed from their Inspector.
Prefab Options
Prefabs in Unity are like a premade template for certain GameObjects. Daggerfall is a highly
procedural game, so prefabs are used mainly for setting up default conditions and settings for
objects and attaching your own custom scripts before procedural objects are imported into scenes.
Import Light Prefabs. Enable this setting to import light prefabs into your scene. If a prefab
is set to None, lights of that type will not be imported. The default light prefabs are in
Prefabs/Scene.
Import Door Prefabs. Enable this setting to import door prefabs into your scene. If a prefab
is set to None, doors of that type will not be imported. The default door prefabs are in
Prefabs/Scene.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Import Enemy Prefabs. Enable this setting to import enemy prefabs into your scene. If
enemy prefab is set to None, then no enemies will be imported. The default enemy prefab is
in Prefabs/Scene.
Optional. City Block and Dungeon Blocks prefabs are used if you wish to attach custom
behaviour to every RMB or RDB block imported. These fields can be set to None and a fully
procedural block object will be created. Default block prefabs are in Prefabs/Scene.
Note: Prefabs will be expanded in future versions of Daggerfall Tools for Unity to allow for more
customisation and control. Prefabs will also assume some of the scene import features currently
exposed by the Importer control panel.
Time & Space Options
These settings control time and space automation of certain game objects at runtime.
Automate Textures. Changes exterior textures based on climate, season, and time of day.
Automate Sky. Changes sky animation based on season, weather (to be implemented) and
time of day.
Automate City Lights. Point lights in cities will turn on and off based on time of day.
Importer
The Importer is used to import individual objects directly into your Unity scene.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Models are imported using a unique ModelID. For example, ModelID 456 is the exterior of “Scourg
Barrow”.
Blocks are imported using a unique Block Name. City blocks end with .RMB and dungeon blocks end
with .RDB. For example, S0000999.RDB is the central block of Privateer’s Hold, and CUSTAA45.RMB
is the exterior of Castle Wayrest.
Cities and Dungeons are a bit more involved as some locations have both an exterior map and a
dungeon map. To import a city or dungeon enter in the format RegionName/LocationName to either
the City field or Dungeon field.
For example, entering Daggerfall/Daggerfall in the City Name field will import the above-ground city
of Daggerfall. Entering the same into the Dungeon Name field will import the dungeon within Castle
Daggerfall. If the target location has any apostrophes, be sure to enter exactly as shown in-game. For
example, entering Daggerfall/Privateer’s Hold into the dungeon field will spawn Privateer’s Hold.
Notes:
City Name and Dungeon Name fields are case-sensitive.
You can use the menu Daggerfall Tools > Atlas to search for locations by region, name, and
type. The format of result can be copy-pasted directly into import field.
Once you have entered a model, block, or location, click the adjacent Import button to import that
resource into Unity. Imported content will be serialized with your scene.
Daggerfall Tools for Unity Tutorial Getting Started V1.6.x [Unity 5.4.0f3] | 07/09/2016
Devblog dfworkshop.net Forums forums.dfworkshop.net Source github.com/Interkarma/daggerfall-unity YouTube youtube.com/daggerfallworkshop Twitter twitter.com/gav_clayton Email [email protected]
Conclusion
Daggerfall Tools for Unity is a powerful scripting asset for working with Daggerfall inside the Unity3D
engine. It is completely open source and has a lively community working on many exciting projects.
If you are interested in learning more about Daggerfall Tools for Unity, or getting involved with its
development, please refer to the links below for more resources.
Development Blog www.dfworkshop.net
Read about the latest developments and work in progress.
Forums forums.dfworkshop.net
Join a growing community of developers and Daggerfall enthusiasts working
with Daggerfall Tools for Unity.
Reddit reddit.com/r/dftfu
If Reddit is more your style, join the /r/dftfu community.
Source github.com/Interkarma/daggerfall -unity
The complete source code of Daggerfall Tools for Unity and Daggerfall Unity.
YouTube youtube.com/user/daggerfallworkshop
For all videos related to Daggerfall Tools for Unity.
Twitter twitter.com/gav_clayton
Follow Interkarma @gav_clayton for regular tweets about Daggerfall Tools
for Unity and other projects.
Email [email protected]
Contact Interkarma directly via email.