pedrus16/frc-overlay

Hi!

Closed this issue · 4 comments

sides commented

I found this repo after you came on my stream by checking out who forked war3observer. It's really cool what you're doing and with a much better base than mine too. I just wanted to give you some updated code I had that I used for a personal overlay that looked more like this:

Untitled-1

It shows tier status and upgrades, and had the capability to show their progress as well but since I thought it looked OK without progress I never added that capability.

Here is the code that drove this (you are free to copy it, same license as on war3observer):
https://gist.github.com/sides/116f83b19b14563d956950b796500830
https://gist.github.com/sides/33cb922fedd2852b7c93a71a379930d8

It worked by running w3booster in tandem with my own websocket server, so it got akas and flags and stuff too, but you should be able to copy the observer-specific code to make it work standalone. You're probably able to copy+paste much of it to war3observer directly.

Rather than returning the struct from the observer API directly, it did some parsing and sent its own structure to the frontend.

It's been a while since I was working on this but I just felt bad about the state I left war3observer in and wanted to offer some help. Feel free to ask any questions too, I'd be happy to help.

sides commented

To add: I don't know what your plans are, but if you want to keep this project as a frontend only, I could probably push out an update to war3observer with improved data structure and other annoyances fixed. Is that something you want, or are you intending to make your own backend eventually too?

Hi! Thank you for reaching out to us! It is really nice of you to offer your help on this :)

For now it is frontend only, we could do most of what we wanted anyway with the current state of w3observer so it's already great we didn't have to develop that part. So, thank you for that!

We actually have some questions about w3observer, that would be great if you could enlighten us on these subjects;

  • Does w3observer expose all info provided by the observer API, or is there more data that we can extract? Or more generally, is there documentation about the observer API, how did you manage to decode the data structure?
  • On some games apm_realtime returns an insane number like 431000 do you know about this issue?
  • Sometimes w3observer returns empty lists for one tick (heroes, units_on_map, buildings_on_maps, researches_in_progress), is this an issue with the observer API?

Thanks again for making w3observer, it is working really great, despite what you think of its state :)

Regards,
Pedrus

sides commented

@pedrus16 thanks for responding, I'll close this.

Does w3observer expose all info provided by the observer API, or is there more data that we can extract? Or more generally, is there documentation about the observer API, how did you manage to decode the data structure?

I originally just trial and error'd it. It has since then had example code released by the developer who was working on the api with blizzard. More info: sides/war3observer#13

I removed it since it wasn't being used by any frontend but the reforged update to the api added some peculiar structures to it: sides/war3structs@171c912 I never fully figured them out or what they represent, even with example code.

On some games apm_realtime returns an insane number like 431000 do you know about this issue?

I have no idea, I never figured out the two apm values. Might also just be quirks in the api.

Sometimes w3observer returns empty lists for one tick (heroes, units_on_map, buildings_on_maps, researches_in_progress), is this an issue with the observer API?

This is an issue with the API, I solved it in the code I posted above by detecting "impossible" changes and ignoring that specific update and waiting for next instead, removing the awkward hickup where stuff disappears.

I really recommend using the code above, it will remove a lot of the work you have to do on the frontend which should be done on the server. It would remove the need for a lot of the code you have right now.

If you want, you can give me roughly the data structure you want, I will push an update to war3observer, and you can use that presumably for a long time, considering Reforged is hardly getting updated. It will fix the hickups you're talking about, and give you tier status/upgrade status grouped by upgrade type. I can also add unit info and stuff.

But if you're fine with just the raw data and doing stuff on the frontend, that's fine too. Check out line 289 and line 334. In the updated code, the server knew when a game had started and ended, so it was able to tell when an impossible change happened, such as heroes or completed upgrades suddenly disappearing. It skipped those updates.

Thank you for the reply, I think we're fine with doing the data processing on the frontend for now. It might be a good idea to move some of the transformations on the backend later but we won't bother you with that, we'll make it ourselves. Thank you for the updated files, I'll take a look at them to update w3observer :)