dpikt Posted October 2, 2020 Report Share Posted October 2, 2020 Download here: https://github.com/dpikt/pop-chart A mod that adds a chart for total population to the game summary. I couldn't find an existing mod that did this so I created my own I haven't tested it out on any machine other than my own, so let me know if you have trouble running it. Any other feedback appreciated as well. Cheers! 3 1 Quote Link to comment Share on other sites More sharing options...
badosu Posted October 2, 2020 Report Share Posted October 2, 2020 Oh, that is super sweet, I was thinking of doing something similar on monitor mod. Nice one :-) 1 Quote Link to comment Share on other sites More sharing options...
badosu Posted October 2, 2020 Report Share Posted October 2, 2020 There's just a small issue with heroes and siege units that account for more than 1 pop, but that should be unnoticeable on shorter games. Quote Link to comment Share on other sites More sharing options...
Freagarach Posted October 2, 2020 Report Share Posted October 2, 2020 Could you consider submitting a patch for this? At http://code.wildfiregames.com. Quote Link to comment Share on other sites More sharing options...
Nescio Posted October 2, 2020 Report Share Posted October 2, 2020 Domestic animals are units and can be trained (and killed), but do not count towards population. What does your mod do with them? Quote Link to comment Share on other sites More sharing options...
badosu Posted October 2, 2020 Report Share Posted October 2, 2020 (edited) Do domestic animals count towards unitsKilled or unitsLost? If not then it is fine. Edit, seems like its fine: if (!cmpUnitEntityIdentity.HasClass("Domestic")) ++this.unitsTrained.total; //... if (cmpLostEntityIdentity.HasClass("Unit") && !cmpLostEntityIdentity.HasClass("Domestic")) { for (let type of this.unitsClasses) this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", type); I think the only thing that could add discrepancies are units that account for more than 1 population. The dog is an issue tho, not Domestic. Edited October 2, 2020 by badosu 1 Quote Link to comment Share on other sites More sharing options...
dpikt Posted October 2, 2020 Author Report Share Posted October 2, 2020 @badosu good call on the dogs. That will make the count quite inaccurate in games where Britons players go with that strategy. Overall, the mod as-is is kind of a hack... ideally population count would be added as one of the player state "sequence" stats so we could get a more accurate number. Unfortunately that's a little beyond my understanding of the game code at the moment, but I'll take another crack at it this weekend. Also happy to merge a PR. Quote Link to comment Share on other sites More sharing options...
dpikt Posted October 2, 2020 Author Report Share Posted October 2, 2020 @Freagarach definitely open to submitting a patch, but I'd like to resolve the above issue first! Quote Link to comment Share on other sites More sharing options...
Nescio Posted October 2, 2020 Report Share Posted October 2, 2020 If I understand correctly, what your mod is doing is add a “units trained minus units lost” graph? In that case the values are strictly incorrect (starting units are not trained, therefore the graph starts at 0). Moreover, units you delete yourself don't count towards “units lost”. Quote Link to comment Share on other sites More sharing options...
dpikt Posted October 2, 2020 Author Report Share Posted October 2, 2020 Yep the first point is mentioned here: https://github.com/dpikt/pop-chart#limitations. And good point on deleting units, I didn't consider that. Quote Link to comment Share on other sites More sharing options...
Freagarach Posted October 3, 2020 Report Share Posted October 3, 2020 13 hours ago, dpikt said: Unfortunately that's a little beyond my understanding of the game code at the moment, but I'll take another crack at it this weekend. You can take a look at StatisticsTracker.js -- especially at the difference how e.g. "lootCollected": this.lootCollected and "percentMapExplored": this.GetPercentMapExplored() are obtained -- and at Player.js. Those should contain (nigh) all information you need. Feel free to ask questions! (You can also join #0ad-dev on IRC for a faster respons.) Quote Link to comment Share on other sites More sharing options...
badosu Posted October 3, 2020 Report Share Posted October 3, 2020 Well, with current information on sequences I'm not sure you are able to retrieve accurate enough for pop chart. If you want to mod it further you can patch statisticstracker as freagarach mentioned accounting for `template.cost.populationBonus`. You'd also have to patch where units are deleted to add a hook for statisticstracker to account for deleted units pop, search `EntitySelection.prototype.update = function() ` Quote Link to comment Share on other sites More sharing options...
mysticjim Posted October 3, 2020 Report Share Posted October 3, 2020 @dpikt Brilliant work, dude, very interested to see how you refine this in terms of the whole situation with count accuracy, but it's certainly a great start. Is there not a live running count of population through the game that can be plotted? I mean, the game keeps track of a pop count, and although it seems to reach it by different means, so does the FGOD mod, right? Or am I missing something silly here? 1 Quote Link to comment Share on other sites More sharing options...
badosu Posted October 3, 2020 Report Share Posted October 3, 2020 The game keeps track for each player individually, you could also store it for yourself on the mod. Easier to just reuse the already built in statistics tracker which stores data in the format the graph can use. The problem is just to use the accurate way for pops. You'd want to hook and add the template.cost.population whenever a unit is trained/killed/deleted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.