Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Building A Modular Trap system.

Author: Mike McGoveran
Date: 6/2/2023


The Problem:
Our procedural dungeon system will need the ability to rapidly configure and prototype  area damage zones for use with traps and enemies with area damage abilities.

The Solution(So Far):
The first step was to deconstruct what elements are needed for an area damage event:

How much Damage?
What sound does the Event make?
What is the visual Representation of the event?
Is there a Delay to the event?
Does the Event Repeat?
If so, how often does it repeat?
Does it affect the player?
Does it affect enemies?
How big of an area should this affect?

Each of these questions represents an input variable or function for the Base Environmental Hazard I would create.


Once these values are determined, we can put them all together in a way to achieve any area damage asset we want to make relatively quickly.  The first thing an Environmental Hazard should do on spawn is create a timer with a delay appropriate to the inputs collected above to call it's action function,  in my case "DoDamage." A bad name in hindsight as a more accurate name would be TriggerHazard (more on this later).  When the DoDamage function fires, we should expect a sound to play,  a Visual to play, and damage to be applied to anything in the appropriate colliders overlap.  While the Sound event will be fairly standard between each Hazard, the visuals will be considerably different. So, we will have a virtual function for PlayVisual that each hazard will need to define.


With this all in place, we can create environmental hazards like Spike Traps And Rock Fall effects from enemies.


Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.