Trigger Design Conventions (long read ;) )

Tuxedo Templar

Member!
Joined
Aug 15, 2003
Messages
237
Reaction score
0
Location
Here!
Website
Visit site
Alright since it's too long to post (go figure, works fine at blizzforums and trickznstuff.net), I've added it as an attachment. This is the formal outline of the system I use to comment, organize, and label triggers, variables, locations, etc., which I hope will be useful to any serious mappers in handling large and complex triggers.

And remember: feedback is a GOOD thing! ;)
 

Tuxedo Templar

Member!
Joined
Aug 15, 2003
Messages
237
Reaction score
0
Location
Here!
Website
Visit site
EDIT- Ok here it is, in all its raw and double-posted glory:

I've done triggers long enough that its starting to get into motor memory for me almost, and along the way I've developed some conventions for handling to triggers, comments, trigger groupings, variable names, location names, etc.

The idea behind conventions of course is so triggers can be readable and easily managable, which even when you don't think you'll need it (i.e. a really simple, trigger-light map), you'd be surprised how much it improves efficiency to have it, especially when your map starts to grow beyond the scope you originally intended it, like mine always do (or maybe just the sheer amount of triggers in it ;)).

Anyway, this is how I do it, and I'm posting it here to share and see if there would be some use to making a standardized triggering convention of sorts. Here's how it works:
  • Trigger Conditions: Within any given trigger, you have the Conditions and Actions lists, respectively. Conditions don't really NEED a strict sortion, as they will evaluate to the same result regardless of the order the conditions are in. Nevertheless, it is always best to arrange the conditions by context, which makes it easier to identify when they will occur and where they belong (especially when debugging.) If you have a series of triggers that are intended to occur only before a given switch is set (cleared), and then another set which will occur only after that switch is set, then you would move that "Switch is set/cleared" condition to the top, as that is the underlying condition for that whole set of triggers.

    Likewise, if you have another context within a context, or more easily explained: if you have another set of triggers within the "Switch is set/cleared" set above which are activated by another unique condition, say, "Current player brings marine to location", then you would put that condition immediately below the "Switch is set/cleared" one, identifying that as the secondary context that sub-set of triggers depends on. Follow this pattern for all triggers with subsets of conditions, arranged from top to bottom, accordingly.
  • Trigger Actions: Unlike trigger conditions, actions can't always be sorted in any specific order without disrupting the trigger's functionality. Therefore the convention here is a lot simpler: all trigger comments labeling things within the trigger will be placed wherever they are needed, but disabled. Trigger comments that summarize the trigger's function (see below for more details) will uniquely describe the trigger's function in no more than one line in the editor's view (for Staredit-based editors), and will be placed at the end of the trigger's action list. Triggers with the 'Preserve trigger' action will have that at the bottom as well, but before the trigger's comment.
  • Trigger Grouping/Arrangement: Because the trigger view in staredit-based editors only seperates the trigger lists by player ownership, and can't filter/arrange by any other criteria, it helps to have a way of ordering/grouping the triggers yourself within the view to make it easier to sift through them. The convention here can vary depending on how interconnected your triggers are, or whether they are specifically designed to activate in a certain order. If there is no stringent ordering or complicated cross-dependancy involved, then arranging triggers is easy: just arrange them in order of their condition context (see above.) And for each major context, create a blank, label-only trigger (condition 'Never') with only a single trigger comment in the action list containing the name of that context (grouping) of triggers that follows below it (up until the next blank label trigger, that is.)

    However it's not always possible to get away with arranging triggers solely by conditional context, although when you can you should always try to. For when you can't, or when it's not as appropriate to do so, you can go ahead and group the triggers in order of their in-game functionality, or however else you see fit (like a group for triggers that activate for the player when the win/lose, or a group for all hyper-trigger-timed events, etc.)
  • Commenting Conventions: Trigger comments, as described above, should adaquately and uniquely describe the trigger they represent in no more than one line in any staredit-based editor. It's really a matter of getting the hang of describing trigger functions uniquely so they don't always get lumped together as rewordings of the same thing or over-abrievated descriptions, etc. I'm good at this so if you need specific help then just ask and I can give it. Beyond the descriptions though, the convention I use has a few more bits to it:

    First of all, since the vast majority of the trigger I make use the 'Preserve trigger' action in them, I mark all triggers without it by putting an underscore ('_') at the beginning of the description. I also try to put these triggers toward the top of their catagorical lists whenever possible.

Continued...
 

Tuxedo Templar

Member!
Joined
Aug 15, 2003
Messages
237
Reaction score
0
Location
Here!
Website
Visit site
...continued...

Here is the convention for labeling these types of triggers:
  • '~' = Perpetual triggers. These run until constantly until something on the outside turns them off.
  • '[ ... ]' = Hyper trigger-timed. These triggers are part of or directly controlled by hyper triggers, and if their conditions are active, will run as fast as the hyper triggers allow them to. Within the braces any combination of other labels can be used, such as the above '~' label.
  • '##' = A number, which can have two meanings: if the number is before, say, the '~' label, it specifies how many times that trigger will perpetuate during the time its running. If it is placed after the '~' label, it specifies how long (in hyper trigger 'wait's, if hyper triggers braces are provided, otherwise the units are time between each preserved trigger's default reactivation period) between each activation in the perpetual sequence the trigger will occur. Numbers can exist both before and after a given (approprate) label.
  • '? #:#' = A randomized event. The #:# part of the label specifies the chance of this trigger being the one to activate during the randomization (like a 1:8 chance this trigger will activate out of 8 other possible random combinations.) Randomization is a fairly high-level concept involving randomizing switch state(s) and linking together several randomized switches to get a randomized number range, which I will not explain here. PM me if you want to know how this works.
  • '|' = A guardian trigger. As described above, this will run only to enforce or prevent something from happening. For example, say you have a location in your map that you don't want any mutalisks to fly into. A guardian trigger would activate whenever "at least 1" mutalisk enters the location, and thus kill it. It is possible if mutalisks are constantly flying into the location that the trigger will stay active constantly, as per each activation period the "at least 1" condition will be reset anew, but unlike the '~' perpetual triggers it will ONLY run as long as the condition is artificially (that is, from an outside source) kept alive, while the guardian triggers themselves constantly seek to clear that condition. The same rules for the '##' label can apply to guardian triggers as they do to perpetuating ('~') ones.
  • '_' = As stated above, this would be any triggers that don't have a preserve trigger action, or else activate only once during the session their underlying context is active. Obviously, these cannot be combined with the '[ ... ]' or '~' labels, but they CAN be combined with the '|' guardian trigger label, to indicate the guardian trigger will only activate once per its context.
  • '__' = Similar to the above, only more specialized: these triggers will activate only once at the start of their context. For instance, if you have a trigger that will activate at the start of the map to set everyone's default player alliances, you would label it with this.
    A blank label can be substituted for triggers with '_|', for simplicity.

[*]Variable Names: Variables, in the starcraft sense, include any switches, unit death counters, score types, resources, countdown timer seconds, and even quantities of units/types of units within a given map location. Anything that holds a number or value that you can check with a trigger condition is a storage variable. However, only switches and death counters can be custom given names, for which the convention works as follows:

For switches, the name of the context they control or events they activate should be provided in 1-3 words that all fit within the switch list view, and adaquately and uniquely describe that switch's intended function. Switches can use a similar labeling convention as triggers:
  • '~' = Part of a perpetuating event. More than one trigger can use this and stay perpetuated with it, as long as their other conditions permit.
  • '? #' = Randomized event switch. Instead of the two #s in the '#:#' label shown above for triggers, the one # is the bit position of the randomized range the current switch is part of, unless it is the only randomized switch used, in which case the # is optional.
  • '- ... -' = This indicates the switch will set the ball rolling for an event sequence once set. Pretty basic.
  • '< ... >' = This indicates the switch is the owner of its own context. The name between the arrow brackets is all capitalized. A place where this would be used is, say, after the intro splash screen and after all the game settings (player alliances, vision, etc.) have been properly set, and the game is ready to begin. This sets the "game-is-running" context, which can be used by all the game triggers to tell them when they are allowed to begin doing their thing.
    A blank label can be used for all else.

[*]Location Names: Last, but not least (especially if you are using lots of locations), is this convention for naming locations. The main thing to note here is that locations are sorted in alphabetical order in their list, so it is benefitial to group all locations that function in a specific context/area/purpose under their own alphabetically-friendly catagorical label. On a side note, typing the first letter of the catagory within the list view will take you to the first location in the list with that name as its first letter. Anyway, first thing first: the labels:
  • '+' = These are mobile locations: ones that will be frequently used for "move location" operations and are generally not expected to stay stationary.
  • '|' = These are out-of-the-way locations that are used to contain something not part of the regular game. Things like computer-owned arbiters, for purposes of a recall spell, or nuke silos, for the purpose of building nukes for casting in a cutscene, for instance.
  • '##' = A numbered label, usually placed after the context name portion of the label. If there are several like locations of the same context/area/purpose that are positioned differently or are used as part of a sequence, then this identifies the position in that sequence or its place among their peers.

Here is a sample location name, using the alphabetically-friendly context name first, the number position second, and the function/location descriptor last:
  • "BOUNDARY- 02 Left Edge"


And so, that's that. I devised this system way back before I started my Starcraft TV, and refined it since, and finally actually took the time to write it down formally so I can share it with the world. I'll probably refine it further still, but for my purposes this about covers everything I usually do with my triggers, and once you get used to using it, can make things tremendously more organized and readable, especially in large mapping projects.

So, if you actually read through that :p, what are your thoughts?
 

Wing Zero

lol just as planned
Joined
Oct 27, 2002
Messages
12,206
Reaction score
16
U nasty lil spammer :p, i think this should be stikie b/c i dont understand it :( Wing=Zero Noob
 

FakeNameHere

BattleForums Senior Member
Joined
Jul 6, 2003
Messages
3,090
Reaction score
0
Website
www.battleforums.com
I never use unerscores, comments or do irregular names for locations. It may come naturally like me, but l actually remember where all the triggers and locations are when creating a map. Its easy to beacuse you are the one who named the location, and you are most likely to remember where it is. Just like playing the map itself, you will know where everything is. I name locations pretty straightforward like 'Spawn 1' and 'Spawn 2'.
 

KillerMe

BattleForums Senior Member
Joined
Jul 29, 2003
Messages
1,200
Reaction score
0
Location
Phoenix, AZ
Website
www.alm.web1000.com
I do use comments, because I find them extremely useful, but I don't put the triggers in any order except for the order that I want them to activate.

As for locations, when I make a bound, if it is the first location of the first level I will name the location 1-1, then 1-2, 1-3, ect... I also have the end of each bound level labeled by Finish Level 1, Finish Level 2, ect....

I'm sorry to say Tuxedo Templar but that system may be useful to you, but not for most other people. Most people organize locations and triggers however they want. The only reason you system would want to be used is if a lot of people are editing maps on battle.net to make a universal code system. However if you do not want people to edit your maps you could create the map, then misname all the locations, and change the names of all your triggers. I also like to throw in a trigger that is generally overlooked, but it relies on you having a non-rigged game (IE: Only 1 zergling on bound maps) that will kick all the players if it detects a change. Obviously this trigger is easy to around (or deactive) if you know where to find it.
 

Tuxedo Templar

Member!
Joined
Aug 15, 2003
Messages
237
Reaction score
0
Location
Here!
Website
Visit site
12 major completed mapping projects later is enough to be thankful for every bit of that longass convention system outline I posted, but not many people have done as much mapping as I have, or will.

For little maps like bounds and defenses and stuff, you can safely get away with spilling whatever off the top of your head and expecting your memory to be adaquate to keep up with it all. But you'd be surprised how much pain and sweat you'll save for even having a simple convention for just commenting triggers.

I think it's fair to say I push SC to its max in many of my maps... especially some of the ones I haven't released yet (some mindboggling stuff, even if I do say so myself.) If you are going to do a group project especially, then having some kind of organized structure or conventions will help out by orders of magnitude more than meer memory, especially to keep compatability when each person adds/changes stuff as they see fit.
 

New threads

Top