Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiC mod support? #2

Closed
coffenbacher opened this issue Aug 30, 2016 · 9 comments
Closed

WiC mod support? #2

coffenbacher opened this issue Aug 30, 2016 · 9 comments

Comments

@coffenbacher
Copy link

Hi HappyLeaves,

Do you know if there's something about WiC mod that breaks this parser? I was trying to parse the Clan Masters recs here (for example: http://aoczone.net/viewtopic.php?f=1342&t=123008) and they're all crashing near the end with:

/root/miniconda3/envs/mgz/lib/python2.7/site-packages/construct/core.pyc in _read_stream(stream, length)
    303     data = stream.read(length)
    304     if len(data) != length:
--> 305         raise FieldError("expected %d, found %d" % (length, len(data)))
    306     return data
    307 

FieldError: expected 1512, found 4

I'm guessing it may be something to do with achievements since I can't get that action to extract no matter what I do, but I'm not sure exactly.

@coffenbacher coffenbacher changed the title WIC mod support? WiC mod support? Aug 30, 2016
@happyleavesaoc
Copy link
Owner

happyleavesaoc commented Aug 30, 2016

I know I have successfully parsed WiC mod recs with this module, but that was back during WiC itself. It is possible the mod has changed, or something else has changed in AoC, or that there is something unique to these recs that is hitting a previously-unknown bug.

@coffenbacher
Copy link
Author

Sounds good, I'll see if I can figure it out.

@happyleavesaoc
Copy link
Owner

If you solve it, a PR would be welcome!

@coffenbacher
Copy link
Author

Of course! I'm going to be parsing a lot of recs soon so I'll try to PR anything useful I come up with. Although this is rather out of my wheelhouse, so don't hold your breath 11. I'm amazed that you + others were able to figure this format out at all in the first place. Really well done.

@happyleavesaoc
Copy link
Owner

What's your project? I might be able to find some time to look at this.

@coffenbacher
Copy link
Author

I'm attempting to parse many, many games (gb scale) to try to generate interesting stats. For example, I was going to look at the effect of slinging in the current Clan Masters tournament.

Here's a toy example that I made yesterday using Arabia 1v1 recs: https://www.reddit.com/r/aoe2/comments/50ck09/feudal_times_in_the_arabia_1v1_invitational/?st=isi7cxex&sh=f60288b1

@happyleavesaoc
Copy link
Owner

I did some investigating. The problem is in the postgame achievements parsing. The quick fix is to comment out this line. You'll still get a parse error, but it will be after the postgame action is parsed, which is the last action anyway.

Those last bytes are actually of variable length. From the games I checked, it could be 0, 504, or 1512. Those with 504 or 0 were failing for you. The next step would be to figure out what influences those extra bytes. I suspect it is something in the postgame structure. That whole section is a bit odd, since I think userpatch hacked it in, rather than being a planned part of the rec from Ensemble.

Cool project. I thought about doing something roughly along those lines, but never had time. Good luck!

@coffenbacher
Copy link
Author

Awesome! Thanks happyleaves. Should be good enough for now.

@happyleavesaoc
Copy link
Owner

Fixed in cc496d2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants