I agree with everything you say. Then again. My tutorial isn't finished yet. This all falls in part 2 of my tutorial which I am still putting together due to the amount of detail I want to put into this subject.
I will explain in detail how to avoid getting a "Sea of variables".
Please be patient and give me time to write part 2.
How to organize your triggering to be as efficient as possible.
How to make your coding more flexible and clean.
We will go over some basic coding knowledge: Records, Action definitions, etc...
Well lets get to it!
Part 1
Organization
First off I'd like to go over some of the main reasons why organization in your triggering is one of the most important aspect.
Keeping your codes organised through folders and labeling them correctly (by name and label Icon) can help you find information in your map better. This will speed up your coding time because you will not have to search for well... anything.
So lets take a look at what a very well organised map would look like.
Here we see the main folder of the map named: The Battle of Terratonix.
Inside we see four folders. Each folder is very straight forward as to what is inside. So let's go ahead and open the folders up and let's see whats inside.
Inside our function folder. We have action, conditions and events folder. Placing your triggers like this is very good because everything of relevance is very easily found.
So I think its pretty clear where I am going with this. So lets open up some more folders and look how everything else is referenced.
As you can see everything is really detailed about what is inside. Making sure everything is at one place is key to finding what you are looking for quickly.
How do you set the icon's for your folders?
Right-click on the folder you want to set an Icon to. Then go down to Label and select the one you think is appropriate.
If you are comfortable with the standard green folder icon that is fine too but having an icon helps you spot that folder faster than with just the name in a sea of green folders. lol...
So is there anything else I can do/need to know to speed up my coding?
Personally, I hate having to right-click and select what type of element I want to create. So I learned all the short-cuts and it helps, A LOT.
Short list of the most useful Short-cuts
New Element: CTRL-W
(This is the most used Short-cut. I use it when I want to add a parameter to a function or when I want to create the previously created item. Yes if you make a folder then press CTRL-W, it will create a new one.)
Create Record: CTRL-U
Create Variable: CTRL-B
Create Folder: CTRL-G
Create Comment: CTRL-/
Create Action Definition: CTRL-ALT-R
Organization Conclusion
So in other words. Keep all your variables in one folder and specify what they are linked to with other folders and comments. Same for triggers, actions, etc...
===================
Part 2
Keeping your code clean.
Read me first
I'm not enforcing my way to code on anyone. This is my own personal method, if you have a better method that you think is better, more power to you. Please let me know if there is anything I should re-phrase or remove.
==========
First and foremost: You need to develope a coder's perspective. Coders, like all humans, are lazy. While making your triggers, use your lazyness to your advantage. You need to think and make everything as flexible as possible. You need to try and use the least amount of scripts to get the result you are after.
"Coding is like writing an essay. Except in this case the shorter the essay, while still getting the point across, the higher the grade. The less time the CPU takes "reading" the essay the more time it has to do other things."
-FockeWulf
First we start with an event (ie. something happends!!!). Each event has variable inputs (ie. Triggering player) that can be aquired depending on what event has taken place.
ie.: An event triggers and then we can then run action definitions to filter and manipulate data inputs to use in "actions" to do something (ie. like create a unit).
ie.: For instance: the "Dialog item is used" event. We can use this to trigger a chain of events that can result in anything from casting spells to declaring war. Okay, so pretty basic stuff right?
Now something that I've seen in a lot of maps is multiple triggers with the same event.
Two or more differant triggers like this can lead to inefficient execution. I have also seen this along with hundreds of unique variables.... This is, and I am sorry to say, wrong. We are going to see how we can use only 1 trigger with a unique event (that is no 2 triggers have the same event) to affect every system in the game.
We are going to remove that "Sea of variables" and replace it with an organised variable database that all your friends will envy! Lets get started!
In part 1, I covered the basics of organising your codes. Your coding should evolve around your organisation. Understand that, in time,
as your project gets bigger it gets harder and harder to keep track of everything. While this is true; there are many ways to optimize your coding
to reduce the growing mess you have been getting by adding more and more data into your map.
Records
If you already know what "Records" are you can skip ahead. Of course a nice refresh is always nice. :)
These cannot be used in every situation but they are extremely helpful in most situations. Records group variables together and lets us work cleanly and orginized. Frankly, I use them for almost everything. To understand the real power behind Records, we need to understand arrays.
A variable with an array of three is exacly the same as four separate variables with the same type. (Four because 0 counts as 1. So from 0 to 3 = 4).
"To give an extremely simple understanding of arrays, imagine a game of tic-tac-toe. There are 9 boxes right? This is what is called a 3x3 array. Each box can have a piece of information stored in them. This information can be of many different types. The difference is that instead of having to use 9 variables for 9 different things now we can use 1 for the 9. The method we use to locate the particular "box" the data is stored in or will be stored in is via it's "index". In a 3x3 array, the index [2][2] means the middle box. Arrays in StarCraft 2 can go up to 4 dimentions (the tic-tac-toe being a 2 dimensional array) so a tremendous amount of data can be stored. The fewer the variables the more efficient the execution."
-FockeWulf
Here we see a "Dialog" variable with an "array" of three. Right under we see four separate "Dialog" variables. Those two are basically the same thing. This is what "arrays" are. They create separate values of the same variable which we can later recall by inputing a value in the "array's index". The essence of arrays comes down to how the computer uses the RAM. For those of you who are novices in this field, all you really need to know is that arrays are better than a lot of single variables. Eventually you will get used to it.
This is where records come in. When you set up your record, you have to link it to a variable. That variable can have arrays. So lets go ahead and create a dialog record.
Here we have our record and I have stored some variables in it already. On the right you see the variable linked to the record. It has two arrays. One of 14 and one of 20. The first one represents the player and the second one represents which dialog we want to use. What this means is, for every PlayerID index and every DialogID index I have a separate record created. Each instance has one dialog variable and one dialog item variable with an array of 20.
Okay that is all very nice, but how is this useful?
We can use this technique to store multiple dialogs into one record. Making our code both less clutered and more efficient.
Action Definition's & Parameters
I have to say: I love Action Definition's. They make coding for this game really fun. They are used to filter through data and apply action's according to the values of the input variables. They act as plugin-scripts into a trigger and give you much more flexability with trigger execution.
Lets stay we have four dialogs, each for a differant system. Obviously we want our dialogs to have functionality so the "Dialog item is used event" comes into play in a single trigger instead of four separate triggers.
Here we see that I used the action definition twice with a differant value at the end. This value represents a dialog.
Now remember this map isn't finished, but it is pretty far in its development nonetheless. So now we only use one trigger to control the actions of all the dialogs. Nice. Lets go see how the action definitions for this are generally set up.
Note the name of the action definition. It starts with a +. This allow's me to quickly show my actions in the new action menu.
It is still very indirect as to what I'm going to do with the action definition.The name is quite simple, +Dialog item is used. We have three parameters: one that get's the dialog item ID from the trigger that fired. One that refers to the player (PlayerID) and an other that dictates which dialog to perform actions on.
Parameters
Parameters act as gateways between triggers and functions (Action definitions, conditions, functions, etc). They allow outputs from the event of a trigger to be used in a function. So for instance: often times you will want to reference exactly what player caused the event and use it in a function to preform some actions.
So let's break down what happends.
We have the parameters DialogID (To reference what dialog), PlayerID (to get the player who caused the event) and a constant, TrueID, which we will go over soon.
"Used dialog Item" is used as an input for the "Which Item?" parameter
"Triggering Player" is used as an input for the "PlayerID" parameter
"TrueID Action bar" is an integer constant. I have used the value "1" for this. I've set it in my DialogID parameter.
Note: Notice the "Create Thread" next to action in the options section of the action definition. Create thread essentially means that the trigger will not wait for the action definition execution to complete. This is the key that allows you to run dozens of functions in a single trigger. This makes for very effecient script execution thus making it a very powerful tool.
There are cases where "Create Thread" must not be used.
ie. Say you have a trigger in which you have an action definition that you created that runs actions that are required to have finished executing before the rest of the trigger you originally ran can continue executing. Checking the "Create Thread" option would make it that when you call that action definition, every actions that run in that thread are independent of the original trigger thread thus letting your original trigger thread finish executing and since you needed the values that were executed in a separate thread to continue the trigger you will get errors.
Why is this important?
"Only one trigger can run at a time. All of the triggers in a map have to execute in the same "thread" because of how StarCraft 2 is coded. Only Blizzard can change this. Google "multi-threading" to get a better definition. What matters for you is that effecient script execution in StarCraft 2 boils down to how few triggers you can use in a map. In many cases its better to do things in the data editor where this single thread limit does not exist. But the data editor is extremely confusing and rather buggy and many map makers prefer to do as little as possible in it. Also for things like first and third person movement systems and shooters: "create thread" is what allows them to be possible at all. Do not underrate this aspect."
-FockeWulf
So what did we accomplish?
Most people would have a separate trigger controling each dialog. This is not efficient and certainly not clean at all. Filtering the data with action definitions is the best way to keep your code clean and efficient.
We used one trigger to affect multiple dialogs. We used action definitions to filter the data efficiently and execute actions with the minimal amount of "clock time" on the CPU.
So what did we learn so far?
We learned that it is possible to make a map using on 1 trigger per event to filter through data to execute the appropriate actions to multiple aspects of your map.
We also learned that keeping a well orginized trigger and data tree makes for better and more effecient script execution. This means less potential for latency in your map.
If this unit is from wow, I must have missed it in the 6 years I've played. This looks like its completely fan made. If not I have no clue where this is from. Freaking boss. Can I have permission to use this model in my 4 player instance styled map?
First and I don't mean to be rude, get a better computer or lower your settings (if that doesn't work go back to buy a better computer)
Second, triggering is like data. You need to link everything together and you need to know how the tools at your disposal work. (Ex.: While, For each integer loops, Records, Arrays, etc...)
Knowing your way around the editor is key to success. Practice makes perfect. If you ever want help with triggering I'd be more than happy to show you what I know. Good luck!
Four players unite to live threw The Battle of Terratonix. Use your abilities together to defeat this instance styled map.
What are the goals of this map?
To create a fast paced co-op instance styled game.
Are there any items or levels?
I want to create a game that is as light weight as possible. There for I don't want to use items or levels in this map.
Why?
While adding items and levels to the abilities is fun in RPG's. They take some time away from the action which I don't want in the gameplay. Bosses will have abilities that will require the player to move a lot. I want every ability from every player unit to be useful in someway or an other to an other player in a certain situation. While the maps are in the sc2 setting. The scripted feel from the bosses will resemble WoW's bosses a lot.
Will there be a sequel?
I don't think so. I just want to release a 15 to 20 minute action packed map for everyone to enjoy.
What kind of work has been done on the map already?
A lot of trigger work has been done already. While its far from finished, I plan to have around 80% of the triggering done this weekend.
Some data work has already been done as well but there is still a lot to do on that side.
Alright. That's all very interesting but why are you posting here?
I'm looking for someone to help out with the data side of the map. I'm a pretty good trigger artist but I'm afraid my data skills are lacking.
I'd like someone that has some experience with making complex spells and that isn't afraid of making one.
So what is there left to do on your project?
Trigger wise; Some systems still need to be built but I got it well in hand. Just needs time.
Data wise; I need to design 3 or 4 more abilities for the Marine type unit as well as the firebat styled unit and the marauder styled unit. The medic could maybe use 1 or 2 more.
I also need some boss abilities. Spells that would require the player to dodge certain items or walls of energy. For more information on this please contact me.
==========
While I know this may not look like much. There is a lot of functionality that I am adding in the background.
I din't want anything fancy for my dialogs. Just something that works.
0
Tutorial has been completed. Enjoy!
0
@Siretu: Go
I agree with everything you say. Then again. My tutorial isn't finished yet. This all falls in part 2 of my tutorial which I am still putting together due to the amount of detail I want to put into this subject.
I will explain in detail how to avoid getting a "Sea of variables".
Please be patient and give me time to write part 2.
Thank you for your input.
0
I will use any tools needed to help. Teamview, teamspeak, ventrilo, skype. Whatever. I want to help!!!
Note: I really just want to help my fellow mappers. I will be more than happy to help ANYONE with any trigger problem what so ever!
0
Reserved!
Video Version TBD
0
@AtikLYar: Go
lol That's why I never saw it. Wasn't playing during that expansion lol..
0
Keeping your code clean and organised
Hi there.
As stated in the title we will be covering;
How to organize your triggering to be as efficient as possible.
How to make your coding more flexible and clean.
We will go over some basic coding knowledge: Records, Action definitions, etc...
Well lets get to it!
Part 1
Organization
First off I'd like to go over some of the main reasons why organization in your triggering is one of the most important aspect.
Keeping your codes organised through folders and labeling them correctly (by name and label Icon) can help you find information in your map better. This will speed up your coding time because you will not have to search for well... anything.
So lets take a look at what a very well organised map would look like.
Here we see the main folder of the map named: The Battle of Terratonix. Inside we see four folders. Each folder is very straight forward as to what is inside. So let's go ahead and open the folders up and let's see whats inside.
Inside our function folder. We have action, conditions and events folder. Placing your triggers like this is very good because everything of relevance is very easily found. So I think its pretty clear where I am going with this. So lets open up some more folders and look how everything else is referenced.
As you can see everything is really detailed about what is inside. Making sure everything is at one place is key to finding what you are looking for quickly.
How do you set the icon's for your folders?
Right-click on the folder you want to set an Icon to. Then go down to Label and select the one you think is appropriate.
If you are comfortable with the standard green folder icon that is fine too but having an icon helps you spot that folder faster than with just the name in a sea of green folders. lol...
So is there anything else I can do/need to know to speed up my coding?
Personally, I hate having to right-click and select what type of element I want to create. So I learned all the short-cuts and it helps, A LOT.
Short list of the most useful Short-cuts
Organization Conclusion
So in other words. Keep all your variables in one folder and specify what they are linked to with other folders and comments. Same for triggers, actions, etc...
===================
Part 2
Keeping your code clean.
Read me first
I'm not enforcing my way to code on anyone. This is my own personal method, if you have a better method that you think is better, more power to you. Please let me know if there is anything I should re-phrase or remove.
==========
First and foremost: You need to develope a coder's perspective. Coders, like all humans, are lazy. While making your triggers, use your lazyness to your advantage. You need to think and make everything as flexible as possible. You need to try and use the least amount of scripts to get the result you are after.
"Coding is like writing an essay. Except in this case the shorter the essay, while still getting the point across, the higher the grade. The less time the CPU takes "reading" the essay the more time it has to do other things."
-FockeWulf
First we start with an event (ie. something happends!!!). Each event has variable inputs (ie. Triggering player) that can be aquired depending on what event has taken place.
ie.: An event triggers and then we can then run action definitions to filter and manipulate data inputs to use in "actions" to do something (ie. like create a unit).
ie.: For instance: the "Dialog item is used" event. We can use this to trigger a chain of events that can result in anything from casting spells to declaring war. Okay, so pretty basic stuff right?
Now something that I've seen in a lot of maps is multiple triggers with the same event. Two or more differant triggers like this can lead to inefficient execution. I have also seen this along with hundreds of unique variables.... This is, and I am sorry to say, wrong. We are going to see how we can use only 1 trigger with a unique event (that is no 2 triggers have the same event) to affect every system in the game. We are going to remove that "Sea of variables" and replace it with an organised variable database that all your friends will envy! Lets get started!
In part 1, I covered the basics of organising your codes. Your coding should evolve around your organisation. Understand that, in time, as your project gets bigger it gets harder and harder to keep track of everything. While this is true; there are many ways to optimize your coding to reduce the growing mess you have been getting by adding more and more data into your map.
Records
If you already know what "Records" are you can skip ahead. Of course a nice refresh is always nice. :)
These cannot be used in every situation but they are extremely helpful in most situations. Records group variables together and lets us work cleanly and orginized. Frankly, I use them for almost everything. To understand the real power behind Records, we need to understand arrays. A variable with an array of three is exacly the same as four separate variables with the same type. (Four because 0 counts as 1. So from 0 to 3 = 4).
"To give an extremely simple understanding of arrays, imagine a game of tic-tac-toe. There are 9 boxes right? This is what is called a 3x3 array. Each box can have a piece of information stored in them. This information can be of many different types. The difference is that instead of having to use 9 variables for 9 different things now we can use 1 for the 9. The method we use to locate the particular "box" the data is stored in or will be stored in is via it's "index". In a 3x3 array, the index [2][2] means the middle box. Arrays in StarCraft 2 can go up to 4 dimentions (the tic-tac-toe being a 2 dimensional array) so a tremendous amount of data can be stored. The fewer the variables the more efficient the execution."
-FockeWulf
Here we see a "Dialog" variable with an "array" of three. Right under we see four separate "Dialog" variables. Those two are basically the same thing. This is what "arrays" are. They create separate values of the same variable which we can later recall by inputing a value in the "array's index". The essence of arrays comes down to how the computer uses the RAM. For those of you who are novices in this field, all you really need to know is that arrays are better than a lot of single variables. Eventually you will get used to it. This is where records come in. When you set up your record, you have to link it to a variable. That variable can have arrays. So lets go ahead and create a dialog record.
Here we have our record and I have stored some variables in it already. On the right you see the variable linked to the record. It has two arrays. One of 14 and one of 20. The first one represents the player and the second one represents which dialog we want to use. What this means is, for every PlayerID index and every DialogID index I have a separate record created. Each instance has one dialog variable and one dialog item variable with an array of 20.
Okay that is all very nice, but how is this useful?
We can use this technique to store multiple dialogs into one record. Making our code both less clutered and more efficient.
Action Definition's & Parameters
I have to say: I love Action Definition's. They make coding for this game really fun. They are used to filter through data and apply action's according to the values of the input variables. They act as plugin-scripts into a trigger and give you much more flexability with trigger execution.
Lets stay we have four dialogs, each for a differant system. Obviously we want our dialogs to have functionality so the "Dialog item is used event" comes into play in a single trigger instead of four separate triggers.
Here we see that I used the action definition twice with a differant value at the end. This value represents a dialog.
Now remember this map isn't finished, but it is pretty far in its development nonetheless. So now we only use one trigger to control the actions of all the dialogs. Nice. Lets go see how the action definitions for this are generally set up.
Note the name of the action definition. It starts with a +. This allow's me to quickly show my actions in the new action menu.
It is still very indirect as to what I'm going to do with the action definition.The name is quite simple, +Dialog item is used. We have three parameters: one that get's the dialog item ID from the trigger that fired. One that refers to the player (PlayerID) and an other that dictates which dialog to perform actions on.
Parameters
Parameters act as gateways between triggers and functions (Action definitions, conditions, functions, etc). They allow outputs from the event of a trigger to be used in a function. So for instance: often times you will want to reference exactly what player caused the event and use it in a function to preform some actions.
So let's break down what happends.
We have the parameters DialogID (To reference what dialog), PlayerID (to get the player who caused the event) and a constant, TrueID, which we will go over soon.
+Dialog Item is Used((Used dialog item), (Triggering player), trueID Action Bar)
"Used dialog Item" is used as an input for the "Which Item?" parameter
"Triggering Player" is used as an input for the "PlayerID" parameter
"TrueID Action bar" is an integer constant. I have used the value "1" for this. I've set it in my DialogID parameter.
Note: Notice the "Create Thread" next to action in the options section of the action definition. Create thread essentially means that the trigger will not wait for the action definition execution to complete. This is the key that allows you to run dozens of functions in a single trigger. This makes for very effecient script execution thus making it a very powerful tool.
There are cases where "Create Thread" must not be used. ie. Say you have a trigger in which you have an action definition that you created that runs actions that are required to have finished executing before the rest of the trigger you originally ran can continue executing. Checking the "Create Thread" option would make it that when you call that action definition, every actions that run in that thread are independent of the original trigger thread thus letting your original trigger thread finish executing and since you needed the values that were executed in a separate thread to continue the trigger you will get errors.
Why is this important?
"Only one trigger can run at a time. All of the triggers in a map have to execute in the same "thread" because of how StarCraft 2 is coded. Only Blizzard can change this. Google "multi-threading" to get a better definition. What matters for you is that effecient script execution in StarCraft 2 boils down to how few triggers you can use in a map. In many cases its better to do things in the data editor where this single thread limit does not exist. But the data editor is extremely confusing and rather buggy and many map makers prefer to do as little as possible in it. Also for things like first and third person movement systems and shooters: "create thread" is what allows them to be possible at all. Do not underrate this aspect."
-FockeWulf
So what did we accomplish?
Most people would have a separate trigger controling each dialog. This is not efficient and certainly not clean at all. Filtering the data with action definitions is the best way to keep your code clean and efficient. We used one trigger to affect multiple dialogs. We used action definitions to filter the data efficiently and execute actions with the minimal amount of "clock time" on the CPU.
So what did we learn so far?
We learned that it is possible to make a map using on 1 trigger per event to filter through data to execute the appropriate actions to multiple aspects of your map. We also learned that keeping a well orginized trigger and data tree makes for better and more effecient script execution. This means less potential for latency in your map.
===================================================================
I hope you all had as much fun reading this tutorial as I had fun writing it. Please feel free to leave a comment or feedback! - DarlD
===================================================================
Special thanks to FockeWulf for his contribution to the create thread section and for correcting the English correctly!
===================================================================
Common Sense 101 - is an other tutorial covering some of the topics covered in this tutorial. Be sure to check it out. Knowledge is power!
===================================================================
Action Definitions and Advanced Triggering Made by ZeldaRules
===================================================================
0
If this unit is from wow, I must have missed it in the 6 years I've played. This looks like its completely fan made. If not I have no clue where this is from. Freaking boss. Can I have permission to use this model in my 4 player instance styled map?
0
@PatchOne: Go
Lol.
First and I don't mean to be rude, get a better computer or lower your settings (if that doesn't work go back to buy a better computer) Second, triggering is like data. You need to link everything together and you need to know how the tools at your disposal work. (Ex.: While, For each integer loops, Records, Arrays, etc...)
Knowing your way around the editor is key to success. Practice makes perfect. If you ever want help with triggering I'd be more than happy to show you what I know. Good luck!
0
Starcraft 2: Bosses & Dungeon team presents
The Battle of Terratonix,
Four players unite to live threw The Battle of Terratonix. Use your abilities together to defeat this instance styled map.
What are the goals of this map?
To create a fast paced co-op instance styled game.
Are there any items or levels?
I want to create a game that is as light weight as possible. There for I don't want to use items or levels in this map.
Why?
While adding items and levels to the abilities is fun in RPG's. They take some time away from the action which I don't want in the gameplay. Bosses will have abilities that will require the player to move a lot. I want every ability from every player unit to be useful in someway or an other to an other player in a certain situation. While the maps are in the sc2 setting. The scripted feel from the bosses will resemble WoW's bosses a lot.
Will there be a sequel?
I don't think so. I just want to release a 15 to 20 minute action packed map for everyone to enjoy.
What kind of work has been done on the map already?
A lot of trigger work has been done already. While its far from finished, I plan to have around 80% of the triggering done this weekend. Some data work has already been done as well but there is still a lot to do on that side.
Alright. That's all very interesting but why are you posting here?
I'm looking for someone to help out with the data side of the map. I'm a pretty good trigger artist but I'm afraid my data skills are lacking. I'd like someone that has some experience with making complex spells and that isn't afraid of making one.
So what is there left to do on your project?
Trigger wise; Some systems still need to be built but I got it well in hand. Just needs time. Data wise; I need to design 3 or 4 more abilities for the Marine type unit as well as the firebat styled unit and the marauder styled unit. The medic could maybe use 1 or 2 more.
I also need some boss abilities. Spells that would require the player to dodge certain items or walls of energy. For more information on this please contact me.
==========
While I know this may not look like much. There is a lot of functionality that I am adding in the background. I din't want anything fancy for my dialogs. Just something that works.
==========
Skype: Mab.youyoux
0
Hello there. As stated in the title, I am recreating the World of Warcraft quest system or at least trying to come up with a close replica.
Why post in the team Recruitment about this?
I am looking for someone else to work on this along side me. Trigger knowledge is essential.
Why are you looking for help?
While I am sure I could do this system on my own, I like to work with a team. Also having a second brain makes things a lot easier :)
Why should we help?
This project is a great learning experience to anyone who wants to learn more about triggers or test his/her coding skills.
Is this project in GUI or Galaxy?
I personally prefer to work in GUI but if you have Galaxy knowledge is a big plus!
Feel free to contact me on Skype or through PM
Skype username: Mab.youyoux
0
Yes this is all in the galaxy editor. Its going to be even nicer with a bunch of sfx!
0
You can alter data for all players or make your own threw dialog and customize it for each player.
0
@Nerfpl: Go
I prefer to help people in real time as much as possible. Sorry?
0
@madlibrarian: Go
Hope that info helped ya.
0
@madlibrarian: Go
which is why I PM'ed you. I wanted to help. ow well I guess. lol?