Jump to content


Community Members
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by agentx

  1. Ok, I understand, the helper function provides the classes combined with no duplicates. That's good! The other part of the question targeted which classes contain which entities? It seems some classes are a must have, others are nice to have and others are superfluous. Which entitiy <-> class relation is future proof?
  2. Changeset 15196 broke a lot of Hannibal, since it uses classes as civ independent feature detector. Now farmsteads are still in class farmstead, but houses are no longer in class house. On the other hand cleaning up 3 different versions of civcentre is probably a good idea. Google couldn't find a single bit of info about VisibleClasses, may I ask what is the thinking? Is there a plan and what is the difference between Classes and VisibleClasses. Why are both needed?
  3. > What is the color code in this example ? Quite unexpected question. Petra is already greedy enough in terms of area. The map is per cent explored. Looping over 65k tiles takes ~1 msec, that's acceptable once per minute, but probably not on bigger maps. Lines are not easily available, on the other hand players can be toggled on/off, with only one color left it is acceptable. And it is only the units screen with huge jumps. The game itself was interesting, Petra chose me for the first two rushes and then hit Aegis very hard. Aegis never attacked me, just some tiny border conflicts. However, at some point both bots stopped training, otherwise I'd had no chance. I've seen Mimo's patch, but couldn't test so far. I think if bots continue training, there is no chance for humans, except may be a network of defense towers and fortresses packed with units to pile up resources and finally launch 250 champions armies one after the other. Sometimes I can manage to build traps with strongly guarded honey pots walled on three sides. But that doesn't work always. Anyway I think multiple bots are great to learn and improve tactics. The game is rich enough so there is no ultimate strategy in sight. I forgot the food chart, Petra went up to ~70,000 and did barter like hell, although metal was always above 30 or so. I've compared the buildings chart against the other panel and apparently Aegis lost 71 buildings more than constructed ???. There is still room for more charts, proposals are welcome. I'm thinking about technologies, but that could end in a screen full of tiny icons or a wall of text...
  4. This started as Numerus Bot and became a Mod. It give you a visual end of game summary. The screenshots are from a 2 hour game with Aegis, Petra and me on the Gallic Fields. There is something wrong with the buildings, I have to investigate, but otherwise it would help if other players give it a try. So far it was only tested with a recent SVN on Linux. Would love to make the mod, well, battleproof. charts-mod.zip
  5. Sander, great explanation, a lot of things make sense now. Thx!
  6. There is only space for ~120 dots per player in the charts screen, so I figured one sample per minute is enough. If games are shorter or longer than 2 hours the data is resampled to fit the 120 dots.
  7. Ok, found the timer. If I understand you correctly, all the components belong to a single player, so each player has a full set of components, hence his own StatisticTracker? If yes, I'll do same with ChartTracker. One more question: At game end, the collect data should be available for the chart panel. I see in summary.js the init function got called with a 'data' object containing playerstate + statistics. Is GuiInterface.prototype.GetExtendedSimulationState the right place to attach the collect charts data to playerstate? So, basically I duplicate and adapt these lines: var cmpPlayerStatisticsTracker = Engine.QueryInterface(playerEnt, IID_StatisticsTracker);ret.players[i].statistics = cmpPlayerStatisticsTracker.GetStatistics();Better? // Updates every minuteconst UPDATE_TIMER_INTERVAL = 60000;function ChartTracker() {}ChartTracker.prototype.Schema = "<a:component type='system'/><empty/>";ChartTracker.prototype.GetChartData = function(){ var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); cmpTimer.CancelTimer(this.updateTimer); this.updateTimer = undefined; return this.chartData;}; ChartTracker.prototype.Init = function(){ this.timeStamp = 0; this.chartData = {}; var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); this.updateTimer = cmpTimer.SetInterval(this.entity, IID_ChartTracker, "updateData", UPDATE_TIMER_INTERVAL, UPDATE_TIMER_INTERVAL, {});};ChartTracker.prototype.updateData = function(msg){ // Get player + range + stats manager var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); var cmpRangeManager = Engine.QueryInterface(this.entity, IID_RangeManager); var cmpStatisticsManager = Engine.QueryInterface(this.entity, IID_StatisticsTracker); var resourceCount = cmpPlayer.GetResourceCounts(); var statistics = cmpStatisticsManager.GetStatistics(); this.chartData[this.timeStamp++] = { 'map': cmpRangeManager.GetPercentMapExplored(cmpPlayer.GetPlayerID()), 'food': resourceCount.food, 'wood': resourceCount.wood, 'stone': resourceCount.stone, 'metal': resourceCount.metal, 'population': cmpPlayer.GetPopulationCount(), 'buildings': statistics.buildingsConstructed - statistics.buildingsLost };};Engine.RegisterComponentType(IID_ChartTracker, "ChartTracker", ChartTracker);
  8. I believe I have something which may work as a ChartTracker component. Only missing part is kind of a timer calling the OnUpdate function every minute with stamp info. Sander, could you provide the final bit? function ChartTracker() {}ChartTracker.prototype.Schema = "<a:component type='system'/><empty/>";ChartTracker.prototype.Init = function(){ this.chartData = {};};ChartTracker.prototype.GetData = function(){ return this.chartData;}; ChartTracker.prototype.OnUpdate = function(msg){ // Get player and range manager var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); var numPlayers = cmpPlayerManager.GetNumPlayers(); var tickData = []; var stamp = 0; // that should be 60, 120, 180, etc.. // push the player data for (var i = 0; i < numPlayers; ++i) { var cmpPlayer = Engine.QueryInterface(cmpPlayerManager.GetPlayerByID(i), IID_Player); // Skip gaia if (i > 0) { tickData.push({ popCount: cmpPlayer.GetPopulationCount(), resCount: cmpPlayer.GetResourceCounts(), mapExplored: cmpRangeManager.GetPercentMapExplored(cmpPlayer.GetPlayerID()) }); } } this.chartData[stamp] = tickData;};Engine.RegisterComponentType(IID_ChartTracker, "ChartTracker", ChartTracker);
  9. I could make the planner somewhat faster, but the main function is still a recursive one. So, I still have to convert it into a while loop, because FF's profiler doesn't help with recursive calls. However, now it is ready to optimize for either cost or time and it is more robust now. I have tested it on all units and structures of athen, hele and mace found in the triple store, which gives a cost report like this: depth iter msec ops Name time food wood stone metal 78 79 13 20 units.hele.ship.trireme 535 850 1900 150 108 109 14 24 structures.mace.wonder 2035 850 3000 2400 2000The costs are total, as if you start with a CC only. Time is the minimum with one unit building and excludes gathering resources. I didn't manage to make nice tables here, shots are attached. The report generator is also online. If someone has a machine planning a units.athen.champion.marine in less than 5 msecs, I'd like to know...
  10. > Or do you want to wait for the real data instead of the currently randomly generated data? Wow, what's going on here? Thx, Hephaestion. Will look into the repo asap. And yes, want to make it complete before commit. I've still that machine setup in the pipeline and I'm currently fighting with the planner. Expect feedback end of WE. PS: Using 'this' in the event handler is nice, didn't know that....
  11. Challenge accepted. I found all (human/bot) chat messages go through GuiInterface.prototype.PushNotification. What do you mean by "reroute" ? A wild guess would be: collect messages in PushNotification add a new event type e.g. "chat" in AIInterface.prototype.EventNames use AIInterface.prototype.GetNonEntityRepresentation to ask GUI for collected messagesanything more? Not clear is how to deal with network chat and recognize team chat.
  12. Yes, but in this case scripting can not add bot chat as feature. The most important part of the API is written in C++. Is bot chat really more difficult than e.g. barterprices? An object with player id as key and message as value would be sufficient.
  13. Are you proposing different binaries for different AIs?
  14. There seems to be no way to let bots communicate with each other like the way humans do by team chat. Actually in a 2v2 game, humans v. bots, humans can exchange info and tactics, bots can't - so chatting is cheating. Imagine sending "attack in 20 sec" to your bot ally to launch a synced attack. Or "need 2000 metal" to force a tribute. Mixed teams would add a new level to the game. Is it a big problem to put two way chat on the API? Sending is already there. Just listening is missing.
  15. > that you use the old buttons Still on A15, because I figured I need to switch to dev on Linux because of better testing, stdout and such. So the charts are postponed a bit. May be you have the time to make a quick mod test on A16? You can switch metrics and toggle player on/off. Would need feedback whether GUI handling is OK. And I need an idea to nicely highlight the active metric in the menu.... charts-02.zip
  16. Screenshot taken from 0 A.D. It's fake data, but png with alpha works, also the metric menu. Credit goes to Josh and <repeat>.
  17. Thx, excellent infos, should put me on the right track.
  18. > seeing a chart in 0AD Unfortunately it is still a chart in Gimp. Generating the <objects> is a good idea and feasible. But has anybody experience if the UI can manage 8 players * 10 metrics * 100 dots? Actually I'd prefer rounded dots not squares, so these are in fact images. Do PNGs with alpha channel work? > listen to the OnUpdate message I want to use the tracker, because the numbers are already there. How do I make it listen to the OnUpdate message? All the stats may amount to a few kilo bytes, is that of concern? Here is an II_xxxx example: var cmpUnitEntityIdentity = Engine.QueryInterface(trainedUnit, IID_Identity);Btw: anybody keen on thinking of the priorities of the metrics? What is a must have? Is units top? // found in StatisticsTracker.js, there is more...unitsTrainedunitsLostunitsLostValueenemyUnitsKilledenemyUnitsKilledValuebuildingsConstructedbuildingsLostbuildingsLostValueenemyBuildingsDestroyedenemyBuildingsDestroyedValueresourcesGatheredresourcesUsedresourcesSoldresourcesBoughttributesSenttributesReceivedtradeIncometreasuresCollectedpercentMapExplored
  19. Ummh, that would make a few thousand objects hand edited, are you sure...?
  20. Thx, I think I spend the tracker a timer, but would prefer it get called on tick, any idea? Re GUI/XML, is there a way to create <objects> on the fly with JS and set size, width, height? Also where are the II_xxxx constants defined, searched all code to no success. I have already a chart panel, will make there subpanels per metric and use many little coloured dot objects per player. Like it?
  21. > The gui is also scripted... Just found out the GUI hot loads on script changes, that's simply crazy. Can someone please tell Mozilla and Google how that works.
  22. Just want to share some fun I'm having with a new group for Hannibal: Scouts. Their goal is to explore the whole map and record geographic features like water, impassable terrain, resources, shores etc. I hope I get them clever enough to detect they are on an island and build a dock + ship to continue exploring the rest of the archipelago. The concept I try to fulfil is: Bots don't cheat. However clouded the map is a bot can easily analyse any part of the map and locate the opponents head-quarter. Hannibal is not like that So here's a first result: If you look closely the dots mark a spot where the scout took a snapshot. While testing I gave the scout three points to visit. If detected idle he moves to the next and so on. Which made another group appear on my list: Patrol. Now that the grainpickers can deal with buildings and scouts with the terrain, the next group is close: miners. After that I have utilized nearly the whole API and will make progress very fast. Here the map to compare: PS: If you think now winning against Hannibal will be easy, just kill the scouts and he's blind - no chance, they reproduce in growing numbers and avoid any violence.
  23. Well, let's say pixels are very little rectangles and graphic stats appear only at game end, so no cheating and no efficiency headache. StatisticsTracker could possibly be extended to store all its data in an growing array with time stamp. Apparently the GUI can already ask StatisticsTracker for numbers and draw them. Where does that happen? Deep links, please
  24. So, adding a tab and drawing pixels involves compiling?
  25. No, it is just I have no clue how components work, I'm already lost at the prototype.Schema line. Can it be used to draw pixels instead of numbers?
  • Create New...