Ok so my Metal Slug map has the feature to set custom binds.
Which is done using hotkey variables which the player can change using the custom binds dialog.
All the keypress events for my triggers use the "Any Key" parameter. Then theres a condition for the trigger "(Key Pressed) == *Key Bind Variable*".
That means all these triggers run and check their conditions at the same time.
Does that create a lot of lag?
Should I just remove the custom binds feature in Metal Slug?
Yes, many triggers with the same event and different conditions will generate lag. Can you not specify the variable in the event? If not, you can create a single trigger with the event and then place a switch statement in the action. Each case of the switch statement would start an action definition. I'm not looking at the editor right now, but it would look something like:
eventAnyKeyisPressedactionsswitch(pressed_key)//I assume that you can find the key that was pressed in the action.case'left_btn': left_is_pressed()case'right_btn': right_is_pressed()case'forward_btn': forward_is_pressed()
left_btn is referring to your variable and left_is_pressed() refers to the names of action definitions that you define.
Be careful when theorizing that something will cause lag. So far 99% of performance concerns people have voiced on these forums have turned out to be a non-issue. There's a saying in software development: "premature optimization is the root of all evil."
When you get to the point where you actually have lag issues then worry about optimizing your triggers. It's unlikely that relatively minor optimizations such as reducing the number of triggers is going to have a noticeable performance effect, anyway.
edit: Ought to specify that I'm mostly talking about when optimization and good design are divergent.. in a lot of cases they're one and the same. Here, for example, condensing everything into a fewer number of triggers would probably make it more maintainable, so I'd consider doing it for that sake.
Yes, many triggers with the same event and different conditions will generate lag. Can you not specify the variable in the event? If not, you can create a single trigger with the event and then place a switch statement in the action. Each case of the switch statement would start an action definition. I'm not looking at the editor right now, but it would look something like:
left_btn is referring to your variable and left_is_pressed() refers to the names of action definitions that you define.
that's pure genius! It's both optimizing and beneficial for design. Thanks guys! +rep!
Ok so my Metal Slug map has the feature to set custom binds.
Which is done using hotkey variables which the player can change using the custom binds dialog.
All the keypress events for my triggers use the "Any Key" parameter. Then theres a condition for the trigger "(Key Pressed) == *Key Bind Variable*".
That means all these triggers run and check their conditions at the same time.
Does that create a lot of lag?
Should I just remove the custom binds feature in Metal Slug?
Yes, many triggers with the same event and different conditions will generate lag. Can you not specify the variable in the event? If not, you can create a single trigger with the event and then place a switch statement in the action. Each case of the switch statement would start an action definition. I'm not looking at the editor right now, but it would look something like:
left_btn is referring to your variable and left_is_pressed() refers to the names of action definitions that you define.
Be careful when theorizing that something will cause lag. So far 99% of performance concerns people have voiced on these forums have turned out to be a non-issue. There's a saying in software development: "premature optimization is the root of all evil."
When you get to the point where you actually have lag issues then worry about optimizing your triggers. It's unlikely that relatively minor optimizations such as reducing the number of triggers is going to have a noticeable performance effect, anyway.
edit: Ought to specify that I'm mostly talking about when optimization and good design are divergent.. in a lot of cases they're one and the same. Here, for example, condensing everything into a fewer number of triggers would probably make it more maintainable, so I'd consider doing it for that sake.
that's pure genius! It's both optimizing and beneficial for design. Thanks guys! +rep!