User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Override Input (for AI simulation)

  1. #1
    No Products Registered

    Join Date
    Jul 2006
    Location
    Madison, WI, USA
    Posts
    250
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Override Input (for AI simulation)

    So I was finding that I was duplicating a lot of work in my 1 or 2 player space combat game because everything the player 2 could do via joystick input, I had to duplicate with "AI" events. Every create object, counter modification, etc, etc. What I'd really like to be able to do is have the AI able to "stuff" commands into one of the joysticks - basically, make the game think player 2 is pressing the fire button, or pressing forward, etc. This way, all the projectile creation logic (etc.) is all centralized and based off input. This is very similar to how Single/Multi-Player networked games I've worked on in the past worked - all player control was driven by input, but AI just provided its own input.

    I considered putting a layer of variables between the input and projectile-spawning events (so I'd store what buttons, etc. are being pressed by input, but be able to override those variables with AI) so that all player actions were driven by this in-between layer of variables. That would work, but I'd lose the ability to tell if a button was just pressed or is being held... I could probably work around that, but it'd be a pain in the butt. I also still wouldn't be able to make my AI drive the ship around via actual input.

    Anyone know of a way to do this, either intrinsically in MMF2 or with an extension?

  2. #2
    No Products Registered

    Join Date
    Jul 2006
    Location
    Madison, WI, USA
    Posts
    250
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Override Input (for AI simulation)

    So I was finding that I was duplicating a lot of work in my 1 or 2 player space combat game because everything the player 2 could do via joystick input, I had to duplicate with "AI" events. Every create object, counter modification, etc, etc. What I'd really like to be able to do is have the AI able to "stuff" commands into one of the joysticks - basically, make the game think player 2 is pressing the fire button, or pressing forward, etc. This way, all the projectile creation logic (etc.) is all centralized and based off input. This is very similar to how Single/Multi-Player networked games I've worked on in the past worked - all player control was driven by input, but AI just provided its own input.

    I considered putting a layer of variables between the input and projectile-spawning events (so I'd store what buttons, etc. are being pressed by input, but be able to override those variables with AI) so that all player actions were driven by this in-between layer of variables. That would work, but I'd lose the ability to tell if a button was just pressed or is being held... I could probably work around that, but it'd be a pain in the butt. I also still wouldn't be able to make my AI drive the ship around via actual input.

    Anyone know of a way to do this, either intrinsically in MMF2 or with an extension?

  3. #3
    No Products Registered

    Join Date
    Jul 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    No... it's a feature I've been asking for... it shouldn't be that hard to implement.

  4. #4
    No Products Registered

    Join Date
    Jul 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    No... it's a feature I've been asking for... it shouldn't be that hard to implement.

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    Alonso's Avatar
    Join Date
    Jul 2006
    Posts
    681
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    Well, if you set it to a joystick, I think the ControlX object could simulate key-strikes. Neither of the X objects (TimeX, ControlX etc) has been converted to MMF2, though.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    Alonso's Avatar
    Join Date
    Jul 2006
    Posts
    681
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    Well, if you set it to a joystick, I think the ControlX object could simulate key-strikes. Neither of the X objects (TimeX, ControlX etc) has been converted to MMF2, though.

  7. #7
    No Products Registered

    Join Date
    Jul 2006
    Location
    Sweden, Lund
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    I used to use the Global Function object to do that. Maybe not precisely what you're asking for but it might help you.
    And yeah, the GF object hasn't been ported yet has it?
    You can use loops:
    On loop "fire": Fire teh missiles!

    You can trigger this loop both from the AI's events and with the player's controls - just start the loop 1 time.
    This saves you the code duplication. <img src="/center/images/graemlins/smile.gif" alt="" />

  8. #8
    No Products Registered

    Join Date
    Jul 2006
    Location
    Sweden, Lund
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    I used to use the Global Function object to do that. Maybe not precisely what you're asking for but it might help you.
    And yeah, the GF object hasn't been ported yet has it?
    You can use loops:
    On loop "fire": Fire teh missiles!

    You can trigger this loop both from the AI's events and with the player's controls - just start the loop 1 time.
    This saves you the code duplication. <img src="/center/images/graemlins/smile.gif" alt="" />

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export Module

    Join Date
    Jun 2006
    Location
    Melbourne, Australia
    Posts
    765
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    The windows message object is an option for simulating keystrokes just a little messy to use.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export Module

    Join Date
    Jun 2006
    Location
    Melbourne, Australia
    Posts
    765
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Override Input (for AI simulation)

    The windows message object is an option for simulating keystrokes just a little messy to use.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Keyboard input vs player control input
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 22nd August 2013, 09:00 PM
  2. Layering Override Problem
    By LavaFlaminG6 in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 15th April 2013, 02:11 PM
  3. Override Mouse Movement (For DEKE15)
    By Jaffob in forum File Archive
    Replies: 1
    Last Post: 30th March 2009, 10:46 PM
  4. override xmouse ymouse-movement-then reactivate
    By DEKE15 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 29th March 2009, 10:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •