[REL] Live Economy Graphs v0.1.3

Discussion in 'Mod Discussions' started by cptawesomer, March 7, 2014.

  1. cptawesomer

    cptawesomer Member

    Messages:
    29
    Likes Received:
    28
    Hey people,

    I've been spending some time on a new mod depicting your economic history graphically. I played a few games with it enabled and it was awesome both in 1p games and shared teamgames.

    Now this is still a work in progress but it's very much usable. Try it out!

    Video by PAMatches


    Screenshot
    Default position:
    [​IMG]
    Dragged around:
    [​IMG]

    What you are looking at

    Left side
    • Blue line: metal income
    • Grey area: metal usage
    Right side
    • Yellow line: energy income
    • Grey area: energy usage
    The graph right now shows about 2 minutes of gameplay history. The graph range is always from zero to the max usage in the past two minutes.

    Incompatibility
    There are no known compatibility issues as of v0.1.1.

    Plans
    • Add economy efficiency/wasted resources to the graph.
    • In the future I plan to create extra settings. It's easy to show any statistics available in the game this way but why not make the speed, colors, size and data displayed configurable?
    Libraries
    Github
    https://github.com/TheMagnificentWerty/wEconomyGraphs

    PAMM
    Now available on PAMM!

    Testing
    I probably wont encounter all the bugs/problems that are going to come forward with this mod. If you've used my mod and encountered problems small or big, please post them here to I can look into it.
    Last edited: March 14, 2014
  2. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Nice. I didn't want to go this far because I expected to keep them inside the bar, which would be tiny. Maybe sparklines.

    Suggestion: show the net amount as a red or green area between the two lines.
    cptawesomer likes this.
  3. stawos

    stawos Member

    Messages:
    79
    Likes Received:
    46
    Looks very promissing, I might try this out now... :)
    cptawesomer likes this.
  4. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Doesn't really work on small windows through.

    Screen Shot 2014-03-07 at 09.41.46 .png
  5. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    Added to PAMM. Nice mod.

    Compatibility with other mods should be easy, you just need to use the floating framework so your graphs can be dragged around.
    cptawesomer likes this.
  6. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    does it work with Economic efficiency?
  7. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    He says in the description. It's compatible, but overlaps a little.
    cptawesomer likes this.
  8. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    Sounds like a pretty nifty mod!

    Let me know when it works with Economic Efficiency.

    Edit: It's compatible now!
    Last edited: March 8, 2014
    cptawesomer likes this.
  9. cptawesomer

    cptawesomer Member

    Messages:
    29
    Likes Received:
    28
    I just performed a mainly cosmetic update on the mod and the charts are now draggable, eliminating compatibility issues. It should be on PAMM as soon as it's accepted.

    See the screenshots for it's new look.

    This would be awesome, I should look into if thats possible with SmoothieChart.

    I wasn't quite as easy as it seemed. Before the mod lived in the 'live_game_econ' view and not in the 'live_game' view because it missed eco data in the model. I had to add said data to the model before I could use it, it works now though (or as soon as it's in PAMM).

    When my updates comes through on PAMM it will have no compatibility issues with said mods.

    Pull request just got merged.
    Last edited: March 8, 2014
    brianpurkiss likes this.
  10. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    [​IMG]
    mered4 and cptawesomer like this.
  11. mered4

    mered4 Post Master General

    Messages:
    4,083
    Likes Received:
    3,149
    This looks pretty awesome. I will definitely be looking into using this.

    :p
    cptawesomer likes this.
  12. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I had to find just the right spot to get metal out from under players, but it worked.

    FYI

  13. cptawesomer

    cptawesomer Member

    Messages:
    29
    Likes Received:
    28
    I will have a look at this, it should be easy to drag them away for users. Thanks for the feedback.

    Can you give me link to that discussion about seperation of panels or any other resource? I would like to learn more about that, it's quite interesting.
  14. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Click the up-arrow next to the quote author's name. Unfortunately there isn't much beyond what I quoted. From what I can tell, mods should have access to the scene creation (Panel) interface, but I'm not sure how that would work with Floating Framework.
    cptawesomer likes this.
  15. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    The graphs look awesome, but they break PA Stats.
    2 combined problems kill it 100% every time:
    1.)
    You are using $(document).ready(...) This puts you behind all other mods, so you are loaded last. Don't do this. Usually there is no need to use document ready. Mods are loaded in such a handler already. In fact using the document ready handler will make it impossible for you to do some kinds of knockout binding manipulations.
    So just don't do it, run your code directly.

    2.) You are doing this with the army handler:

    Code:
        handlers.army = function (payload) {
        ....
        }
    This overwrites the handler if any other mod has one. Yes PA itself has no handler, but it turns out PA Stats is very interested into that handler as well.
    PA Stats however is nicer to other mods and does this:
    Code:
    var oldHandlerArmy = handlers.army
    handlers.army = function(payload) {
    if (oldHandlerArmy) {
    oldHandlerArmy(payload);
    }
    };
    So if PA Stats would be loaded last nobody would notice. But the document ready puts the graph constantly behind PA Stats, overwriting the handler, resulting in PA Stats never being notified that the game started.

    EDIT:
    Another thing you might want to think about is putting your mod into the economy subscene of live_game. It's kind of part of that scene.
    Last edited: March 9, 2014
    thetrophysystem and Fr33Lancer like this.
  16. cptawesomer

    cptawesomer Member

    Messages:
    29
    Likes Received:
    28
    Thanks for the feedback. PA Stats still seems to work for me strangely. But you have valid points.

    I added this while debugging and I forgot to change it back, thanks.

    Yeah, this is not done the proper way by me, I will fix this.

    You are talking about the "live_game_econ.html" panel right? Because this is how I started out (v0.1.0), but I had a hard time adding the windows to rFloatFrame as mouse clicks did not seem to register so I moved them to the live_game.

    Edit: I have applied the fixes and they are now waiting to be pulled (v0.1.3).
    Last edited: March 9, 2014
    cola_colin likes this.
  17. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I've never used rFloatFrame myself, so dunno. Not a big fan of floating frames in general.

    PA Stats monitors other stuff as well and fiddles with far more (i.e. the alerts) things, it cannot be put into the economy scene.

    EDIT:
    merged your pull request, fixed the updated date and pushed to pamm
    Last edited: March 9, 2014
    thetrophysystem likes this.
  18. cptawesomer

    cptawesomer Member

    Messages:
    29
    Likes Received:
    28
    Yeah PAStats doesn't have much UI to worry about. I think users would like to be able to drag the graphs around though. rFloatFrame remembers position, does snapping etc. It's a good user experience.
  19. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Not a fan in a personal subjective sense. I hate it when I randomly move around stuff without wishing to do so :p
    thetrophysystem likes this.
  20. cptawesomer

    cptawesomer Member

    Messages:
    29
    Likes Received:
    28
    Ah yeah I don't like that either. rFloatFrame is a great addition to usability though and it brings standardization to the way mods handle their windows and positioning. I love it.

Share This Page