Jump to content

jonbaer

Community Members
  • Posts

    188
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by jonbaer

  1. Well there is a race @ the moment to quantize and make them small enough but I agree ... you would get just as much joy storing random text in a mod.  I think I found a couple of random seeds for my map that I think can work for my original objective.  If I had a feature request here it would be to freeze/label the seed as a new map somehow (sorry if this is already possible) 

  2. The LLM is a full time hallucinating machine :-) it was meant to be a (half) a joke.  However I think at some point you can feed (or "fine-tune") it with a more in-depth version of a game manual and have it work pretty decent (definitely not as fast as what might be required for RTS) but more as a critic for moves maybe.  I recently read Sony would adjust settings in realtime (https://insider-gaming.com/sony-patent-game-difficulty/) which seems a bit (odd) interesting (I thought tons of games already did this).

    It would be actually kinda cool if say you did spawn a Themistocles or hero you got a chat/hint message from them on your gameplay if human vs. AI ... but that is future talk on running locally or remote (ie OpenAI API, etc.) - who knows maybe that day is sooner than realized :-\

    • Like 1
  3. I don't really know how well this works in principle, I mainly took it originally that Petra should be moved out into it's own mod w/o public and nearly all the managers should be exposed to zero_ad.py (my main focus was https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/simulation/ai/petra/tradeManager.js#L587) but since multimodal LLMs can make judgements on strategies from gamestates/minimaps/Atari(like) bitmaps it might make sense to query it once for general strategy and then as the game progresses check for changes in strategy (using the LLM is a bit of a cheat/hack + no way of knowing if you get the best strategy).  It would be a little like say reading all books on Themistocles strategies + presenting state (or minimap) for next best set of build orders or something, ie "He persuaded the Athenians to invest their income from silver mines in a war fleet of 200 Triremes." ... but then again looking through some of the managers quite a few methods have already really been somewhat optimized (and LLM would probably ruin some things).  I think I looked @ https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/simulation/ai/petra/startingStrategy.js#L207 before as well.  

    (Also bear in mind my game + map setup is always the same + conditioned for this so it doesn't apply to the overall game) and swap to MicroRTS for a "lighter version of 0AD", https://github.com/Farama-Foundation/MicroRTS-Py ... 

    Screenshot 2023-12-27 at 8.55.56 PM.png

    Screenshot 2023-12-27 at 8.57.38 PM.png

    Screenshot 2023-12-27 at 9.00.24 PM.png

    Screenshot 2023-12-27 at 9.11.17 PM.png

    • Like 1
    • Haha 1
  4. I realize this might sound like a crazy thought, but I realized there was an "encyclopedia" being created/generated @ https://github.com/TheShadowOfHassen/0-ad-history-encyclopedia-mod ... imagine using some of that as the base of behavior for some civs and leaders.  The thing about current LLM states are just that they already include game/military/economic strategy from training data, fine tuning on that information would be an amazing feat if you could replay it back.  Nowhere near that point but thinking out loud.

    • Like 1
  5. Well (in a general sense), the current overall global behavior is really locked and not based on anything, for example here:

    // Petra usually uses the continuous values of personality.aggressive and personality.defensive
        // to define its behavior according to personality. But when discontinuous behavior is needed,
        // it uses the following personalityCut which should be set such that:
        // behavior="aggressive" => personality.aggressive > personalityCut.strong &&
        //                          personality.defensive  < personalityCut.weak
        // and inversely for behavior="defensive"
        this.personalityCut = { "weak": 0.3, "medium": 0.5, "strong": 0.7 };

    Getting the behavior to decide on actions based on overall game state, an LLM given some objective should be able to decide + use random choice (when it sees the entire board/minimap/ally info).  Should be clear I am not using an LLM to "play the game", just logging decision points @ the moment.

    • Like 1
  6. Trying to fix this myself, there seems to be a case if you play vs. multiple AIs where the diplomacy for ally/neutral/enemy only changes once w/ a preset condition and then stays there.

    It would be nice to make this smarter and more challenging somehow.  Is there even any docs/posts which discuss how this is suppose to work?

    At the moment I am playing 1 vs. 5 AIs where I will make decisions on which ally makes economic sense but it would be great if there was a decision maker on the other side in the game.

    Hope this makes sense.

    https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js

    • Like 1
  7. I have only used it + compiled on OSX and Linux, when you say "it" does that mean it won't compile or the python client won't work/do anything on Windows, is there an error trace somewhere.  This is tough because obviously the game itself is (without doubt) rendered beautifully on Windows/GPUs/gaming rigs but I think this bit (RL/ML/AI) is really being done more in Linux/parallel.  I come in peace and hope the two camps can work together :-). I guess leaving this as a compile-time option is the only way forward.  I was hoping somehow as something through the mod lobby too.

  8. I will try, I think the major issue here is probably along the lines of versioning the protobuf builds at some point and I don't know how that works.  Like maybe zero_ad is a pip installed library with a version inline with the subversion id or the Alpha 23 version, etc.  Everything else (beyond what is inside of main.cpp) can just be really built on as default.  In other words just let python have the ability to talk to pyrogenesis and push everything else to another repo.  I think there should be (or probably is) already someway to define a client/server mismatch.  I don't think @irishninja needs the main build to include the clients, I could be wrong or this has probably been discussed but I didn't see it yet.

  9. I was able to fix my errors by pip3 install --upgrade tensorboardX + playing around with the zero_ad py client has been fun.

    One thing I'd like to figure out (this might already exist or I just don't know if it is something which can be accomplished), would be for the python client to actually inject a way to overwrite some of the JS prototypes.  I will give an example, in Petra on the tradeManager it will link back to HQ for something like this:

    m.HQ.prototype.findMarketLocation = function(gameState, template)

    To me this is a decision making ability I feel like RL would be pretty well suited for (I could be wrong), but I feel like having ways to optimize your market in game (with say a Wonder game mode) on a random map would be a great RL accomplishment ... especially you would get bonus points to work around enemies + allies.  Sorry I have always been fascinated w/ that function of the game, kudos to whoever wrote it.  There are occasions where this AI makes some serious mistakes on not identifying chokepoints/narrow water routes, etc.  But to me @ least it's an important part of the game that pre simulating or making that part of the AI smarter would be key.

    Also will D2199 make it into master copy?  I can't seem to locate where that decision was(n't) made ... thanks.

  10. There are still some minor small issues but I got it running, I had to directly install rllib (pip3 install ray[rllib]) + obviously forgot to install the map(s) first time around :-\

    It looks like I may not be running w/ the correct version of TF inside of Ray though since I get this from the logger ... AttributeError: 'SummaryWriter' object has no attribute 'flush' ...

    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/ray/tune/trial_runner.py", line 496, in _process_trial
        result, terminate=(decision == TrialScheduler.STOP))
      File "/usr/local/lib/python3.7/site-packages/ray/tune/trial.py", line 434, in update_last_result
        self.result_logger.on_result(self.last_result)
      File "/usr/local/lib/python3.7/site-packages/ray/tune/logger.py", line 295, in on_result
        _logger.on_result(result)
      File "/usr/local/lib/python3.7/site-packages/ray/tune/logger.py", line 214, in on_result
        full_attr, value, global_step=step)
      File "/usr/local/lib/python3.7/site-packages/tensorboardX/writer.py", line 395, in add_histogram
        self.file_writer.add_summary(histogram(tag, values, bins), global_step, walltime)
      File "/usr/local/lib/python3.7/site-packages/tensorboardX/summary.py", line 142, in histogram
        hist = make_histogram(values.astype(float), bins)
    AttributeError: 'NoneType' object has no attribute 'astype'

    Is there something inside of ~/ray_results which would confirm a successful run? (I have not used it much yet but will read over the docs this week).

  11. Thank you, was able to build this fork and have it running now, I am currently on OSX w/ no GPU @ the moment (usually anything I require GPU for I use Colab or Gradient @ the moment) ... I wasn't able to run PPO_CavalryVsInfantry because of what looked like Ray problems but will figure out.  

    • Like 1
  12. Hmm ... I still get ...

    Premake args:  --with-rlinterface --atlas
    Error: invalid option 'with-rlinterface'
    ERROR: Premake failed

    I don't see it in premake5.lua @ all ... https://github.com/0ad/0ad/blob/master/build/premake/premake5.lua

    There is only a master branch there right?

    Edit: Sorry or just to be clear, I should apply the D2199 diff if I want that option? I meant I just did not see it in my latest git pull anywhere.

  13. I actually started a small repo area a while back (after I found the Hannibal 0AD bot), https://github.com/0ad4ai ... but I think the problem he had was that releases were moving so quickly it was hard to nail down a solid externalized interface.  I think the minigames are a great place to start but I tend to think I have my ideas broken up to be too narrow (market production for example), many of these can obviously be related to techniques already in Starcraft play, resource management.  I did not bail on these ideas but I rather found a "simpler" version easier to work w/ so I have a built copy which is smaller, but even then I moved onto MicroRTS for quicker implementation of ideas, https://github.com/santiontanon/microrts ... there is an OpenAI gym for it but likewise there issues always seems to be across what format to write data out to (binary vs. JSON) especially when your state is quite large.

    Either way I would love to see an 0AD-gym be available @ some point.  It's just hard to say if it justifies pulling down and using the entire game or just say 1 map + 2/3 civs, etc.

  14. Thanks for pointing out the Economy Simulation mod, I think I will look @ it ... I didn't mean for population aging to be so complexed, just something simpler, I feel like there are moments where I don't want to have to kill off idle types of players (fishing, etc.) and have some type where they could either convert on their own or just die off when not needed, but something more in a realistic way that is geared toward overall economics of the gameplay.

    • Like 1
  15. Has there ever been any discussion to maybe adding @ some point in time a new dynamic for population aging somehow?  Thinking something like just a basic timer but time could be x-factored by medicine technology tree somewhere, also adding some demographic type of charting, also maybe x-factored could be attack dynamics where young battle = x1, middle age (prime) is x5 and later periods in old age are x1.

    Thoughts?

    [0] - https://en.wikipedia.org/wiki/Population_ageing

  16. The way I see it the nomad mode is a bit flawed and yet excellent at the same time.  Random maps throwing random resources will immediately doom certain civs right off the bat depending on geography.  In your best strategy you build a dock and hope for the best in gathering up to build a Civ Centre.  Part of it is a short mini-game within a game.

    So to answer your question build a dock and immediately gather wood/stone/metal (thus placing your dock in an equal distance between all 3 being part of your fate/doom/win).

  17. Just to keep this conversation going a bit, I came across this while watching the Tensorflow Dev Summit videos, https://github.com/tensorflow/datasets/blob/master/tensorflow_datasets/video/starcraft.py ... in light of what I think happens w/ SC2 AI build-ups it is more of passing minimap visual information into decision making, another more high level route.  BTW I noticed quite a few discussions in regards to forks of 0AD, something I would like to see of any forks is the possibility on making 2 different projects, one simply for the Pyrogenesis RTS engine and the other for Civs straight down the line to being loadables or mod-based.

  18. A Gym/Universe setup would be great but 0ad isn't a simple Atari 2600 environment ;-) I haven't looked much @ it since Hannibal dev kinda died down but in retrospect really what I think the launcher (https://github.com/agentx-cgn/Hannibal/blob/master/launcher.py) was doing was to dump game state and let a sub python process (ML/RL) analyze and then pass it back up to one of the managers in Petra when decision making on the next action (gather/attack/defend/etc).  Really the first step is to try to strip down pyrogenesis to bare bones w/ 1 civ and 1 map somehow (and of course keep it inline w/ master branch), otherwise you are looking @ 2GB public.zip - in nutshell the eye candy graphics nothing pertaining to the bare bone of the AI planning.  At the moment it is easier to test ideas w/ something micro like, https://github.com/santiontanon/microrts and then bring it back into 0ad, probably as a mod itself.

    Another interesting thread I came across: 

     

    • Like 1
×
×
  • Create New...