Skip to content

Commit 04308a8

Browse files
authored
1.5.0 (#20)
## [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
1 parent d7c1f91 commit 04308a8

19 files changed

Lines changed: 1817 additions & 1400 deletions

CHANGELOG

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,27 @@
55

66
### Planned
77

8+
- minimizing to systray
89
- Web Interface
910
- Stat Tracking
1011
- Payload parsers
1112

12-
### Needs Fixing
13+
### To Fix
1314

14-
- logging top level errors. pausing before quitting
15+
- load unexpired cache entries on startup
16+
17+
## [1.5.0] 2021-07-27
18+
19+
### Changed
20+
21+
- Bypass caching for specific requests
22+
- Requests from the game are unconditionally sent to real servers to ensure
23+
consistency
24+
25+
### Fixed
26+
27+
- Demote some error messages to warnings
28+
- Fixed hardcoded IP addresses causing network issues
1529

1630
## [1.4.1] - 2021-07-08
1731

@@ -50,3 +64,4 @@ one
5064

5165
- Local installation
5266

67+

CONTRIBUTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Contributing Guide
2+
3+
Please help me. Fork this. Write in the wiki. Open a million issues. Add docs,
4+
ask questions. I will try my best
5+
6+
DM me on discord: Cybermelon#1969
7+
8+
## Overview
9+
10+
`gg-struggle` is a local webserver that caches responses from the guilty
11+
This speeds up loading and menu times for regions furthest from Japan (NA, EU)
12+
13+
The user package consists of
14+
15+
1. a nodejs webserver w/ scripts
16+
- self-signed SSL certs
17+
- hosts file patch
18+
2. sqlite db to
19+
3. payload dumps in temp dir
20+
21+
Cache is in-memory, and payloads are stored between sessions via sqlite and
22+
dump files.
23+
24+
### Usage w/ git and nodejs
25+
26+
Clone into any directory, create a self-signed cert, and run like any node
27+
package.
28+
29+
```
30+
git clone https://github.com/tsaibermelon/gg-struggle
31+
cd gg-struggle
32+
33+
# create key
34+
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -config tools/localhost.cnf
35+
openssl pkcs12 -export -out gg-struggle-cert.pfx -inkey key.pem -in cert.pem
36+
37+
# copy sample config and run w/ it
38+
cp local.json myconfig.json
39+
node . myconfig.json
40+
```
41+
42+
## How It Works
43+
44+
### Problem
45+
46+
When loading up the main menu, the guilty gear game downloads all your game
47+
data in several HTTP (100+) requests to the game servers. These requests
48+
are done in order, waiting for one to complete before doing the next.
49+
50+
Making this many requests isn't too bad, until you factor in latency.
51+
Each request has to go to Japan and back, ~250ms each way / ~500+ ms total.
52+
Multiply this by 100 requests and no wonder it can take it 5 minutes.
53+
54+
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)
55+
56+
### Solution
57+
58+
tl;dr cache the responses and send old ones back to the game immediately.
59+
60+
To solve this we put a fake server (`gg-struggle`) in the middle, between the game and the server.
61+
We trick our game into thinking `gg-struggle` is the real server and asks
62+
it for data. `gg-struggle` makes the same request to the real server and copies the response
63+
back to the game. Then saves the response for later.
64+
65+
The next time the game tries to make the same request (e.g. download latest news),
66+
`gg-struggle` will already have saved that data from earlier and return it back
67+
immediately.

DEVGUIDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Developer's Guide
2+
3+
This contains all the more technical details for developers and beginners
4+
looking to start.

README.md

Lines changed: 41 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,40 @@
22

33
![Demo Video](media/ggmain.webm)
44

5-
# 🔥⚠ HOTFIX
6-
7-
For those suddenly getting network issues, you can replace the ip address with the right one
8-
in your hosts file.
9-
10-
1. `ping ggst-game.guiltygear.com`. Note the IP address:
11-
12-
```
13-
Pinging ggst-game.guiltygear.com [<ip addr>] with 32 bytes of data:
14-
```
15-
16-
3. Run notepad as administrator
17-
4. Change the line with `ggst-game-real.guiltygear.com`. Note the **`real`**
18-
19-
```
20-
# C:\windows\system32\drivers\etc\hosts
21-
<ip addr> ggst-game-real.guiltygear.com
22-
```
23-
245
## tl;dr
256

267
`gg-struggle` is a program that reduces loading times by caching
278
the Guilty Gear server responses. Instead of taking 500+ ms/request,
289
this takes ~20ms/req.
2910

30-
Download [here](https://github.com/tsaibermelon/gg-struggle/releases/download/v1.4.1/install-gg-struggle-v1.4.1.exe)
31-
32-
### Usage
33-
34-
1. Install using `install-gg-struggle.exe`.
35-
2. Start `gg-struggle`. Keep this console open while guilty gear is running.
36-
3. _SLASH!_
37-
38-
## Overview
39-
40-
`gg-struggle` is a local webserver that caches responses from the guilty
41-
This speeds up loading and menu times for regions furthest from Japan (NA, EU)
42-
43-
I'll update this with more documentation as I have time
11+
Download [here][releases]
4412

45-
### Automated Install
13+
### zip Archive (Windows)
4614

47-
Install using the `install-gg-struggle.exe` installer.
15+
Install and run by unzipping the .zip file in releases
4816

49-
1. run `install-gg-struggle.exe`
50-
2. Launch `gg-struggle.exe` through the start menu
51-
3. Load game
52-
53-
NOTE: While installed, `gg-struggle` MUST be running while the game is up.
54-
You must uninstall to revert things to normal.
55-
56-
### Manual Install
57-
58-
1. Run `certmgr.exe` as admin
59-
2. Import `gg-struggle-cert.pem` under the **"Trusted Root Certification Authority"**
60-
3. Edit `c:\windows\system32\drivers\etc\hosts` file as admin to include the following lines
61-
62-
127.0.0.1 ggst-game.guiltygear.com
63-
3.112.119.46 ggst-game-real.guiltygear.com
64-
65-
## How It Works
66-
67-
### Problem
17+
1. Use installer from releases [releases][releases].
18+
2. Run `gg-struggle` before playing. Keep this window open during play
19+
3. _SLASH!_
6820

69-
When loading up the main menu, the guilty gear game downloads all your game
70-
data in several HTTP (100+) requests to the game servers. These requests
71-
are done in order, waiting for one to complete before doing the next.
21+
## Updating
7222

73-
Making this many requests isn't too bad, until you factor in latency.
74-
Each request has to go to Japan and back, ~250ms each way / ~500+ ms total.
75-
Multiply this by 100 requests and no wonder it can take it 5 minutes.
23+
Uninstall and reinstall with newest installer.
7624

77-
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)
25+
## Uninstall / Remove
7826

79-
### Solution
27+
Run `uninstall-gg-struggle.ps1`.
8028

81-
tl;dr cache the responses and send old ones back to the game immediately.
29+
You can verify it's removed by opening
30+
`c:\windows\system32\drivers\etc\hosts` in a text editor like notepad. This
31+
line should __NOT__ exist.
8232

83-
To solve this we put a fake server (`gg-struggle`) in the middle, between the game and the server.
84-
We trick our game into thinking `gg-struggle` is the real server and asks
85-
it for data. `gg-struggle` makes the same request to the real server and copies the response
86-
back to the game. Then saves the response for later.
33+
```
34+
127.0.0.1 ggst-game.guiltygear.com
35+
```
8736

88-
The next time the game tries to make the same request (e.g. download latest news),
89-
`gg-struggle` will already have saved that data from earlier and return it back
90-
immediately.
37+
If you see this line, open it with _notepad as administrator_ and delete the
38+
line and save.
9139

9240
## Known Issues
9341

@@ -97,24 +45,30 @@ The first load is always gonna be slow as normal, but subsequent loads should be
9745

9846
> Floor lockout / old data
9947
100-
As of 1.3, any changes to player data won't show in the client for 24 hours.
101-
Future versions will dynamically cache data based on the request routes,
102-
so that trivial data like player lobbies are always up-to-date.
48+
Ranks and floor progressions would never update for some people.
10349

104-
This'll be fixed in the next patch.
50+
This should be fixed in 1.5 Please report instances of this in issues.
10551

10652
## Logs
10753

54+
Crashes are hopefully stored in the logs. If experiencing an issue,
55+
please paste relevant screenshots of the log.
56+
10857
Windows: `%TEMP%/gg-struggle/all.log`
10958
linux: `$TMPDIR/gg-struggle/all.log`
11059

11160
## FAQ
11261

62+
> Is this a virus? How safe is this?
63+
64+
This isn't a virus, people can check the code.
65+
It's common webserver software.
66+
11367
> Will I get banned?
11468
115-
The likelihood of getting banned is highly unlikely, since we're not tampering
116-
with the game data nor the game client. We're just sitting on the network
117-
between the game and servers, cleanly passing data along.
69+
I'd say it's highly unlikely because `gg-struggle` runs as a standalone program
70+
that does not touch the game in any way. It reads your game's network traffic
71+
and relays it without any tampering.
11872

11973
We are sending slightly stale data back to the game client, so there can be
12074
some client-side bugs with out-of-date info, like showing a lobby list with
@@ -130,16 +84,15 @@ We need to do two things with admin:
13084
We need to assure windows that it can trust gg-struggle is the
13185
real `ggst-game.guiltygear.com`, even though it's really not.
13286

87+
There's no way to distinguish if the HTTP request was made from the proxy or the game.
13388

134-
> What does the installation do?
89+
> What does installation do?
13590
136-
The installation does 3 things
137-
138-
1. Installs the .exe file
139-
2. Modifies the `hosts` file
140-
3. Locally generates a Self-Signed Certificate
91+
1. Modifies the `hosts` file
92+
2. Locally generates a Self-Signed Certificate (cause you can trust youself)
14193
- installs to the windows root store
14294
- copy stored at `%ProgramFiles%/gg-struggle`
95+
3. Installs the `gg-struggle` proxy to your program files.
14396

14497
> Why is GG:ST so slow?
14598
@@ -149,7 +102,6 @@ When the game loads, a 100+ of HTTP requests are sent serially. Each request
149102
can take ~200-1500ms due to latency from a region like NA to Japan. This adds
150103
up to roughly `100 * 800 = 80+ seconds` in the average case.
151104

152-
153105
> Why doesn't the game just lump the requests into one big one?
154106
155107
In Japan, the devs probably didn't experience this problem. 100 requests at 10ms/req
@@ -163,6 +115,9 @@ overwork themselves on the game itself.
163115

164116
> How does gg-struggle fix this?
165117
118+
We remember the data from previous connections and serve that to the game
119+
while fetching from Japan in the background.
120+
166121
I've written an in-depth non-tech explanation in the form of a movie heist in
167122
[EXPLANATION.md](docs/EXPLANATION.md)
168123

@@ -248,3 +203,5 @@ You should also remove the `gg-struggle` certificate by
248203
1. Run `certmgr.msc` as admin
249204
2. Navigate to "Trusted Root Certifcation Authorities"
250205
3. Delete `gg-struggle`
206+
207+
[releases]: https://github.com/tsaibermelon/gg-struggle/releases/download

build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
# Building on windows (with cygwin lol)
3+
4+
5+
npm install
6+
pkg --target node14-win .
7+
cd tools
8+
iscc /F"install-gg-struggle" installer.iss
9+
10+

build_dontuse.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
NODE_URL="https://nodejs.org/dist/latest"
6+
NODE_SUM_URL="https://nodejs.org/dist/latest/SHASUMS256.txt"
7+
SUMFILE="sums.txt"
8+
OUTFILE_NODE="gg-struggle-node-win-64.zip"
9+
OUTFILE="gg-struggle-win-64.zip"
10+
OUTDIR="build"
11+
12+
mkdir -p $OUTDIR
13+
rm -r $OUTDIR/node
14+
cd $OUTDIR
15+
16+
# download sha sums
17+
[ -f $SUMFILE ] || curl $NODE_SUM_URL >$SUMFILE
18+
19+
# download latest node
20+
while read line; do
21+
SUM="$(echo -n $line | awk '{ print $1; }')"
22+
NAME="$(echo -n $line | awk '{ print $2; }')"
23+
if [[ "$NAME" =~ '-win-x64.zip' ]]; then
24+
# download
25+
curl "${NODE_URL}/${NAME}" >"$NAME"
26+
27+
# check for integrity
28+
shasum --ignore-missing --UNIVERSAL -c $SUMFILE -q
29+
30+
# all good. unzip and rename versioned dir to node
31+
#rm -r $OUTDIR/node
32+
unzip $NAME
33+
NODE_DIR="$(basename $NAME .zip)"
34+
mv $NODE_DIR node
35+
fi
36+
done <$SUMFILE
37+
38+
39+
40+
# create zip archive of repo
41+
git --git-dir=$PWD/../.git archive --format=zip -o $OUTFILE HEAD
42+
43+
# create a node version
44+
cp $OUTFILE $OUTFILE_NODE
45+
zip -r --grow $OUTFILE_NODE node/

local.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"options": {
3+
"pfxFile": "gg-struggle-cert.pfx",
4+
"passphrase": "totsugeki",
5+
"port": 443,
6+
7+
"logLevel": "info",
8+
"rootDir": "__TEMP__",
9+
"ggHost": "ggst-game.guiltygear.com",
10+
"cachePolicy": {
11+
"default": "3 hours",
12+
"routes": {
13+
"/api/catalog/.*": "-1",
14+
"/api/get_vip_status/.*": "3 hours",
15+
"/api/lobby/.*": "-1",
16+
"/api/player_match/.*": "-1",
17+
"/api/statistics/.*": "3 hours",
18+
"/api/sys/.*": "5 minutes",
19+
"/api/tus/read": "-1"
20+
}
21+
} }
22+
}

0 commit comments

Comments
 (0)