Re:TypeScript types can run DOOM [video]
by dimitropoulos on Wednesday February 26, 2025 @01:15PM
(#43186365)
(author here) pause on that screen and look at the code displayed on the right (as well as the note at the bottom!) the way to do keyboard inputs is basically exactly what people do for tool assisted speedrunners. Some people at this point in the message just went "oh cool!" and others went "you liar! that's not the same thing!". There was SO MUCH to say in 7 minutes in a short video like that, but rest assured, I'll go into depth on that in the next videos. The pong stuff that's shown is real (only the animating part was the creative liberty) and it's in the open source codebase.
Re:TypeScript types can run DOOM [video]
by darcien on Wednesday February 26, 2025 @12:34PM
(#43185941)
I haven't checked the DOOM one, but for the Pong example, the keyboard input is prerecorded. As in the sequence of the keyboard key press are sequenced in a TS array[0].
[0]: https://github.com/MichiganTypeScript/typescript-types-only-...
Re:TypeScript types can run DOOM [video]
by dimitropoulos on Wednesday February 26, 2025 @01:16PM
(#43186375)
yep! exactly this! like how a tool assisted speedrunner works
Re:TypeScript types can run DOOM [video]
by Jare on Wednesday February 26, 2025 @06:40PM
(#43189589)
That's also how the Doom demos worked right? :D
Re:TypeScript types can run DOOM [video]
by pcthrowaway on Wednesday February 26, 2025 @12:35PM
(#43185945)
If I had to guess, it's a file with an array of keys pressed (or unpressed) at some time interval (say 0.1 seconds). Then a VS code extension can append to the array every 0.1 second along with any key-press states at that time. The compiler updates the game state whenever this array gets updated.
However, I'm guessing this is why we see a demo of pong and not doom. Doom probably just can't keep up with this.
No idea if I'm remotely on the right track here though.
What I don't understand is how this thing does keyboard input.
At 3:42, the video simply says, "And, yes, there's a way to do keyboard input," without elaborating on how. What sorcery is that? There must be something outside the type system translating keyboard input into TypeScript types…??