Closed gandhiy closed 5 years ago
One of the recent additions (checking for the get_state/make_actions ordering) broke reading replays. I have now pushed a fix to dev branch with updated replay_example.py
and torille/torille.py
which should fix the issue.
I would appreciate if you can report if this works for you, too :)
Edit: Ah I just realized the actions indeed are not the correct ones. Let me look into this
Edit2: Derp mistake: I did not have most up-to-date remotecontrol.lua
code in the Toribash script directory (the Toribash used to by the Python code). After updating it to the newest one reading replays works. Check that remotecontrol.lua
under toribash/data/script
is the one currently in master branch under toribash-codes
Checking on the files. Was just about to report that the replays were still not working. Let me check the lua files against each other and then I'll check.
Tested the codes on the newest version Toribash from Steam and things seem to work as expected, but this was only on one machine on one platform so all reports on things working/not working are welcome!
I updated code from dev and made sure that remotecontrol.lua
script was the same as the one in master, but now I'm getting a different error.
Whenever I run the example, the window opens and then closes just a few seconds later. Then, the program just hangs until I Ctrl+C out of it. I'm on a mac, so I wasn't entirely sure of how to get toribash into the folder, but I tried a bunch of different things.
1.) I ran pip install torille
and then copied the toribash folder from there into a clone of the repo. I unistalled torille with pip uninstall torille
, replaced the code inside of the toribash folder with the toribash-code files, and then ran pip install -e .
inside of ToriLLE.
2.) I installed Toribash using wine, dragged the folder inside of ToriLLE, and replaced the code using toribash-code. I reinstalled ToriLLE with pip install -e .
.
3.) I repeated the second process this time, but I merged the toribash-codes folders with the toribash folder I got from downloading with wine.
For the first two, the same issue kept popping up. I would run python replay_example.py
, the screen would pop up, eventually disappear (within a few seconds), and the program would hang. When I Cmd+C out, I get the following error:
^C
Traceback (most recent call last):
File "replay_example.py", line 20, in <module>
controller.init()
File "/Users/yashgandhi/Documents/Repos/ToriLLE/torille/torille.py", line 379, in init
conn, addr = s.accept()
File "/anaconda3/lib/python3.6/socket.py", line 205, in accept
fd, addr = self._accept()
KeyboardInterrupt
Exception ignored in: <bound method ToribashControl.__del__ of <torille.torille.ToribashControl object at 0x10a8beda0>>
Traceback (most recent call last):
File "/Users/yashgandhi/Documents/Repos/ToriLLE/torille/torille.py", line 669, in __del__
File "/Users/yashgandhi/Documents/Repos/ToriLLE/torille/torille.py", line 397, in close
AttributeError: 'NoneType' object has no attribute 'close'
With the third option, it didn't crash, but I just had a working copy of the game. So I could view the replay and even play the game, but nothing was being saved into any variable on the python side.
You need to make sure the replay
directory next to toribash.exe
contains the replays you want, this is why step 1) does not work (missing the replay file). Could you try this:
1) Fresh install torille with pip install torille
(to get a working copy of Toribash for Mac)
2) Merge contents of toribash-codes
in dev branch with the toribash directory under the pypi package (you can find the location in Python with import torille; torille.__file__
).
3) Update torille.py
in the pypi package with the one from current dev branch.
4) Copy the replay file 0headkick.rpl
from original Toribash replay directory to toribash/replay
under pypi package (Note: The replays must reside in replay
folder next to toribash.exe
. Game does not allow reading replays outside this folder)
5) Set DRAW_GAME=True
in replay_example.py
.
6) Run the example. You should first see the players holding still for one game, after which the replay starts and after it ends you should have the states in Python. You should obtain 301 states.
Unfortunately I do not have an access to Mac so I can not exactly replicate this issue. I just tested this to work on Ubuntu 18.04.
I followed this and I'm not getting any errors anymore, but nothing happens. The dummy action just occurs both times (in the finish game call and the read_replay call).
I saw that the read_replay method sets the setting with the replay file, but does it need to sent using _send_setting?
Yes, that setting is set inside reset()
. This is also the reason why you need to finish the game before you can read a replay, as in the current form you can only send settings once game is over.
Is the replay file in the correct replay folder? You can test this by focusing on the Toribash window, pressing "T" to open chat and commanding \lr 0headkick.rpl
. This should start the replay, assuming it is in the right directory.
The replay loaded up fine using the command.
What's the difference between replayed_replay and replay_file? Also, why do you only use replayed_replay in read_replay?
Update, it's working now! I'm not entirely sure what part I was missing, but I think I was just missing a different step every time I tried again. Thanks for the help!
Glad it was resolved :). I also updated the pypi package with a replay and the newest code.
Thank you for bringing this up!
I was wondering if you've gotten the replay example to work. I was trying to get it to read a replay from the original toribash folder, but I keep getting back a list of the dummy actions and the state values associated with that process.
Also, before that, I followed the script, but kept getting the error
Any reason why that would happen/would cause that?
Thanks for any help with this!