Giter VIP home page Giter VIP logo

bbreplay's People

Contributors

ibboard avatar

Stargazers

 avatar

Watchers

 avatar  avatar

bbreplay's Issues

Avoid handling TurnOverEvent in ball bounce

_process_ball_movement() iterates through ball bounce and throw-in events. It also picks up the TurnOver event, but we should be able to identify when it is going to happen before we read it and then let the outer loop (throw, blitz or other even type) handle it so that we're not doing a board.change_turn() in the middle of something else.

Fix time limit exceeded handling outside movement/throws/etc

In Replay_2021-05-09_09-44-12.db there's a blitz after the opposition have a "Time limit exceeded!" turn over. This isn't picked up until the second player moves, and even that is only because of the blitz trying to look up dice rolls etc.

Currently we get a "stop iteration exception" because the list runs out, but we need to do something better with timeouts.

Ideally this would go somewhere central like Replay's _process_turn(), but we don't have the current list of log entries there and can't peek at the next ones. We may need to append the turn over to the end of the previous list, which would require changes to log parsing as well.

Setup mismatch leads to armour value roll validation failure

We get ValueError: Expected ArmourValueRollEntry for TeamType.HOME #4 but got TeamType.HOME #5 from Replay_2020-08-23_10-04-41.db because there's a target player command for data [1, 7, 0, 2, 255, 255, 0, 0, 1, 0, 0, 0] (player index 2, which is player number 4) but the target space command has data [1, 7, 4, 0, 26, 0, 0, 0, 4, 10, 0, 0] and player index 3 (number 5) is in that space.

Also, this isn't picked up until the armour roll stage. We should be able to check the space occupant before we get to armour rolls.

Setup missing players

Replay_2020-09-12_14-03-21.txt errors with Unexpected large move for Belsathion Talaneth from Position(-1, -1) to Position(2, 9) (i.e. player isn't deployed but then moves). The setup appears to be missing two players (only nine deployed at the start of the match)

May be another version of #5 or may be something else.

Handle pitch invasion

Replay_2020-09-06_10-13-12.db has a pitch invasion in turn 8. Each player rolls a dice with modifiers to see whether they're knocked unconscious, but the game doesn't record this. We then end up with a blitz that we think is missing a dodge because we don't know that the player is down.

We might be able to do something with reading ahead to see when we expect dodges that don't appear (which indicates that the player isn't where we think they are) but that's going to be messy and patchy at best (players who a downed but then avoided by the opposition and never moved will never be flagged as down)

Handle Leader rerolls for Loners

In Replay_2020-09-06_10-13-12.txt, we get an error because it performs a Loner check but a Leader reroll. The Leader reroll is a skill and so shows up before the Loner. We need to handle this, since we normally rely on the commands to see what happened.

It might help to parse all reroll entries (which may also help with some kickoff results that grant extra rerolls).

Handle catch from kick-off

Replay_2021-04-11_10-04-51.db has a kick-off event at command 780, which (because of scatter) lands on a player. The player fails to catch and the ball bounces, but we don't even check and the catch is taken as the first event in the following blitz.

Quick Snap should ignore tackle zones

Similar to #1 - Replay_2020-08-23_10-04-41.txt has a Quick Snap where a player makes what would be a dodge, but no roll is made because it's a quick snap. However, we handle it like a normal turn and so look for a dodge event but find the ball bouncing.

Handle off-pitch push against Fend breaking blitz

Replay_2020-08-16_10-12-51.db has a blitz against someone with Fend who is in the end zone. It currently exceptions with:

Traceback (most recent call last):
  File "dump-data.py", line 74, in <module>
    for event in replay.events():
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 180, in events
    for event in self._process_turn(cmds, log_entries, board):
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 353, in _process_turn
    yield from self._process_block(targeting_player, target_by_idx, cmds,
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 642, in _process_block
    yield from self.__process_block_rolls(targeting_player, target_by_idx, cmd, cmds, moved,
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 766, in __process_block_rolls
    yield from self._process_movement(pushing_player, cmd, cmds,
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 1028, in _process_movement
    result = log_entry.result
AttributeError: 'SkillEntry' object has no attribute 'result'

This appears to be because the player continues moving after the blitz and the push off the pitch means that there isn't a PushbackCommand, which causes the code to jump to movement instead of fending.

Mishandled turns leads to turns moving to wrong half and "missing" player

Replay_2020-09-13_10-11-03 was raising AttributeError: 'NoneType' object has no attribute 'position' because of a setup command Setup(team=TeamType.AWAY, player_idx=15, pos=1,10, data=[1, 15, 1, 10, 0, 0, 0, 0, 0, 0, 0, 0]) that was trying to get a non-existent player from the home team. This was because it thinks it's after half-time (so teams swap) but a blitz means that it should be before half-time.

Handle dropped ball during movement

Replay_2020-08-16_10-12-51.db fails because the ball carrier trips and drops the ball. We currently check for a turnover straight away, but since 9664b53 we've moved the TurnOverEvent to the end of the list of log entries. In this case we have not only a bounce, but a throw-in!

[Dodge(team=TeamType.AWAY, player=1, required=3+, roll=1, result=ActionResult.FAILURE), Reroll(team=TeamType.AWAY), Dodge(team=Team
Type.AWAY, player=1, required=3+, roll=6, result=ActionResult.SUCCESS), GoingForIt(team=TeamType.AWAY, player=1, required=2+, roll=1, result=ActionResult.FAIL
URE), ArmourValueRoll(team=TeamType.AWAY, player=1, required=8+, roll=4, result=ActionResult.FAILURE), Bounce(direction=ScatterDirection.SW), ThrowInDirection
(direction=ThrowInDirection.DOWN_PITCH), ThrowInDistance(distance=7), Bounce(direction=ScatterDirection.E), TurnOver(team=TeamType.AWAY, reason=Knocked Down!)
]
        Consuming BounceLogEntry 5: Bounce(direction=ScatterDirection.SW)
Traceback (most recent call last):
  File "dump-data.py", line 68, in <module>
    for event in replay.events():
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 172, in events
    for event in self._process_turn(cmds, log_entries, board):
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 355, in _process_turn
    yield from self._process_movement(player, cmd, cmds, None, log_entries, board)
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 888, in _process_movement
    validate_log_entry(log_entry, TurnOverEntry, player.team.team_type)
  File "/home/ibboard/Projects/bbreplay/bbreplay/replay.py", line 1206, in validate_log_entry
    raise ValueError(f"Expected {expected_type.__name__} but got {type(log_entry).__name__}")
ValueError: Expected TurnOverEntry but got BounceLogEntry

Fix "double bounce" handling

b6ace5a slightly changed the way we handle bounces. There's code in the ball movement function that skips some ghost bounces (ones from a replay that seemed to be ignored and only the second one applies). However, in Replay_2020-09-13_10-11-03.db the fireball triggers a NE bounce (onto a now prone player) then a S bounce, but the replay ignores this and only applies the S bounce.

Handle side-step

cmd_type=85 appears to be some kind of "player got interrupted" command followed by cmd_type=86, which specifies a space and always appears to relate to a blocked player who has the "Side-Step" skill.

This just needs to be handled as a skill action, as the pushback then appears as normal afterwards with an identical location.

Handle leap *without* it being from a tackle zone

Our Leap code is currently in a if not failed_movement and is_dodge(board, player, target_space): block. While leap is normally used to jump over someone (and hence is coming from a position that would be a dodge) it can be used to jump from free space into tackle zones (or into free space! although that's unlikely).

We don't currently have any examples of non-tackle zone leaps, but we should handle it.

Make sure reroll counts are tracked properly

Following #6, it looks like we are adding a leader reroll every kickoff. That's fine if it's a quiet match and the game only has one touchdown in the last turn of each half, but quick teams can score quicker and leaders shouldn't get another reroll until the next half.

Missing turn changes

Replay_2020-09-06_10-13-12.db gets to:

EndTurn{'team': <TeamType.HOME: 0>, 'number': 7, 'reason': 'Knocked Down!'}
StartTurn{'team': <TeamType.AWAY: 1>, 'number': 8}

And then fails because it encounters a KORecoveryEntry (which happens at a touchdown or half-time) rather than a block in a blitz. This suggests that the turns got out of sync somehow and it's supposed to be ending turn 8 (and reaching half-time) rather than ending turn 7. Or we missed it earlier (because it's at line 3018 of the logs and CStateMatchHalfend happens at 3354)

Handle log actions separated by cinematics

The move that triggers #15 doesn't appear to have a GFI roll in the logs. The player moves their 6 movement, blitzes (GFI one) and then moves after the blitz (GFI two) but the log just shows:

|  +- Enter CStateMatchActionTT
|  |
|  | Release CStateMatchSelectTT
|  | GameLog(02): ORK #10 Granik Going for it  (2+) : 4 -> Success
|  | GameLog(02): ORK (10) Granik Block  Result:
[Defender Down] - [Pushed]
|  | Entering CStatePlayerTeamChooseOptionalSkills, Warpstone Heat is WAITING FOR player decision
|  | Entering CStatePlayerTeamChooseOptionalSkills, Orkington Red Skullz is WAITING FOR player decision
|  | GameLog(02): ORK #10 Granik chooses : Defender Down
|  | Entering CStatePlayerTeamChooseOptionalSkills, Orkington Red Skullz is NOT WAITING FOR player decision
|  | Entering CStatePlayerTeamChooseOptionalSkills, Warpstone Heat is NOT WAITING FOR player decision
|  | GameLog(11): WAR #01 Thekit uses Fend.
|  | GameLog(02): WAR #01 Thekit Injury  : 3 + 1 = 4 -> Stunned
|  | Init CStateMatchSelectTT
|  |
|  +- Exit CStateMatchActionTT

Appears to be an odd game glitch like d5ce99d, possibly caused by blitzing someone with Fend off the pitch?

Quick Snap should ignore effects like "wild animal"

Replay_2020-08-16_10-12-51.txt has a "Quick Snap" at kickoff. We treat it as a turn, but the Skaven team have a rat ogre who checks for Wild Animal but finds a "Bounce" event. That suggests that Wild Animal (and presumably Stupidity etc) doesn't apply during a Quick Snap.

Handle automated kick-off

Replay_2020-07-26_10-08-00.txt has a timed out kickoff, so the computer picks a point and kicks for the player but that point doesn't appear to be listed in the commands or log.

On the plus side, the ball goes off-pitch and so we just need to adjust it to handle the subsequent touchback. On the minus side, we need to investigate what happens if the kick was aimed on-pitch.

Handle mid-game disconnections

Replay_2021-04-11_10-04-51.db ends with a disconnection due to network issues. The relevant part of the log is:

 |  +- Enter CStateMatchSelectTT
 |  | 
 |  | Disconnection with player keepstherainoff in internet game.
 |  | Interrupted network connection during match.
 |  | Reconnecting To Opponent
 |  | Reconnecting To Opponent
 |  | Contexts : GLOBAL(1)GUI(1)CAMERA(1)CAMERAMATCHDEFAULT(1)MATCH(1)PLAYERTEAMHUMAN(1)
 |  | Reconnecting To Opponent
 |  | Reconnecting To Opponent
 |  | Net Event : Player connected: keepstherainoff
 |  | Net Event : Player connected: ibboard
 |  | Successfully reconnected to opponent : 0
 |  | Reconnection SuccessFull
 |  | Network disconnection in a game launched via the multi-player platform.
 |  | We are still logged in, so the opponent is probably responsible for the disconnection.
 |  | Team Home is set as responsible for the disconnection.
 |  | Contexts : GLOBAL(1)GUI(1)CAMERA(1)CAMERAMATCHDEFAULT(1)MATCH(1)PLAYERTEAMHUMAN(1)PLAYERTEAMGAMEPLAYTT(1)
 |  | GameLog(12): NAG #07 Indfil earns 3 SPP (Touchdown)
 |  | GameLog(12): NAG #13 Anasfynn earns 3 SPP (Touchdown)
 |  | we can quit match now: SendMsg(CStateMsgMatchPrematureEndOfMatch)
 |  | Init CStateMatchEnd
 |  | 
 |  +- Exit CStateMatchSelectTT

We should probably treat the Team <x> is set as responsible for the disconnection as an AbandonnedGame event.

Use more of the surrounding log information

Currently we just take the log lines from anything with "CMatchState" in the opening and closing block, but sometimes there's useful information.

For example, this block clearly says there's a touchback without us calculating whether it is or isn't.

|  +- Enter CStateMatchEngagementTouchback
|  |
|  | Release CStateMatchEngagementKickoffEnd
|  | GameLog(02): Bounce (D8) : 1
|  |
|  +- Exit CStateMatchEngagementTouchback

Edit: Although we may need to be careful, because that section may be a general "kickoff has happened" event, given how much it appears!

Handle Jump Up *without* it being in a tackle zone

As with #20, our Jump Up skill handling is in a if not failed_movement and is_dodge(board, player, target_space): block. Unlike Leap, Jump Up could be quite frequently used outside tackle zones and we should handle it in all situations!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.