Jump to content

agentx

Community Members
  • Posts

    276
  • Joined

  • Last visited

  • Days Won

    7

Posts 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?

    • Like 1
  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...

    • Like 1
  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.

    post-16051-0-86287400-1401802960_thumb.ppost-16051-0-50750900-1401802811_thumb.ppost-16051-0-16989500-1401802835_thumb.p

    post-16051-0-38155900-1401802854_thumb.ppost-16051-0-17374200-1401802879_thumb.ppost-16051-0-81822400-1401802903_thumb.p

    charts-mod.zip

  5. 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);
  6. 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);
  7. 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  2000

    The 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...

    post-16051-0-27903900-1401444853_thumb.ppost-16051-0-41535100-1401444861_thumb.ppost-16051-0-67603000-1401444844_thumb.p

    • Like 3
  8. > 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....

  9. 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:

    1. collect messages in PushNotification
    2. add a new event type e.g. "chat" in AIInterface.prototype.EventNames
    3. use AIInterface.prototype.GetNonEntityRepresentation to ask GUI for collected messages

    anything more?

    Not clear is how to deal with network chat and recognize team chat.

  10. 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.

  11. > 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....

    gui-sketch-02.jpg

    charts-02.zip

  12. > 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
  13. 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.

    gui-sketch.jpg

    Like it?

  14. 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:

    landPass-8.png

    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:

    map-scout.jpg

    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. ;)

    • Like 3
  15. The gui is also scripted, but the engine is made towards drawing rectangles with textures and text, so I don't really know if you can draw per pixel in an efficient way.

    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 :)

×
×
  • Create New...