ReactiveDrop / reactivedrop_public_src

Alien Swarm: Reactive Drop game source code and issue tracker.
https://reactivedrop.com
118 stars 34 forks source link

Speedrun.com integration #479

Closed ywgATustcbbs closed 1 year ago

ywgATustcbbs commented 1 year ago

Come up with some new possible solutions. Sorry to post them here because i use a phone to edit texts and steam app is unfriendly to long text editing.

I see the current possible solution is to use speedrun.com, But few ssrd players knows the website. It needs recognition and promotion from the devs before it is accepted by the Asrd players. Technically, it can replace or integrate with the game to encourage players to perform runs that can be verified, and discourage/expose those cheaters, further maintaining a good community environment.

There are several solutions to integrate speedrun.com into lb. Followings are sorted based on the works needed.

1st solution. No need to change game logic. But to retrive info from speedrun.com and display it in game.

  1. Split the current in-game lb screen into two parts, display verified speedrun.com results as verified on top half, and display the current lb as un-verified on the bottom half.
  2. Done. Thus will encourage players to submit records for verification.

2nd solution is based on the 1st one:

  1. contact moderators on speedrun.com, increase/expand speedrun categories for each map and difficulties. Sure, the moderator will have a lot of works to do. But i think community will get it done.
  2. Retrieve data from speedrun.com, display them.
  3. Done.

3rd solution (based on previous one):

  1. invite some moderators to join devs team as long-term community menbers.
  2. Review And revise the current speedrun rules to force using speedrun challenge as proposed
  3. Recruit more community moderators.
  4. Done.

4th solution:

  1. Do as speedrun.com, Add a speedrun submitting page to the official website. User fills in their steam I'd and other game info, post a YouTube link.
  2. Find some community moderators to verify the submitted runs.
  3. Display them in the game and on the official website.
  4. This need much more web coding.

5th solution. Integrate with autorecoding.

  1. Send each demo md5 and sha256 strings to website to protect records from demo editing.
  2. Community moderators verify top records, websit auto verify other records using demo file checks.
  3. No video and demo verification is required, unless it breaks the top 20 and
  4. Top 100 records.
  5. Players who have broken top records will have several days or weeks to prepare video and/demo using local demo files.
  6. Once demo uploaded to the website, check md5 in the database.
  7. Once passed, run auto verification. And if needed, perform community verification.
  8. Only permanently keeping top 20 or 50 demos for further reporting.

These solutions don't need much website resources. Perhaps, devs can try to contact/regrouping community members. I think it worth trying.

mithrand0 commented 1 year ago

Integration would mean, someone needs to code it, it can be a lot of work.

ywgATustcbbs commented 1 year ago

Integration would mean, someone needs to code it, it can be a lot of work.

Perhaps, can start with the easiest one.

fetch html metadata from an url is relatively easy using Python. Grab the info needed daily and cache them on official website. This part should be easy. Game Ui might take some time.

I think i can write a c# demo to fetch data from speedrun.com

ywgATustcbbs commented 1 year ago

Integration would mean, someone needs to code it, it can be a lot of work.

https://github.com/speedruncomorg/api

This is speedrun.com official api, this may save most of the data fetching work

mithrand0 commented 1 year ago

I we wanted to implement such thing into the game, it would need to be written in c++, which complicates things (at least for me).

ywgATustcbbs commented 1 year ago

I we wanted to implement such thing into the game, it would need to be written in c++, which complicates things (at least for me).

I guess it's http get/post the problem? Or json parser?

The api itself is easy, Just use the get method (the url is specified by the api doc) that provided by any httpclient lib. A json file with lb info is received. Then parse it using any json parser and retrieve data from it.

Perhaps i can try to write a demo after holidays

Httpclient for cpp https://github.com/yhirose/cpp-httplib

Json parser for cpp https://github.com/nlohmann/json

There are many similar but more light eeighted libs on github.

The api doc for leaderboards https://github.com/speedruncomorg/api/blob/master/version1/leaderboards.md

BenLubar commented 1 year ago

We have jsmn and ISteamHTTP in the game, but there are significant privacy concerns to doing a third party HTTP request every time someone does something in a game.

ywgATustcbbs commented 1 year ago

...there are significant privacy concerns...

I'm not sure but it's the the 3rd party libs that raises the concerns. Am i right?

As far as i know, the speedrun.com api itself is only an anonymous get method.

mithrand0 commented 1 year ago

Ben means stuff like https://gdpr.eu/what-is-gdpr/.

wawawawawawawa commented 1 year ago

Would it be worthwhile to contact speedrun.com to see if they would even want some partnership? Obviously no point for me to message them if you guys are strongly against it, hence my question here first, but IMO even just a small UI linking to speedrun.com home page would already be a good step to make players thrive for recordings.

ywgATustcbbs commented 1 year ago

Ben means stuff like https://gdpr.eu/what-is-gdpr/.

I don't understand. Those data are posted by speedeun.com user and are in public domain(or cc3.0?). If one wants to post runs via api, he must register apeedrun.com account and specify his token in the api. By registering, he already agrees the terms of use.

mithrand0 commented 1 year ago

Ben means stuff like https://gdpr.eu/what-is-gdpr/.

I don't understand. Those data are posted by speedeun.com user and are in public domain. If one wants to post runs via api, he must register apeedrun.com account and specify his token in the api. By registering, he already agrees the terms of use.

Noticed.

When making an api call from the game to speedrun.com (i.e. showing the leaderboards of speedrun in-game), we would disclose the ip of the user. Ip addresses are considered person data in the eu, falling under gdpr. The only way around it, is to legally ask for explicit opt-in to do the call, and store this consent somewhere, which already makes this whole thing more tricky.

If you mean, speedruns are posted outside of the game, that is fine. But in that case we could close the ticket, since no integration would be needed between game and speedrun.com

wawawawawawawa commented 1 year ago

If you mean, speedruns are posted outside of the game, that is fine. But in that case we could close the ticket, since no integration would be needed between game and speedrun.com

Yes and no, even without a full integration, small steps can be made, with a simple link from main menu towards speedrun home page.

Obviously full integration would be awesome, but since technical limitations, first need to to just give an easier access to the website, which will make said website "officially accepted". IMO the intention is as important as the result, and if full integration is not possible, any step towards it is already a good thing.

With zero integration (aka, not even a small link), there is no officialization, nor a show that such an option is something rd team would like to have (and as I said, I feel diverting peer-review towards community would be the correct way to tackle this, as it shouldn't be done by devs).

But yes, I feel just having rd stance on it with a small integration would already go long ways.

PS : I won't mind asking speedrun.com if they would want to do something, and maybe they even have ideas/solutions as I assume they already did such partnerships, but I would like to first know if you guys even think it's a possible solution.

ywgATustcbbs commented 1 year ago

Got It. So there are some walk aroubds

  1. Get the data using official website server and cache the data. Then game clients retrive data from official server.
  2. Post the cached data on forum using a bot, game clients retrive data from forum.
  3. Directly state It in the game teens of use
  4. Make an Ui switch, store the term of use using steam cloud
  5. Check the locations of the users and black This function for eu users, Instead, show a string to tell them they can see verified records on speedrun.com
mithrand0 commented 1 year ago

From Speedrun.com:

Some operations the API offers require a user-context to work. In this case, an API client needs to authenticate on behalf of a registered user.

To prevent excessive crawling of the data we make available and to ensure a good overall performance, requests to the API are subject to rate limits.

Single ip or bot they don't want

Get the data using official website server and cache the data.

We would create another dependency and single point of failure, something we prefer not to introduce.

wawawawawawawa commented 1 year ago

This seems like quite some time investment though, and that's not even knowing if speedrun.com even agrees to this. 1) need to know if rd team want a partnership 2) need to know if speedrun.com want a partnership 3) start small (just a link to officialize stuff) 4) look for improvement on integration / solutions for technical difficulties

But no point looking at 4) if 1) and 2) are not known. Pretty sure 3) shouldn't require much time investment, but no point without knowing if both party want a partnership

mithrand0 commented 1 year ago
  1. need to know if rd team want a partnership

I am leaving this choice to the other members of the rd team.

quite some time investment though

And this is exactly my concern. It sounds so easy, but there are a lot of small roadblocks to take. Agree a link shouldn't harm, but let's be honest, how many games have an actual implementation like this in their game?

ywgATustcbbs commented 1 year ago

From Speedrun.com:

Some operations the API offers require a user-context to work. In this case, an API client needs to authenticate on behalf of a registered user.

This is intend for posting new records. An user token is required in that case

To prevent excessive crawling of the data we make available and to ensure a good overall performance, requests to the API are subject to rate limits.

Single ip or bot they don't want

Retrive data daily or wewkly will be enough, Since moderators also Needs time to verify a run. If official website could cache data, daily caching will be ok

mithrand0 commented 1 year ago

"You may not use any scraper, crawler, spider, robot or other automated means of any kind to access or copy data."

As home user, you might take such terms lightly, but as organization, we have to be a bit more careful. Of course if speedrun would agree, and there is a legal data agreement, then it would become something else. Even after that, It is still some work to implement.

ywgATustcbbs commented 1 year ago

Here is another solution.

  1. Store the records in a local file that shipped with every game updates/patches.
  2. The records would be added into the translation repo
  3. community will update the records file manually, at least i can do this updating work.
  4. The rest is Ui design

Anyway, The current workload on data retriving is really small. When there are more records, We can find other soluatiins.

mithrand0 commented 1 year ago

"You may not use any scraper, crawler, spider, robot or other automated means of any kind to access or copy data."

We are legally not allowed to copy the data local. We don't own it.

Personally, I would love speedrun integration, it just has legal and some technical caveats to do so.

ywgATustcbbs commented 1 year ago

"You may not use any scraper, crawler, spider, robot or other automated means of any kind to access or copy data."

We are legally not allowed to copy the data local. We don't own it.

It says no copy using robots. It does not say i can't copy data Manually, It doesn't say i can't store data to a local file

mithrand0 commented 1 year ago

"You may not use any scraper, crawler, spider, robot or other automated means of any kind to access or copy data."

We are legally not allowed to copy the data local. We don't own it.

It says no copy using robots. It does not say i can't copy data Manually, It doesn't say i can't store data to a local file

https://gdpr.eu/data-privacy/

Above link explains in-depth, what is required and what not. The terms of speedrun (which above is only a small snippet) are on their site, these are added on top of gdpr. Since a lot of countries implement something similar, it's (legally) not as easy as you suggest.

TLDR: this implementation can have serious privacy concerns and issues. This is not due technical reasons, but due how personal data is handled, which is subject to local laws.

ywgATustcbbs commented 1 year ago

Even If speedrun.com don't allows it,. We can post our runs for verification on steam forum. Community members could work as moderators. once confirned, records can be Manually uploaded into github repo. Only Needs a file to store It. This is the most essy solution that i can come up with. No legal issues.

The current lb has so many problems, why not do something.

mithrand0 commented 1 year ago

The current lb has so many problems, why not do something.

We tried, the public discussion of that is on the Steam forums.

If you want to make a steam forum post about speedruns and rules, I am happy to pin it on top of the discussion board. But any integration in the game with a third party service, will hit the same personal data questions as above. The only way to fix that, is by storing the data on the steam platform, like how we do it right now.

Maybe the most easy way is to add a link to a video on the stats page for each record, but that means Ben needs to code that. I leave that to him to answer. It's also not the integration you asked for in the first place..

ywgATustcbbs commented 1 year ago

The current lb has so many problems, why not do something.

We tried, the public discussion of that is on the Steam forums.

If you want to make a steam forum post about speedruns and rules, I am happy to pin it on top of the discussion board.

Actually, that post is talking about how we can find a way to show verified records in game to everyone, It doesn't matter where to post the records.

The issue is, the "new" board is recognized by the official. The dev team tells the community where to post the records for verification and the community will follow the instructions.

I can suggest a solution, But i can't announce It.

ywgATustcbbs commented 1 year ago

It's also not the integration you asked for in the first place..

Integration is not the purpose. The purpose is try to find a solution to show verified records in game that can partial replacing The current lb.. I tried my best you find a dolusyion to show verified records directly in the game to discourage cheaters.

Ideally, a little verified mark on the current lb will be enough. Then the problem comes to how to verify the record. Sunce you suggested in the steam thread that speedrun.com is recommend, So i tried to find a solution to integrate It.

As the devs concern, the integration of speedrun.com is technically possible but has legal issues.

So let's go back to what i really want to talk. Lb problems.

As far as i know, community wants to

  1. Get ride of cheaters on lb, Especially for top records
  2. At least distinguish cheating from real recirds

devs want to

  1. Improve community environment, get rid of or discourage/punish cheaters.
  2. Do less coding works If posdible
  3. No legal issues

Based on these, i think we have one possible solution.

  1. All top records need a community verification. Those video links could be posted on forum for verification. All devs need to do on this is add a speedrun verification sub-forum Just as bug reports, post requirements.
  2. User post their video proofs. Devs do nothing
  3. Find some community moderators to do the work. If there is only a few moderators, only verify top records. devs do nothing.
  4. Once verified, community moderators will collect record info periodically.
  5. The devs has to find a way to put a verified flag on backed db according to verification results. The devs could assign some trusted community members to do manual marking.
  6. Modify The current lb display method s bit. Show The verified mark.
ywgATustcbbs commented 1 year ago

"You may not use any scraper, crawler, spider, robot or other automated means of any kind to access or copy data."

We are legally not allowed to copy the data local. We don't own it.

Personally, I would love speedrun integration, it just has legal and some technical caveats to do so.

Oh God, you've made a big mistake on this.

In The sperdrun.com api page, It clrary states:

Content License As with the main website, all original content provided through the API is licensed under CC-BY-NC 4.0. Images and videos are copyright of their respective owners.

In The website's term of use:

Ownership of the website All pages within the Website and any materials made available for download are the property of the Company, or its licensors or suppliers, as applicable. The Company makes no claim of ownership as to the Data as it is received from the API. ... User submissions through the website Original content provided on the site is licensed under Creative Commons Attribution-NonCommercial 4.0 International. Content uploaded by users, such as game cover images, are copyright of their respective owners; the same applies to content that is linked to, like YouTube videos and external images or documents.

That means, you may cache and redistribute The records using api under cc-by-nc-4. These records including players, time, records, etc., are all original content created by users. Or, If don't believe it, you can write an email to ask them if it's true.

In The api's readme.md, It also states that

If possible, please set a descriptive User-Agent HTTP header. This makes it easier for us to see how the API is being used and optimise it further. A good user agent string includes your project name and possibly the version number, like my-bot/4.20.

Note It encourages you to name a bot. Its not blocking you from getting data. Anyway, an api is intended for automation.

mithrand0 commented 1 year ago

Oh God, you've made a big mistake on this.

I don't think I did, but I give up on the discussion after this line (: I agree with @BenLubar any third party integration is a privacy/legal issue, tried to explain why. Maybe someone else can explain it better.

Regarding your suggestion:

1) All top records need a community verification. Those video links could be posted on forum for verification. All devs need to do on this is add a speedrun verification sub-forum Just as bug reports, post requirements.

If you want a speedrun verification subforum, I am happy to create it. Just say the word.

2) User post their video proofs. Devs do nothing

Sounds fine

3+4) Find some community moderators to do the work. If there is only a few moderators, only verify top records. devs do nothing. Once verified, community moderators will collect record info periodically.

If you can find enough people that are willing to do the job, sure!

5+6) The devs has to find a way to put a verified flag on backed db according to verification results. The devs could assign some trusted community members to do manual marking. Modify The current lb display method s bit. Show The verified mark.

There is no way to do this technically, as far as I can see in the Steamworks Api. Scores are uploaded, there is no way to change information from another source later. Here is the information about SteamWorks Leaderboards: https://partner.steamgames.com/doc/features/leaderboard

Just give me a ping when you want a speedrun subcategory on the forums. If you prepare a text, that explains the rules, we can review it and make it sticky there.

ywgATustcbbs commented 1 year ago

Just give me a ping when you want a speedrun subcategory on the forums. If you prepare a text, that explains the rules, we can review it and make it sticky there.

Before we can put it into practice, i want to post a working workflow, please check if there any blokings.

  1. Modify the game code a bit, print an identification string in the console Or chat with each upload call. The string is not complete at this stage. It should be something that can be used to identify the record. there are 3 updateleaderboardrecord calls in the source code. It seems that m_LeaderboardScoreDetails is used to record details. i don't know which one to modify. But I think this is a piece of cake for devs
  2. The verification string will consists of 3 parts: records info, record checksum and moderator signature.
  3. Record info contains time and details (the info submitted via updateleaderboard function, no code changes is needed)
  4. The checksum Needs a bit of coding. It is the md5 or sha256 results of steamid+time+match details. That is, one game could have up to 8 identification strings. User has to submit runs for verification as a (temporary) team. I think this is reasonable for players who wants to be verified. This way, we can do second validation when displaying lb. Checksum is important because it is used to check the uploader's identity.
  5. If a user wants his record to be verified. He must provide a video together with all identification strings.
  6. Once verified, The identification string is digitally signed by community moderators using their private keys. At this stage, the identification string is complete. It is then send back to the user. Because the string contains the info of steamid, other players can't use it.
  7. The devs have to write a simple Ui that accepts the string. The string is Then verified using moderators' public keys (shipped with the game). Then use checksum to check if the record belongs to the user. After all checks, the user overide the existing records by specifying k_ELeaderboardUploadScoreMethodForceUpdate in update function.
  8. If the record is unexpectedly broken by a user But no video proof is 5aken. Community would accept videos recorded using demo file If it's not a top record. Otherwise, the user can use the string to roolback his record.
  9. For the dispkaying of the lb. It doesn't need much coding. After lb data received, check the signature using public keys. If passed, It is a verified record. Then display a verified icon (something like ☑)

I think it is at least a working approach. It has many problems. But as a demonstration, It can work without much coding works. So i suggest to try it in beta as an experimental feature. Then we can improve the workflow.

mithrand0 commented 1 year ago

I don't see how above can technically work when looking at the Steam SDK. Not without wiping existing leaderboards and a solution for everything mentioned here and on the Steam forums:

https://steamcommunity.com/app/563560/discussions/2/3361397532252356972/#c3761102779887394593

It can work without much coding works. this is a piece of cake for devs The devs have to write

If you think it's such a piece of cake to write it, please go ahead! It's not that I don't want to implement something, but from my point of view, I just don't see above as easy and/or workable solution.

That said, I spent a lot of time repeating myself with basically the same message, which isn't that productive. Stepping out of this specific discussion and leave to to others for now :-)

ywgATustcbbs commented 1 year ago

I don't see how above can technically work when looking at the Steam SDK. Not without wiping existing leaderboards and a solution for everything mentioned here and on the Steam forums:

https://steamcommunity.com/app/563560/discussions/2/3361397532252356972/#c3761102779887394593

It can work without much coding works. this is a piece of cake for devs The devs have to write

If you think it's such a piece of cake to write it, please go ahead! It's not that I don't want to implement something, but from my point of view, I just don't see above as easy and/or workable solution.

That said, I spent a lot of time repeating myself with basically the same message, which isn't that productive. Stepping out of this specific discussion and leave to to others for now :-)

i wrote a working demo, the displaying of lb on other clients is similar to the last verification part. when verifiend, override the existing record using steamwork function. since i dont know how to show messages in chat window, and how to get the info needed, i only write some string to represent them.

https://github.com/ywgATustcbbs/asrd_speedrun_lb_demo

ywgATustcbbs commented 1 year ago

I don't see how above can technically work when looking at the Steam SDK. Not without wiping existing leaderboards and a solution for everything mentioned here and on the Steam forums:

currently the game use this functions to upload score

SteamAPICall_t UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount );

in this function, the 2nd parameter eLeaderboardUploadScoreMethod can be used to force override an existing record.

ywgATustcbbs commented 1 year ago

@BenLubar

Could you please kindly tell me These things, Or give me some hints. I am not familar with the source code and have no idea where to find them.

  1. the function name that display messages in chat
  2. Function name that returns the current user steamid
  3. there are two update leaderboard function calls in source code, which one is working or both of them
  4. where is the part that display lb on loading screen
  5. Where is the part that rename the demo file

I am working on integrating the demo code into the source code. The demo works fine but i don't know where to put it into the source code.

The demo repo is posted in previous comment.

mithrand0 commented 1 year ago

Your code cannot work, because:

image

I don't see how above can technically work when looking at the Steam SDK. Not without wiping existing leaderboards and a solution for everything mentioned here and on the Steam forums: https://steamcommunity.com/app/563560/discussions/2/3361397532252356972/#c3761102779887394593

Need a solution for the trust issue first as described in the forums.

I prefer to not communicate any further here, it isn't productive for anyone. Happy to discuss this on Steam Chat or Discord, maybe that way it's easier to explain why your suggestions will not work without solve other things first.

mithrand0 commented 1 year ago

Regarding make them official, this is the poll we had a while ago:

image

ywgATustcbbs commented 1 year ago

Happy to discuss this on Steam Chat or Discord,

Both are OK.

mithrand0 commented 1 year ago

Chat was more or less a repeat of what is already said above.

mithrand0 commented 1 year ago

Talked about this, we won't integrate speedrun.com, or do time consuming modifications to the leaderboards for only a small group.

A forum post was created, as well as a page on the site:

The post will be posted into Chinese, when the translation is ready.

This means this issue is handled for now.