From d8daaebb4c5bf89250a7d35c97676dbb23ccbe3c Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:53:09 +0300 Subject: refactor: update readme and rules. use sdp for early demo confirmation --- README.md | 12 ++++++---- RULES.md | 37 +++++++++++++++-------------- frontend/src/components/UploadRunDialog.tsx | 29 +++++++++++----------- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index f6c86b6..5ff180e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Portal 2 Least Portals Hub +# Least Portals Hub (LPHUB) ## About LPHUB @@ -8,11 +8,13 @@ Our comprehensive map library contains detailed, wiki-style information for maps In addition, we host a leaderboard section for each map where users can compare their accomplishments and compete for having the lowest amount of portals possible. Users can upload their records, along with demo proof in order to get on to the leaderboards. +There's also discussion tabs for each map to act like forum pages in order to talk about possible new routes, alternatives, and overall comments. + ## Project Team * [@pektezol](https://github.com/pektezol) - Project Lead * [@Krzyhau](https://github.com/Krzyhau) - Visual Design -* [@Nidboj132](https://github.com/Nidboj132) - Frontend & Subject Expert +* [@Nidboj132](https://github.com/Nidboj132) - Subject Expert & Frontend * [@Oryn](https://github.com/Oryn-Goia) - Subject Expert * [@Wolfboy248](https://github.com/Wolfboy248) - Frontend @@ -27,8 +29,8 @@ In addition, we host a leaderboard section for each map where users can compare ## Special Thanks -* [@UncraftedName](https://github.com/UncraftedName) - For providing the (former) parser that retrieves total portal count and elapsed time from the CM counter found [here](https://github.com/UncraftedName/UntitledParser). -* [@NeKz](https://github.com/NeKzor) - For being the inspiration of this project and the developer of the former least portals site found [here](https://lp.nekz.me/). +* [@NeKz](https://github.com/NeKzor) - For being the inspiration of this project and the developer of the former least portals site found [here](https://github.com/NeKzor/lp). Also for creating the [@nekz/sdp](https://github.com/NeKzor/sdp) package for demo parsing in client-side for quick information. +* [@UncraftedName](https://github.com/UncraftedName) - For being a guide to parsing demo files and helping with how to retrieve total portal count and elapsed time from the CM counter with their parser found [here](https://github.com/UncraftedName/UntitledParser). ## Documentation @@ -71,4 +73,4 @@ By using LPHUB, you acknowledge that you have read and understood this disclaime ## Last Update -2024-09-09 \ No newline at end of file +2024-10-19 \ No newline at end of file diff --git a/RULES.md b/RULES.md index 99c5a3e..3645d8f 100644 --- a/RULES.md +++ b/RULES.md @@ -4,39 +4,40 @@ To compete on the leaderboard, you must adhere to the following rules. Failure t ## Game -All runs must be performed on the latest release of Portal 2. Game files must not be modified in any way (things such as binary or dll files). -Launch options that alter game behavior (e.g., `-tickrate`) are prohibited -The use of scripts, cheats, plugins, third-party software, or anything that changes the game's behavior is strictly forbidden. -The only allowed plugin is SourceAutoRecord and if used it must be latest version. +- All runs must be performed on the latest release of Portal 2. Game files must not be modified in any way (things such as binary and/or .dll files). +- Launch options/commands that alter game behavior (e.g., `-tickrate`) are prohibited. +- The use of scripts, cheats, plugins, third-party software, or anything that changes the game's behavior is strictly forbidden. +- The only allowed plugin is SourceAutoRecord, and if used, it must be the latest version. ### Texture Modifications -You may modify texture files as long as it doesn't give you any advantage. +- You may modify texture files as long as it doesn't give you any advantage. Both `.vtf` and `.vmt` files associated with these textures can be modified. -Models cannot be modified as they alter game behaviour +- Models cannot be modified as they alter game behaviour. ## Runs ### Demos -Proof of your run must be recorded using demos. To start recording, type `record ` when entering the map, or use the SAR plugin with the command `sar_record_at 0`. -A valid demo begins when the player can move and ends when the player touches the end flags. -For cooperative runs, both players must submit their demos. +- Proof of your run must be recorded using demos. To start recording, type `record ` when entering the map, or use the SAR plugin with the command `sar_record_at 0`. +- A valid demo begins when the player can move and ends when the player touches the end flags. +- For cooperative runs, both players must submit their demos. ### Console Commands & Cheats -The use of cheats, including specific console commands, is prohibited. Even if a command is not cheat-protected, it may still invalidate your run. For a full list of banned commands, refer to rules.portal2.sr/#command-list. -Additionally, commands that affect game behavior (e.g., `net_*` commands) are not allowed. +- The use of cheats, including specific console commands, is prohibited. Even if a command is not cheat-protected, it may still invalidate your run. For a full list of banned commands, refer to [rules.portal2.sr/#command-list](https://rules.portal2.sr/#command-list). +- Additionally, commands that affect game behavior (e.g., `net_*` commands) are not allowed. ### Banned Exploits -The following exploits are banned: freezing the game window, pause abuse, packet loss manipulation, intentional internet disconnection, and any glitches requiring setup before the run (e.g., moving portals or EHM). -If you're unsure whether an exploit is allowed, ask in the Discord server. +- The following exploits are banned: freezing the game window, pause abuse, packet loss manipulation, intentional internet disconnection, and any glitches requiring setup before the run (e.g., moving portals or EHM). +- If you're unsure whether an exploit is allowed, ask in the Discord server. -### Note +## Important Note -The moderation team has the authority to remove any record they believe to be illegitimate. -If you accidentally submit an illegitimate run, the moderation team will attempt to contact you, and you may receive a warning. -However, ignoring their attempts to contact you, deliberately cheating, or receiving too many warnings may result in a ban. +- The moderation team has the authority to remove any record they believe to be illegitimate, and/or ban any player they believe to have broken the rules. +- If you 'accidentally' submit an illegitimate run, the moderation team will attempt to contact you, and you may receive a warning. However, ignoring their attempts to contact you, deliberately cheating, and/or receiving too many warnings may result in a ban. +- Use common sense. You must be really pathetic if you intentionally cheat on least portals of all things. -As this is an open beta, we highly encourage players to test the limits and report any exploits they discover. Your feedback is essential to improving the system and ensuring fair competition. +## Last Updated +2024-10-19 diff --git a/frontend/src/components/UploadRunDialog.tsx b/frontend/src/components/UploadRunDialog.tsx index b241ed1..b26bbe6 100644 --- a/frontend/src/components/UploadRunDialog.tsx +++ b/frontend/src/components/UploadRunDialog.tsx @@ -1,16 +1,12 @@ import React from 'react'; import { UploadRunContent } from '../types/Content'; -import { DemoMessages, ScoreboardTempUpdate, SourceDemoParser, UserMessage } from '@nekz/sdp'; -import fs from 'fs'; - - +import { ScoreboardTempUpdate, SourceDemoParser, NetMessages } from '@nekz/sdp'; import '../css/UploadRunDialog.css'; import { Game } from '../types/Game'; import { Map } from '../types/Map'; import { API } from '../api/Api'; import { useNavigate } from 'react-router-dom'; -import { SvcUserMessage } from '@nekz/sdp/script/src/types/NetMessages'; interface UploadRunDialogProps { token?: string; @@ -108,16 +104,19 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, return } } - // const demo = SourceDemoParser.default() - // .setOptions({ packets: true }) - // .parse(await uploadRunContent.host_demo.arrayBuffer()); - - // const scoreboardPacket = demo.findPacket(ScoreboardTempUpdate) - // if (scoreboardPacket) { - // console.log(scoreboardPacket) - // } else { - // console.log("couldnt find scoreboard packet") - // } + const demo = SourceDemoParser.default() + .setOptions({ packets: true }) + .parse(await uploadRunContent.host_demo.arrayBuffer()); + const scoreboard = demo.findPacket((message) => { + return message instanceof NetMessages.SvcUserMessage && message.userMessage instanceof ScoreboardTempUpdate; + }) + + if (!scoreboard) { + alert("Error while processing demo: Unable to get scoreboard result. Is this not a CM demo?") + return + } + const { portalScore, timeScore } = scoreboard.userMessage?.as() ?? {}; + console.log(`Portal count: ${portalScore}. Ticks: ${timeScore}.`); if (window.confirm("Are you sure you want to submit this run to LPHUB?")) { const message = await API.post_record(token, uploadRunContent); alert(message); -- cgit v1.2.3