Skip to main content

Rei - Blog Post 7

Since the beginning of the semester, Matthew and I have been woking hard on the Replay Parser and Frame Collector. Both of these parts are crucial to the success of our project. With the first Demo of our project done also comes the completion of this first milestone.



Parsing the replay exposed some interesting information to us about how inputs are recorded, and therefore how the game sees them. Our original understanding of inputs was that multiple inputs would actually be spread out across multiple frames, however this was not true. It turns out that a frame is followed by a list of events which take place on that frame. We also learned that some human actions translate into multiple inputs. For example:

If you are using the control stick to move your character and you hold right on the control stick, your character moves right. One may think that this means the action RIGHT_PRESS is input, in actuality a list of actions is generated.

The list may look something like : {ANGLE___0, RIGHT_TAP, RIGHT_PRESS}.
Where: 
    ANGLE___0 means that a control stick is being held right.
    RIGHT_TAP means that the right action has been tapped. (Starts the Run Action)
    RIGHT_PRESS means that the right action has been pressed. (Continues the Run Action)

This is important to note the angles as using it means that Actions that take place in different directions can happen simultaneously. (Moving Right while Attacking Up).

The source code for the parser can be found here. I plan to add in-depth documentation for this python code in the GitHub, I also hope to upload the code onto PiPy as a module so it can be added to a python environment directly with pip.

Because this is the first replay tool for Rivals of Aether that I have seen, I would like to release it back to the community that helped make this project viable.


Finally, the last thing that I did during this break was create the Demo for out project. This involved packaging together frames and action sets. This was actually quite an easy task, because of all the preemptive work Matthew and I put in. The frames were already synced pretty well with the replay file, after some minor adjustments it was pretty much perfect.

As stated earlier, the code for the demo is quite simple. It follows a very simple set of actions:

  1. Create a list.
  2. Grab all the frame .npy files.
  3. For each .npy, create a tuple (frame_num, frame) and add it to the list.
  4. Grab all actions from a replay file.
  5. For each action, create a tuple (frame_num, action) and add it to the list.
  6. Sort the list by the first element in the tuple.
  7. Pair actions with the nearest frame following them.
Then, in order to present the pairing. We just output the frame to a png, and the action_list to a .txt, both of which can be read by other programs. When we want to move on to the next frame, we overwrite the temp png and txt.

The source code for the demo can be found here.

Comments

Popular posts from this blog

Rei - Blog Post 10

So,  I missed blog post 9. This is me acknowledging that for consistency. Anyway, the past couple of weeks have been incredibly productive for ContentsMayBeHot. Matthew has finished collecting all the replay data, we have refactored our project to reduce complexity, we have improved the runtime of our code, and finally we have started seriously training our model. The Changes Matthew implemented multi-threading for the model loading. Which reduced our load time between files from about 3-5 Seconds to 1 Second or less. Which allows us to fully train a model in much less time! While Matthew did this I reduced the code duplication in our project. This way, if we needed to change how we loaded our training data, we didn't have to change it in multiple places. This just allows us to make hot-fixes much more efficiently. We also started working on some unittests for our project using pytest. These tests were written because of a requirement for another class, but we thought it

Matthew - Blog Post 10

At the time of my last blog post, we were managing quite a few problems. Our model was essentially vaporware, our training and testing was hindered by slow, blocking function calls from our loader, and our VRAM was continually getting exhausted during training sessions. But there is nothing to worry about. We have made major strides since then. Major strides. Model improvements First, we have completely overhauled our model's architecture. We are now using a model composed of special layers that combine the functionality of a 2D convolutional neural network with that of an LSTM. Here is a summary of  our model as printed by Keras: This model was made with the help of the wonderful community over on Stack Overflow . I would also like to mention that Professor Auerbach made invaluable contributions. In general, his tutelage made this project possible. We dropped our Sequence subclass, and replaced it with training and testing loops. In these loops, we iterate over the whol

Matthew - Blog Post 8

replaymanager.py is only 339 lines long but it feels at least three times that when I'm working on it. The module is definitely due for a refactor. For one, the term subdataset should be renamed to version_set and extracted into a class. version_set more accurately and describes what it is, and the class extraction would clean up the namespace in ReplayManager. There is probably some kind of class extraction possible for replays, so that their names, paths, file streams, and Twitter profiles can all be neatly encapsulated, thereby cleaning up the namespace even more. However, I do not want to worry about having two kinds of replays: the one used by ReplayManager and the one used by ReplayParser. Even though ReplayManager does not use ReplayParser, the prospect of making things more muddier deters me. There's probably a right way to refactor this code, but, to put it simply, now is not the time. Speaking of time, I came up with a great way to get work done, even when I am slee