-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [1.5.0] 2021-07-27 ### Changed - Bypass caching for specific requests - Requests from the game are unconditionally sent to real servers to ensure consistency ### Fixed - Demote some error messages to warnings - Fixed hardcoded IP addresses causing network issues
- Loading branch information
1 parent
d7c1f91
commit 04308a8
Showing
19 changed files
with
1,817 additions
and
1,400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Contributing Guide | ||
|
||
Please help me. Fork this. Write in the wiki. Open a million issues. Add docs, | ||
ask questions. I will try my best | ||
|
||
DM me on discord: Cybermelon#1969 | ||
|
||
## Overview | ||
|
||
`gg-struggle` is a local webserver that caches responses from the guilty | ||
This speeds up loading and menu times for regions furthest from Japan (NA, EU) | ||
|
||
The user package consists of | ||
|
||
1. a nodejs webserver w/ scripts | ||
- self-signed SSL certs | ||
- hosts file patch | ||
2. sqlite db to | ||
3. payload dumps in temp dir | ||
|
||
Cache is in-memory, and payloads are stored between sessions via sqlite and | ||
dump files. | ||
|
||
### Usage w/ git and nodejs | ||
|
||
Clone into any directory, create a self-signed cert, and run like any node | ||
package. | ||
|
||
``` | ||
git clone https://github.com/tsaibermelon/gg-struggle | ||
cd gg-struggle | ||
# create key | ||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -config tools/localhost.cnf | ||
openssl pkcs12 -export -out gg-struggle-cert.pfx -inkey key.pem -in cert.pem | ||
# copy sample config and run w/ it | ||
cp local.json myconfig.json | ||
node . myconfig.json | ||
``` | ||
|
||
## How It Works | ||
|
||
### Problem | ||
|
||
When loading up the main menu, the guilty gear game downloads all your game | ||
data in several HTTP (100+) requests to the game servers. These requests | ||
are done in order, waiting for one to complete before doing the next. | ||
|
||
Making this many requests isn't too bad, until you factor in latency. | ||
Each request has to go to Japan and back, ~250ms each way / ~500+ ms total. | ||
Multiply this by 100 requests and no wonder it can take it 5 minutes. | ||
|
||
A good explanation of this can be found on reddit: [here](https://www.reddit.com/r/Guiltygear/comments/oaqwo5/analysis_of_network_traffic_at_game_startup) | ||
|
||
### Solution | ||
|
||
tl;dr cache the responses and send old ones back to the game immediately. | ||
|
||
To solve this we put a fake server (`gg-struggle`) in the middle, between the game and the server. | ||
We trick our game into thinking `gg-struggle` is the real server and asks | ||
it for data. `gg-struggle` makes the same request to the real server and copies the response | ||
back to the game. Then saves the response for later. | ||
|
||
The next time the game tries to make the same request (e.g. download latest news), | ||
`gg-struggle` will already have saved that data from earlier and return it back | ||
immediately. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Developer's Guide | ||
|
||
This contains all the more technical details for developers and beginners | ||
looking to start. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
# Building on windows (with cygwin lol) | ||
|
||
|
||
npm install | ||
pkg --target node14-win . | ||
cd tools | ||
iscc /F"install-gg-struggle" installer.iss | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
NODE_URL="https://nodejs.org/dist/latest" | ||
NODE_SUM_URL="https://nodejs.org/dist/latest/SHASUMS256.txt" | ||
SUMFILE="sums.txt" | ||
OUTFILE_NODE="gg-struggle-node-win-64.zip" | ||
OUTFILE="gg-struggle-win-64.zip" | ||
OUTDIR="build" | ||
|
||
mkdir -p $OUTDIR | ||
rm -r $OUTDIR/node | ||
cd $OUTDIR | ||
|
||
# download sha sums | ||
[ -f $SUMFILE ] || curl $NODE_SUM_URL >$SUMFILE | ||
|
||
# download latest node | ||
while read line; do | ||
SUM="$(echo -n $line | awk '{ print $1; }')" | ||
NAME="$(echo -n $line | awk '{ print $2; }')" | ||
if [[ "$NAME" =~ '-win-x64.zip' ]]; then | ||
# download | ||
curl "${NODE_URL}/${NAME}" >"$NAME" | ||
|
||
# check for integrity | ||
shasum --ignore-missing --UNIVERSAL -c $SUMFILE -q | ||
|
||
# all good. unzip and rename versioned dir to node | ||
#rm -r $OUTDIR/node | ||
unzip $NAME | ||
NODE_DIR="$(basename $NAME .zip)" | ||
mv $NODE_DIR node | ||
fi | ||
done <$SUMFILE | ||
|
||
|
||
|
||
# create zip archive of repo | ||
git --git-dir=$PWD/../.git archive --format=zip -o $OUTFILE HEAD | ||
|
||
# create a node version | ||
cp $OUTFILE $OUTFILE_NODE | ||
zip -r --grow $OUTFILE_NODE node/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"options": { | ||
"pfxFile": "gg-struggle-cert.pfx", | ||
"passphrase": "totsugeki", | ||
"port": 443, | ||
|
||
"logLevel": "info", | ||
"rootDir": "__TEMP__", | ||
"ggHost": "ggst-game.guiltygear.com", | ||
"cachePolicy": { | ||
"default": "3 hours", | ||
"routes": { | ||
"/api/catalog/.*": "-1", | ||
"/api/get_vip_status/.*": "3 hours", | ||
"/api/lobby/.*": "-1", | ||
"/api/player_match/.*": "-1", | ||
"/api/statistics/.*": "3 hours", | ||
"/api/sys/.*": "5 minutes", | ||
"/api/tus/read": "-1" | ||
} | ||
} } | ||
} |
Oops, something went wrong.