Differences

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

Link to this comparison view

Both sides previous revision Previous revision
gdevelop5:events:draft-optimization [2020/01/13 23:23]
silver-streak Minor grammar changes
gdevelop5:events:draft-optimization [2020/01/13 23:39] (current)
silver-streak Minor grammar changes
Line 7: Line 7:
 GDevelop 5 gives you total freedom in events. While this can be awesome, it can also be very costly for the processor when running the game. GDevelop 5 gives you total freedom in events. While this can be awesome, it can also be very costly for the processor when running the game.
  
-It is important to [[gdevelop5:​tutorials:​basic-game-making-concepts|understand what events are]] and that all events are **each called once per second**.+It is important to [[gdevelop5:​tutorials:​basic-game-making-concepts|understand what events are]] and that all events are //each called once per second//.
  
-<​note>​For example: With a game at 60 frames per second (FPS), if you have this action then in this action will be executed 60 times in a second.</​note>​+<​note>​For example: With a game at 60 frames per second (FPS), if you have a single ​actionthen in this action will be executed 60 times in a second.</​note>​
  
  
 ====== Optimization in the engine ====== ====== Optimization in the engine ======
-The GDevelop engine ​do once simple thing, ​he said to the graphic api do not render the object not in viewport+The GDevelop engine ​does one simple thing for optimizationit tells the graphic api to not render the object not in viewport.
-This doesn'​t affect the creator because it's handle in background.+
  
-<​note>​But this is an interesting thing. Hide or disable what you don't need. This is the key of the optimization.</​note>​+This doesn'​t affect the person creating the game because it's handled in the background. 
 + 
 +<​note>​It can still be important to hide or disable what you don't need. This is the key of the optimization.</​note>​
  
  
 ====== Trigger once ====== ====== Trigger once ======
  
-Tigger once is a condition, this allow to run the actions ony once, for each time the conditions have been met.+The **Tigger once** condition ​causes event actions ​to only run once each time the conditions have been met.
  
-Let's take an example where want to create an object every time I clickI'​ll ​show you the wrong way and the right way to do it.+Let's take an example where we want to create an object every time the mouse button is clickedThis will show you the wrong way and the right way to do it.
  
 {{:​gdevelop5:​events:​bad_event_optimisation.png?​nolink|}} {{:​gdevelop5:​events:​bad_event_optimisation.png?​nolink|}}
  
-What i want : When i press the mouse left button ​i create ​an object called ​"MyObject"+  * What should happen ​: When the mouse left button ​is pressed, ​an object ​is created ​called ​**MyObject**
-What i get : When i press the mouse left button ​i create ​multiple objects called ​"MyObject".+  ​* ​What actually happens ​: When the mouse left button ​is pressed, ​multiple objects called ​**MyObject** are created.
  
-This is bad because when you press the button ​your finger ​is on button during ​short time maybe like 0.3seconds. During this time the event can be called multiple times then the object is created more what once.+This occurs ​because when the mouse button is pressed, it is likely held down for longer than single frame like 0.3 seconds. During this period of time the event is called multiple times, and the object is created more than once.
  
 For fix that we need add the condition **Trigger once** in the condition. For fix that we need add the condition **Trigger once** in the condition.