GraylinKim / sc2reader

A python library that extracts data from various Starcraft II resources to power tools and services for the SC2 community. Who doesn't want to hack on the games they play?
http://sc2reader.readthedocs.org
MIT License
410 stars 85 forks source link

sc2printer wrong magic #7

Closed g4borg closed 13 years ago

g4borg commented 13 years ago

the magic in sc2reader is as follows:

!c:\Python27\python.exe

this is not good, it should be:

!/usr/bin/env python

possibly followed by:

coding: utf-8

or else it only works if you have python there installed :) which is not an issue on windows, but an issue on unix, where this directory does not exist. :)

GraylinKim commented 13 years ago

Hey g4borg, good catch!

I develop about half and half in Windows and GNU/Linux but I guess I've never run sc2printer on linux to catch the error.

I notice you've made a fork, are you looking to contribute? There's always work to be done and we'd love to have you on board!

If so I'll gladly handle your pull request, otherwise I'll fix it myself.

g4borg commented 13 years ago

yeah wrote you a message about the fork, so you can close this bug later with the cool closes #bug stanza !! :D i would not touch your main code, I want to branch it to test out some other replays. see message.

you fix it :) i am still a github noob.

g4borg commented 13 years ago

ah i closed that, omg.

GraylinKim commented 13 years ago

Opened it again. You can (I think github gives you permissions) change the status of the issues with the actions pull down at the top of the issue thread.

GraylinKim commented 13 years ago

I fixed the magic in commit: 29828cdf5bcecd183b1ec88449cb1f50e8f60f5a

g4borg commented 11 years ago

since i am now at writing my first network engine, i still study sc2 mechanics and mainly look at how your reader is going on (i dont know if you remember, but we talked about the magic once, and i forked sc2reader since i wanted to implement sc2 reading for starbattle maps back then)

what i noticed about learning how to write an engine is, that sc2 works as a predetermined state machine and sends only inputs, which in fact is how the replays might be saved, so basicly, your reader gives me a lot of clue now, how the sc2 engine seems to work

you would help me a lot if you would clarify me following questions:

you can email me also directly to gab@g4b.org

i hope the questions are understandable, i would be very happy if you take your time to give an answer them, even if just short "I assume yes" :)

anything i can help, i will

c ya

Gabor Guzmics <>< http://www.g4b.org

GraylinKim commented 11 years ago

since i am now at writing my first network engine, i still study sc2 mechanics and mainly look at how your reader is going on (i dont know if you remember, but we talked about the magic once, and i forked sc2reader since i wanted to implement sc2 reading for starbattle maps back then)

Ah, okay. You should definitely make sure to keep your fork up to date!

Also, keep in mind that there are no guarantees that event parsing for custom games like Star Battle works. Custom maps are not currently supported and if they work then it is sheer coincidence. If you are able to make changes to improve custom map support I'll gladly accept them though.

what i noticed about learning how to write an engine is, that sc2 works as

a predetermined state machine and sends only inputs, which in fact is how the replays might be saved, so basicly, your reader gives me a lot of clue now, how the sc2 engine seems to work

Yes, the Starcraft II client is a deterministic state machine with the two primary inputs:

Starcraft just loads up the initial game state and replays the events in order.

  • you learn the second of any game event as a combination of frame >> 4, which leads me to believe, that there are 16 frames per second in the engine. am i right? that means, the sc2 integrator steps forward 16 times per second, and interpolates all movement inbetween mostly linearly to fit the fps i guess.

There are 16 frames per game second in SC2. Events come in on a frame granularity though, so when replaying the events through an engine you'll want to stay on the frame level. Seconds are only pulled to be more meaningful to a human reader.

  • do you also track movement with your reader? (I guess no, since i didnt find any code which leads me to any sort of state integration, therefore i guess, you only scan for game events and recalculate the game by your own ruleset?)

Movement tracking would be a monumental effort. You'd need to create a very accurate reproduction of their game engine as well as improve upon efforts to read information out of map files. I did run into one pretty advanced map reading tool the other day that you can check out: TL Threadhttp://www.teamliquid.net/forum/viewmessage.php?topic_id=132627, Unofficial Source https://github.com/RFDaemoniac/sc2-map-analyzer, Documentationhttp://www.sc2mapster.com/assets/sc2-map-analyzer/pages/analysis-details/ .

  • maybe if my engine works flawlessly, i will try to play around wrapping some classes and moving some dots around with the replays, but i am not sure, if your reader already exposes that kind of data. is it in the stream? well if not, i am not disappointed, mostly, i study the state machine of sc2 mainly, because it helps me to see if i do my own engine right, but mostly my engine is way simpler and also not predetermination safe and works with 0.2 integration instead of 1/16th.

sc2reader exposes raw event information as best as it possibly can. Past that it currently has two primary services for replay files:

You might want to look into creating a special datapack for your custom games if you intend to use sc2reader for this. That way the custom units and abilities with what ever meta data you want to give them can be accessible via the replay just like the current standard data is.

you can email me also directly to gab@g4b.org

i hope the questions are understandable, i would be very happy if you take your time to give an answer them, even if just short "I assume yes" :)

anything i can help, i will

c ya

Gabor Guzmics <>< http://www.g4b.org

— Reply to this email directly or view it on GitHubhttps://github.com/GraylinKim/sc2reader/issues/7#issuecomment-10335483.