forked from olafurw/vvvvvv-hook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
107 lines (57 loc) · 4.76 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Install DirectX SDK
https://www.microsoft.com/en-us/download/details.aspx?id=6812
Windows SDK
https://www.microsoft.com/en-us/download/details.aspx?id=8279
Detours
Kiero Hook
https://github.com/Rebzzel/kiero
https://github.com/master131/ExtremeInjector ???
no, use this as a seperate application ??
https://stackoverflow.com/questions/58275749/how-to-inject-dll-making-a-detours-enabled-hook
https://tasvideos.org/LawsOfTAS
http://tasvideos.org/LawsOfTAS/OnSavestates.html
https://github.com/TASEmulators/fceux/blob/201cb50d8914e55223a1bf3ad19f0bc46bfdc407/src/movie.cpp#L1479
Since it's SDL2 I have to match how they create the d3d device.
https://github.com/zielmicha/SDL2/blob/master/src/render/direct3d/SDL_render_d3d.c#L535
Big issue is that we get attached before the window is created, so we have to wait.
Fixed with new hooking code.
Game has a way to set the framerate to 30fps which based on the source code does not wait for events
But if a game does this we might have to hook the SDL_PollEvent code
---
xx Intro
I love playing games, been playing them since I was a kid.
Later in life I learned how to program, so I've always thought about, how can I best combine these two things.
What I ended up doing is working in the gaming industry for 7 years, working on many aspects of game development (except making a game, but that's a talk for another day)
But what I found interesting is to create tools that would play games for me.
There are actually a lot of interesting technical considerations here so I hope you can get something out of this even if you don't play games.
xx Game loop
xx Explain Speedrunning
Whenever there is a timer or a score, people will try to beat it. This is also true with video games.
Early racing games were often the first games where people competed to beat them as fast as possible, but without the internet you would have to take a photo of your monitor and send it to a gaming magazine.
This even became a regular section in Nintendo magazines.
And then Doom arrived on the scene.
Doom from 1993 was a first person shooter where you kill demons from hell. But here are the parts of the game that are important to us.
Important fact 1. Doom is single threaded.
Not very common to have multiple cores back in 1993, so many games from that time run the update loop I mentioned earlier in a very naive way. 1 read of the inputs, 1 update state, 1 draw.
Important fact 2. Doom's random number generator is deterministic.
Anytime anything in the game wants to receive a random number, they would ask the rng function, it would consult the rng table, and give you a number and then increment the index to the next entry in the table.
Important fact 3. Doom allows you to record your gameplay.
Doom can save your inputs into a file and then play them back, as if someone were pressing those inputs. This is only possible because of fact 1 and 2.
Important fact 4. Doom shows you a timer at the end of the level.
So Doom became one of the early speedrunning games, and because the internet was "super fast" back then, you could share the small file (called a demo) with your friends and they can see your skills at the game.
There is a lot we could go into regarding the community but we are here to code, so lets talk tech.
xx Explain TAS speedrunning
Because these are files that only contain the inputs, you can write software that creates these files and try to exploit the game to the fullest.
These kinds of speedruns are called TAS or Tool Assisted Speedruns.
Tool Assisted Speedruns can be a very complicated affair or something very simple. They don't even need to be speedruns, you can use tools to assist you to play a game due to some sort of imparement or write some tools to play games just because its fun.
xx Show Bejeweled 3 tool I made (perhaps also the triangle game)
Here is an early attempt by me, this game is Bejeweled 3, a game where you have to match 3 gems or more of the same color. So what we can do is this. We can take a screenshot of the game board, use image detection software to figure out what color is where, reconstruct the board in memory and figure out the best move to take. Then we find where the mouse should click and move and perform that action.
You'd think that all of these actions are slow, but it is so fast that it can perform match movements in mid air, while the gems are falling.
xx Talk about the pros and cons of developing a tool like that
xx Show a game that does this via slowdowns (perhaps Trackmania)
xx Talk about the pros and cons on the slowdown version
xx Show how Doom 1993 does this, Demo files, deterministic RNG
xx Show it in code using the patricia doom repo, pros and cons, etc
xx Show VVVVVV, how it works, etc.
xx Show the game being played by the tool.
xx Explain the tool, problems in making it, pros cons, etc