Jump to content
  • 0

Event flow optimization


Khaikaa

Question

Hi everybody, I have a technical question right now about event flow.

 

Imagine the next scenary:

 

- There is a player variable called value which can value 0, 1, 2, 3 or 4.

- We want to make an event that checks that variable's value and acts in consequence.

 

We can do in 2 diferents ways:

 

 

1st option: Simple conditional branches

 

We can make a structure like this:

Conditional branch: [Player Variable value is equal to 0]

 @> do stuff

 @>

: Else

 @>

: End branch

Conditional branch: [Player Variable value is equal to 1]

 @> do stuff

 @>

: Else

 @>

: End branch

etc

 

 

2nd option: Inner conditional branches

 

Conditional branch: [Player Variable value is equal to 0]

 @> do stuff

 @>

: Else

 @> Conditional branch: [Player Variable value is equal to 1]

        @> do stuff

        @>

        : Else

        @>

        : End branch

: End branch

etc

 

 

Both options will do the very same thing, but which one is cheaper for the server/client?

 

 

Also, there is the possibility to add label and go to laber commands to the first option so it only runs a portion of the event, for example:

 

Conditional branch: [Player Variable value is equal to 0]

 @> do stuff

 @> go to label endEvent

 @>

: Else

 @>

: End branch

Conditional branch: [Player Variable value is equal to 1]

 @> do stuff

 @> go to label endEvent

 @>

: Else

 @>

: End branch

etc

label endEvent

 

is it cheaper for the server/client doing the label/go to label thing or running the whole event?

 

Thank you!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1
1 hour ago, Khaikaa said:

2nd option: Inner conditional branches

 

Slightly better, because it will not run excess conditional checks after one is met.  The first option will be just as good if you put an "Exit Event Processing" between each conditional though.

 

You can use go-to labels but I would avoid them at all costs.. it is kinda heavy on the cpu to remap the events call stack to that label. See my suggestion above to use exit event processing.

 

 

 

Link to comment
Share on other sites

  • 0
7 hours ago, jcsnider said:

 

Slightly better, because it will not run excess conditional checks after one is met.  The first option will be just as good if you put an "Exit Event Processing" between each conditional though.

 

You can use go-to labels but I would avoid them at all costs.. it is kinda heavy on the cpu to remap the events call stack to that label. See my suggestion above to use exit event processing.

 

 

 

This may be a stupid question but does adding labels as comments (I mean, without adding any go to label command) costs to the cpu?

Link to comment
Share on other sites

×
×
  • Create New...