playMaker

Author Topic: Array Maker and playmaker control  (Read 906 times)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Array Maker and playmaker control
« on: September 25, 2020, 03:40:33 PM »
Hello, I am attempting to improve on the mapping keys aspect within “Playmaker Control”

Link: https://colpolstudios.itch.io/playmaker-control

In order to complete remapping of the ship shooting control you currently need to follow these steps.

1. Select the controller type, PlayStation, Xbox, D-pad PlayStation or D-pad Xbox.

2. Press the spacebar to activate the remapping abilities.

3. The Playstation square button is set for shooting, select it by hovering the mouse icon over the button and keeping the mouse cursor over this button left click to select it.

4. keeping the mouse cursor over this button, now choose your new shooting button by pressing the required button on your joystick.

5. Now select this chosen button and keeping the mouse cursor over this button, select the original key to finish.

Should you duplicate the same key. Orignal key mappings are re-applied.

Each key on either joystick type has its own unique Id, currently, none are tagged.

Using string compares I check if a duplicate key used, stored as bool.

Then later check every frame is this bool true or false. If true “Orignal key mappings are re-applied” and you can simply try again.

But this design requires too many steps and if I was to use “array maker” I think it may be possible to check if two keys are duplicated and swap them around?

The idea being that it would be impossible to have two identical keys chosen.

I have not used “Array Maker” before and am hoping that someone could help me with my task, please.
« Last Edit: September 25, 2020, 03:42:55 PM by colpolstudios »

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: Array Maker and playmaker control
« Reply #1 on: September 29, 2020, 03:13:12 PM »
Array maker and hash table proxy.

I am looking at the three in a row example as it seems the right choice.

In my prototype

When assigning a new button the user must first select it “using the mouse”, So I can use a similar setup.

Giving each joystick button a unique “Reference” use the set event data to tell my manager about the change and send the “changed event”

In the Manager using “Get event info” get the “Reference” and store the changes “Hash table set” for the “reference and the string” Then check (“Duplicate Found” (Global event)).

FSM Duplicate check: Start, wait 0.1:

This is where I get lost.

In my case, it is only possible to select one button to change at a time. You then change its value by pressing a button on the joystick.

There are 14 possible buttons on a PlayStation joystick. Each one is given its specific joystick button value, so each one is different.

Do I Iterate from 0 to 14 Getting the Owner, Slot type string and Result as “Next Item”, string compare [item], [next item] not equal “Fail” and “Finished” This should be where we have the duplicate.

At this juncture I wish to swap these two values around, But how do I tell which one was the first to be selected?

Maybe this is not possible?

Thank you for your time if you have read up to this point.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: Array Maker and playmaker control
« Reply #2 on: October 01, 2020, 07:46:50 AM »
News!

I got this working without using an array here is how.

https://ibb.co/F8Yw1Q1

Video: https://youtu.be/c3SJeOamicQ

Button checker FSM

   This example is only for choosing a PS touchpad and then selecting the left joystick button:
   
   Each button is saved with a unique name to the player prefs. At startup are set with default values.

   Each button has three essential variables that are used in order to achieve the swapping function. Picked type bool, Int (this is a global) and Default touchpad value (Joystick1Button13)

 The picked bool is only true once you have chosen the button to change.

The int value is the way I check what combo was used.

The Default touchpad value (Joystick1Button13) used later.

Order of events as they happen.

1. Use the mouse to select the button (example PS touchpad) click to choose. Picked value set to true. Int value set to 14.

2. Select the joystick button you wish to use. Press key on the joystick. (The left joystick button)

3. The button checker fsm
           Starts by checking for a duplicate state
           If none return. If yes then a duplicate was found.
           Switch keys around leads you to “find the only match”
           This state checks again, but this time for a match found.
           Check my bool state, checks the “Picked value” (This will be true)
           We verify this in the “Two matching found” state.
           The “identify key found state” gets the bool value of the left joystick button             “Picked” and check that it is false.
           Send the Global “Change”

Change: Swap keys state: Check that the bool “Picked” of the left joystick is false.

An int switch to manage all the possible combos (one done as testing) Check the global int (it will be set to 14 at this point) go to event “touchpad & left stick”

Working for touchpad and left stick state: Get the Default value (Joystick1Button13) and store it as “Swapped value” Set player pref “ps left joystick button” to the swapped value.

There will be 13 of possible combos for each key. That's a big int switch.

Writing this information has helped me spot areas where I can improve on the FSM.

The question: Is it worth all the extra work?


   
« Last Edit: October 01, 2020, 08:54:49 AM by colpolstudios »