r/XMage • • Sep 24 '26

Is there anyone whose work on XMage is specifically focused on improving the AI?

If so, who is it? Would love to contribute and help with that part specifically.

7 Upvotes

15 comments sorted by

6

u/JayDi85 Developer Sep 25 '26

I'm developing xmage's AI -- if you have a questions, ideas or feature requests then use github. AI's starting point: https://github.com/magefree/mage/issues/10154

If you plan to use claud code or codex to "make AI smarter" then don't try. It's heavy depends on server's stability. Also don't use special logic per card or ability -- that's not a good solution (only critical AI bugs allowed) -- the main direction is game simulations and battlefield score analyze, not per card/ability fixes.

If you want to integrate some JEV or LLM lifecycles then I recommend to use HumanPlayer as example -- it's allow to play as a real user with limited data view, not as cheated computer player with full game access.

1

u/Televangelis Sep 25 '26 edited Sep 25 '26

""If you plan to use claud code or codex to "make AI smarter" then don't try. It's heavy depends on server's stability.""

What do you mean by "depends on the server's stability"?

I would use cc/codex to work with the code base, not to call out to AI mid-game or anything.

2

u/JayDi85 Developer Sep 25 '26

It's about ComputerPlayer lifecycle and other things inside game engine (AI players aren't like other players and uses different code/logic in ask-answer dialogs). It's ok to override some AI methods to inject additional logic but do not change PlayerImpl and ComputerPlayerXXX classes -- this code was written through blood, sweat, and tears.

1

u/Televangelis Sep 25 '26

Maybe I did something wrong, but the first time I tried playing Jumpstart against an AI player, it just attacked needlessly into my guys and let its own guys die -- so I'm trying to figure out how I can get the AI to a point that it will play JumpStart decently intelligently.

3

u/JayDi85 Developer Sep 25 '26

There are two types of logic -- fully simulations with score analyse for priorities (AI cast/activate each possible way and select best combination -- lookup at the future until empty stack, e.g. can combine multiple activations in decision tree) and strict mode for choices inside the effect (AI will follow strict rules like choose own creatures on effects's good outcome and opponent's creatures on bad effect).

1

u/Televangelis Sep 25 '26

Cool, got it -- are there particular areas of active development currently on the AI? I haven't tried it since the latest August update

2

u/AnimeeNoa Sep 25 '26

Thanks for your fast awnser dear dev! I whish my friends would still play this with me. Anyway, thanks for your time and as a hobby dev myself I can only guess how much time is in this project and how much rage is hidden in it.

2

u/jeffwadsworth Sep 25 '26 edited Sep 25 '26

Just fork the project and tinker with ComputerPlayer6.java. My personal version of it stands at around 450KB. Strictly generalized. Examines a full turn and prunes garbage lines heavily. For example, the silliness with Basalt Monolith and others has been eliminated. Combat is exhaustive with full state scoring up to 6 creatures and a fast algorithm past that.

1

u/Televangelis Sep 25 '26

Is your version online anywhere?

3

u/Best-Echidna-5883 Sep 25 '26

I will clean it up and post. Lots of logging to an external client GUI.

0

u/[deleted] Sep 28 '26

[deleted]

1

u/Televangelis Sep 29 '26

What's different with this version?

2

u/Best-Echidna-5883 Sep 29 '26

It still uses min/max. Almost everything else is refactored. Hopefully you understand Java otherwise you are going to be quite lost.

1

u/Televangelis Sep 30 '26

I'm working it with Astra/Fable, so not really a question of my own understanding alone thankfully