Duplicate Events When Using Multiple Input Triggers

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Summary

There is an issue when using multiple input trigger devices to listen to the same input action. If multiple input trigger devices have the same player registered, each device will propagate their PressedEvent multiple times. Additionally, when subscribing a function to the pressed event of an input trigger device, the function will be subscribed to that event for all devices, not just the one specified.

Ideally, each Input Trigger Device only propagates 1 PressedEvent per press of that input per device. Right now, a PressedEvent is propagated once per number of InputDevices listening to that input, from each device.

Additionally, each Input Trigger Device should only propagate events to functions that are subscribed to that device. Right now, if multiple devices listen to the same input, its pressed events propagate to any function subscribed to the pressed event of anyof the devices

Steps to Reproduce

For this verse code:

@editable Trigger1: trigger_device = trigger_device{}
@editable InputTrigger1: input_trigger_device = input_trigger_device{}
@editable InputTrigger2: input_trigger_device = input_trigger_device{}

OnBegin<override>()<suspends>:void=
    Trigger1.TriggeredEvent.Subscribe(OnTrigger)

OnTrigger(TriggeringAgent: ?agent): void =
    if(ValidAgent:=TriggeringAgent?):
        InputTrigger1.Register(ValidAgent)
        InputTrigger2.Register(ValidAgent)

        InputTrigger1.PressedEvent.Subscribe(OnTrigger1)
        InputTrigger2.PressedEvent.Subscribe(OnTrigger2)

OnTrigger1(PressingAgent:agent): void=
    Print("Trigger1 Activated!")

OnTrigger2(PressingAgent:agent): void=
    Print("Trigger2 Activated!")
  1. Create a map with the above custom verse device
  2. Add a trigger device, and 2 input trigger devices, and set them as editables on debug_device
  3. Ensure both input trigger devices are listening for the same input
  4. Start game
  5. Activate trigger to register and subscribe the input trigger devices
  6. Activate the input the input trigger devices are looking for
  7. Observe 8 print statements

Similarly, for this verse code:

debug_device := class(creative_device):

@editable Trigger1: trigger_device = trigger_device{}
@editable InputTrigger1: input_trigger_device = input_trigger_device{}
@editable InputTrigger2: input_trigger_device = input_trigger_device{}

OnBegin<override>()<suspends>:void=
    Trigger1.TriggeredEvent.Subscribe(OnTrigger)

OnTrigger(TriggeringAgent: ?agent): void =
    if(ValidAgent:=TriggeringAgent?):
        InputTrigger1.Register(ValidAgent)
        InputTrigger2.Register(ValidAgent)

        InputTrigger1.PressedEvent.Subscribe(OnTrigger1)

OnTrigger1(PressingAgent:agent): void=
    Print("Trigger1 Activated!")

Results in 4 print statements, even though nothing is subscribing to the Trigger2 Pressed Event.

And finally for this verse code:

debug_device := class(creative_device):

@editable Trigger1: trigger_device = trigger_device{}
@editable InputTrigger1: input_trigger_device = input_trigger_device{}
@editable InputTrigger2: input_trigger_device = input_trigger_device{}

OnBegin<override>()<suspends>:void=
    Trigger1.TriggeredEvent.Subscribe(OnTrigger)

OnTrigger(TriggeringAgent: ?agent): void =
    if(ValidAgent:=TriggeringAgent?):
        InputTrigger1.Register(ValidAgent)

        InputTrigger1.PressedEvent.Subscribe(OnTrigger1)

OnTrigger1(PressingAgent:agent): void=
    Print("Trigger1 Activated!")

Results in 1 print statement.

Expected Result

Each Input Trigger Device only propagates 1 PressedEvent per press of that input per device.

Each Input Trigger Device should only propagate events to functions that are subscribed to that device.

Observed Result

A PressedEvent is propagated once per number of InputDevices listening to that input, from each device.

If multiple devices listen to the same input, its pressed events propagate to any function subscribed to the pressed event of any of the devices.

Platform(s)

Windows

Additional Notes

I have a minimum reproduction project for this issue, as it is quite confusing to describe. If I can share a private version somehow, and that will be helpful, just let me know.

bumping this. I know the description is a lot, but is no one else seeing this issue?

I’ll get someone to take a look.

1 Like

We’ve been able to reproduce this here and we put in a ticket.

FORT-763762

1 Like

thank you Flak :smiley:

The status of FORT-786618 incident has been moved from ‘Needs Triage’ to ‘To Do’.

1 Like

bump, any update here?