Adam's Lair Forum

Duality Development Report
Page 1 of 16

Author:  Adam [ 2014/02/22, 15:10 ]
Post subject:  Duality Development Report

Hey everyone,

In the course of ongoing work on issue 69, I have just pushed a series of ~ 10 commits to GitHub, which include some broader changes on the maintenance and overall API side. Some of these changes will break your code. But don't worry - it looks worse than it is. Here's a quick overview on what has changed:

  • CorePluginRegistry.RegisterTypeCategory is gone. Use the EditorHintCategory attribute on your Components and Resources instead.
  • CorePluginRegistry.RegisterTypeImage is gone. Use the EditorHintImage attribute on your Components and Resources instead.
  • Introduced a kind-of standard for embedded resources across all Duality Assemblies. They are located within the EmbeddedResources subfolder and accessed via .resx ResourceManagers, which are usually located in the projects Properties subfolder.
  • DualityEditor namespace is now called Duality.Editor
  • DualityLauncher namespace is now called Duality.Launcher
  • Plugin namespaces now are Duality.Plugins.XY and Duality.Editor.Plugins.XY für all Duality plugins.
  • Duality.ColorFormat and Duality.VertexFormat have been merged to Duality.Drawing, which now also contains classes such as Canvas and DrawDevice.
  • Duality.Profiling is gone and has moved to Duality directly.
  • Some Tweaks and Bugfixes, as usual.

For upgrading, you'll most likely have to recompile all of your plugins and do some Find / Replace All operations. After that, your Resources should be fine though, I've added a proper SerializeErrorHandler to the Compatibility plugin, which should cover most renamed and relocated Types.

I hope, you'll be able to upgrade without big problems. Sorry for the inconvenience!

Author:  Adam [ 2014/03/03, 22:43 ]
Post subject:  Re: It's "Let's break everything"-Saturday

I have successfully closed the above mentioned issue 69 now, and there have been a lot of changes and improvements to the overall editor framework. Some of them might affect you, but most of them won't unless you're into editor development.

  • The PropertyGrid has been upgraded to reflect on currently available object values in order to determine which PropertyEditor to use. Let's say you've got a Property of Type IYourInterface or object: In the previous implementation, the PropertyGrid only provided access to members of the respective member Type. The new implementation checks what kind of object is currently stored and creates the appropriate PropertyEditor based on that. You can pack a Vector3 into an object Property and will actually see a Vector3Editor now.
  • It also allows creating arbitrary objects when hitting the create button on Members with abstract or interface Types. A dialog will show up, asking you which kind of object to create.
  • PropertyEditorProviders are gone. The job is now done by adding a PropertyEditorAssignment attribute to a PropertyEditor.
  • It is now possible to launch DualityEditor using a different working directory than the one where the executable is located. This can be useful for maintaining multiple Testbeds, each with their own Data directory, or plugins.
  • PreviewGenerators, FileImporters and DataConverters no longer need to be registered in the CorePluginRegistry anymore. It's done using Reflection now.
  • DesignTimeData is no longer accessible using CorePluginRegistry, but instead using static methods in DesignTimeDataObject.
  • EditorActions have been refactored to be based on inheritance rather than configured delegates. They no longer need to be added to the CorePluginRegistry, but are detected using reflection.
  • In fact, CorePluginRegistry has been removed completely, and all classes have been moved from Duality.Editor.CorePluginInterface to Duality.Editor.
  • The default editor plugin known as EditorBase has been split up into a lot of smaller plugins. Besides EditorBase, which carries a lot of general stuff like PropertyEditors, DataConverters and EditorActions, there is now one distinct editor plugin for each module, i.e. CamView, LogView, SceneView, ProjectView and ObjectInspector. Each of them can be replaced, removed or improved separately without affecting any other, since there is no connection between any of these editor plugins.
  • There is now a generalized API for highlighting objects in the editor, similar to the one for object selection. It is currently used for focusing objects in the CamView and highlighting nodes in SceneView and ProjectView. To highlight an object, simply call DualityEditorApp.Highlight(..), to react to a highlight request, subscribe to the appropriate DualityEditorApp event.

These are a lot of changes, but I think that the overall code quality and learning curve for the editor has improved a lot in these last weeks. I hope this will help all of you getting into editor programming easier and encourage you to improve the existing toolset on your own :)

Author:  Adam [ 2014/03/10, 22:27 ]
Post subject:  Re: It's "Let's break everything"-Saturday

Hey guys,

I'd like to bring attention to this issue I have just filed. If anyone will seriously miss MetaFormats or the ResourceHacker, please post here or comment on the issue.

Author:  Adam [ 2014/03/24, 17:52 ]
Post subject:  Re: Duality Development Report

Overall project maintenance appears to be the headline of most commits in the last weeks. This time, I've spent some time to clean up the GitHub repository and restructure its dependencies. Additionally, there have been some minor improvements to Duality itself.

  • Added ReadObject / WriteObject convenience methods to the Formatter class, which allow to load and save arbitrary data using Duality serialization in a one-liner.
  • Removed the whole MetaFormat API from Duality, including the format itself as well as MetaFormatter classes.
  • Simplified the serialization class structure. There are only Formatter, XmlFormatter and BinaryFormatter now.
  • Numeric PropertyEditors now display a min / max value bar, if a reasonable range has been specified.
  • The EditorHintRange attribute now allows specifying a logical and reasonable range separately. While the editor allows you to specify any logically clamped value, it will optimize its visuals and behavior to the reasonable value range.
  • Added the Grid<T> utility class, which is a two-dimensional container class aimed to be used in Tilemaps, Inventory screens, or similarly 2D grid-aligned data.
  • It is now possible to specify whether or not VSync should be active.
  • Moved all example projects from GitHub to Dropbox.
  • Moved all dependencies to distinct GitHub repositories, which are mapped into the Duality Repository using the Git Submodule feature.
  • Moved custom WinForms Controls to separate dependency. In case you don't want to use Duality, but some of its neat WinForms Controls, you can find them here.
  • As usual, a lot of minor Bugfixes and Tweaks

Since I want to make sure the current version is stable, not all of these changes have made it into the latest binary commit - but of course they're all on GitHub, if you want to check them out right now.

Author:  Adam [ 2014/08/18, 16:47 ]
Post subject:  Re: Duality Development Report

As posted here, there is a Duality beta version available that includes a new and shiny package management system. One thing that isn't described there is that you can actually publish your own Duality packages for everyone to download.

PM me in case you want to test that before I get around to write some official documentation on this. It's quite easy and you don't need webspace or magic to do this.

Author:  Adam [ 2014/08/19, 13:11 ]
Post subject:  Re: Duality Development Report

I have written a quick overview on publishing custom packages in the wiki. Not very thorough yet, but the main points are in there.

Author:  Adam [ 2014/08/22, 17:05 ]
Post subject:  Re: Duality Development Report

Since the Package Management Beta feedback was 100% positive so far, I have replaced the regular Duality download with the Package Management one. This should also introduce some bugfixes that weren't available in the old version.

Author:  Adam [ 2014/09/07, 15:32 ]
Post subject:  Re: Duality Development Report

Mostly working on the Cloning System rewrite lately. I would guess that it's almost done, but we'll see. Major improvements are:

  • The ability to modify cloning behavior conveniently using [CloneBehavior(...)] attributes instead of being forced to do 100% manual cloning. They will be supported both on classes and fields.
  • The ability to skip certain fields during cloning entirely using a field attribute. By default, NonSerialized will have the same effect, but the same field attribute can be used to request not skipping them. This will allow handling only a certain subset of fields in a manual clone override.
  • A lot more robust behavior when it comes to Components referencing others. It shouldn't break like the old one.
  • Very likely a noteworthy performance boost for cloning objects.

After testing and tweaking it a lot more, I will merge it back to the main branch and publish new packages, but right now, this is still experimental.

Author:  Adam [ 2014/09/16, 11:02 ]
Post subject:  Re: Duality Development Report

I have merged the cloning branch into the master branch. Everyone who isn't in the middle of a big production that can't be afforded to break short-term, feel free to pull the latest changes from GitHub.

Notable changes:

  • The new system can properly handle delegates and events, including their subscriptions.
  • It can handle any kind of inter-object reference, including Components referencing Components from different objects.
  • You can now modify cloning behavior per-object and per-field using [CloneBehavior(...)] and [CloneField(...)] flags without needing to implement custom cloning.
  • Implementing custom cloning procedures for an object no longer deactivates Duality's reflection-driven fallback, which is ideal if you just need to perform some post-clone actions. If you want to take over handling of a single field, flag that field using the [ManuallyCloned] attribute, if you want to take over everything that is declared within your class, flag the class itself with [ManuallyCloned].
  • Implementing custom cloning procedures now requires two distinct methods: One for discovering ownership by the current object, and one for copying data.
  • There are convenient "HandleXY" methods provided within custom cloning methods to automate a specific part of it.
  • Although the new system is slightly slower as a whole (~1.2x) it can still yield notable performance boosts in a lot of cases, compared to the old one, especially for objects that are relying on 100% automated cloning. Manual cloning is still faster, but the difference is a lot smaller.
  • When copying data from A to B, the new system preserves already existing objects in the target graph, if there is an equivalent in the source graph. References to child objects from B will still be valid after a CopyTo operation in most cases. This was previously only true for Components.

Breaking changes:

  • Manual cloning now uses a different interface.
  • The globally available extension methods for cloning have been renamed.
  • The CloneProvider class has changed dramatically. If you were interacting with it directly, you will need to rewrite that.
  • [NonSerialized] fields are excluded from cloning by default because they're usually irrelevant or temporary. To change this, add [CloneField(CloneFieldFlags.DontSkip)] to the field.

I have written a lot of unit tests and did a lot of manual testing, but there may still be some bugs in the new system I haven't seen yet. Please report anything suspicious, so I can have a look at it. If no severe problems are reported, I will publish a new set of Duality packages soon.

Author:  Adam [ 2014/09/30, 15:21 ]
Post subject:  Re: Duality Development Report

I have submitted an entire new set of NuGet packages that is on par with the current master branch. This means, the new cloning system is now live in the binary release as well as all those little tweaks and fixed that have sneaked in while developing it. There also has been a lot of tweaking in the physics system that now actually pays attention to not messing up unit conversions throughout its API.

Since the new binaries are out there now, I was finally able to release the new and shiny sample packages for the DynamicLighting and Steering plugins: You can now install them using the Duality package manager and will receive some new folders containing usage examples. Here's a sneak peek of what you get:

Tweaking ambient / directional lighting and moving around a point light:


Basic steering behavior and aggressiveness settings:


Page 1 of 16 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group