joystick, mouse, and keyboard keypress serializer

this is not finished*

this system rolls through a number of input channels and checks to see if the key is mapped,

if the key is mapped a list is added to an inputList

[‘GameCommand’,Index]

you then decide on a command input order

like

[ forward, left, down, right, jump, duck, sprint ]

so MoveDict = {“WKEY”:[‘Forward’,0], “UPARROWKEY”:[‘Forward’,0], “JOYSTICK_UP”:[‘Forward’,0] }

all of these potentially could add [‘Forward’,0] to the input list at any order in the input list

we then sort using

ListM = sorted(ListM, key=lambda tup: tup[1])
    NL =[]
    for entry in ListM:
        if entry[0] not in NL:
            NL.append(entry[0])



so the keypresses are indexed,

next they are rolled through and if they are not on the list they are added to it

this list is sent to a actor or used to call a function directly using a dictionary

Now we have all keys mapped using 1 system :smiley:

Attachments

Serilizer_2.blend (470 KB)

update and video on the way*

Attachments

Serilizer_3.blend (465 KB)

here is the system working in my own large project
don’t mind the IK - it’s a upbge bug that is solved in a branch, I need it in master however :smiley:

Here is a video of me adapting the code to a new project
And adding axis value support.