PGE2v1 - Development Status

Discussion in 'Command Ops Series' started by MarkShot, Nov 18, 2015.

  1. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    PGE = Panther Games Enhancer

    What is it?

    In many RTS games you can assign hot keys to units. PGE allows you to assign hot keys to [map location + zoom level]. It allows for up to 12 hot keys. It has the option to remember these hot keys between gaming sessions (stored and reloaded from an INI file).

    PGEv3 supported the following games (GAMES not DLC modules): HTTR, COTA, and BFTB.

    PGE2v1 will support CO2 (only).

    Today, I began my initial research and discovered this interesting fact.

    The CO2 Strat Map in the CONTROL Window is +15 pixels wider and +17 pixels taller than the above three mentioned games.

    The Strat Map is important since PGE is NOT a mod. It makes no changes to anything. It is utility that runs alongside the game. (Think of it more as a programmable joystick or keyboard.) PGE works by capturing the user specified Strat Map location/zoom and replaying it bound to a key.

    PGEv3 is currently about 1600 lines of AutoHotKey code.

    Well, I just wanted to let those who had previously used PGE with BFTB (that's when I wrote it) that I have begun thinking about how to make it work for CO2.

    (more to follow)
     
  2. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    I think I am done for today.

    * Ripped out old HTTR/COTA/BFTB compatibility code.

    * Confirmed that I will be able to support a floating Control Window and multiple monitors.

    * Capture of Strat Pixel location click now works, but replay does not as I need to support multiple independent Windows.

    * Reported a bug to Dave in 5.1.22; SHFT-1 does not work to bring up the Control Window.

    It's a start! :)

    PS: The original PGE was written 5 years ago! Amazing.
     
  3. Dave 'Arjuna' O'Connor

    Dave 'Arjuna' O'Connor Panther Games Designer

    Joined:
    Jul 31, 2014
    Messages:
    3,050
    Likes Received:
    335
    That is not a bug Mark. We now have a specific Cntl button on the toolbar that toggles the Control dialog. This activates code that manages the dialogs. It's important that happens.
     
  4. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    I see. The mouse over still says SHFT-1. Is there any key stroke to open the Control Window other than me programmatically generating a mouse click event? (Maybe I don't even need to, since PGE will do nothing if one tries to set a hot spot without the Control Window having focus.)

    One more question while I am at it. That window is named "Control". I am having trouble finding out what is the name of main map window is? (as I need to switch focus from "Control" to whatever the map is)

    Thanks.
     
  5. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
  6. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    Today's update very exciting. It is by no means close, but it is a proof concept that this is going to work. (Multiple Displays, and floating Control Window)

    * Succeeded in capturing the map location (setting hot spot) and playing back (relocating the map). Previously, I was only able to capture. I knew that was working from looking at the INI values created. But today, the game map jumped for the first time.

    Old code: PGE1v3:

    MouseClick, left, 10, 10 ; Reset Strat Map
    Sleep, DelayMap

    If FKeyId=1
    MouseClick, left, F01X, F01Y
    Else If FKeyId=2
    MouseClick, left, F02X, F02Y
    Else If FKeyId=3
    MouseClick, left, F03X, F03Y

    New code: PGE2v1:

    WinActivate, Controls,
    Sleep, DelayMap

    If FKeyId=1
    {
    MouseClick, right, , , 1, 2, U
    MouseClick, left, F01X, F01Y
    }
    Else If FKeyId=2
    {
    MouseClick, right, , , 1, 2, U
    MouseClick, left, F02X, F02Y
    }
    Else If FKeyId=3
    {
    MouseClick, right, , , 1, 2, U
    MouseClick, left, F03X, F03Y
    }
     
  7. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    Much was working and new code was being written to address issues like the zoom level is no longer controlled by ALT-LCLICK and ALT-RCLICK.

    And then, it hit me that everything was broken. Somehow the new runtimes which Dave has introduced as made the scripting of AutoHotKey behave completely erratic with the new release. All types of buttons and controls are getting mysteriously triggered. I have no idea why.

    Also, remember this utility is not supported by Panther. I have to admit that for the moment I am at an impasse, since things are seriously broken.
     
  8. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    Okay, I have upgraded to:

    AutoHotkey112209_Install.exe

    That seemed to do it. Now, working:

    * Store hot spot.

    * Relocate map to hot spot

    * Set default hot spot zoom level

    * Set individual hot spot zoom level

    Not working yet:

    * Nudging hot spots with the arrow keys for fine positioning.

    * Various programs checks:

    ** Particular functions can only be invoked while the map has focus

    ** Storing of hot spot it taking place only within the valid portion of the Control Window

    ** The Control Window is open when attempting to execute any PGE function

    *** Remember ***

    * Coding needs to be done to recognize that there is now more than a single window. Previously, the game had a fixed interface.

    * The size and location of the strat map within the Control Window has changed.

    ---

    Probably anywhere from 5-10 hours of additional coding/testing is required.

    PGE2v1 makes little difference on the tutorial toy map. But it makes a substantial difference on some of the huge maps. And remember, that hot spots for 14 day battles can be reloaded between gaming sessions.
     
  9. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    BTW, I had a choice of 3 different version of AutoHotKey with which to distribute the executable. For greatest compatibility, I will be choosing ANSI 32 bit.

    See below for details of what it will actually do. This functionality is already available for HTTR/COTA/BFTB.

    2am here - good night!
     
    #9 MarkShot, Nov 25, 2015
    Last edited: Nov 25, 2015
  10. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
  11. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    I have been coding for a day and half, it is time to admit that I am abandoning this project.

    Why?

    Okay, I upgraded to the latest runtime version of AutoHotKey and did resolve much of the weirdness which crept in after Dave's upgrade of the Microsoft Libraries.

    I thought I was getting close to the finish line. As usual, I was testing and coding/testing in a prototyping style. I finally noticed a subtle, but truly devastating problem.

    With PGE1v3 for HTTR/COTA/BFTB, I could recover exactly the hot spot which had been set by the user. I mean exactly down to the pixel.

    But I noticed with PGE2v1 for CO2, my hot spots were drifting over time. Meaning the more you returned to one, the more it tended to drift.

    What was going on?

    Previously, I was able to position the mouse to any X/Y pair for the Airborne Assault or Command Ops engine with perfect fidelity. Since I could just put the mouse cursor down where it needed it to be. (Almost as if the cursor was being lifted from the screen and placed back down.)

    However, with CO2, Dave's new Microsoft libraries are seeing change of cursor location as drag events. Thus, my scripting is generating side effects (dragging of the mouse). Over time, this builds up and means that any kind of precision by PGE has been lost.

    Finally, why am I sure that it is CO2's new Microsoft runtimes? I have used interpreted (not compiled versions) with the same AutoHotKey runtime which I am coding with for CO2. With BFTB, my former code is able to position the mouse cursor to any location without it being seen as mouse movement (a drag event).

    Guys, these drag events are really a drag. It completely breaks how PGE works. I will check the AutoHotKey documentation one final time, but I am ready to throw in the towel. I cannot reproduce PGE for CO2. Sorry.
     
  12. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    Good news! There will be a PGE2v1. I am almost there with all the previous functionality. The only thing besides HTTR/COTA/BFTB support which I decided to drop (since you can just run the old PGE) is I will only support 3 zoom levels as opposed to the full 6 in the game. I decided this due to performance issues. I was especially concerned as my new PC is just six months old and was cutting edge and over clocked. I want PGE2v1 to work on everyone's PC not just mine.

    Here is the key insights that occurred today (or should I say tonight; no one programs computers during the day. It goes against the culture).

    I figured out how to fix the drift in my hot spot code.

    It was drifting due to the user having the mouse in hand with buttons pressed; required to enable various functions.

    There is in AutoHotKey:

    Block, On
    Block, Off

    This basically blocks any user input which occurs during execution between these two markers. Thus, I was able to prevent drift of hot spots. They now recover exactly to the pixel.

    I also found out that unlike Dave's older games the mini-map was no longer responding to each pixel click, but implementing a landing area strategy (means the map does not jump until the mouse clicks outside the current landing area; map context). This can be defeated by clicking outside and then clicking back; effectively causing a reset of the landing area. Thus, making it possible to nudge hot spots once set.

    I can see the completion of this utility now. It will be very useful for my own play on new maps. I am looking forward to starting to play.


    I am happy to share this with the community. I have made it robust that it contains plenty error checking to prevent user error. I am currently waiting to work out the details of hosting with LnL. I have probably about one more days worth of work on nudging and to update the old documentation.
     
    #12 MarkShot, Nov 27, 2015
    Last edited: Nov 27, 2015
  13. Dave 'Arjuna' O'Connor

    Dave 'Arjuna' O'Connor Panther Games Designer

    Joined:
    Jul 31, 2014
    Messages:
    3,050
    Likes Received:
    335
    Great news Mark. I knew you would come through. You should be able to add it as a resource. Use the Resource menu in the forum's menu bar.

    Sent from my GT-I9195T using Tapatalk
     
  14. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
  15. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
  16. MarkShot

    MarkShot Member

    Joined:
    Jun 3, 2015
    Messages:
    226
    Likes Received:
    11
    I must say PGE is completely integrated into the game when you combine with a programmable keyboard and mouse:

    [​IMG]

    [​IMG]
     

Share This Page