Extract from a Wesnoth replay: game settings, sides info, chat log.
- Features
- User's manual
- Users FAQ
- API
- Installing
- Afterword
- Software Disclaimer
- Donation sponsorship Disclaimer
- Links
- UI screenshots
App consists from:
- NodeJS back-end with web-server
fastify
and API endpoint; - Front-end (at the same web-server).
This app is for parsing replays from official server 'replays.wesnoth.org'. App gather game settings, sides info, and chat log with unique feature - show all chat lines with binding to current turn number.
I wish it could help somehow tournament organizers.
Players also could use it to get quick glance at replay.
Although this app created for 1v1 replays (for 2 sides/players), it still could be used with any replay with some disclaimers - for example app would show chat log, but there could be wrong colorizing and so on.
Example of colorized chat log with binding to turn numbers:
- Find a replay at official Wesnoth replays server. Supported only 1.14.X versions (probably other versions could work too).
- Copy link to replay (example: link).
- Open app https://wespar.onrender.com/.
- Insert link and press button.
- Server would download that replay, decompress and parse info.
- Result would be shown.
Q: Does it say if a player picked?
A: No, I could not gather such info from replay file structure.
Q: Why there are no factions?
A: There is no simply universal way to get factions from replay structure. So, there are only leaders as faction's representative.
Q: Why there are "unknown_time" for messages from server?
A: It's my placeholder, because there are really no timestamp for server's messages in replay structure. Interesting, that if you render replay with Wesnoth-client, there would be your local time.
Q: Could you know for sure from replay who was winner?
A: There currently is nothing recorded about who won or lost. The issue is that while it would be possible to determine the winner in the case of a leader death (in regular scenarios) or if a side surrendered, there's no way to determine a winner (ie in case of a rage quit) or if a winner even needs to be determined (ie in case of a game being saved in order to be continued later). (Pentarctagon, Wesnoth forums)
POST
to path /url
with JSON payload:
{
"urlFileForParsing": "https://replays.wesnoth.org/1.14/2021/04/30/2p__Swamp_of_Dread_Turn_10_(31797).bz2"
}
JSON would be like this:
{
"errorInRequest": null or string,
"answer": {
"errorWhileParsing": null or string,
"meta": null or {},
"gameSettings": null or {
"addons": null or [{}],
"settings": null or {},
"turns": null or integer
},
"sides": null or [{}],
"chat": null or [{}],
"mTime": null or integer
}
}
Example for cURL:
APP_URL="https://wespar.onrender.com"
ENDPOINT="/url"
curl --header "Content-Type: application/json" \
--request POST \
--data '{"urlFileForParsing":"https://replays.wesnoth.org/1.14/2021/03/22/2p__Weldyn_Channel_Turn_14_(155976).bz2"}' \
$APP_URL$ENDPOINT
For GNU/Linux:
git clone https://github.com/amokmen/wespar/
cd wespar
npm install
npx husky install
npm run start
Starting point for back-end is ./index.js
and config is at ./config.js
.
ENV variables that app could use: PORT
(web-server listening port number), LOG_LEVEL
and LOG_LEVEL_FASTIFY
(trace, debug, info, warn, error, fatal, silent).
This is a hobby/learning project and I want to develop it in my way. I could make life a bit easier for me if use official Wesnoth WML parser for creating JSON from WML. But I intentionally decided to not do this.
It was rather painful experience trying to research and understand Wesnoth replay file structure. More words and pictures are here, including monstrous algorithm of parsing.
P. S. I spent more than 2 month for active developing this app (including time for tooling).
- This software is provided "as is," and you use the software at your own risk.
- There are no any warranties.
- All donations are non-refundable.
- Therefore, donors explicitly release recipient from any restrictions on how those funds are spent.
- No goods or services were provided in return for any contribution.
- Original Wesnoth WML parser - could be used to convert replay files to JSON or XML.
- Original Wesnoth WML indent utility - could be used to indent WML files for easy understanding inner structure.
- Meme generator.
- Cool service for showing key codes, including mobile devices.
- Great free app for online creating diagrams - Draw.io
Before work:
After work: