The Parts and Whole: Overview

From The DarkMod Wiki
Revision as of 22:07, 26 April 2022 by Geep (talk | contribs) (→‎Other Techniques that Affect Both DR and TDM: add link to Inlining topic)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

By Geep 2022

This is a work in progress. To give feedback or suggestions, see the forum thread The Parts and Whole: Discussion

As a broad theme, "The Parts and Whole" explores map objects being brought together into higher-level assemblies... their creation, navigation, manipulation, and benefits. Dark Radiant provides a number of techniques to control the visibility, selectability, and association of multiple objects. Some also can improve game performance. Here's a quick overview. Follow individual links for lots more.

Techniques that Affect DR Only

To speed up complex editing, DR provides 6 techniques to form collections of associated objects, to benefit:

  • Ease of selection and subsequent manipulation
  • Control of visibility, hiding items that obscure what you really want to see and manipulate.

These techniques do not affect your project's .map file or performance. Those that are persistent across DR sessions store their information in the map/<FM>.darkradiant file.

In a Nutshell

Technique Purpose Pros & Cons
Hide/Show Toggle visibility of selected or deselected objects. Pros: Quick & easy. Important as adjunct to "Group" and "Selection Set".
Region Define a box & temporarily hide everything that doesn’t touch it. Pros: Easy to use. Several way to define box.

Also: Can generate auto-sealed map file of region for testing, but with caveats.

Layer Assign each object to one or more named layers, based on any criteria. Then toggle layer visibility. Pros: Highly customizable. Quick layer select.

Cons: Requires active organization and management.

Filter Toggle visibility based on class name or other attributes (i.e., spawnargs). Pros: Good selection of built-in filters. Quick to use & needs no management. Custom filters possible.

Cons: Custom filters require programming.

Group Cluster objects together to select, move, or copy as group. Pros: Quick, easy, scales well to large number of Groups and of objects within.

Cons: Groups are unnamed.
Also: Stack-like (LIFO) manipulation method to love/hate.

Selection Set Cluster objects together temporarily, with naming. Pros: Consider for one-time complex editing tasks.

Cons: Lacks the persistence and fine-grained control of Groups and Layers.

Additional "Cons"

  • For all techniques that hide items: you might forget the hiding is in effect when it comes time to copy things, so you fail to copy the totality of what’s needed.
  • In the next table’s "Max # of Collections" Column: "Dozens" – typically just a few dozen - refers to practical limitations on suitability of the dropdown menu or scrollable list used to view and manipulate the list.

Characteristics

Technique Collect Items without Touching Them Collection Named Hide Collection Directly Max # of Collections Persistent (Kept Across DR Sessions)
Hide/Show X 1
Region X Export filename only Hides non-collection 1
Layer X X Dozens X
Filter X X (criteria) X Dozens X
Group No limit X
Selection Set X Dozens

Cloning Objects - The Basics

As you know, one or more selected objects are duplicated in DR simply by hitting the Space bar. They appear atop their source objects (or slightly displaced, if the "Offset cloned objects by 1 grid unit to the right and downwards" button is so toggled). Name conflicts are automatically resolved. You then drag the clones to where you need them.

Space bar is effectively a shortcut for Copy/Paste. Furthermore, you can use Copy in one DR instance and Paste in another; the duplicates will arrive at the source's map coordinates. Then you drag.

You could Copy from DR, Paste into a text editor, and save to disk. Then later reverse the process. Prefabs, next, formalizes that process, and spares you the post-paste dragging.

Prefabs

A Prefab is a set of map objects stored as a disk file, for re-use. The set is typically of moderate size and diverse but with a unifying theme, e.g.:

  • a house
  • a corridor with wall modules
  • a few AI characters and their paths, with some adjoining furniture and knick-knacks.

A Prefab file has much the same syntax and content as a Map file, but is meant for DR alone; it cannot be DMAP’d.

Upon import into DR, a Prefab is converted to its constituent objects. During this, two checkboxes provide automatic options for the objects: to re-position them around the current map insertion point, and to place them in a Group. Once inside DR, there is no longer a prefab per se.

Stock Prefabs are an important asset distribution method for TDM. Or you can make your own custom ones. It is one way to promulgate duplicates throughout your current FM, or be part of a private asset archive for all your FMs. Or shared. Prefabs may be helpful while crafting new modular architectures.

Technique Purpose Pros & Cons
Import Prefab (or RMB Insert Prefab) Inspect available prefabs (either stock TDM ones, or custom), and place in your project Pros: Can preview prefabs. On import, can control insertion and/or auto-group as desired.

Cons: Only map objects are contained in a prefab; other assets may be needed. If importing duplicates, each instance adds to map filesize and (typically) entity count.

Export Selected as Prefab Make a custom prefab, to re-use in current or future FMs, or share with others. Pros: Creates custom asset for import, e.g., duplicates in your FM

Cons: If planning to share, some extra steps recommended.

Maps

[Planned: Export Map, Export Selection as Map, Import Map, Merge Map]

Models

TBD

Other Techniques that Affect Both DR and TDM

[PLANNED coverage, except as linked]:

]