Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
quick:design [2018/05/18 21:46] pedroquick:design [2020/02/07 11:05] jesusmayoral
Line 135: Line 135:
  
 - Close the editor. Remember that behaviors are automatically saved. - Close the editor. Remember that behaviors are automatically saved.
-- Select, if needed, the `Enemy` game object and observe the behavior executor parameters. Remember that the `wanderArea` is still unestablished so the `GetRandomInArea` does not know the area where the position should be chosen from. Specifically, `GetRandomInArea` requires a game object _with a box or sphere collider_.+ 
 +If neededor if you haven't used the "InitialScene": 
 + 
 +- Select, the `Enemy` game object and observe the behavior executor parameters. Remember that the `wanderArea` is still unestablished so the `GetRandomInArea` does not know the area where the position should be chosen from. Specifically, `GetRandomInArea` requires a game object _with a box or sphere collider_.
 - Select the `Floor` game object, and add it a Box collider. Set (10, 0, 10) as its size. - Select the `Floor` game object, and add it a Box collider. Set (10, 0, 10) as its size.
 - Select the `Enemy` game object, and drag and drop the `Floor` into the `wanderArea` parameter. - Select the `Enemy` game object, and drag and drop the `Floor` into the `wanderArea` parameter.
Line 345: Line 348:
         public GameObject prefab;         public GameObject prefab;
         public GameObject wanderArea;         public GameObject wanderArea;
 +        public GameObject player;
 +
  
         public int Spawns = 750;         public int Spawns = 750;
Line 352: Line 357:
         void Start()         void Start()
         {         {
-            entities =  +            entities = new List<GameObject>(); 
-              new List<GameObject>(FindObjectsOfType(typeof(GameObject))  +            entities.Add(player);
-                as GameObject[]); +
-            entities.RemoveAll(e => e.GetComponent<BehaviorExecutor>() == null);+
             InvokeRepeating("Spawn", 0f, 1.0f / 1000.0f);             InvokeRepeating("Spawn", 0f, 1.0f / 1000.0f);
         }         }
Line 422: Line 425:
 Once the enemies have been spawn you can check the scene stats, by pressing the `Stats` button in the `Game` pannel, and see how many frames per second (FPS) are you getting, 50 in the example shown in the figure. Once the enemies have been spawn you can check the scene stats, by pressing the `Stats` button in the `Game` pannel, and see how many frames per second (FPS) are you getting, 50 in the example shown in the figure.
  
-![Performance Tasks per tick = 500](images/QuickStartGuide/PerformanceTest1.PNG "Performance Tasks per tick = 500")+{{ :images:design:PerformanceTest1.png }}
  
 One way to increase the performance without decreasing the number of spawns or making modifications to the behavior tree is to modify the field `Max Task Per Tick` of the `Behavior Executor` component of the `Enemy prefab`, by default its value is 500. Set it to `1`, play the scene again and see how it affects performance. In this case our frame rate increases up to 65 FPS without apparently affecting the observed behavior of the enemies. One way to increase the performance without decreasing the number of spawns or making modifications to the behavior tree is to modify the field `Max Task Per Tick` of the `Behavior Executor` component of the `Enemy prefab`, by default its value is 500. Set it to `1`, play the scene again and see how it affects performance. In this case our frame rate increases up to 65 FPS without apparently affecting the observed behavior of the enemies.