- Joined
- Jun 17, 2007
- Messages
- 1,433
How to Reduce game play lag
By hvo-busterkomo
By hvo-busterkomo
1. Give variables initial values instead of setting them in a trigger.
Bad:
-
Melee Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set Var[1] = 1
-
Set Var[2] = 1
-
Set Var[3] = 1
-
Set Var[4] = 1
-
Set Var[5] = 1
-
Set Var[6] = 1
-
Set Var[7] = 1
-
-
-
Melee Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
For each (Integer A) from 1 to 7, do (Actions)
-
Loop - Actions
-
Set Var[(Integer A)] = 1
-
-
-
-
2. Avoid using variables when unnecessary
Bad:
-
Melee Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set Random = (Random integer number between 1 and 2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Random Equal to 1
-
-
Then - Actions
-
Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-
-
Else - Actions
-
Unit - Create 2 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-
-
-
-
-
Melee Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Random integer number between 1 and 2) Equal to 1
-
-
Then - Actions
-
Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-
-
Else - Actions
-
Unit - Create 2 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-
-
-
-
-
Events
-
Map initialization
-
Conditions
-
Actions
-
Unit - Create (Random integer number between 1 and 2) Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-
-
3. Only use 1 Initialization trigger
Bad:
-
Melee Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set Var[1] = 1
-
-
-
Melee Initialization Copy
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set Var[2] = 1
-
-
-
Melee Initialization Copy 2
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set Var[3] = 1
-
-
-
Melee Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set Var[1] = 1
-
Set Var[2] = 1
-
Set Var[3] = 1
-
-
Bad:
-
Events
-
Time - Every 0.01 seconds of game time
-
Conditions
-
(Peasant 0000 <gen> is alive) Equal to False
-
-
Actions
-
Set Random = 1
-
-
Good:
-
Events
-
Time - Every 0.03 seconds of game time
-
Conditions
-
(Peasant 0000 <gen> is alive) Equal to False
-
-
Actions
-
Set Random = 1
-
-
5. Miscellaneous Tips
Avoid the
-
Do Nothing
Also. Be sure to clean all Memory Leaks http://www.hiveworkshop.com/forums/showthread.php?t=35124
Note: This tutorial is incomplete
Last edited: