Opened 9 years ago
Closed 8 years ago
#3404 closed defect (needsinfo)
[PATCH] Adapt replays for variable turn length
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | |
Component: | Core engine | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
This ticket deals with adapting the replay menu to variable turn lengths (#3752, #69).
Reading the entire commands.txt
file to derive the total game duration of a replay is an I/O-heavy task, as the previous iterations of the patches in #3258 had shown.
If #4020 can be solved, the duration could be loaded from metadata.json, where it is saved as timeElapsed
.
Attachments (1)
Change History (5)
comment:1 by , 8 years ago
Description: | modified (diff) |
---|---|
Summary: | Save ingame-time in commands.txt → Adapt replays for variable turn length |
Type: | enhancement → defect |
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
by , 8 years ago
Attachment: | 3404_timeElapsed_v1.patch added |
---|
comment:3 by , 8 years ago
Keywords: | review patch added |
---|---|
Milestone: | Backlog → Alpha 21 |
Summary: | Adapt replays for variable turn length → [PATCH] Adapt replays for variable turn length |
comment:4 by , 8 years ago
Keywords: | review removed |
---|---|
Milestone: | Alpha 21 |
Resolution: | → needsinfo |
Status: | new → closed |
Variable turn lengths:
The patch still uses getReplayDuration
which doesn't work with variable turn lengths. Since there is a feasible approach to keep constant turn lengths with ensuring that the simulation isn't paused due to network lag, it might not be needed to adapt it to variable turn lengths.
If #3752 is settled and fixed this might be reopened.
Performance:
I doubt whether it is really faster to load and parse an entire JSON file instead of doing what is done now. The commands.txt
file is already opened and getReplayDuration
only reads the last few lines. The metadata file is only opened when selecting a replay, not when getting the replay list. So the attached patch opens a second file instead of only that one for every file in the replay list.
The duration should be saved to the replay cache though.
Code style:
- Only one hunk adds relevant code. The others should be part of a cleanup commit that changes all occurances (i.e.
GetReplayAttributes
too). - L251 should be an
else
since there might be a replay with duration 0. Don't be so negative and invert the condition of the if statement. - Use
ScriptInterface.GetProperty
instead ofJS_GetProperty
(rewrote the ticket as
commands.txt
is very likely the wrong place to save that information)