-
Posts
194 -
Joined
-
Last visited
-
Days Won
4
jonbaer last won the day on December 28 2023
jonbaer had the most liked content!
Profile Information
-
Location
Brooklyn, NY
-
Interests
Machine learning, AI, 0ad
Recent Profile Visitors
3.846 profile views
jonbaer's Achievements

Sesquiplicarius (3/14)
106
Reputation
-
Using AI (Articial Intellegence) to Get Gameplay Answers?
jonbaer replied to Thales's topic in General Discussion
I wanted to also point out something else, when you take a given output the first time and apply it much of it looks and seems "hallucinated" but that is really expected because they are random starting points and they don't adjust until many hours of gameplay later, it is that updating bit where you need "memory" (what a model really represents) - the "RAG[1] of 0AD" if you want to call it that, ie: [1] - https://en.wikipedia.org/wiki/Retrieval-augmented_generation -
Using AI (Articial Intellegence) to Get Gameplay Answers?
jonbaer replied to Thales's topic in General Discussion
You really have to define what a "winning" idea in AI is, for me it is probably what I like to call a "stable equilibrium" in the game. I will give an example but I still think multimodal AI (ie, image in, data (actions) out) is very much possible. If I start a game off w/ 8 AI, procedural map, nomad mode, population 300, etc. and get to a point in the game where there is balanced play among a group of civs and they are not dying out, allies are made, etc. I find a game where it shows the "AI" made good decisions based on resources @ hand (and maybe understand mistakes, this is the bit current LLMs can not do, w/o infinite memory, etc.). This type of setup is long and drawn out and not for everyone but doing these types of simulation games is really the setup I think the game can accomplish. You are right it's all currently based off training from the internet and "hallucinates" like nuts but it's the instruction/memory/recall I think you can do (albeit I wish it was with a more slimmed down version of the game). A base example would be the question of "what's the best location to place a Civ Center (ie: base)?" ... your own analysis from previous gameplay might be to place it close to a coast or within equal distance of stone/metal repositories (for late game) or near food/wood (for early game), etc. Or has is hard coded in there build a dock first (would most people understand this or more importantly would "AI" have figured it out) ... Almost anything from https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/simulation/ai/petra/startingStrategy.js Other items for AI, best spot for marketplace, best spot for a dock (even applying more AI to the tradeManager, etc.) ... so many small hooks/traces you can plug into headquarters.js ... once again I don't think the goal is to create an unbeatable AI, but to model the game and make (and explain) better decisions. YMMV. -
Using AI (Articial Intellegence) to Get Gameplay Answers?
jonbaer replied to Thales's topic in General Discussion
Actually, the real key (I think) w/ this game in general is to plug some type of LLM that understands the game state (from the discovered minimap) and append it to all of Petra AI managers @ https://github.com/0ad/0ad/tree/master/binaries/data/mods/public/simulation/ai/petra I studied this for a long time and had a working copy w/ Hannibal at https://github.com/0ad4ai/ Basically (from high level) on every tick you are asking each "manager", look at this photo (overhead minimap) and tell me best values for next action, but there are certain strategies that involve more cycles at every tick so you have to wait and it never makes a move or takes too long (ie "thinking"). I have a lot of respect for developers of Petra/Hannibal and got hung up on really complex questions like what you posted, especially when it came to AI to AI in https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js ("should I ally/neutral/enemy with you?") I think what is fascinating is that the LLM (either OpenAI/Gemini) do have military strategies baked in (from reading nearly everything) and understand 0AD manual/game setup. The trick is just formatting it back from that API to actions (maybe w/ the RL ports). I am sure Starcraft2 RTS AI folks do this all the time but I find 0AD resources much simpler to work with. -
Man was so long ago I don't even think I remembered my own logic to that patch :-) The ticket says "disappointed" jonbaer but I don't think I was disappointed - this patch also doesn't really solve a Save Map option, it's just to restart the game with the same game attributes. I don't know if it shuts down everything properly as I remember the audio falling out after a handful of restarts. I do remember playing around w/ pyrogenesis in tests ... https://github.com/0ad/0ad/blob/master/binaries/system/readme.txt -autostart="TYPEDIR/MAPNAME" enables autostart and sets MAPNAME; TYPEDIR is skirmishes, scenarios, or random -autostart-seed=SEED sets randomization seed value (default 0, use -1 for random)
-
The other (small) annoying thing with Random maps is there is no way to grab the seed. For example if you end up in a procedural map that you very much enjoy it's a bit of a pain to dig down to find the seed (and no real way to regenerate). This is not a very common case - but I think at one point I recommended you should be able to "Save Game" (save game state) and also "Save Map" (save map setup).
-
If you select say Random/Archipelago a seed is dropped + it has to be extracted. You have to hack around (both to get the seed + setup a new game save w/ it for another round).
-
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)
-
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 :-\
-
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 ...
-
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.
-
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.
-
Was trying to adjust the Archipelago random seed to get something similar but can't come close, wasn't there a project a while back to produce maps based on supercontinents (it may not have been this game), looking for the layout close to https://en.wikipedia.org/wiki/Pangaea_Proxima This map is primarily for 8 AIs (controlled via random LLM strategies) so doesn't have to be perfect, more for research.
-
irishninja started following jonbaer
-
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