All Activity
- Today
-
Running a replay with -serializationtest=N segfaults at turn N+1 for me, in every game with Petra AIs I tried. For example skirmishes/acropolis_bay_2p with two Petra AIs and N = 200, on a clean release build of main 47f5fb4f (no local changes). The commits since then don't touch the simulation code. Backtrace, shortened: ``` JS::shadow::Zone::needsIncrementalBarrier (this=0x0) js::gc::PreWriteBarrierImpl JS::Heap<JS::Value>::~Heap ICmpTemplateManager::~ICmpTemplateManager (m_CachedInstance) CCmpTemplateManager::Deallocate CComponentManager::ResetState CComponentManager::~CComponentManager CSimulation2Impl::Update (the secondary simulation is rebuilt every turn) ``` What I think happens: 1. The serialization test destroys the previous turn's secondary CComponentManager every turn. 2. ~CComponentManager first removes its extra GC roots tracer, and ResetState() clears m_TraceCache, so the components' cached JS instances aren't traced any more. 3. ResetState() then deletes the components in reverse order. Deleting the AIManager destroys the AI's script interface, and Context::UnRegisterRealm calls JS::FinishIncrementalGC if an incremental GC is running. MaybeIncrementalGC() at the end of each turn usually leaves one running. 4. That GC sweeps the cached instances of the components that haven't been deleted yet. 5. The next destructor, the TemplateManager's JS::Heap<JS::Value> m_CachedInstance, runs a write barrier on the dead cell. Finishing any incremental GC at the start of ~CComponentManager, before anything stops being traced, fixed it for me: ``` CComponentManager::~CComponentManager() { JSContext* cx = m_ScriptInterface.GetGeneralJSContext(); if (JS::IsIncrementalGCInProgress(cx)) JS::FinishIncrementalGC(cx, JS::GCReason::API); JS_RemoveExtraGCRootsTracer(cx, Trace, (void*)this); ResetState(); } ``` With it, Acropolis Bay ran 100 turns of the serialization test without problems, and a random map game ran 1,000 turns. Something else I noticed while looking at this, though it wasn't the cause: Update assigns a new m_SecondaryTerrain before it replaces the context and component manager that still point to the old terrain. Resetting the component manager first, then the context, then the terrain avoids that.
-
On Survival of the Fittest, if you save the game and load it again, no more enemy waves come. attackerUnitTemplates in maps/random/survivalofthefittest_triggers.js is a script global that only InitSurvival fills (on OnInitGame). Script globals aren't saved and OnInitGame doesn't run on load, so after a load the table is empty and the next wave fails with: ``` ERROR: Error in timer on entity 1, IID104, function DoAction: TypeError: can't access property "heroes", attackerUnitTemplates[civ] is undefined ``` After that no further waves spawn. To reproduce: 1. Start Survival of the Fittest. 2. Save before the first wave and load the save. 3. Wait for the wave: the error above shows up and no attackers come. A rejoin is not affected, because a rejoining client runs InitGame before it receives the state. I checked that with two peers. Fix: reload the templates if the table is empty when a wave starts: ``` Trigger.prototype.StartAnEnemyWave = function() { + if (!Object.keys(attackerUnitTemplates).length) + this.LoadAttackerTemplates(); ``` With this, loaded games stay identical to the running game across the waves I tested. Tested on main 47f5fb4f;
-
On random/wall_demo with Petra AIs, a client that rejoins goes out of sync, because a loaded AI has a base manager that the running AI never created. On Wall Demo neither player starts with a civic centre or a unit in an accessible land region, so Petra's region analysis fails at game start (the "does not know how to interpret this map" case from #3110). gameAnalysis then returns before basesManager.init, so noBase stays undefined. BasesManager.Serialize already handles that (noBase?.Serialize()). But on load, HQ.Deserialize calls this.basesManager.init(gameState, true) unconditionally, which creates noBase, and BasesManager.Deserialize keeps it even though the save has none. So every loaded or rejoined AI has one more base manager than the AI in the running game. AI state is part of the full state hash, so a rejoin goes out of sync. I tested it with two peers: a host playing Wall Demo with two Petra AIs (seed 31), and an observer that rejoined and got the state of turn 600. Both peers wrote OOS dumps at turn 880. With the fix below there was no OOS up to turn 1,099. To reproduce: 1. Host a game on random/wall_demo with two Petra AIs. 2. Let an observer join after turn 500. 3. The joiner goes out of sync a few hundred turns later (turn 880 in my test). Single player is affected too: loading a save gives the AI the extra noBase. In my headless runs every restore from turns 500, 1,000 and 1,500 differed from the running game at the first comparison. Fix: in BasesManager.Deserialize, leave noBase undefined when the save doesn't have one. With that, loads from turns 500, 1,000 and 1,500 matched the running game at every compared turn up to 2,000. I tested it as a small mod; the change is just clearing this.noBase when the saved data has no noBase entry: ``` --- a/binaries/data/mods/public/simulation/ai/petra/basesManager.js +++ b/binaries/data/mods/public/simulation/ai/petra/basesManager.js @@ -796,6 +796,10 @@ this.noBase.init(gameState, BaseManager.STATE_WITH_ANCHOR); this.noBase.Deserialize(gameState, data.noBase); } + else + // init() (called by HQ.Deserialize) created a noBase that the saved game never had: + // the region analysis failed at game start, so basesManager.init was never called. + this.noBase = undefined; this.baseManagers = []; for (const basedata of data.baseManagers) ``` Tested on main 47f5fb4f.
-
On the Flood map, a game with Petra AIs plays differently after a load (or a rejoin) once the water has started rising. Petra builds its accessibility data (the land and water regions) once, in init (simulation/ai/common-api/shared.js), and nothing tells it when the water level changes. So in the running game the AI keeps using the regions from before the flood. An AI that is loaded after the first rise, from a save or on a rejoin, builds them again on the flooded terrain and makes different decisions from the first turn (different subroles and gather orders). Since AIs run on every client, a rejoin after the rise goes out of sync. I tested this with two peers: a host playing Flood with two Petra AIs (seed 21), and an observer joining after turn 1,500. The observer was reported out of sync at turn 1,824. To reproduce without a network game: 1. Run Flood headless with two Petra AIs and a fixed seed. 2. Save at turns 1,200, 1,300 and 1,400 (the first rise is at 260 seconds). 3. Load each save and compare with the game that kept running. The load from turn 1,200 (before the rise) stays identical. The loads from 1,300 and 1,400 differ within 100 turns. I see two ways to fix it: - Save the terrain analysis and regions in the shared script's Serialize() and restore them on load instead of recomputing them. This keeps the current behaviour and makes a loaded game match the running one. I tried this: on Flood, 330 of 330 compared states were equal (125 of 330 without it). - Tell the AIs about water and terrain changes and rebuild the accessibility data when they happen. That would change how the AI plays tho Here is the patch for the first option, against current main: ``` --- a/binaries/data/mods/public/simulation/ai/common-api/shared.js +++ b/binaries/data/mods/public/simulation/ai/common-api/shared.js @@ -32,14 +32,39 @@ /** Return a simple object (using no classes etc) that will be serialized into saved games */ Serialize() { + // loaded but not yet initialized (e.g. serialized again right after a load): write the loaded copy back + if (this.savedTerrain) + return { + "players": this._players, + "templatesModifications": this._templatesModifications, + "entitiesModifications": this._entitiesModifications, + "metadata": this._entityMetadata, + "terrainAnalyzer": this.savedTerrain.terrainAnalyzer, + "accessibility": this.savedTerrain.accessibility + }; return { "players": this._players, "templatesModifications": this._templatesModifications, "entitiesModifications": this._entitiesModifications, - "metadata": this._entityMetadata + "metadata": this._entityMetadata, + // the terrain analysis and regions are built once, at initialization, and kept while the + // game runs; save them so that a load restores them instead of recomputing them from the current terrain + "terrainAnalyzer": SharedScript.plainFields(this.terrainAnalyzer), + // (the accessibility map is the analyzer's map, the same array: saved once and relinked on load) + "accessibility": SharedScript.plainFields(this.accessibility, this.terrainAnalyzer && this.terrainAnalyzer.map) }; } + static plainFields(obj, shared) + { + const out = {}; + if (obj) + for (const key of Object.keys(obj)) + if (key != "sharedScript" && !(shared && obj[key] === shared)) + out[key] = obj[key]; + return out; + } + /** * Called after the constructor when loading a saved game, with 'data' being * whatever Serialize() returned @@ -50,6 +75,7 @@ this._templatesModifications = data.templatesModifications; this._entitiesModifications = data.entitiesModifications; this._entityMetadata = data.metadata; + this.savedTerrain = { "terrainAnalyzer": data.terrainAnalyzer, "accessibility": data.accessibility }; this.isDeserialized = true; } @@ -117,6 +143,13 @@ // create the terrain analyzer this.terrainAnalyzer = new TerrainAnalysis(this, state); this.accessibility = new Accessibility(state, this.terrainAnalyzer); + if (deserialization && this.savedTerrain && this.savedTerrain.accessibility) + { + Object.assign(this.terrainAnalyzer, this.savedTerrain.terrainAnalyzer); + Object.assign(this.accessibility, this.savedTerrain.accessibility); + this.accessibility.map = this.terrainAnalyzer.map; + } + this.savedTerrain = undefined; // Resource types: ignore = not used for resource maps // abundant = abundant resource with small amount each ``` Tested on main 47f5fb4f.
-
wasname321 joined the community
-
The Oath of Ashes — a mini automated war for 0 A.D.
lilypoppy replied to lilypoppy's topic in General Discussion
@Asher Right now, Atlas-tools is proving to be a real asset when it comes to the mapping side of things. It's helping me move forward on that front, and that's genuinely valuable. Where things get more involved is on the testing side. At the moment, I'm focused on figuring out how to properly implement the JavaScript portion of the work, making sure everything is set up the right way rather than rushing through it. That said, I'm running into some pretty big challenges. The first one is that every time I change something, I have to reload Atlas all the time. So it's genuinely slow, and that really adds up over the course of a day. The second challenge is that I'm working with Holger to find a way to load the game directly onto Mercator. If we can pull that off, the simulation would save us a crazy amount of time. That's the goal we're chasing right now, and it would make a real difference." With@ Grautvornix, And one thing I like about Atlas-tool: when I add something to Atlas, it shows up immediately. If I could do that with JavaScript, it would be such a game changer. @Grautvornix -
More exciting updates on the development of World Rising! Units can now suffer from different status effects during their adventures and battles: Burning: Caused by flaming arrows. Stun: Triggered by attacks from large animals or special combat abilities. Poisoning: Caused by venomous animals. Unlike other status effects, poisoning has no time limit and remains active until the affected unit is treated by a healer. I've also added new visual effects and am expanding the Japanese wildlife, including terrestrial and marine animals such as sharks and whales. Our second map, Japanese Coast, is nearly complete, filled with wildlife, biodiversity, and natural beauty. One of the most interesting additions is the sharks' natural hunting behavior. They swim through the ocean, approach schools of fish, attack, feed, and then swim away. Your fishermen will likely witness plenty of shark attacks while fishing! With each update, we aim to make World Rising a more vibrant, dynamic, immersive, and strategic experience. Enjoy the latest screenshots and videos! As always, your feedback and suggestions are very welcome. I hope you enjoy these new additions! 1752930104_Gravando2026-12-03224236.mp4 965785587_Gravando2026-12-03225242.mp4 1676370618_Gravando2026-12-03225912.mp4
-
The Oath of Ashes — a mini automated war for 0 A.D.
Asher replied to lilypoppy's topic in General Discussion
Could you explain how it works? How do you use Atlas-tools to help? Is there a lot of testing involved to see if the units go exactly where you want them? How do you time it? -
what games do you play besides 0ad?
Nicolaus_von_Kues replied to grepmaster's topic in Introductions & Off-Topic Discussion
Still difficult to master. I'm also thinking of installing The Witcher and other old games that I never got to play. -
The Oath of Ashes — a mini automated war for 0 A.D.
lilypoppy replied to lilypoppy's topic in General Discussion
I believe that stepping beyond what is currently possible will help create new and original projects! The challenge lies in finding creators, as it requires a great deal of versatility. @Grautvornix That’s why I really like Atlas-tools -
The Oath of Ashes — a mini automated war for 0 A.D.
lilypoppy replied to lilypoppy's topic in General Discussion
@AsherIf you have any questions, I could help you! -
The Oath of Ashes — a mini automated war for 0 A.D.
Asher replied to lilypoppy's topic in General Discussion
Just watched it. That is pretty cool! I kinda want to make a movie in 0 A.D. now -
=[TASK]= Ishtar Gate of Babylon
Cyrus_Junior replied to wowgetoffyourcellphone's topic in Official tasks
thank you for the motivation! - Yesterday
-
The Oath of Ashes — a mini automated war for 0 A.D.
Grautvornix replied to lilypoppy's topic in General Discussion
Spoiler: one party won the fight - although a two remaining adversary troops plus a single warrior were left inactive and were not attacked. Did I say already that it looks awesome? Moving such an army on both sides looks truly impressive. -
The Oath of Ashes — a mini automated war for 0 A.D.
Asher replied to lilypoppy's topic in General Discussion
No, not yet... (I actually didn't watch it yet either though) -
The Oath of Ashes — a mini automated war for 0 A.D.
lilypoppy replied to lilypoppy's topic in General Discussion
@Asher @Grautvornix Did you make popcorn? -
The Oath of Ashes — a mini automated war for 0 A.D.
Grautvornix replied to lilypoppy's topic in General Discussion
@lilypoppy Absolutely awesome!!! @Asher is right - you were making a movie! -
Grautvornix started following Asher
-
Grautvornix started following lilypoppy
-
The Oath of Ashes — a mini automated war for 0 A.D.
Grautvornix replied to lilypoppy's topic in General Discussion
@lilypoppyThank you so much - happy to see it is useful! The next version is going to have quite a few extra gadgets and capabilities. -
The Oath of Ashes — a mini automated war for 0 A.D.
Asher replied to lilypoppy's topic in General Discussion
Yah, I can imagine it would be. But it is pretty cool -
The Oath of Ashes — a mini automated war for 0 A.D.
lilypoppy replied to lilypoppy's topic in General Discussion
@Asher I’ve managed to create some scenes with Burning Heart, but I have to admit that it’s a challenge. maybe one day with Atlas-tool @Grautvornix -
Asher started following The Oath of Ashes — a mini automated war for 0 A.D.
-
The Oath of Ashes — a mini automated war for 0 A.D.
Asher replied to lilypoppy's topic in General Discussion
Now you are making movies in 0 A.D.? -
The Oath of Ashes — a mini automated war for 0 A.D.
lilypoppy replied to lilypoppy's topic in General Discussion
@Grautvornix I forgot the most important part: that it’s with the help of Atlas-tools ! -
The Oath of Ashes — a mini automated war for 0 A.D.
Grautvornix replied to lilypoppy's topic in General Discussion
@lilypoppy It is phantastic what can be acheived with a bit of scripting when you ahve a good game and map basis. Will test immediately! -
lilypoppy started following The Oath of Ashes — a mini automated war for 0 A.D.
-
My friends, get the popcorn ready… or your dinner. I cooked up something special for 0 A.D. Nothing serious, nothing historically verified — it's pure testing. But the result is so hypnotic that you'll want to settle in for a while and just watch. The concept: a war far away. You're neither a general nor a god. You're a spectator. A small, fully automated war unfolding in 7 phases and lasting about 6 minutes. Each side fights on its own, the mechanics do their job, and all you have to do is watch. It's first and foremost a test bench: I wanted to see what 0 A.D.'s JavaScript and triggers have in their belly. The Oath of Ashes is that — a story of honor and ashes played out by units that know nothing about it. How to play with a friend (manual mode) Here we do the opposite: we want the players to take control back, so we disable the automation. Two things to do: Delete the file maps/scenarios/the_oath_of_ashes_triggers.js. Remove its reference in the_oath_of_ashes.xml. In the ScriptSettings block, the "TriggerScripts" line becomes: json "TriggerScripts": ["scripts/TriggerHelper.js"], (You can also delete the TriggerScripts entry entirely.) Then, in the game setup, assign an AI to player 2 (Kushites). Otherwise their army will just stand there while you attack them — and that's less fun. Now you're the one playing — no more automated war, no more scripted phases, just a normal battle to fight with a friend. Technical note — OpenGL (especially macOS and R28) A quick heads-up for the graphics side. This scenario leans on the base game's rendering, and 0 A.D. uses OpenGL. On macOS, OpenGL support is deprecated and can be finicky depending on your driver and OS version — and if you're on a build around R28, there are known quirks worth watching for. I can't guarantee a perfectly smooth ride on every Mac setup. So if you run into graphical glitches, crashes, black screens, or weird rendering while running this scenario, please send me feedback. Tell me your OS, your 0 A.D. version, your OpenGL/driver situation if you know it, and what you saw. That kind of report is genuinely useful — it helps me figure out whether the issue comes from the scenario's triggers or from the OpenGL side itself. One phase of this project was the map itself. The map was created using Atlas Tools — a package that combines Mercator and post-Atlas, created by Grautvornix. It's a set of Python-based tools designed to make map creation and verification easier for 0 A.D. projects: Mercator helps you build terrain from scratch or from digital elevation models, and post-Atlas checks, verifies, and converts maps to the R28/R29 game format. You can hand over work between them and refine in Atlas afterwards. @Grautvornix Une guerre lointaine. — Lilypoppy le_serment_des_cendres.zip
-
@Dunedan, @vladislavbelov I’ve encountered a situation where some strings—which I distinctly remember having already translated—are now appearing as untranslated. As I worked through the remaining strings, I kept coming across such instances, even though I am certain I had translated them previously. Upon investigating, I discovered that these translations were apparently deleted three months ago (this is what’s highlighted in the screenshot). In other words, the translations existed, but for some reason, they were removed. I’m not sure why this happened, so I’ve posted a question about it on the forum.
