Is this even possible??? (AI workaround idea for 4 gamepads) (Read 163 times)

Started by junkerde, February 11, 2019, 10:08:10 pm
Share this topic:
Is this even possible??? (AI workaround idea for 4 gamepads)
#1  February 11, 2019, 10:08:10 pm
  • avatar
  • *
The quick and dirty: Can AI be coded so that it only does 1 single command, and retriggers itself to turn off immediately after the command is sent out? And how should I approach this?

The convoluted: My game I'm making is enough that players only need 2 fight keys and 4 directionals. I was thinking about 4 human players with 4 controls at the same time: P1 and P2 = Team 1 Left, P3 and P4 = Team 2 Right

Player 1 uses 4 directionals, 2 buttons (A and B), this leaves 5 keys left.

Not even sure if this is also possible, but in the CNS I want to trigger that if the player is a specific ID ( ID (1) and (3) are players 3 and 4) that there directional keys and buttons are remapped. This means Player 2 on Player 1's team can use the rest of the keys P1 isnt using, keys C, X, Y, Z and start and that would allow simuealtaneous movemnt of the characters without clicking the same keys of the other character. I then remap P2 keys using joy2key so theyre not confusing. Outside of mugen's program.

Heres the problem, P2 and P4 still needs 1 extra key if this method is used. Which is where my question above comes in. I can remmap a control combination in joytokey to a single button on my joystick, so I was thinking if ctrl + 2 and +4 turns on AI, is there a way fo the AI to just send 1 simple command and then turn off. And if its SUccesful, if I do initiate ctrl + 2 or +4 again, would MUGEN.exe think Im trying to turn off the AI and not trigger the command again? Or does it work by checking to see if the AI is off or not?

I just thought I wouldn't attempt if it wasnt remotely possible. Or is there something practical and easy im not thinking off??
Re: Is this even possible??? (AI workaround idea for 4 gamepads)
#2  February 12, 2019, 09:28:56 am
  • avatar
  • **
    • USA
This is the least of your worries.  For this to work at all, you need to override the ctrl variable and rewrite all of the behavior for jumping, crouching, blocking, etc because that stuff is handled by the engine.  I'm not entirely sure that you can even read another player's inputs, but either way, Mugen isn't going to be impressed by this idea.

On the bright side, the massive amount of CNS coding you need to do in the CMD file would let you use things like your U+D and L+R as a button for something, so you've got buttons to spare.
Re: Is this even possible??? (AI workaround idea for 4 gamepads)
#3  February 12, 2019, 11:12:22 pm
  • avatar
  • *
Shoot i didnt even think of U+D and L+R! Thanks! I began implementing it and its working very nice with regular and flying characters as well, basically i use the trigger:

triggerall = partner,ID = 33 || partner,ID = 35 for player 1 and 2, and triggerall = partner,ID = 32 || partner,ID = 34 for player 3/4

which means there are double the amount of commands, working very well with my joypad and its working as predicted. I'm going to have a lot of fun with this one!!! I've had to modify the common cns as well and it works quite nice as I had thought

Still, I think there is an easier way to do this instead of copy pasting all the commands a 2nd time, like if I do an if,else, or a variable (which Im not sure how I would set up).

Any thoughts if there is a shorter way? If not Im pretty ok with this, it gets the job done.
Re: Is this even possible??? (AI workaround idea for 4 gamepads)
#4  February 19, 2019, 05:59:45 am
  • avatar
  • *
EDIT: Solved. Literally Ikemen GO Plus/Ikemen Plus already does this and all my characters work on it. No need for the sophisticated stuff.