Very strange error with activating a trigger by release

Report any bugs here or ask questions here!

Very strange error with activating a trigger by release

Postby phsc » 3 November 2020, 21:20

Well, I am having an issue which I have no idea of how to solve, because it actually works, but not on multiplayer! and I think it might be some glitch, but before I make a post saying it is a glitch or contact Eric, I am seeking help from the community.
I have been working on a PB2 map that has a flash mechanic, where you press the key F and you flash a short distance, but you can also hold it to flash for a longer one, this was easy to think about and execute, and it did work perfectly fine in singleplayer, however when I tested it on multiplayer, when I release F (currently G because of test purposes) the game crashes, holding F and activating the trigger that releasing F activates also crashes, and there is a timer that activates it, however, I've done some testing and pressing an USE button to activate such trigger, called #release, the game does not crash in multiplayer.
I have asked many map makers help (Ditzy, who I think did not see my message) and Mrnat, who did provide me with a possible cause for things not working properly, that did not solve the issue, I also found a ton of possible mistakes, such as a division by zero and some other weird values, because of the variable declaration order, but such issues seem to have been all fixed, I am quite sleepy at the moment and might not be thinking that right tho.

The map is phsc-flash, https://www.plazmaburst2.com/?s=9&a=&m= ... id=1001686
it is open-source for now, https://www.plazmaburst2.com/level_edit ... -flash&a=#
I made an explanation of how the triggering works on discord so fellow map makers could get a better understanding of the system:
what happens is pretty simple, #start*timer activates #declaration (sets var_load, activates #constantupdate and runs #setbind trigger), #setbind sets trigger #press under hold of key F and sets trigger #release under release of key G (originally F)

#contantupdate*trigger*1 moves the region #cursor to #player*1 cursor and region #player to #player*1 position, and creates the variables var_cursor_x and _y, and var_player_x and _y, for each of their positions, and sets var_distance_x and _y to the same value of var_cursor_x and _y, and calls #constantupdate*trigger*2
#constantupdate*trigger2 sets var_distance_negx and _negy to var_player_x and var_player_Y values, and then the negative of it, so -var_distance_negx and negy, to allow me to add (in this case it would be a subtraction but there is no action so you have to do this) their values to var_distance_x and distance_y, to get the distance betwen the player and the cursor under var_distance_x and _y, i divide both values by 40 so i can work with multiplicating them to the intensity the player wants, this trigger activates #constantupdate*trigger*3
#constantupdate*trigger*3 multiplies var_distance_x and _y by var_load, the amount of time the button has been pressed, to a max of 40 (100% of the original value, teleporting to the cursor, and a minimum of 10), it also adds the distance to var_player_x and _y so it can teleport betwen the player and the cursor, since it is only the distance, and after all of that, the region #cursor*goal has its X and Y positions sets to var_player_x and var_player_y

if the player holds F #press is activated, which sets the value of var_load to 10, activates #constant_hold timer and deactivates itself, #constanthold calls with a delay of 1 #hold, which shows a hint with the value of var_load, adds one to it, and checks if it is over 40, if it is over 40, the timer #constanthold that activated such trigger is deactivate and the trigger #release is activate
#release is what happens when you release F (in this case G so you guys understand the issue, #release deactivates #constanthold and activates the timer #reactivation, updates the hint to reloading... teleports the player to #cursor*goal and deactivates itself, the timer #reactivation has a delay of 30 and activates #reactivate, which activates trigger #press, deactivates itself, shows the hint reloaded, and activates #release again so it all can start again


HELP
User avatar
phsc
Noir Lime [600]
 
Posts: 694
Joined: 27 July 2013, 13:58
Location: Brazil

Re: Very strange error with activating a trigger by release

Postby S U P E R » 4 November 2020, 05:11

The crash seems to be caused by #constanthold timer . I've remade your flash mechanic using alternative methods and it no longer crashes in multiplayer (I've got the "hold it to flash for a longer one" feature working too).

There's the map source: https://www.plazmaburst2.com/level_edit ... flash&a=#_
Last edited by S U P E R on 4 November 2020, 05:39, edited 2 times in total.
S U P E R

S U P E R
Recruit
 
Posts: 21
Joined: 8 January 2017, 17:02

Re: Very strange error with activating a trigger by release

Postby Nyove » 4 November 2020, 05:28

Hey phsc,

I managed to solve your issue.

The map souce for your reference as well as testing: https://www.plazmaburst2.com/level_edit ... -help3&a=#
Map ID: alesupport-help3
Map page: https://www.plazmaburst2.com/?s=9&a=&m= ... id=1001927

Issue (mostly theory / speculations, need EG's confirmation)

Key bind / release trigger actions are client-sided trigger actions. Key release trigger action by itself works normally in MP. However, due to the client-sided nature of this trigger actions, certain actions executed by the trigger may get desynchronized. Since your key release trigger causes a position change of the player, this position change may not be recognized and this results in the flash crashing.

Evidence

When I removed the teleport trigger action, your entire contraption works in MP. When I changed the teleport trigger action to 'Move player' trigger action, you encounter the same issue.

Furthermore, there had been an incident of game acting differently due to desync nature:
viewtopic.php?f=182&t=23316&p=204718#p204718

(If that's the case, not sure how variables induced client sided trigger action can utilise TP trigger actions).

Solution

I utilised a region syncing mechanism before executing the key release triggers. Once I implemented this, the release trigger seems to work perfectly fine in MP now.

For more information about the region syncing mechanism, you may refer to the following map:
https://www.plazmaburst2.com/?s=9&a=&m= ... &id=999227

Please do not hesitate to ask if you have any more enquiries.

Best regards,
Nyove
Proud to be part of something meaningful.
Need any assistance? Join the PB2 discord server at https://discord.com/invite/Bhe9rNz or raise a support ticket at https://www.plazmaburst2.com/support

Contact me on discord for quickest reply possible.

User avatar
Nyove
Moderator
 
Posts: 255
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: Very strange error with activating a trigger by release

Postby phsc » 4 November 2020, 15:36

S U P E R wrote:The crash seems to be caused by #constanthold timer . I've remade your flash mechanic using alternative methods and it no longer crashes in multiplayer (I've got the "hold it to flash for a longer one" feature working too).

There's the map source: https://www.plazmaburst2.com/level_edit ... flash&a=#_

The issue is not #constanthold, I know that for sure, the issue was #release and I will explain it later, thanks for remaking the system, the hold it to flash a longer distance feature did work perfectly, but I changed the button from F to G when releasing, because I wanted to know where the crash was happening (and I was almost completely sure it happened in #release, and it does, and I will explain this when I reply to Mrnat444 and Darkstar 1).

Nyove wrote:
Issue (mostly theory / speculations, need EG's confirmation)

Key bind / release trigger actions are client-sided trigger actions. Key release trigger action by itself works normally in MP. However, due to the client-sided nature of this trigger actions, certain actions executed by the trigger may get desynchronized. Since your key release trigger causes a position change of the player, this position change may not be recognized and this results in the flash crashing.

Check out phsc-button flash (https://www.plazmaburst2.com/?s=9&a=&m= ... id=1001899)
Activating a trigger on release that teleports the player crashes the game on multiplayer, and it is not so much of a syncing problem! because in that map, there is one timer that calls the trigger and it all moves one single player, there should be no syncing issues, but it still crashes, even with only one player in the map, this is obviously a glitch and I will let Eric know about it, this is really bizarre because it breaks even with one person in multiplayer, and it is not about syncing (I will explain this once I explain how Mrnat444 and Darkstar 1 solved this issue).

Nyove wrote:
Evidence

When I removed the teleport trigger action, your entire contraption works in MP. When I changed the teleport trigger action to 'Move player' trigger action, you encounter the same issue.

Furthermore, there had been an incident of game acting differently due to desync nature:
viewtopic.php?f=182&t=23316&p=204718#p204718

(If that's the case, not sure how variables induced client sided trigger action can utilise TP trigger actions).

Originally the map used the move player trigger action and I did change it, I choose the teleport from region to another because of the teleporting effect, which I think looks way better, however syncing the teleportation effect would allow for the possibility of a player being in the exact area of the region taht teleports the one that flashes, which could cause some issues in multiplayer.

Nyove wrote:
Solution

I utilised a region syncing mechanism before executing the key release triggers. Once I implemented this, the release trigger seems to work perfectly fine in MP now.

Well, this is trange, because this is not needed!

I asked people on #maps of PBC and on #general of Cult of USE, and respectively, Darkstar 1 and Mrnat444 replied:


mrnat replied before everybody else so he is the first to fix the issue

The issue is completely solved if you just move the teleporting action from #release to some other trigger activated by a delay 0 timer or something like that, both of them found out about that and it works!
So it is not a syncing issue!

(also darkstar asked, why am I constantly calculating the position of the flash? it is because I might add a visual indicator of the flash range/not allow you to flash over walls, and this would be needed for such systems)

I am unsure if adding syncing to the map is good because of the teleportation from region to player cursor, or even if that is the right action to use in general, because if you test the map with a bigger region, you can see the other players teleporting with you, and then it syncs them back to their actual position.

Also there was already a variable with the player's slot (var_slot) in #declaration, so you did not need to set the player slot variable, and well, I will be using your system because in my tests it is basically impossible for a player to fit the #player region, and it does give the visual effect, well, thanks! but syncing is not the issue, instead, the teleporting action being in the trigger activated by the release button trigger action, and this is a bug that should be fixed by Eric!
User avatar
phsc
Noir Lime [600]
 
Posts: 694
Joined: 27 July 2013, 13:58
Location: Brazil


Return to Bug Reporting, Help & Support

Who is online

Users browsing this forum: No registered users