I am having a problem when doing a fast-replay of a game (Livingstone, Alpha). Only during fast-replay, some of the removeFromStockById() in a notification (notif_soldGem) don't occur. No errors are reported and each stock item has a unique ID. The game works fine real-time. turn-based or step-by-step replay.
How the game works:
- player gets X number of times to randomly draw a stone.
- player clicks on a "bag" icon to randomly draw one stone. The notif_stoneDug() is called to display that token in the "stonesPulled" stock.
- if player has drawn the last stone, all drawn stones are then moved on the screen from the "stonesPulled" stock to the "gemsInHand" stock.
- the player may then immediately click on items in the "gemsInHand" stock one at a time to sell them, which results in notif_soldGem() removing the gem from the "gemsInHand" stock.
It is usually the first removeFromStockById() in notif_soldGem() that gets skipped after all the items are moved from the one stock to the other in notif_stoneDug().
Is the fact that I have the await and/or made notif_stoneDug() async maybe an issue for fast-replay? Do I need to do any work to handle animations done by stock calls during fast-replay or is that handled within stock?
Pseudo-Code snippets:
How the game works:
- player gets X number of times to randomly draw a stone.
- player clicks on a "bag" icon to randomly draw one stone. The notif_stoneDug() is called to display that token in the "stonesPulled" stock.
- if player has drawn the last stone, all drawn stones are then moved on the screen from the "stonesPulled" stock to the "gemsInHand" stock.
- the player may then immediately click on items in the "gemsInHand" stock one at a time to sell them, which results in notif_soldGem() removing the gem from the "gemsInHand" stock.
It is usually the first removeFromStockById() in notif_soldGem() that gets skipped after all the items are moved from the one stock to the other in notif_stoneDug().
Is the fact that I have the await and/or made notif_stoneDug() async maybe an issue for fast-replay? Do I need to do any work to handle animations done by stock calls during fast-replay or is that handled within stock?
Pseudo-Code snippets:
Code: Select all
notif_stoneDug : async function(notif) {
this.stonesPulled.addToStockWithId(this.stoneStockIndex.get(stoneColorName),stoneId);
if (lastStoneDug) {
await this.wait(2000); // delay so player can see last stone dug
for (var pulledStoneId in pulledStones) {
this.gemsInHand.addToStockWithId(stoneType,stoneId,pulledItemDivId);
this.stonesPulled.removeFromStockById(stoneId);
}
}
}
notif_soldGem : function(notif) {
this.gemsInHand.removeFromStockById(notif.args.stone_id);
}