Rough cut on install instructions.

This commit is contained in:
Zed A. Shaw 2024-08-23 14:39:18 -04:00
parent f73d3fbfd8
commit 8f48627c72
3 changed files with 108 additions and 21 deletions

127
README.md
View file

@ -1,38 +1,123 @@
A game I'm working. It's a weird one.
# About Turing's Tarpit
Right now I've got a command that watches your files for changes, and runs a build command. It's
entirely overengineered for this purpose, but it has what I'll need later. To build it do this:
This is a game for programmers. The eventual goal is to make a small game that makes programmer
development live streams more exciting, but also makes it fun to try to keep your code bug free.
## How It Works
0. You start with 100 Hit Points (HP).
1. _Turing's Tarpit (TT)_ watches your git repo.
2. If you save any files in your git then TT will run your build.
3. It then uses a regex to detect errors, warnings, and notes from your compiler.
4. Every error is 4 HP of damage. Warnings and Notes are 1 HP.
5. If you successfully build with no errors then you get 10% HP back (healed).
6. It keeps track of your rounds, and your longest streak. A streak is how many builds have run without producing an error.
Eventually this will become more complex as I add in a few more mechanics, but this is the general
game loop. Some of the ideas for future mechanics:
1. I have a real trash Brainfuck compiler. I want to have that in there somewhere.
2. I like the way Shotgun Roulette works where you get some items per round and can use them to gain
an advantage.
3. I want streaks to be some kind of reward, either you just get some healing after a certain
number, or you can "cash them in" for a special item.
4. It needs to detect when you don't make enough changes to be worth it, but I might try to punish you if you just change a file's timestamp.
5. Running your unit tests as well to analyze the TAP output and punish you for test failures.
## Platforms
Currently this only works on Windows but there's nothing in this that will stop it from working
anywhere else. It uses FTXUI to make a TUI so that means it's very portable. I just haven't spent
the time to try to port it yet.
It's also only been test with GCC and C++. I'm betting the regex will be crazy wrong for any other
language. _BTW, where's the TAP output for compilers?_
## Compiling Setup
> __WARNING__ These instructions are off the top of my head right now so they're probably wrong. I
> need to do a clean build in a fresh VM.
To build this you'll need to install [winlibs](https://winlibs.com/) and [meson](https://mesonbuild.com/) but I believe my build process downloads everything else.
If you want to get setup quickly with a C/C++ build environment then you can use my installer scripts. Start a _NORMAL_ user PowerShell to run this. If you're walking around the internet as a raw _Administrator_ user then you might as well just inject ebola infected blood straight into your eye you idiot. No, UAC will not save you. Listen to Zed.
Now, in your _NORMAL_ user PowerShell do this:
```shell
irm https://learncodethehardway.com/setup/base.ps1 -outfile base.ps1
powershell -executionpolicy bypass .\base.ps1
```
Do not _go anywhere_. You have to enter in passwords for your _Administrator_ user. You do have a
second user that's an administrator right? Seriously, what's your problem. Do you just like having
your neighbor install a RAT tool to spy on you? Make two accounts already.
Now that you have this you can install the compiler tools:
```shell
irm https://learncodethehardway.com/setup/cpp.ps1 -outfile cpp.ps1
powershell -executionpolicy bypass .\cpp.ps1
```
For a bit of extra nice things, run my `extras.ps1` too:
```shell
irm https://learncodethehardway.com/setup/extras.ps1 -outfile extras.ps1
powershell -executionpolicy bypass .\extras.ps1
```
## Building
Once you have all of that you should be able to check out the code from this git:
```shell
git clone https://git.learnjsthehardway.com/learn-code-the-hard-way/turings-tarpit.git
```
Then change into the directory and run my setup script:
```shell
powershell -executionpolicy bypass .\scripts\reset_build.ps1
```
That should setup your meson build with everything you need, so now you run it:
```shell
./scripts/reset_build.ps1
meson compile -C builddir
```
If you get a bad compile because of libgit2's `src/util/process.h` then do this:
The next dumb as hell thing is even though I've told `meson` to build a static binary it refuses.
You have to copy a couple .dll files to your local directory for the easiest way to play with it:
```shell
cp patches/process.h subprojects/libgit2/src/util/
meson compile -C builddir
cp .\builddir\subprojects\libgit2-1.8.1\*.dll .
cp .\builddir\subprojects\efsw\*.dll .
ls *.dll
```
I don't know why it fails at this, and only on Windows but I've talked to them repeatedly and it's
mostly "works for me" responses. I also can't figure out how Meson exactly applies patches. I've
generated every possible patch I can and Meson just can't apply them.
You should then see the `libefsw.dll` and `liblibgit2package.dll` files in the local directory which
will let you run the `escape_turings_tarpit.exe` game locally.
Once it's running, we have even more annoying BS to deal with, and that's because Meson doesn't
actually statically compile efsw or libgit2. Even though I said `--default-librart=static --prefer-static` in the setup it just ignores that and makes DLLs. The "fix" for this asinine stupidity is this:
> __WARNING__ The reason you're copying all these files to the local directory is so you can run the
> game and the DLLs but _also_ run the build on the code. Windows locks executables when they're
> active, so when you build `builddir/escape_turings_tarpit.exe` it'll fail if you're also running
> it. Copy it all up and then you can run builds in the game while you work on the game.
Then hang out for a while and it should build. You can then do your first run. First, run the
tests:
```shell
meson devenv -C builddir
cd ..
cp builddir/watchgit .
./watchgit . "meson compile -C builddir
.\builddir\runtests
```
Do all that garbage and yay, this little program runs. Finally.
If those run then try to run the game on its own code:
## Future Changes
```shell
cp .\builddir\escape_turings_tarpit.exe . ; .\escape_turings_tarpit.exe .\ "meson compile -C builddir"
```
1. If I can't figure out why libgit2 has compilation errors in `src/util/process.h` then I may just rip it out and just shell out to `git` directly.
2. Ultimately I can jsut use efsw to watch the directory for all changes, but I wanted to only focus on what's in git. Oh well.
3. I also have to find out why efsw and libgit2 refuse to compile statically. Once I do that I can static compile `watchgit` and then work on the next part of the game.
Now it's playing, so all you have to do is open one of the .cpp files, make a mistake, save it, and
watch the game play.

View file

@ -6,6 +6,7 @@ cp *.wrap subprojects
# cp -recurse -force packagefiles subprojects
mkdir builddir
meson wrap install fmt
meson wrap install openal-soft
meson wrap install sqlite3
meson wrap install sqlitecpp
meson wrap install ftxui

View file

@ -8,6 +8,7 @@ mv packagecache ./subprojects/
mkdir builddir
cp *.wrap subprojects
meson wrap install fmt
meson wrap install openal-soft
meson wrap install sqlite3
meson wrap install sqlitecpp
meson wrap install ftxui