tutorial:how-drawgroups-and-displaygroups-work

How Drawgroups and DisplayGroups Work

Authors: Thegreatgramcracker

TL;DR: Drawgroups are the groups that are used for drawing objects. Displaygroups are the groups you get from walking on collision which say which drawgroups to draw.

Every part (map piece, collision, object, enemy, and player) in a map has it's own collections of groups used to determine if that part will be enabled based on the collision the player is standing (known as Drawgroups), and in the case of collision, also include the groups inherited by the player standing on it for what they will have enabled (known as Displaygroups).

The term “enabled” in this context means that it is both rendered and updated. If a part is not enabled, it is not drawn (rendered) by the game nor is it updated (for things such as playing animations, running AI/talk scripts, etc).

Therefore, when editing maps, it is very important to match the groups of nearby parts when placing down new parts, in order to avoid issues with your edits not being displayed.

It's also important to know for creating new maps if you wish to optimize how many things need to be loaded at a given time. Note that Elden Ring does NOT use this system of Drawgroups and Displaygroups for the overworld map, rather it loads things in chunks at different levels of detail based on the chunk you currently occupy.

However, it does use them in most legacy dungeons, and every game Demon's Souls onwards also uses the draw/display group system.

The easiest way to view these groups is in DSMapStudio/Smithbox. Click on any map part and go to your “Render Groups” window. You will see a big 32×4 matrix of checkboxes like this:

Likely if you clicked a map piece then you will see some checkboxes highlighted green. If you clicked collision then you may see some highlighted red or yellow. These represent the bits of the objects 4 draw and display groups, each being 32 bits long. The actual values of the Drawgroups and Displaygroups in the part's properties are the 32 bit unsigned integer representation of these bits, but since we are more concerned with the individual bits, the “Render Groups” window makes it easier to read and adjust these values. This is what each symbol in this menu means:

  • Checkmark: In DSMapStudio, you are choosing to render parts that have this bit enabled in their Drawgroups. Can be toggled on and off with a click.
  • Green: Selected part has this bit in it's Drawgroups enabled. Use the “Get Draw” button to set your checkmarked bits to the bits that this object has set for it's drawgroups, and the “Assign Draw” button to set all checkmarked bits to ON and all not checkmarked bits to OFF.
  • Red: Selected part has this bit in it's Displaygroups enabled. Use the “Get Disp” button to set your checkmarked bits to the bits that this object has set for it's displaygroups, and the “Assign Disp” button to set all checkmarked bits to ON and all not checkmarked bits to OFF.
  • Yellow: Selected part has this bit in both it's Drawgroups and Displaygroups enabled.

Now, for the meat and potatoes, how do these groups actually work? It's quite simple, but can produce confusing results if you aren't sure what everything means. The render group system is thus:

  • The player and enemies inherit the Drawgroups that are set on the collision they are currently standing on, and, in the case of the player, they also inherit Displaygroups.
  • Any part which has a bit in it's Drawgroups that matches any bit in the Displaygroups that the player currently has will be enabled. If there are no overlapping groups, it will be disabled.

Simple, right? But there are some easy pitfalls that can happen due to the logic of the system, and some special cases I'll go over.

Pitfalls:

  • If you walk on to collision that doesn't display any of it's own drawgroups, you will inherit those groups, thus disabling your own character and softlocking the game. To avoid this, make sure every collision has at least one drawgroup that is shared with it's own displaygroups (if you see a box highlighted in Yellow in DSMapStudio, you're good).
  • If you have two collisions that the player can transition between, and each do not have displaygroups that draw each other, you will blink out of existence for a frame or two as you transition between them, since for a few frames you seem to have the drawgroups of the new collision you walked on but the displaygroups haven't been inherited yet. To avoid this, ensure that adjacent collisions draw each other in addition to themselves.

Note that you can walk onto collision that is not currently being drawn, since even if it's not rendered or updated, collision still continues to function (otherwise there could be situations of enemies thinking they are falling for a second before being disabled).

Special Cases:

  • CollisionName Property: For objects and enemies, this sets the initial state of their Render Groups to be the same as the specified part name, which can be either a map piece or collision. Convenient for not having to manually set the groups to be the same. Objects will keep their inherited groups permanently but enemies will eventually inherit them automatically from the collision they are standing on.
  • It seems having no bits set in the drawgroups for a part will make it always appear.
tutorial/how-drawgroups-and-displaygroups-work.txt · Last modified: by admin