One of the challenges we faced in Dungeon Defenders II was creating interesting defenses that did not restrict our map design. While many defenses have no problem being placed on bridges, hills, or other sources of uneven terrain in our maps, there are a few that needed some additional tweaks. Today I’d like to discuss some of the steps we’ve taken to help our traps and auras look good on any type of terrain.
In the original Dungeon Defenders, traps were just a decal on the ground. We decided to actually design the physical traps in DD2 so the effects would come from an existing structure. Unfortunately, a physical object designed to lay flat always assumes the ground is level, so it won’t look as good on uneven terrain. This results in object clipping.
For the Huntress's traps, we were able to fix this problem by aligning the trap to something called a surface normal. What this means is when you place a Blaze Balloon trap (for example) on a set of stairs, it automatically rotates to align itself with the surface underneath it. Once the defense has been adjusted, its visual effects still play in something called world space, which basically means up is up, so you won't have the balloon floating off sideways.
DD1 auras were an interesting problem to solve.
We didn’t want to re-use the domes because of how much it visually overwhelmed the map. After careful experimentation, we re-purposed the dynamic decals we used for traps in the original Dungeon Defenders. This allowed the auras to be projected on and conform to any surface, which was really nice. Problem solved.
The one issue we ran into was with the Lightning Aura. This defense is meant to shoot bolts of lightning toward the ground, but unfortunately it assumes a flat surface. While everyone on the team loved our initial pass, we had to get creative with our tweaks to make it conform to our design rules.
We solved this by using another Unreal system called beams. A beam works by procedurally creating geometry between two endpoints, one of which is always at the top of the defense. The other one we fire off into the world to detect the nearest surface it can interact with. Not only does this help simulate how lightning functions in the real world, but it helps the Lightning Aura that understands the surface, regardless of the location it is placed.
Defenses orienting to and understanding the surfaces they’re placed upon is just the beginning. We have several other cool systems that give defenses more interesting and distinctive effects once they’re placed in the map. I look forward to sharing what we have learned and how we applied it in the future.
-Brian Goodsell, VFX Intern
The random winner of our Environmental traps blog is Ubara-tutu!
Leave a comment to get your hands on the Dungeon Defenders II pre-alpha. We’ll pick a random poster and reveal the winner in our next blog post!