[REL] n Screens, or pushing PA pips to their limits and beyond

Discussion in 'Released Mods' started by cola_colin, February 23, 2014.

  1. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    A picture says more than 1000 words. A gallery of pictures is even better!


    Note how the last image has a broken view in the left. This is because even 1 more views crashes PA. Since all views need a hack view behind them to work I have 3*6*2-1 = 35 holodecks in there. ... actually I just realized I still had the default holodeck super small somewhere, so it's 36.

    The mod is on pamm.
    However you will need to configure it for your setup yourself. Using this requires a bit of try and error from you, it's not ready out of the box.
    So do the following to get it running for your setup:

    1. Install n Screens via pamm.
    2. open this file: %LOCALAPPDATA%\Uber Entertainment\Planetary Annihilation\mods\nScreens\ui\mods\nScreens\global.js
    3. Read the first few lins in it. There are 2 example configs and one outcommented piece of code to do x*y views. Configure it however you want. In a simple case for i.e. dualscreen you most likely just need to change a few pixel sizes of the dualscreen example and remove the comment out. Just delete the 3 screen example that is active by default.
    4. Get this autoit v3 and this script (store as .au3 file):
    Code:
    #include <WinAPI.au3>
    #include <Constants.au3>
    #include <WindowsConstants.au3>
    
    ;8/16 are to hide window borders
    $xp = -8-1280
    $yp = -8
    $width = 16 + 1920 + 1280 + 1280
    $height = 16 + 1080
    
    WinMove("Planetary Annihilation", "", $xp, $yp, $width, $height)
    
    $h = WinGetHandle("Planetary Annihilation")
    $iOldStyle = _WinAPI_GetWindowLong($h, $GWL_STYLE)
    $iNewStyle = BitXOr($iOldStyle, 0xC00000)
    ; set window style to very small borders
    _WinAPI_SetWindowLong($h, $GWL_STYLE, $iNewStyle)
    _WinAPI_SetWindowPos($h, 0, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE))
    
    ; needed to get pa above the task bar
    WinWait("Planetary Annihilation");
    WinSetState("Planetary Annihilation", "", @SW_MINIMIZE)
    WinWait("Planetary Annihilation");
    WinSetState("Planetary Annihilation", "", @SW_RESTORE)
    
    WinMove("Planetary Annihilation", "", $xp, $yp, $width, $height)
    configure xp, yp, width, height for match the size of your screens.

    5.
    Start PA in windowed mode, size it so it already is a bit on every screen to prevent bugs.
    Run the script. PA should now fill all your screens fullscreen and have the configured multiscreen setup.

    Caveats:

    It does not work anymore to hide any pip.
    You can however still switch the view between main and one chosen view.

    Highly experimental, not much tested, has compatibility issues with some mods.
    Fixes for mods I have:

    staticmenu's hack to break the stars in the background kill the UI layout for the mainmenu. To prevent that either uninstall it and us no starfield, or combine no startfield with a modified version of staticmenu that does has no code to kill the starfield.

    dTimer uses a relative position. This means it won't be positioned right because the UI fix works by using an absolute position box for all UI. To fix this you can modify dTimer with a simple style="positition: absolute"

    Code @ Github: https://github.com/pamods/ui-mod-nScreens

    That's all.
    Last edited: February 23, 2014
  2. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    I hacked your mod last night and got it using one less hack holodeck on 2-screen. I don't think there is a general solution for it though, so I'll only bother to share it if people are having performance problems with yours.
    totalannihilation likes this.
  3. giggle

    giggle New Member

    Messages:
    26
    Likes Received:
    3
    Hi, got this working to display the screens split over my two displays properly,

    Never had a problem with black screen until this latest patch. Was getting it all the time and then install no more black screens mod and it was fixed.

    Now the black screens have returned.

    Here is my global.js file

    Code:
    var nScreens = {
    
    /*
        // this is where the UI ends up
        main: "top: 0px; left: 1280px; width: 1920px; height: 1080px;",
       
        // this is the size of the primary holodeck
        mainHolodeck: "top: 0px; left: 0px; width: 4480px; height: 1080px;",// make sure to end in ;
       
        views: [
            "top: 0px; right: 0px; width: 1280px; height: 1024px;",
            "top: 0px; left: 0px; width: 1280px; height: 1024px;"
        ],
        // index of views // if a view is not correctly showing try to add it's index here
        // this is expensive fps wise. Try to make it so the main holodeck is big enough to cover for one of the views
        hackForIndex: [1], // 0 is completely above the main holodeck for this default config => no hack required
        // only one view can be part of the swapping with the main view
        pipIndex: 0,
        */
       
        // dualscreen
       
        main: "top: 0px; right: 0px; width: 1920px; height: 1080px;",// make sure to end in ;
        mainHolodeck: "top: 0px; left: 0px; width: 1350px; height: 740;",// make sure to end in ;
        /*
        main: "top: 0px; right: 0px; width: 1920px; height: 1080px;",// make sure to end in ;
        mainHolodeck: "top: 0px; left: 0px; width: 1920px; height: 1080px;",// make sure to end in ;
        */
        views: [
          "top: 0px; left: 0px; width: 1350px; height: 740px;",
        ],
            // index of views // if a view is not correctly showing try to add it's index here
            // this is expensive fps wise. Try to make it so the main holodeck is big enough to cover for one of the views
            hackForIndex: [0],
            pipIndex: 0,
    };
    
    $(function() {
        var holodecks = $('holodeck').length;
    
        // assume this tells us we are in live_game
        // we need to run before the live_game.js on the live_game.html, thus we are a global mod here
        if (holodecks > 0) {
            // remove the default holodecks
            $('holodeck').remove();
           
            var allViews = [];
            allViews.push(nScreens.mainHolodeck);
            for (var i = 0; i < nScreens.views.length; i++) {
                allViews.push(nScreens.views[i]);
            }
           
            for (var i = 0; i < allViews.length; i++) {
                var view = allViews[i];
               
                var deck = $('<holodeck></holodeck>');
               
                if (i === 0) {
                    deck.addClass("primary");
                }
               
                deck.attr('style', view+"z-index: -17000;position:fixed;");
               
                var tagetContainer = "body";
               
                $(tagetContainer).append(deck);
               
                if (i >= 1 && nScreens.hackForIndex.indexOf(i-1) != -1) {
                    $(tagetContainer).append($(deck).clone());               
                }
            }
        }
    });
    
    var nScreenFixUi = function() {
        var bc = $('body').children().not('holodeck').detach();
        bc.each(function() {
            $(this).addClass("receiveMouse");
        });
        var resizer = $('<div style="position: absolute;'+nScreens.main+'" class="ignoreMouse"></div>');
       
        resizer.append(bc);
        $('body').append(resizer);
        // fix bad fixed positions
        var stupidFixedStuff = [
            '.div_status_bar_cont',
            '.div_player_list_panel',
            '.div_alert_panel_cont',
            '.div_planet_list_panel',
            '.div_planet_detail_panel',
            '.div_celestial_cont'
        ];
        for (var i = 0; i < stupidFixedStuff.length; i++) {
            $(stupidFixedStuff[i]).css('position', 'absolute');
        }
        // sort of fixes floating frames from rFloatframes
        // yes for them fixed is the right thing
        $(".ui-draggable").css("position", "fixed");
    };
    
    // live game is special
    if (window.location.href.indexOf("live_game") === -1) {
        $(nScreenFixUi);
    }
    
    
    any ideas why my main screen is black screening?
  4. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    So you have this config:

    Code:
            main: "top: 0px; right: 0px; width: 1920px; height: 1080px;",// make sure to end in ;
            mainHolodeck: "top: 0px; left: 0px; width: 1350px; height: 740;",// make sure to end in ;
    
            views: [
              "top: 0px; left: 0px; width: 1350px; height: 740px;",
            ],
                    hackForIndex: [0],
                    pipIndex: 0,
    This tells n Screens the following:

    You have your UI on the screen that is on the most right. It is full HD sized.
    You have your main view holodeck on the most left it is 1350 pixels wide.
    You have an extra view on tthe most left, it is 1350 pixels wide and 740 pixels in height.
    You want a hacked pip for the 1350x750 pixel view. This is necessary if that view is alone, or it will only show icons.
    You want the 1350x750 pixels view to be the one that interacts with swapcamera.

    @cptconundrum I am not sure I understand the differences you hacked. I thought my dualscreen config was optiomal. Can you maybe post the resulting holodecks so I can understand?
  5. giggle

    giggle New Member

    Messages:
    26
    Likes Received:
    3
    so i should change the mainHolodeck value to read:

    mainHolodeck: "top: 0px; right: 0px; width: 1920px; height: 1080px;"

    this will place my main view correctly?
  6. giggle

    giggle New Member

    Messages:
    26
    Likes Received:
    3
    now i can see about 300 pixels of the main view on left hand side of my main screen, the rest is black
  7. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    Now is the time to buy a graphics card. Been limping along with integrated until now but this is too good to pass up on :D
    stuart98 and cptconundrum like this.
  8. giggle

    giggle New Member

    Messages:
    26
    Likes Received:
    3
    i have modified my mainHolodeck value to read:

    mainHolodeck: "top: 0px; right: 100px; width: 1920px; height: 1080px;"

    now i can see an additional 100 pixels coming from the left, my display is about 400 pixles into the screen formthe left hand side
  9. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    The fact that it is partly visible tells us that the position is partly correct. Just continue moving it until it is fully correct. ;) I dunno about your setup. Something is weird.
  10. giggle

    giggle New Member

    Messages:
    26
    Likes Received:
    3
    Ok it seems that the following setting works

    mainHolodeck: "top: 0px; left: 1360px; width: 1920px; height: 1080px;",// make sure to end in ;

    My main Holodeck is inputted to be 1360 pixels from the left, this is the width of my screen on the left. Am i correct then in saying that 'the mainHolodeck refers to the position of the main view in terms of the total screen width and height'? And that main refers to the absolute size of the main view, but not its position?
  11. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    main is the UI only it has nothing to do with the actual ingame world
    mainHolodeck is the main view of the world.

    Both specify full position + size.

    Guess main isn't the best name. It results from how I wrote it first to have main holodeck and main ui in the same place.
  12. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    Example for single screen, fullscreen 1080p, main view 1440x1080 to the left, 4 small views to the right:

    example_n_screens.jpg

    Code:
    var nScreens = {
    
       // this is where the UI ends up
    
       main: "top: 0px; left: 0px; width: 1440px; height: 1080px;",
    
       
    
       // this is the size of the primary holodeck
    
       mainHolodeck: "top: 0px; left: 0px; width: 1440px; height: 1080px;",// make sure to end in ;
    
       
    
       views: [
      "top: 0px; left: 1440px; width: 480px; height: 270px;",
      "top: 270px; left: 1440px; width: 480px; height: 270px;",
      "top: 540px; left: 1440px; width: 480px; height: 270px;",
      "top: 810px; left: 1440px; width: 480px; height: 270px;"
    
       ],
    
       // index of views // if a view is not correctly showing try to add it's index here
    
       // this is expensive fps wise. Try to make it so the main holodeck is big enough to cover for one of the views
       hackForIndex: [0, 1, 2, 3],
    
       // only one view can be part of the swapping with the main view
    
       pipIndex: 0,
    
    Because it's single screen you don't need to worry about autoit and resizing windows.
    maxpowerz and Clopse like this.
  13. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    There are so many possibilities!
    totalannihilation and reptarking like this.
  14. davedontmind

    davedontmind Member

    Messages:
    36
    Likes Received:
    29
    This is an awesome mod, thanks!

    I changed this line in the .au3 script:
    Code:
    $iNewStyle = BitXOr($iOldStyle, 0xC00000)
    to this:
    Code:
    $iNewStyle = BitAnd($iOldStyle, 0xde33ffff)
    which will remove the borders completely, and removes the need for the 8/16 tweaks for the window positioning (technical explanation: it clears the bits for WS_CAPTION, WS_THICKFRAME, WS_MINIMIZE, WS_MAXIMIZE, & WS_SYSMENU)

    so the positioning for my 3 x 1920x1080 screen setup is now:
    Code:
    $xp = -1920
    $yp = 0
    $width = 5760
    $height = 1080
  15. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    A setup like that where it is possible for the player to quickly make the main view show one of the small views could be very effective as a kinda minimap.
  16. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Does anyone have any clue what to do about the show through icons? I just did a test game vs AI and while the extra views are fun, challenging and helpful their usage suffers a lot later in tthe game:

    [​IMG]
    Clearly this is an expansion with 1 air worker and 1 factory. Can you see it?

    :(
  17. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    It's because of the hack holodeck. One holodeck shows the planet texture, one shows the icons. The one showing icons probably can't hide them when they are invisible because there is no texture to hide behind.
    totalannihilation and reptarking like this.
  18. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I doubt the icons ever hide behind a textures. They are probably just not rendered at all in the correct case.

    The icons are somehow linked to other holodecks, basically when I have i.e. the main holodeck + a pip the icons will not be visible on the pip if they are not visible on the main holodeck.

    Somehow this all seems like somewhere in the native code there is some bug that causes holodecks to not be as independent as they should be. It seems like they pair up and tie some behavior to each other. Icons, visible textures, ???

    EDIT:
    Experiment:

    1. main holodeck is somewhere super small, pretty much non existent
    2. added 2 pips that partly overlap, only the overlapping area is visible.
    Now I zoom into the hacked view as much as possible, so only a very small area is visible and scroll away from my commander on the visible area.
    Result:

    [​IMG]

    no icons. To the right you can see a few metal spots of the hack holodeck

    Now I wonder if I can somehow zoom in the hack holodecks (or actually it is probably better to zoom them out into celestial view)

    ... isn't there a hotkey that moves the camera into celestial view? Maybe I can do what you did with alertsManager and the default pip...

    A fun sideeffect is that the system planets are always listed like this because there is a holodeck that is zoomed out to maximum...

    EDIT:
    celestial view actually is a bad idea. Instead of not showing the icons this happens at least in my current testcase once they should be hidden:
    [​IMG]

    EDIT 3:
    It seems impossible to actually get rid of all icons on the the view. No matter what I do once I have icons all aroound the planet I get this kind of thing:

    [​IMG]

    @pinbender/UBER :
    Does this bug make any sense to you?
    Last edited: February 23, 2014
  19. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    What the asdf?

    Yeah... I think I might need a new GPU and a few new monitors...
  20. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    Zoom to celestial is currently broken in this build. It always locks my view in celestial and I lose all control.
    totalannihilation and reptarking like this.

Share This Page