ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

How do I support multi-key input in the Player Brain -> Discrete Player Actions?

Open Sohojoe opened this issue 8 years ago • 6 comments

Goal: I wish to implement a brain that supports the following discrete actions with key combinations when using Player Brain

Element 0. Key ’None’. Action = NoOp Element 1. Key ’Right Arrow’. Action = Move Right Element 2. Key ’Left Arrow’. Action = Move Left Element 3. Key ’space’. Action = Jump Element 4. Key ’space’ + ’Right Arrow’. Action = Jump Right Element 5. Key ’space’ + ’Left Arrow’. Action = Jump Left

I do not see how to have multiple keys within one element

Sohojoe avatar Jul 19 '18 07:07 Sohojoe

You don't put them all in one element. Use multiple elements for the same Index.

e.g. in your case I believe you have only one discrete parameter as input, which can have 6 different values. So you will have six elements, each mapped to a different key (let's say the number keys on your keyboard, 1 to 6). The index stays the same: 0 (for the first and only discrete action). The value changes for each element, from 0 to 5.

NightSp4rk avatar Jul 20 '18 14:07 NightSp4rk

Thanks @NightSp4rk. Let us know if this addresses your issue @Sohojoe.

mmattar avatar Jul 25 '18 06:07 mmattar

@mmattar / @NightSp4rk - what i need is for Element 4 to be triggered when right arrow AND space are press and Element 5 to be triggered on left arrow AND space

image

Sohojoe avatar Jul 27 '18 04:07 Sohojoe

@Sohojoe I think with the multi-discrete control feature in v0.5 this should be solved I guess?

xiaomaogy avatar Sep 27 '18 21:09 xiaomaogy

@xiaomaogy - I tested with 0.5 and it solves it - thanks!

Sohojoe avatar Sep 30 '18 22:09 Sohojoe

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 03 '20 01:01 lock[bot]