17 Cookbook
Colin McMillen edited this page 11 months ago
  • encode ogg files so that they're not above 48khz (the max monogame can handle): oggenc --resample=48000 sword_swing_*.wav

  • find monogame content builder errors:

C:\Progra~2\MSBuild\MonoGame\v3.0\Tools\MGCB.exe /quiet /platform:DesktopGL /@:"C:\Users\mcmillen\src\sneak\Content\Content.mgcb" /outputDir:"bin\DesktopGL\Content" /intermediateDir:"obj\DesktopGL\Content"
  • sort gitea access.log by IP address: sudo -u git cat /var/lib/gitea/log/access.log | cut -d " " -f 1 | sort | uniq -c | sort -nr | head

  • update the pointer to the public/ submodule in git: git commit -m "update public/" public

  • export sprites from Aseprite with: [X] JSON Data, [v] Array, [X] tags, Item Filename: {title} {frame}

  • translate mp3 to ogg: ffmpeg -i file.mp3 file.ogg

  • pngcrush everything: for file in **/*.png ; do pngcrush -brute -ow $file; done

  • pngcrush everything that's changed:

for file in $(git status --porcelain --untracked=all | cut -b 4- | grep "\.png$") ; do pngcrush -brute -ow $file; done

or with output showing size changes:

for file in $(git status --porcelain --untracked=all | cut -b 4- | grep "\.png$") ; do oldSize=$(ls -l $file | cut -d " " -f 5 ); pngcrush -q -brute -ow $file; newSize=$(ls -l $file | cut -d " " -f 5); echo "$file $oldSize -> $newSize"; done     
  • sizes of things in C#:
sizeof(Vector2) = 8
sizeof(Vector3) = 12
sizeof(Vector4) = 16
sizeof(Color) = 4
sizeof(VertexPositionColor) = 16
  • To call sizeof(), wrap it in an unsafe block, like:
unsafe {
  Debug.WriteLine("sizeof(Vector2) = " + sizeof(Vector2));
}

You also have to check a tickybox: Project > Properties > [X] Allow unsafe code.

python3 public/tools/assets/import_ccg.py ../assets/cleancutgames/Pixelart_Medieval_Fantasy_Characters_Pack/Characters/ Executioner_Female ~/src/assets/processed/ > import.txt

Then cp import.txt into the appropriate output directory.

Then you can git push origin or git push gitlab.

  • Remove a remote:
git remote remove github
  • Push code to private and public repositories:
git push && git push github
  • Find all TODOs:
grep TODO $(git ls-tree -r master --name-only)
  • Fix file endings for all C# files:
git ls-tree -r master --name-only | grep ".cs$" | xargs dos2unix

deprecated stuff

  • Get repo working on completely fresh install: first, make sure that git.semicolin.games has the right ssh public key for the machine. Then:
sudo apt install git-lfs
git lfs install
git clone git@git.semicolin.games:semicolin/sneak-private.git sneak
git submodule init
git submodule update
  • Add git remotes for both gitlab and github:
git remote add origin git@github.com:mcmillen/sneak-private.git
git remote add gitlab git@gitlab.com:SemiColinGames/sneak-private.git