[Update 2.49] AIs in JavaScript, TypeScript and Python, Collection page, and seasonal events
Hi everyone!
Update 2.49 is live! On the menu: seasonal events arrive, you can now code your AIs in Python and TypeScript on top of LeekScript, a new Collection page, a filterable fight history, and a big translation pass across all 17 languages.
Full changelog here: https://leekwars.com/release/2.49
Seasonal events
- The game now has seasons: Solstice, Heatwave, Halloween, Easter and Christmas. During a season, a banner shows up in the garden and a short announcement welcomes you.
- Each season boosts one fight type with +50% XP and loot (for example Battle Royale during Solstice). A nice reason to switch up your routine depending on the time of year.
- Plus 10 new season trophies, gathered in a "Seasons" category: five for logging in during each season, five for playing 1000 fights of the boosted type.
Your AIs in JavaScript, Python and TypeScript
- You can now write your AIs in JavaScript, Python or TypeScript, on top of LeekScript: just create a
.js, .py or .ts file in the editor and equip it like any other AI. Multi-file projects work as you'd expect (import between your AIs, subfolders, relative paths), and TypeScript is transpiled automatically.
- Under the hood, your code runs in a GraalVM sandbox isolated from the fight engine, with a memory budget that scales with your leek's level. In JavaScript and TypeScript, operations are counted deterministically: a custom instruction counter, not a stopwatch, so the same code always yields the same count regardless of server load. Fight functions keep their usual operation costs. (Python still relies on a CPU-time budget for now, the deterministic counter is coming.)
- These languages come with a fully object-oriented API:
me, typed entities (Leek, Turret, Bulb, Chest, Mob), Weapon and Chip inheriting from Item, cells (Cell), the field (Field) and Fight. Methods return real objects, not ids: me.weaponCell(target) returns a Cell, cell.path(target) a path of Cells. Constants are organized by family (Effect.DAMAGE, State.UNHEALABLE, Entity.Stat.STRENGTH, Cell.Type.EMPTY...) and in JS/TS weapons and chips are shared instances: me.weapon === Weapon.pistol when the pistol is equipped, and weapon.features lists its characteristics.
- On the editor side: in TypeScript and JavaScript, live type checking and autocompletion over the whole fight API, shipped fully typed; in Python, live validation through Pyright (undefined names, type and syntax errors flagged as you type). And when signing up, you now pick your starting language, with a sample AI for each.
- What about LeekScript? It doesn't move an inch: same API, same costs, it remains the reference language of the game.
Collection and history
- New Collection page: track your progress on weapons, chips, hats, potions and resources. For the completionists.
- The fight history gets filters (by result, by fight type) and an opponent search, and updates live without reloading the page.
Editor and comfort
- A VSCode-style command palette, opened with
Ctrl+Shift+P, to run editor actions from the keyboard.
- The editor theme now automatically follows the site theme (light/dark), and your AI code is cached locally for faster loading.
- Also: a redesigned Contact page, dedicated article pages for the dev blog (indexed by search engines), a maintenance page with a leek runner mini-game, leek names in the tournament bracket, a button to refresh the item showcase in the shop, and clicking a fight notification now opens the report or fight directly.
LeekScript and fixes
- Language side: return type covariance when overriding a method, the optional indexed access
a?[b], new constants, and a good number of compiler and runtime fixes.
- A big quality pass on the translations of all 17 languages (completions and mistranslations fixed), and a long list of display fixes (fights, chat, forum, editor, trophies).
One last word: opening AIs up to JavaScript, Python and TypeScript is a long-time dream and easily one of the biggest evolutions of the game in years. Three real languages, with the whole fight API, in the editor and in fights. I really can't wait to see what you build with them. And tell me in the comments which language you'd like to see next! See you in the garden!
Pilow