Go Back   Gamerz-Forum.Com > Gaming > Warcraft 3

Warcraft 3 The Famous Blizzard Game - Warcraft 3 and Warcraft 3: The Frozen Throne This Forum Includes Map Dev/Modding.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-29-2008, 08:22 PM
Knight7770's Avatar
Dark Imperium
 
Join Date: Apr 2008
Posts: 61
Credits: 26
Downloads: 0
Uploads: 0
Knight7770 has got alittle rep (5+)
[Tutorial] Triggering Efficiency

Tutorial - Basic Triggering Efficiency


What is triggering efficiency?
Triggering efficiency is generally using fewer lines of code to perform the same task. This can reduce map size, lag, and waste-of-time syndrome.

An example of a very inefficient trigger:

Code:
E: 
Unit enters Region<gen>
C: 
(Triggering unit) equal to Unit 001<gen>
A: 
Set LeakPoint = Position of (Triggering unit)
Unit - Create 1 Footman at Leakpoint, facing Default Building Facing degrees
Unit - Create 1 Footman at Leakpoint, facing Default Building Facing degrees
Unit - Create 1 Footman at Leakpoint, facing Default Building Facing degrees
Unit - Create 1 Footman at Leakpoint, facing Default Building Facing degrees
Unit - Create 1 Footman at Leakpoint, facing Default Building Facing degrees
Unit - Create 1 Footman at Leakpoint, facing Default Building Facing degrees
Unit - Create 1 Footman at Leakpoint, facing Default Building Facing degrees
Custom script: call RemoveLocation(udg_LeakPoint)
Why is this trigger inefficient? It doesn’t have any leaks.
This trigger is inefficient because you can do the same thing like this:

Code:
E: 
Unit enters Region<gen>
C: 
(Triggering unit) equal to Unit 001<gen>
A: 
For every integer A from 1 to 7, do:
	Set LeakPoint = Position of (Triggering unit)
	Unit - Create 1 Footman at Leakpoint, facing Default Building 	Facing degrees
	Custom script: call RemoveLocation(udg_LeakPoint)
Note how this trigger does the same thing as the previous one, but is much shorter. This is trigger efficiency.

Another example of trigger inefficiency is when you have several triggers with the same event, and similar conditions and actions. For example, if you have a folder of triggers for a dice roll, and one trigger for each possible roll, that is very inefficient. What would be better would be something like this:

Code:
E: 
[Whatever activates the dice roll]
C:
A:
If (All Conditions are true), then do (Then actions), else do (else actions)
	If - (All conditions are true)
		DiceRollInt equal to 1
	Then -
		[Insert actions here]
	Else - 
If (All Conditions are true), then do (Then actions), else do (else actions)
	If - (All conditions are true)
		DiceRollInt equal to 2
	Then -
		[Insert actions here]
	Else - 

If (All Conditions are true), then do (Then actions), else do (else actions)
	If - (All conditions are true)
		DiceRollInt equal to 1
	Then -
		[Insert actions here]
	Else - 
If (All Conditions are true), then do (Then actions), else do (else actions)
	If - (All conditions are true)
		DiceRollInt equal to 3
	Then -
		[Insert actions here]
	Else - 
If (All Conditions are true), then do (Then actions), else do (else actions)
	If - (All conditions are true)
		DiceRollInt equal to 4
	Then -
		[Insert actions here]
	Else - 
If (All Conditions are true), then do (Then actions), else do (else actions)
	If - (All conditions are true)
		DiceRollInt equal to 5
	Then -
		[Insert actions here]
	Else - 
…
Although this is long, it is more efficient than having one trigger for each If/Then/Else statement.


More examples of trigger inefficiency are:
•Having several units stored in their own variables and then ordering them to do the same actions.
•Fixing leaks that do not exist.
•Having lines of code that essentially do nothing.
More to come…


The respective solutions to those problems are:
•Add the units to a unit group variable and order that unit group to do the actions.
•Make sure you know what leaks and what doesn’t
•Remove those lines of code.
More to come…


For questions or comments, please do not send me a PM. Post them in this thread.
__________________
Have you heard of [Only registered and activated users can see links. ]? You will once you click that link :rolleyes:
Reply With Quote
  #2 (permalink)  
Old 04-29-2008, 09:39 PM
DarkF0x's Avatar
Regular (Got the Tee)
 
Join Date: Mar 2007
Location: SF CA
Posts: 89
Credits: 71
Downloads: 0
Uploads: 0
DarkF0x has got alittle rep (5+)
Nice tutorial but isnt this in the wrong section?
__________________
Selling Bera Server Mesos. $.75USD/Mil pm if wanna buy
[Only registered and activated users can see links. ]
Reply With Quote
  #3 (permalink)  
Old 04-29-2008, 09:50 PM
Knight7770's Avatar
Dark Imperium
 
Join Date: Apr 2008
Posts: 61
Credits: 26
Downloads: 0
Uploads: 0
Knight7770 has got alittle rep (5+)
It must be approved to be in the Tutorials section.
Thanks
__________________
Have you heard of [Only registered and activated users can see links. ]? You will once you click that link :rolleyes:
Reply With Quote
  #4 (permalink)  
Old 05-06-2008, 04:23 PM
Oninuva's Avatar
Ownage
 
Join Date: Jun 2006
Location: The US & A.
Posts: 3,055
Downloads: 0
Uploads: 0
Oninuva is a glorious beacon of light (75+)
The trigger isn't more efficient if it uses "for every integer A..."

It would be easier to make but for the game, it takes more time to execute or run because of the extra integer it has to generate everytime instead of just running through 7 actions. With the "for every integer A..." function you are running through 15 functions.
__________________
Oninuva
Gamerz-Forum Admin
Reply With Quote
  #5 (permalink)  
Old 06-27-2008, 10:24 PM
Novice (Hey I am Trying to Leech)
 
Join Date: Jun 2008
Posts: 2
Credits: 2
Downloads: 0
Uploads: 0
tontan has got alittle rep (5+)
Thank you for posting that article there.It really helped because I'm still learning this game.I'm very curious because all of my friends enjoyed playing this.
Reply With Quote
  #6 (permalink)  
Old 07-01-2008, 05:57 PM
HolyPaladin's Avatar
The Ultimate
 
Join Date: Jun 2006
Location: GamerzForum :)
Posts: 271
Credits: 57
Downloads: 0
Uploads: 0
HolyPaladin almost there! (45+)
Quote:
Originally Posted by tontan View Post
Thank you for posting that article there.It really helped because I'm still learning this game.I'm very curious because all of my friends enjoyed playing this.
Don't you mean it help you learn to map
__________________
Welcome to my Lair.
Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 11:47 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.1 ©2007, Crawlability, Inc.
Template-Modifikationen durch TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios