diff options
Diffstat (limited to 'live/blog')
36 files changed, 1412 insertions, 622 deletions
diff --git a/live/blog/a/acomodada_la_pagina_de_arte.html b/live/blog/a/acomodada_la_pagina_de_arte.html index bfd6cce..5703a47 100644 --- a/live/blog/a/acomodada_la_pagina_de_arte.html +++ b/live/blog/a/acomodada_la_pagina_de_arte.html @@ -16,13 +16,11 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- og meta --> <meta property="og:title" content="Al fin ya me acomodé la página pa' los dibujos -- Luevano's Blog"/> @@ -73,10 +71,15 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Al fin ya me acomodé la página pa' los dibujos</h1> <p>Así es, ya quedó acomodado el sub-dominio <code>art.luevano.xyz</code> pos pal <a href="https://art.luevano.xyz">arte</a> veda. Entonces pues ando feliz por eso.</p> -<p>Este pedo fue gracias a que me reescribí la forma en la que <code>pyssg</code> maneja los templates, ahora uso el sistema de <code>jinja</code> en vez del cochinero que hacía antes.</p> +<p>Este pedo fue gracias a que me reescribí la forma en la que <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> maneja los templates, ahora uso el sistema de <a href="https://jinja.palletsprojects.com/en/3.1.x/"><code>jinja</code></a> en vez del cochinero que hacía antes.</p> <p>Y pues nada más eso, aquí está el <a href="https://art.luevano.xyz/a/elephant_octopus.html">primer post</a> y por supuesto acá está el link del RSS <a href="https://art.luevano.xyz/rss.xml">https://art.luevano.xyz/rss.xml</a>.</p> <div class="page-nav"> @@ -107,7 +110,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, Jun 06, 2021 @ 19:06 UTC</p> - <p>Modified: Sun, Jun 06, 2021 @ 19:08 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:19 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@spanish.html">spanish</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/asi_nomas_esta_quedando.html b/live/blog/a/asi_nomas_esta_quedando.html index c1f9f3f..b275a2c 100644 --- a/live/blog/a/asi_nomas_esta_quedando.html +++ b/live/blog/a/asi_nomas_esta_quedando.html @@ -16,13 +16,11 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- og meta --> <meta property="og:title" content="Así nomás está quedando el página -- Luevano's Blog"/> @@ -73,13 +71,19 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Así nomás está quedando el página</h1> <p>Estuve acomodando un poco más el <em>sItIo</em>, al fin agregué la “sección” de <a href="https://luevano.xyz/contact.html">contact</a> y de <a href="https://luevano.xyz/donate.html">donate</a> por si hay algún loco que quiere tirar varo.</p> <p>También me puse a acomodar un servidor de <a href="https://xmpp.org/">XMPP</a> el cual, en pocas palabras, es un protocolo de mensajería instantánea (y más) descentralizado, por lo cual cada quien puede hacer una cuenta en el servidor que quiera y conectarse con cuentas creadas en otro servidor… exacto, como con los correos electrónicos. Y esto está perro porque si tú tienes tu propio server, así como con uno de correo electrónico, puedes controlar qué características tiene, quiénes pueden hacer cuenta, si hay <em>end-to-end encryption</em> (o mínimo <em>end-to-server</em>), entre un montón de otras cosas.</p> <p>Ahorita este server es SUMISO (<em>compliant</em> en español, jeje) para jalar con la app <a href="https://conversations.im/">conversations</a> y con la red social <a href="https://movim.eu/">movim</a>, pero realmente funcionaría con casi cualquier cliente de XMPP, amenos que ese cliente implemente algo que no tiene mi server. Y también acomodé un server de <a href="https://matrix.org/">Matrix</a> que es muy similar pero es bajo otro protocolo y se siente más como un discord/slack (al menos en el <a href="https://element.io/">element</a>), muy chingón también.</p> -<p>Si bien aún quedan cosas por hacer sobre estos dos servers que me acomodé (además de hacerles unas entradas para documentar cómo lo hice), quiero moverme a otra cosa que sería acomodar una sección de dibujos, lo cual en teoría es bien sencillo, pero como quiero poder automatizar la publicación de estos, quiero modificar un poco el <a href="https://github.com/luevano/pyssg">pyssg</a> para que jale chido para este pex.</p> +<p>Si bien aún quedan cosas por hacer sobre estos dos servers que me acomodé (además de hacerles unas entradas para documentar cómo lo hice), quiero moverme a otra cosa que sería acomodar una sección de dibujos, lo cual en teoría es bien sencillo, pero como quiero poder automatizar la publicación de estos, quiero modificar un poco el <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> para que jale chido para este pex.</p> <p>Ya por último también quiero moverle un poco al CSS, porque lo dejé en un estado muy culerón y quiero meterle/ajustar unas cosas para que quede más limpio y medianamente bonito… <em>dentro de lo que cabe porque evidentemente me vale verga si se ve como una página del 2000</em>.</p> +<p><strong>Actualización</strong>: Ya tumbé el servidor de XMPP porque consumía bastantes recursos y no lo usaba tanto, si en un futuro consigo un mejor servidor podría volver a hostearlo.</p> <div class="page-nav"> <span class="next"> @@ -109,6 +113,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Fri, Jun 04, 2021 @ 08:24 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:18 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@spanish.html">spanish</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/devs_android_me_trozaron.html b/live/blog/a/devs_android_me_trozaron.html index 69239fb..860bd63 100644 --- a/live/blog/a/devs_android_me_trozaron.html +++ b/live/blog/a/devs_android_me_trozaron.html @@ -16,13 +16,11 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- og meta --> <meta property="og:title" content="Los devs de Android/MIUI me trozaron -- Luevano's Blog"/> @@ -73,6 +71,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Los devs de Android/MIUI me trozaron</h1> <p>Llevo dos semanas posponiendo esta entrada porque andaba bien enojado (todavía, pero ya se anda pasando) y me daba <em>zzz</em>. Pero bueno, antes que nada este pex ocupa un poco de contexto sobre dos cositas:</p> diff --git a/live/blog/a/el_blog_ya_tiene_timestamps.html b/live/blog/a/el_blog_ya_tiene_timestamps.html index 29c080e..cf9d36d 100644 --- a/live/blog/a/el_blog_ya_tiene_timestamps.html +++ b/live/blog/a/el_blog_ya_tiene_timestamps.html @@ -16,13 +16,12 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + <!-- og meta --> <meta property="og:title" content="Así es raza, el blog ya tiene timestamps -- Luevano's Blog"/> @@ -73,12 +72,19 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Así es raza, el blog ya tiene timestamps</h1> <p>Pues eso, esta entrada es sólo para tirar update sobre mi <a href="https://blog.luevano.xyz/a/first_blog_post.html">primer post</a>. Ya modifiqué el <code>ssg</code> lo suficiente como para que maneje los <em>timestamps</em>, y ya estoy más familiarizado con este script entonces ya lo podré extender más, pero por ahora las entradas ya tienen su fecha de creación (y modificación en dado caso) al final y en el índice ya están organizados por fecha, que por ahora está algo simple pero está sencillo de extender.</p> <p>Ya lo único que queda es cambiar un poco el formato del blog (y de la página en general), porque en un momento de desesperación puse todo el texto en justificado y pues no se ve chido siempre, entonces queda corregir eso. <em>Y aunque me tomó más tiempo del que quisiera, así nomás quedó, diría un cierto personaje.</em></p> -<p>El <code>ssg</code> modificado está en mis <a href="https://git.luevano.xyz/.dots">dotfiles</a> (o directamente <a href="https://git.luevano.xyz/.dots/tree/.local/bin/ssg">aquí</a>).</p> -<p>Por último, también quité las extensiones <code>.html</code> de las URLs, porque se veía bien pitero, pero igual los links con <code>.html</code> al final redirigen a su link sin <code>.html</code>, así que no hay rollo alguno.</p> +<p><del>El <code>ssg</code> modificado está en mis <a href="https://git.luevano.xyz/.dots">dotfiles</a> (o directamente <a href="https://git.luevano.xyz/.dots/tree/.local/bin/ssg">aquí</a>).</del> +<ins>Como al final ya no usé el <code>ssg</code> modificado, este pex ya no existe.</ins></p> +<p>Por último, también quité las extensiones <code>.html</code> de las URLs, porque se ve bien pitero, pero igual los links con <code>.html</code> al final redirigen a su link sin <code>.html</code>, así que no hay rollo alguno.</p> +<p><strong>Actualización</strong>: Ahora estoy usando mi propia solución en vez de <code>ssg</code>, que la llamé <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a>, de la cual empiezo a hablar <a href="https://blog.luevano.xyz/a/new_blogging_system.html">acá</a>.</p> <div class="page-nav"> <span class="next"> @@ -108,7 +114,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Tue, Mar 16, 2021 @ 02:46 UTC</p> - <p>Modified: Mon, May 17, 2021 @ 20:53 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:15 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@spanish.html">spanish</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/first_blog_post.html b/live/blog/a/first_blog_post.html index 6da8afd..d5eb3fd 100644 --- a/live/blog/a/first_blog_post.html +++ b/live/blog/a/first_blog_post.html @@ -16,13 +16,12 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + <!-- og meta --> <meta property="og:title" content="This is the first blog post, just for testing purposes -- Luevano's Blog"/> @@ -73,11 +72,17 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>This is the first blog post, just for testing purposes</h1> - <p>I’m making this post just to figure out how <a href="https://www.romanzolotarev.com/ssg.html"><code>ssg5</code></a> and <a href="https://kristaps.bsd.lv/lowdown/"><code>lowdown</code></a> are supposed to work (and eventually also <a href="https://www.romanzolotarev.com/rssg.html"><code>rssg</code></a>).</p> -<p>At the moment, I’m not satisfied because there’s no automatic date insertion into the 1) html file, 2) the blog post itself and 3) the listing system in the <a href="https://blog.luevano.xyz/">blog homepage</a> (and there’s also the problem with the ordering of the entries…). And all of this just because I didn’t want to use <a href="https://github.com/LukeSmithxyz/lb">Luke’s</a> solution (don’t really like that much how he handles the scripts… <em>but they just work</em>).</p> + <p>I’m making this post just to figure out how <a href="https://www.romanzolotarev.com/ssg.html"><code>ssg5</code></a> and <a href="https://kristaps.bsd.lv/lowdown/"><code>lowdown</code></a> are supposed to work, and eventually <a href="https://www.romanzolotarev.com/rssg.html"><code>rssg</code></a>.</p> +<p>At the moment I’m not satisfied because there’s no automatic date insertion into the 1) html file, 2) the blog post itself and 3) the listing system in the <a href="https://blog.luevano.xyz/">blog homepage</a> which also has a problem with the ordering of the entries. And all of this just because I didn’t want to use Luke’s <a href="https://github.com/LukeSmithxyz/lb">lb</a> solution as I don’t really like that much how he handles the scripts (<em>but they just work</em>).</p> <p>Hopefully, for tomorrow all of this will be sorted out and I’ll have a working blog system.</p> +<p><strong>Update</strong>: I’m now using my own solution which I called <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a>, of which I talk about <a href="https://blog.luevano.xyz/a/new_blogging_system.html">here</a>.</p> <div class="page-nav"> <span class="next"> @@ -101,7 +106,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Sat, Feb 27, 2021 @ 13:08 UTC</p> - <p>Modified: Mon, May 17, 2021 @ 20:53 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:14 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/git_server_with_cgit.html b/live/blog/a/git_server_with_cgit.html index defcf3e..3c0bcae 100644 --- a/live/blog/a/git_server_with_cgit.html +++ b/live/blog/a/git_server_with_cgit.html @@ -16,14 +16,21 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> + <!-- highlight support for code blocks --> <script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> <script type="text/javascript"> hljs.initHighlightingOnLoad(); </script> <link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + + + <!-- og meta --> <meta property="og:title" content="Create a git server and setup cgit web app (on Nginx) -- Luevano's Blog"/> <meta property="og:type" content="article"/> @@ -73,17 +80,34 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Create a git server and setup cgit web app (on Nginx)</h1> - <p>My git server is all I need to setup to actually <em>kill</em> my other server (I’ve been moving from servers on these last 2-3 blog entries), that’s why I’m already doing this entry. I’m basically following <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server">git’s guide on setting up a server</a> plus some specific stuff for (btw i use) Arch Linux (<a href="https://wiki.archlinux.org/index.php/Git_server#Web_interfaces">Arch Linux Wiki: Git server</a> and <a href="https://miracoin.wordpress.com/2014/11/25/step-by-step-guide-on-setting-up-git-server-in-arch-linux-pushable/">Step by step guide on setting up git server in arch linux (pushable)</a>).</p> -<p>Note that this is mostly for personal use, so there’s no user/authentication control other than that of SSH. Also, most if not all commands here are run as root.</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> + <p>My git server is all I need to setup to actually <em>kill</em> my other server (I’ve been moving from servers on these last 2-3 blog entries), that’s why I’m already doing this entry. I’m basically following <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server">git’s guide on setting up a server</a> plus some specific stuff for <mark>btw i use</mark> Arch Linux (<a href="https://wiki.archlinux.org/index.php/Git_server#Web_interfaces">Arch Linux Wiki: Git server</a> and <a href="https://miracoin.wordpress.com/2014/11/25/step-by-step-guide-on-setting-up-git-server-in-arch-linux-pushable/">Step by step guide on setting up git server in arch linux (pushable)</a>).</p> +<p>Note that this is mostly for personal use, so there’s no user/authentication control other than that of normal <code>ssh</code>. And as with the other entries, most if not all commands here are run as root unless stated otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#git">Git</a></li> +<li><a href="#cgit">Cgit</a><ul> +<li><a href="#cgits-file-rendering">Cgit’s file rendering</a></li> +</ul> +</li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>I might get tired of saying this (it’s just copy paste, basically)… but you will need the same prerequisites as before (check my <a href="https://blog.luevano.xyz/a/website_with_nginx.html">website</a> and <a href="https://blog.luevano.xyz/a/mail_server_with_postfix.html">mail</a> entries), with the extras:</p> <ul> <li>(Optional, if you want a “front-end”) A <strong>CNAME</strong> for “git” and (optionally) “www.git”, or some other name for your sub-domains.</li> <li>An SSL certificate, if you’re following the other entries, add a <code>git.conf</code> and run <code>certbot --nginx</code> to extend the certificate.</li> </ul> -<h3 id="git">Git<a class="headerlink" href="#git" title="Permanent link">¶</a></h3> +<h2 id="git">Git<a class="headerlink" href="#git" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/git">Git</a> is a version control system.</p> <p>If not installed already, install the <code>git</code> package:</p> <pre><code class="language-sh">pacman -S git @@ -117,11 +141,11 @@ systemctl enable git-daemon.socket </code></pre> <p>You’re basically done. Now you should be able to push/pull repositories to your server… except, you haven’t created any repository in your server, that’s right, they’re not created automatically when trying to push. To do so, you have to run (while inside <code>/home/git</code>):</p> <pre><code class="language-sh">git init --bare {repo_name}.git -chown -R git:git repo_name.git +chown -R git:git {repo_name}.git </code></pre> -<p>Those two lines above will need to be run each time you want to add a new repository to your server (yeah, kinda lame… although there are options to “automate” this, I like it this way).</p> +<p><mark>Those two lines above will need to be run each time you want to add a new repository to your server</mark>. There are options to “automate” this but I like it this way.</p> <p>After that you can already push/pull to your repository. I have my repositories (locally) set up so I can push to more than one remote at the same time (my server, GitHub, GitLab, etc.); to do so, check <a href="https://gist.github.com/rvl/c3f156e117e22a25f242">this gist</a>.</p> -<h3 id="cgit">Cgit<a class="headerlink" href="#cgit" title="Permanent link">¶</a></h3> +<h2 id="cgit">Cgit<a class="headerlink" href="#cgit" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Cgit">Cgit</a> is a fast web interface for git.</p> <p>This is optionally since it’s only for the web application.</p> <p>Install the <code>cgit</code> and <code>fcgiwrap</code> packages:</p> @@ -162,10 +186,9 @@ repo.url={url} repo.path={dir_path} repo.owner={owner} repo.desc={short_description} - ... </code></pre> -<p>Where you can uncomment the <code>robots</code> line to let web crawlers (like Google’s) to index your <code>git</code> web app. And at the end keep all your repositories (the ones you want to make public), for example for my <a href="https://git.luevano.xyz/.dots"><em>dotfiles</em></a> I have:</p> +<p>Where you can uncomment the <code>robots</code> line to not let web crawlers (like Google’s) to index your <code>git</code> web app. And at the end keep all your repositories (the ones you want to make public), for example for my <a href="https://git.luevano.xyz/.dots"><em>dotfiles</em></a> I have:</p> <pre><code class="language-apache">... repo.url=.dots repo.path=/home/git/.dots.git @@ -174,6 +197,7 @@ repo.desc=These are my personal dotfiles. ... </code></pre> <p>Otherwise you could let <code>cgit</code> to automatically detect your repositories (you have to be careful if you want to keep “private” repos) using the option <code>scan-path</code> and setup <code>.git/description</code> for each repository. For more, you can check <a href="https://man.archlinux.org/man/cgitrc.5">cgitrc(5)</a>.</p> +<h3 id="cgits-file-rendering">Cgit’s file rendering<a class="headerlink" href="#cgits-file-rendering" title="Permanent link">¶</a></h3> <p>By default you can’t see the files on the site, you need a highlighter to render the files, I use <code>highlight</code>. Install the <code>highlight</code> package:</p> <pre><code class="language-sh">pacman -S highlight </code></pre> @@ -222,10 +246,10 @@ exec highlight --force --inline-css -f -I -O xhtml -S "$EXTENSION" 2&g <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, Mar 21, 2021 @ 19:00 UTC</p> - <p>Modified: Tue, Jun 08, 2021 @ 07:27 UTC</p> + <p>Modified: Fri, May 05, 2023 @ 08:35 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> +<a href="https://blog.luevano.xyz/tag/@code.html">code</a>, <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> </div> </div> diff --git a/live/blog/a/hoy_toco_desarrollo_personaje.html b/live/blog/a/hoy_toco_desarrollo_personaje.html index e67976a..e57dd46 100644 --- a/live/blog/a/hoy_toco_desarrollo_personaje.html +++ b/live/blog/a/hoy_toco_desarrollo_personaje.html @@ -16,13 +16,9 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> <!-- og meta --> <meta property="og:title" content="Hoy me tocó desarrollo de personaje -- Luevano's Blog"/> @@ -73,6 +69,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Hoy me tocó desarrollo de personaje</h1> <p>Sabía que hoy no iba a ser un día tan bueno, pero no sabía que iba a estar tan horrible; me tocó desarrollo de personaje y saqué el <em>bad ending</em>.</p> diff --git a/live/blog/a/mail_server_with_postfix.html b/live/blog/a/mail_server_with_postfix.html index c8acc43..95003e5 100644 --- a/live/blog/a/mail_server_with_postfix.html +++ b/live/blog/a/mail_server_with_postfix.html @@ -16,14 +16,21 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> + <!-- highlight support for code blocks --> <script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> <script type="text/javascript"> hljs.initHighlightingOnLoad(); </script> <link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + + + <!-- og meta --> <meta property="og:title" content="Create a mail server with Postfix, Dovecot, SpamAssassin and OpenDKIM -- Luevano's Blog"/> <meta property="og:type" content="article"/> @@ -73,18 +80,38 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Create a mail server with Postfix, Dovecot, SpamAssassin and OpenDKIM</h1> - <p>The entry is going to be long because it’s a <em>tedious</em> process. This is also based on <a href="https://github.com/LukeSmithxyz/emailwiz">Luke Smith’s script</a>, but adapted to Arch Linux (his script works on debian-based distributions). This entry is mostly so I can record all the notes required while I’m in the process of installing/configuring the mail server on a new VPS of mine; also I’m going to be writing a script that does everything in one go (for Arch Linux), that will be hosted <a href="https://git.luevano.xyz/server_scripts.git">here</a>.</p> -<p>This configuration works for local users (users that appear in <code>/etc/passwd</code>), and does not use any type of SQL Database. And note that most if not all commands executed here are run with root privileges.</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> + <p>The entry is going to be long because it’s a <em>tedious</em> process. This is also based on <a href="https://github.com/LukeSmithxyz/emailwiz">Luke Smith’s script</a>, but adapted to Arch Linux (his script works on debian-based distributions). This entry is mostly so I can record all the notes required while I’m in the process of installing/configuring the mail server on a new VPS of mine; <del>also I’m going to be writing a script that does everything in one go (for Arch Linux), that will be hosted <a href="https://git.luevano.xyz/server_scripts.git">here</a>.</del> <ins>I haven’t had time to do the script so nevermind this, if I ever do it I’ll make a new entry regarding it.</ins></p> +<p>This configuration works for local users (users that appear in <code>/etc/passwd</code>), and does not use any type of SQL database. And note that most if not all commands executed here are run with root privileges, unless stated otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#postfix">Postfix</a></li> +<li><a href="#dovecot">Dovecot</a></li> +<li><a href="#opendkim">OpenDKIM</a><ul> +<li><a href="#opendkim-dns-txt-records">OpenDKIM DNS TXT records</a></li> +</ul> +</li> +<li><a href="#spamassassin">SpamAssassin</a></li> +<li><a href="#wrapping-up">Wrapping up</a></li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>Basically the same as with the <a href="https://blog.luevano.xyz/a/website_with_nginx.html">website with Nginx and Certbot</a>, with the extras:</p> <ul> <li>You will need a <strong>CNAME</strong> for “mail” and (optionally) “www.mail”, or whatever you want to call the sub-domains (although the <a href="https://tools.ietf.org/html/rfc2181#section-10.3">RFC 2181</a> states that it NEEDS to be an <strong>A</strong> record, fuck the police).</li> <li>An SSL certificate. You can use the SSL certificate obtained following my last post using <code>certbot</code> (just create a <code>mail.conf</code> and run <code>certbot --nginx</code> again).</li> -<li>Ports 25, 587 (SMTP), 465 (SMTPS), 143 (IMAP) and 993 (IMAPS) open on the firewall.</li> +<li>Ports <code>25</code>, <code>587</code> (SMTP), <code>465</code> (SMTPS), <code>143</code> (IMAP) and <code>993</code> (IMAPS) open on the firewall (I use <code>ufw</code>).</li> </ul> -<h3 id="postfix">Postfix<a class="headerlink" href="#postfix" title="Permanent link">¶</a></h3> +<h2 id="postfix">Postfix<a class="headerlink" href="#postfix" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/postfix">Postfix</a> is a “mail transfer agent” which is the component of the mail server that receives and sends emails via SMTP.</p> <p>Install the <code>postfix</code> package:</p> <pre><code class="language-sh">pacman -S postfix @@ -121,7 +148,7 @@ smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous, noplaintext smtpd_sasl_tls_security_options = noanonymous </code></pre> -<p>Specify the mailbox home (this is going to be a directory inside your user’s home containing the actual mail files):</p> +<p>Specify the mailbox home, this is going to be a directory inside your user’s home containing the actual mail files, for example it will end up being<code>/home/david/Mail/Inbox</code>:</p> <pre><code class="language-apache">home_mailbox = Mail/Inbox/ </code></pre> <p>Pre-configuration to work seamlessly with <code>dovecot</code> and <code>opendkim</code>:</p> @@ -135,8 +162,7 @@ smtpd_milters = inet:127.0.0.1:8891 non_smtpd_milters = inet:127.0.0.1:8891 mailbox_command = /usr/lib/dovecot/deliver </code></pre> -<p>Where <code>{yourdomainname}</code> is <code>luevano.xyz</code> in my case, or if you have <code>localhost</code> configured to your domain, then use <code>localhost</code> for <code>myhostname</code> (<code>myhostname = localhost</code>).</p> -<p>Lastly, if you don’t want the sender’s IP and user agent (application used to send the mail), add the following line:</p> +<p>Where <code>{yourdomainname}</code> is <code>luevano.xyz</code> in my case. Lastly, if you don’t want the sender’s IP and user agent (application used to send the mail), add the following line:</p> <pre><code class="language-apache">smtp_header_checks = regexp:/etc/postfix/smtp_header_checks </code></pre> <p>And create the <code>/etc/postfix/smtp_header_checks</code> file with the following content:</p> @@ -173,7 +199,7 @@ newaliases <pre><code class="language-sh">systemctl start postfix.service systemctl enable postfix.service </code></pre> -<h3 id="dovecot">Dovecot<a class="headerlink" href="#dovecot" title="Permanent link">¶</a></h3> +<h2 id="dovecot">Dovecot<a class="headerlink" href="#dovecot" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Dovecot">Dovecot</a> is an IMAP and POP3 server, which is what lets an email application retrieve the mail.</p> <p>Install the <code>dovecot</code> and <code>pigeonhole</code> (sieve for <code>dovecot</code>) packages:</p> <pre><code class="language-sh">pacman -S dovecot pigeonhole @@ -288,8 +314,8 @@ account required pam_unix.so <pre><code class="language-sh">systemctl start dovecot.service systemctl enable dovecot.service </code></pre> -<h3 id="opendkim">OpenDKIM<a class="headerlink" href="#opendkim" title="Permanent link">¶</a></h3> -<p><a href="https://wiki.archlinux.org/title/OpenDKIM">OpenDKIM</a> is needed so services like G**gle (we don’t mention that name here [[[this is a meme]]]) don’t throw the mail to the trash. DKIM stands for “DomainKeys Identified Mail”.</p> +<h2 id="opendkim">OpenDKIM<a class="headerlink" href="#opendkim" title="Permanent link">¶</a></h2> +<p><a href="https://wiki.archlinux.org/title/OpenDKIM">OpenDKIM</a> is needed so services like G**gle don’t throw the mail to the trash. DKIM stands for “DomainKeys Identified Mail”.</p> <p>Install the <code>opendkim</code> package:</p> <pre><code class="language-sh">pacman -S opendkim </code></pre> @@ -338,7 +364,8 @@ chmod g+r /etc/postfix/dkim/* <pre><code class="language-sh">systemctl start opendkim.service systemctl enable opendkim.service </code></pre> -<p>And don’t forget to add the following <strong>TXT</strong> records on your domain registrar (these examples are for Epik):</p> +<h3 id="opendkim-dns-txt-records">OpenDKIM DNS TXT records<a class="headerlink" href="#opendkim-dns-txt-records" title="Permanent link">¶</a></h3> +<p>Add the following <strong>TXT</strong> records on your domain registrar (these examples are for Epik):</p> <ol> <li><em>DKIM</em> entry: look up your <code>{yoursubdomain}.txt</code> file, it should look something like:</li> </ol> @@ -346,7 +373,7 @@ systemctl enable opendkim.service "p=..." "..." ) ; ----- DKIM key mail for {yourdomain} </code></pre> -<p>In the TXT record you will place <code>{yoursubdomain}._domainkey</code> as the “Host” and <code>"v=DKIM1; k=rsa; s=email; " "p=..." "..."</code> in the “TXT Value” (replace the dots with the actual value you see in your file).</p> +<p>In the <strong>TXT</strong> record you will place <code>{yoursubdomain}._domainkey</code> as the “Host” and <code>"v=DKIM1; k=rsa; s=email; " "p=..." "..."</code> in the “TXT Value” (replace the dots with the actual value you see in your file).</p> <ol start="2"> <li> <p><em>DMARC</em> entry: just <code>_dmarc.{yourdomain}</code> as the “Host” and <code>"v=DMARC1; p=reject; rua=mailto:dmarc@{yourdomain}; fo=1"</code> as the “TXT Value”.</p> @@ -356,7 +383,7 @@ systemctl enable opendkim.service </li> </ol> <p>And at this point you could test your mail for spoofing and more.</p> -<h3 id="spamassassin">SpamAssassin<a class="headerlink" href="#spamassassin" title="Permanent link">¶</a></h3> +<h2 id="spamassassin">SpamAssassin<a class="headerlink" href="#spamassassin" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/SpamAssassin">SpamAssassin</a> is just <em>a mail filter to identify spam</em>.</p> <p>Install the <code>spamassassin</code> package (which will install a bunch of ugly <code>perl</code> packages…):</p> <pre><code class="language-sh">pacman -S spamassassin @@ -409,10 +436,10 @@ ExecStart=/usr/bin/vendor_perl/spamd -x -u spamd -g spamd --listen=/run/spamd/sp <pre><code class="language-sh">systemctl start spamassassin.service systemctl enable spamassassin.service </code></pre> -<h3 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h3> -<p>We should have a working mail server by now. Before continuing check your journal logs (<code>journalctl -xe --unit={unit}</code>, where <code>{unit}</code> could be <code>spamassassin.service</code> for example) to see if there was any error whatsoever and try to debug it, it should be a typo somewhere (the logs are generally really descriptive) because all the settings and steps detailed here just (literally just finished doing everything on a new server as of the writing of this text) worked <em>(((it just werks on my machine)))</em>.</p> +<h2 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h2> +<p>We should have a working mail server by now. Before continuing check your journal logs (<code>journalctl -xe --unit={unit}</code>, where <code>{unit}</code> could be <code>spamassassin.service</code> for example) to see if there was any error whatsoever and try to debug it, it should be a typo somewhere because all the settings and steps detailed here just worked; I literally just finished doing everything on a new server as of the writing of this text, <mark>it just werks on my machine</mark>.</p> <p>Now, to actually use the mail service: first of all, you need a <em>normal</em> account (don’t use root) that belongs to the <code>mail</code> group (<code>gpasswd -a user group</code> to add a user <code>user</code> to group <code>group</code>) and that has a password.</p> -<p>Next, to actually login into a mail app/program/whateveryouwanttocallit, you will use the following settings, at least for <code>thunderdbird</code>(I tested in windows default mail app and you don’t need a lot of settings):</p> +<p>Next, to actually login into a mail app/program, you will use the following settings, at least for <code>thunderdbird</code>(I tested in windows default mail app and you don’t need a lot of settings):</p> <ul> <li>* server: subdomain.domain (mail.luevano.xyz in my case)</li> <li><strong>SMTP</strong> port: 587</li> @@ -426,10 +453,9 @@ systemctl enable spamassassin.service </ul> <p>All that’s left to do is test your mail server for spoofing, and to see if everything is setup correctly. Go to <a href="https://www.appmaildev.com/en/dkim">DKIM Test</a> and follow the instructions (basically click next, and send an email with whatever content to the email that they provide). After you send the email, you should see something like:</p> <figure id="__yafg-figure-3"> -<img alt="DKIM Test successful" src="images/b/notes/mail/dkim_test_successful.png" title="DKIM Test successful"> +<img alt="DKIM Test successful" src="https://static.luevano.xyz/images/b/notes/mail/dkim_test_successful.png" title="DKIM Test successful"> <figcaption>DKIM Test successful</figcaption> </figure> -<p>Finally, that’s actually it for this entry, if you have any problem whatsoever you can <a href="https://luevano.xyz/contact.html">contact me</a>.</p> <div class="page-nav"> <span class="next"> @@ -459,10 +485,10 @@ systemctl enable spamassassin.service <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, Mar 21, 2021 @ 04:05 UTC</p> - <p>Modified: Tue, Jun 08, 2021 @ 07:29 UTC</p> + <p>Modified: Fri, May 05, 2023 @ 08:35 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> +<a href="https://blog.luevano.xyz/tag/@code.html">code</a>, <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> </div> </div> diff --git a/live/blog/a/new_blogging_system.html b/live/blog/a/new_blogging_system.html index 066f288..9a06766 100644 --- a/live/blog/a/new_blogging_system.html +++ b/live/blog/a/new_blogging_system.html @@ -16,13 +16,12 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + <!-- og meta --> <meta property="og:title" content="I'm using a new blogging system -- Luevano's Blog"/> @@ -73,14 +72,20 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>I'm using a new blogging system</h1> <p>So, I was tired of working with <code>ssg</code> (and then <code>sbg</code> which was a modified version of <code>ssg</code> that I “wrote”), for one general reason: not being able to extend it as I would like; and not just dumb little stuff, I wanted to be able to have more control, to add tags (which another tool that I found does: <code>blogit</code>), and even more in a future.</p> <p>The solution? Write a new program “from scratch” in <em>pYtHoN</em>. Yes it is bloated, yes it is in its early stages, but it works just as I want it to work, and I’m pretty happy so far with the results and have with even more ideas in mind to “optimize” and generally clean my wOrKfLoW to post new blog entries. I even thought of using it for posting into a “feed” like gallery for drawings or pictures in general.</p> <p>I called it <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a>, because it sounds nice and it wasn’t taken in the PyPi. It is just a terminal program that reads either a configuration file or the options passed as flags when calling the program.</p> <p>It still uses Markdown files because I find them very easy to work with. And instead of just having a “header” and a “footer” applied to each parsed entry, you will have templates (generated with the program) for each piece that I thought made sense (idea taken from <code>blogit</code>): the common header and footer, the common header and footer for each entry and, header, footer and list elements for articles and tags. When parsing the Markdown file these templates are applied and stitched together to make a single HTML file. Also generates an RSS feed and the <code>sitemap.xml</code> file, which is nice.</p> -<p>It might sound convoluted, but it works pretty well, with of course room to improve; I’m open to suggestions, issue reporting or direct contributions <a href="https://github.com/luevano/pyssg">here</a>. BTW, it only works on Linux for now (and don’t think on making it work on windows, but feel free to do PR for the compatibility).</p> +<p>It might sound convoluted, but it works pretty well, with of course room to improve; I’m open to suggestions, issue reporting or direct contributions <a href="https://github.com/luevano/pyssg">here</a>. For now, it is only tested on Linux (and don’t think on making it work on windows, but feel free to do PR for the compatibility).</p> <p>That’s it for now, the new RSS feed is available here: <a href="https://blog.luevano.xyz/rss.xml">https://blog.luevano.xyz/rss.xml</a>.</p> +<p><strong>Update</strong>: Since writing this entry, <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> has evolved quite a bit, so not everything described here is still true. For the latest updates check the newest entries or the git repository itself.</p> <div class="page-nav"> <span class="next"> @@ -110,7 +115,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Fri, May 28, 2021 @ 03:21 UTC</p> - <p>Modified: Fri, May 28, 2021 @ 03:42 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:18 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/password_manager_authenticator_setup.html b/live/blog/a/password_manager_authenticator_setup.html index afd0e45..fbc57d1 100644 --- a/live/blog/a/password_manager_authenticator_setup.html +++ b/live/blog/a/password_manager_authenticator_setup.html @@ -16,13 +16,11 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- og meta --> <meta property="og:title" content="My setup for a password manager and MFA authenticator -- Luevano's Blog"/> @@ -73,10 +71,15 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>My setup for a password manager and MFA authenticator</h1> <p><strong>Disclaimer</strong>: I won’t go into many technical details here of how to install/configure/use the software, this is just supposed to be a short description on my setup.</p> -<p>It’s been a while since I started using a password manager at all, and I’m happy that I started with <a href="https://keepassxc.org/">KeePassXC</a> (open source, multiplatform password manager that it’s completely offline) as a direct recommendation from <a href="https://www.lmcj.xyz/">lm</a>; before this I was using the same password for everything (like a lot of people), which is a well know privacy issue as noted in detail by <a href="https://askleo.com/different-passwords-for-everything/">Leo</a> (I don’t personally recommed LastPass as Leo does). Note that you will still need a <em>master password</em> to lock/unlock your password database (you can additionally use a hardware key and a key file).</p> +<p>It’s been a while since I started using a password manager at all, and I’m happy that I started with <a href="https://keepassxc.org/">KeePassXC</a> (open source, multiplatform password manager that it’s completely offline) as a direct recommendation from <a href="https://www.lmcj.xyz/"><mark>EL ELE EME</mark></a>; before this I was using the same password for everything (like a lot of people), which is a well know privacy issue as noted in detail by <a href="https://askleo.com/different-passwords-for-everything/">Leo</a> (I don’t personally recommed LastPass as Leo does). Note that you will still need a <em>master password</em> to lock/unlock your password database (you can additionally use a hardware key and a key file).</p> <p>Anyways, setting up <em>keepass</em> is pretty simple, as there is a client for almost any device; note that <em>keepass</em> is basically just the format and the base for all of the clients, as its common with pretty much any open source software. In my case I’m using <a href="https://keepassxc.org/">KeePassXC</a> in my computer and <a href="https://www.keepassdx.com/">KeePassDX</a> in my phone (Android). The only concern is keeping everything in sync because <em>keepass</em> doesn’t have any automatic method of synchronizing between devices because of security reasons (as far as I know), meaning that you have to manage that yourself.</p> <p>Usually you can use something like G**gl* drive, dropbox, mega, nextcloud, or any other cloud solution that you like to sync your <em>keepass</em> database between devices; I personally prefer to use <a href="https://syncthing.net/">Syncthing</a> as it’s open source, it’s really easy to setup and has worked wonders for me since I started using it, also it keeps versions of your files that can serve as backups in any scenario where the database gets corrupted or something.</p> <p>Finally, when I went through the issue with the micro SD and the <em>adoptable storage</em> bullshit (you can find the rant <a href="https://blog.luevano.xyz/a/devs_android_me_trozaron.html">here</a>, in spanish) I had to also migrate from <em>G**gl* authenticator</em> (<em>gauth</em>) to something else for the simple reason that <em>gauth</em> doesn’t even let you do backups, nor it’s synched with your account… nothing, it is just standalone and if you ever lose your phone you’re fucked; so I decided to go with <a href="https://getaegis.app/">Aegis authenticator</a>, as it is open source, you have control over all your secret keys, you can do backups directly to the filesystem, you can secure your database with an extra password, etc., etc.. In general <em>aegis</em> is the superior MFA authenticator (at least compared with <em>gauth</em>) and everything that’s compatible with <em>gauth</em> is compatible with <em>aegis</em> as the format is a standard (as a matter of fact, <em>keepass</em> also has this MFA feature which is called TOPT and is also compatible, but I prefer to have things separate). I also use <em>syncthing</em> to keep a backup of my <em>aegis</em> database.</p> @@ -116,7 +119,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, May 15, 2022 @ 22:40 UTC</p> - <p>Modified: Sun, May 22, 2022 @ 00:24 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 03:49 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a> </p> diff --git a/live/blog/a/rewrote_pyssg_again.html b/live/blog/a/rewrote_pyssg_again.html index 481cb45..a1443d9 100644 --- a/live/blog/a/rewrote_pyssg_again.html +++ b/live/blog/a/rewrote_pyssg_again.html @@ -16,13 +16,12 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + <!-- og meta --> <meta property="og:title" content="Rewrote pyssg again -- Luevano's Blog"/> @@ -73,9 +72,14 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Rewrote pyssg again</h1> - <p>I’ve been wanting to change the way <a href="https://github.com/luevano/pyssg">pyssg</a> reads config files and generates <code>HTML</code> files so that it is more flexible and I don’t need to have 2 separate build commands and configs (for <a href="https://blog.luevano.xyz">blog</a> and <a href="https://art.luevano.xyz">art</a>), and also to handle other types of “sites”; because <code>pyssg</code> was built with blogging in mind, so it was a bit limited to how it could be used. So I had to kind of <em>rewrite</em> <code>pyssg</code>, and with the latest version I can now generate the whole site and use the same templates for everything, quite neat for my use case.</p> + <p>I’ve been wanting to change the way <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> reads config files and generates <code>HTML</code> files so that it is more flexible and I don’t need to have 2 separate build commands and configs (for <a href="https://blog.luevano.xyz">blog</a> and <a href="https://art.luevano.xyz">art</a>), and also to handle other types of “sites”; because <code>pyssg</code> was built with blogging in mind, so it was a bit limited to how it could be used. So I had to kind of <em>rewrite</em> <code>pyssg</code>, and with the latest version I can now generate the whole site and use the same templates for everything, quite neat for my use case.</p> <p>Anyways, so I bought a new domain for all <code>pyssg</code> related stuff, mostly because I wanted somewhere to test live builds while developing, it is of course <a href="https://pyssg.xyz">pyssg.xyz</a>; as of now it is the same template, CSS and scripts that I use here, probably will change in the future. I’ll be testing new features and anything <code>pyssg</code> related stuff.</p> <p>I should start pointing all links to <code>pyssg</code> to the actual site instead of the github repository (or my <a href="https://git.luevano.xyz">git</a> repository), but I haven’t decided how to handle everything.</p> @@ -101,6 +105,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Tue, Dec 20, 2022 @ 04:31 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 03:57 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/tenia_esto_descuidado.html b/live/blog/a/tenia_esto_descuidado.html index 76fa1ed..b30a3b7 100644 --- a/live/blog/a/tenia_esto_descuidado.html +++ b/live/blog/a/tenia_esto_descuidado.html @@ -6,7 +6,7 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" href="https://static.luevano.xyz/images/icons/favicon.ico"> -<title>Tenia este pex algo descuidado -- Luevano's Blog</title> +<title>Tenía este pex algo descuidado -- Luevano's Blog</title> <meta name="description" content="Nada más un update en el estado del blog y lo que he andado haciendo."/> <link rel="alternate" type="application/rss+xml" href="https://blog.luevano.xyz/rss.xml" title="Luevano's Blog RSS"> <!-- general style --> @@ -16,16 +16,14 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- og meta --> - <meta property="og:title" content="Tenia este pex algo descuidado -- Luevano's Blog"/> + <meta property="og:title" content="Tenía este pex algo descuidado -- Luevano's Blog"/> <meta property="og:type" content="article"/> <meta property="og:url" content="https://blog.luevano.xyz/a/tenia_esto_descuidado.md"/> <meta property="og:image" content="https://static.luevano.xyz/images/b/default.png"/> @@ -73,13 +71,18 @@ </header> <main> - <h1>Tenia este pex algo descuidado</h1> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> + <h1>Tenía este pex algo descuidado</h1> <p>Así es, tenía un poco descuidado este pex, siendo la razón principal que andaba ocupado con cosas de <em>la vida profesional</em>, ayay. Pero ya que ando un poco más despejado y menos estresado voy a seguir usando el blog y a ver qué más hago.</p> -<p>Tengo unas entradas pendientes que quiero hacer del estilo de “tutorial” o “how-to”, pero me lo he estado debatiendo, porque Luke ya empezó a hacerlo más de verdad en <a href="https://landchad.net/">landchad.net</a>, lo cual recomiendo bastante pues igual yo empecé a hacer esto por él (y por <a href="https://lmcj.xyz/">lm</a>); aunque la verdad pues es muy específico a como él hace las cosas y quizá sí puede haber diferencias, pero ya veré en estos días. La próxima que quiero hacer es sobre el VPN, porque no lo he <em>setupeado</em> desde que reinicié El Página Web y La Servidor, entonces acomodaré el VPN de nuevo y de pasada tiro entrada de eso.</p> -<p>También dejé un dibujo pendiente, que la neta lo dejé por 2 cosas: está bien cabrón (porque también lo quiero colorear) y porque estaba ocupado; de lo cuál ya sólo queda el <em>está bien cabrón</em> pero no he tenido el valor de retomarlo. Lo triste es que ya pasó el tiempo del hype y ya no tengo mucha motivación para terminarlo más que el hecho de que cuando lo termine empezaré a usar Clip Studio Paint en vez de Krita, porque compré una licencia ahora que estuvo en 50% de descuento (sí, me mamé).</p> +<p>Tengo unas entradas pendientes que quiero hacer del estilo de “tutorial” o “how-to”, pero me lo he estado debatiendo, porque Luke ya empezó a hacerlo más de verdad en <a href="https://landchad.net/">landchad.net</a>, lo cual recomiendo bastante pues igual yo empecé a hacer esto por él (y por <a href="https://lmcj.xyz/"><mark>EL ELE EME</mark></a>); aunque la verdad pues es muy específico a como él hace las cosas y quizá sí puede haber diferencias, pero ya veré en estos días. La próxima que quiero hacer es sobre el VPN, porque no lo he <em>setupeado</em> desde que reinicié El Página Web y La Servidor, entonces acomodaré el VPN de nuevo y de pasada tiro entrada de eso.</p> +<p>También dejé un dibujo pendiente, que la neta lo dejé por 2 cosas: está bien cabrón (porque también lo quiero colorear) y porque estaba ocupado; de lo cuál ya sólo queda el <em>está bien cabrón</em> pero no he tenido el valor de retomarlo. Lo triste es que ya pasó el tiempo del hype y ya no tengo mucha motivación para terminarlo más que el hecho de que cuando lo termine empezaré a usar Clip Studio Paint en vez de Krita, porque compré una licencia ahora que estuvo en 50% de descuento.</p> <p>Algo bueno es que me he estado sintiendo muy bien conmigo mismo últimamente, aunque casi no hable de eso. Sí hay una razón en específico, pero es una razón algo tonta. Espero así siga.</p> -<p>Ah, y también quería acomodarme una sección de comentarios, pero como siempre, todas las opciones están bien <em>bloated</em>, entonces pues me voy a hacer una en corto seguramente en Python para <em>el back</em>, MySQL para la base de datos y Javascript para la conexión acá en <em>el front</em>, algo tranqui.</p> +<p><del>Ah, y también quería acomodarme una sección de comentarios, pero como siempre, todas las opciones están bien <em>bloated</em>, entonces pues me voy a hacer una en corto seguramente en Python para <em>el back</em>, MySQL para la base de datos y Javascript para la conexión acá en <em>el front</em>, algo tranqui.</del> <ins>Nel, siempre no ocupo esto, pa’ qué.</ins></p> <p>Sobres pues.</p> <div class="page-nav"> @@ -110,6 +113,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, Jul 18, 2021 @ 07:51 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:20 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@spanish.html">spanish</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/volviendo_a_usar_la_pagina.html b/live/blog/a/volviendo_a_usar_la_pagina.html index 8380991..59a898d 100644 --- a/live/blog/a/volviendo_a_usar_la_pagina.html +++ b/live/blog/a/volviendo_a_usar_la_pagina.html @@ -16,13 +16,11 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- og meta --> <meta property="og:title" content="Volviendo a usar la página -- Luevano's Blog"/> @@ -73,12 +71,17 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Volviendo a usar la página</h1> <p>Después de mucho tiempo de estar luchando con querer volver a usar este pex (maldita <em>d</em> word y demás), ya me volví a acomodar el setup para agregar nuevas entradas.</p> -<p>Entre las cosas que tuve que hacer fue actualizar el <a href="https://github.com/luevano/pyssg">pyssg</a> porque no lo podía usar de una como estaba; y de pasado le agregue una que otra feature nueva. Luego quiero agregarle más funcionalidad para poder <em>buildear</em> la página completa; por ahora se hace en segmentos: todo lo de <a href="https://luevano.xyz">luevano.xyz</a> está hecho manual, mientras que <a href="https://blog.luevano.xyz">blog</a> y <a href="https://art.luevano.xyz">art</a> usan <a href="https://github.com/luevano/pyssghttps://github.com/luevano/pyssg">pyssg</a>.</p> +<p>Entre las cosas que tuve que hacer fue actualizar el <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> porque no lo podía usar de una como estaba; y de pasado le agregue una que otra feature nueva. Luego quiero agregarle más funcionalidad para poder <em>buildear</em> la página completa; por ahora se hace en segmentos: todo lo de <a href="https://luevano.xyz">luevano.xyz</a> está hecho manual, mientras que <a href="https://blog.luevano.xyz">blog</a> y <a href="https://art.luevano.xyz">art</a> usan <a href="https://github.com/luevano/pyssg">pyssg</a>.</p> <p>Otra cosa es que quizá me devuelva a editar alguans entradas nada más para homogeneizar las entradas específicas a <em>Create a…</em> (tiene más sentido que sean <em>Setup x…</em> o algo similar).</p> -<p>En otras noticias, estoy muy agusto en el jale que tengo actualmente aunque lleve alrededor de 3 semanas de un infierno por problemas debidos a varias razones (del jale). Debo pensar en si debo omitir cosas personales o del trabajo aquí, ya que quién sabe quién se pueda llegar a topar con esto <em>*thinking emoji*</em>.</p> +<p>En otras noticias, estoy muy agusto en el jale que tengo actualmente aunque lleve alrededor de 3 semanas de un infierno en el jale. Debo pensar en si debo omitir cosas personales o del trabajo aquí, ya que quién sabe quién se pueda llegar a topar con esto <em>*thinking emoji*</em>.</p> <div class="page-nav"> <span class="next"> @@ -108,7 +111,7 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Thu, Apr 28, 2022 @ 03:21 UTC</p> - <p>Modified: Thu, Apr 28, 2022 @ 03:28 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:23 UTC</p> <div class="article-tags"> <p>Tags: <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@spanish.html">spanish</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> diff --git a/live/blog/a/vpn_server_with_openvpn.html b/live/blog/a/vpn_server_with_openvpn.html index de80c45..6109f37 100644 --- a/live/blog/a/vpn_server_with_openvpn.html +++ b/live/blog/a/vpn_server_with_openvpn.html @@ -16,14 +16,21 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> + <!-- highlight support for code blocks --> <script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> <script type="text/javascript"> hljs.initHighlightingOnLoad(); </script> <link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + + + <!-- og meta --> <meta property="og:title" content="Create a VPN server with OpenVPN (IPv4) -- Luevano's Blog"/> <meta property="og:type" content="article"/> @@ -73,18 +80,36 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Create a VPN server with OpenVPN (IPv4)</h1> <p>I’ve been wanting to do this entry, but had no time to do it since I also have to set up the VPN service as well to make sure what I’m writing makes sense, today is the day.</p> <p>Like with any other of my entries I based my setup on the <a href="https://wiki.archlinux.org/title/OpenVPN">Arch Wiki</a>, <a href="https://github.com/Nyr/openvpn-install">this install script</a> and <a href="https://github.com/graysky2/ovpngen">this profile generator script</a>.</p> -<p>This will be installed and working alongside the other stuff I’ve wrote about on other posts (see the <a href="https://blog.luevano.xyz/tag/@server.html">server</a> tag). All commands here are executes as root unless specified otherwise. Also, this is intended only for IPv4 (it’s not that hard to include IPv6, but meh).</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> +<p>This will be installed and working alongside the other stuff I’ve wrote about on other posts (see the <a href="https://blog.luevano.xyz/tag/@server.html">server</a> tag). All commands here are executes as root unless specified otherwise. Also, this is intended only for IPv4 (it’s not that hard to include IPv6, but meh). As always, all commands are executed as root unless stated otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#create-pki-from-scratch">Create PKI from scratch</a></li> +<li><a href="#openvpn">OpenVPN</a><ul> +<li><a href="#enable-forwarding">Enable forwarding</a></li> +<li><a href="#create-client-configurations">Create client configurations</a></li> +</ul> +</li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>Pretty simple:</p> <ul> -<li>Working server with root access, and with Ufw as the firewall.</li> -<li>Depending on what port you want to run the VPN on, the default <code>1194</code>, or as a fallback on <code>443</code> (click <a href="https://openvpn.net/vpn-server-resources/advanced-option-settings-on-the-command-line/">here</a> for more). I will do mine on port <code>1194</code> but it’s just a matter of changing 2 lines of configuration and one Ufw rule.</li> +<li>Working server with root access, and with <code>ufw</code> as the firewall.</li> +<li>Depending on what port you want to run the VPN on, the default <code>1194</code>, or as a fallback on <code>443</code> (click <a href="https://openvpn.net/vpn-server-resources/advanced-option-settings-on-the-command-line/">here</a> for more). I will do mine on port <code>1194</code> but it’s just a matter of changing 2 lines of configuration and one <code>ufw</code> rule.</li> </ul> -<h3 id="create-pki-from-scratch">Create PKI from scratch<a class="headerlink" href="#create-pki-from-scratch" title="Permanent link">¶</a></h3> +<h2 id="create-pki-from-scratch">Create PKI from scratch<a class="headerlink" href="#create-pki-from-scratch" title="Permanent link">¶</a></h2> <p>PKI stands for <em>Public Key Infrastructure</em> and basically it’s required for certificates, private keys and more. This is supposed to work between two servers and one client: a server in charge of creating, signing and verifying the certificates, a server with the OpenVPN service running and the client making the request.</p> <p>This is supposed to work something like: 1) a client wants to use the VPN service, so it creates a requests and sends it to the signing server, 2) this server checks the requests and signs the request, returning the certificates to both the VPN service and the client and 3) the client can now connect to the VPN service using the signed certificate which the OpenVPN server knows about. In a nutshell, I’m no expert.</p> <p>… but, to be honest, all of this is a hassle and (in my case) I want something simple to use and manage. So I’m gonna do all on one server and then just give away the configuration file for the clients, effectively generating files that anyone can run and will work, meaning that you need to be careful who you give this files (it also comes with a revoking mechanism, so no worries).</p> @@ -128,8 +153,8 @@ openssl dhparam -out dh.pem 2048 openvpn --genkey secret ta.key </code></pre> <p>That’s it for the PKI stuff and general certificate configuration.</p> -<h3 id="openvpn">OpenVPN<a class="headerlink" href="#openvpn" title="Permanent link">¶</a></h3> -<p><a href="https://wiki.archlinux.org/title/OpenVPN">OpenVPN</a> is a robust and highly flexible VPN daemon, that’s pretty complete feature wise.</p> +<h2 id="openvpn">OpenVPN<a class="headerlink" href="#openvpn" title="Permanent link">¶</a></h2> +<p><a href="https://wiki.archlinux.org/title/OpenVPN">OpenVPN</a> is a robust and highly flexible VPN daemon, that’s pretty complete feature-wise.</p> <p>Install the <code>openvpn</code> package:</p> <pre><code class="language-sh">pacman -S openvpn </code></pre> @@ -231,6 +256,7 @@ verb 3 explicit-exit-notify 1 </code></pre> <p><code>#</code> and <code>;</code> are comments. Read each and every line, you might want to change some stuff (like the logging), specially the first line which is your server public IP.</p> +<h4 id="enable-forwarding">Enable forwarding<a class="headerlink" href="#enable-forwarding" title="Permanent link">¶</a></h4> <p>Now, we need to enable <em>packet forwarding</em> (so we can access the web while connected to the VPN), which can be enabled on the interface level or globally (you can check the different options with <code>sysctl -a | grep forward</code>). I’ll do it globally, run:</p> <pre><code class="language-sh">sysctl net.ipv4.ip_forward=1 </code></pre> @@ -276,7 +302,7 @@ ufw reload systemctl enable openvpn-server@server.service </code></pre> <p>Where the <code>server</code> after <code>@</code> is the name of your configuration, <code>server.conf</code> without the <code>.conf</code> in my case.</p> -<h4 id="create-client-configurations">Create client configurations<a class="headerlink" href="#create-client-configurations" title="Permanent link">¶</a></h4> +<h3 id="create-client-configurations">Create client configurations<a class="headerlink" href="#create-client-configurations" title="Permanent link">¶</a></h3> <p>You might notice that I didn’t specify how to actually connect to our server. For that we need to do a few more steps. We actually need a configuration file similar to the <code>server.conf</code> file that we created.</p> <p>The real way of doing this would be to run similar steps as the ones with <code>easy-rsa</code> locally, send them to the server, sign them, and retrieve them. Nah, we’ll just create all configuration files on the server as I was mentioning earlier.</p> <p>Also, the client configuration file has to match the server one (to some degree), to make this easier you can create a <code>client-common</code> file in <code>/etc/openvpn/server</code> with the following content:</p> @@ -349,7 +375,7 @@ chown nobody:nobody pki/crl.pem chmod o+r pki/crl.pem cd $CPWD </code></pre> -<p>And the way to use is to run <code>vpn_script new/rev client_name</code> as sudo (when revoking, it doesn’t actually deletes the <code>.ovpn</code> file in <code>~/ovpn</code>). Again, this is a little script that I put together, so you should check it out, it may need tweaks (depending on your directory structure for <code>easy-rsa</code>) and it could have errors.</p> +<p>And the way to use is to run <code>vpn_script new/rev client_name</code> as sudo (when revoking, it doesn’t actually delete the <code>.ovpn</code> file in <code>~/ovpn</code>). Again, this is a little script that I put together, so you should check it out, it may need tweaks (depending on your directory structure for <code>easy-rsa</code>).</p> <p>Now, just get the <code>.ovpn</code> file generated, import it to OpenVPN in your client of preference and you should have a working VPN service.</p> <div class="page-nav"> @@ -380,10 +406,10 @@ cd $CPWD <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, Aug 01, 2021 @ 09:27 UTC</p> - <p>Modified: Sun, Aug 01, 2021 @ 10:13 UTC</p> + <p>Modified: Fri, May 05, 2023 @ 08:36 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> +<a href="https://blog.luevano.xyz/tag/@code.html">code</a>, <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> </div> </div> diff --git a/live/blog/a/website_with_nginx.html b/live/blog/a/website_with_nginx.html index 386b95d..6070c82 100644 --- a/live/blog/a/website_with_nginx.html +++ b/live/blog/a/website_with_nginx.html @@ -16,14 +16,21 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> + <!-- highlight support for code blocks --> <script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> <script type="text/javascript"> hljs.initHighlightingOnLoad(); </script> <link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + + + <!-- og meta --> <meta property="og:title" content="Create a website with Nginx and Certbot -- Luevano's Blog"/> <meta property="og:type" content="article"/> @@ -73,25 +80,39 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Create a website with Nginx and Certbot</h1> <p>These are general notes on how to setup a Nginx web server plus Certbot for SSL certificates, initially learned from <a href="https://www.youtube.com/watch?v=OWAqilIVNgE">Luke’s video</a> and after some use and research I added more stuff to the mix. And, actually at the time of writing this entry, I’m configuring the web server again on a new VPS instance, so this is going to be fresh.</p> -<p>As a side note, (((i use arch btw))) so everything here es aimed at an Arch Linux distro, and I’m doing everything on a VPS. Also note that most if not all commands here are executed with root privileges.</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> +<p>As a side note, <mark>i use arch btw</mark> so everything here es aimed at an Arch Linux distro, and I’m doing everything on a VPS. Also note that most if not all commands here are executed with root privileges.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#nginx">Nginx</a></li> +<li><a href="#certbot">Certbot</a></li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>You will need two things:</p> <ul> <li>A domain name (duh!). I got mine on <a href="https://www.epik.com/?affid=da5ne9ru4">Epik</a> (affiliate link, btw).<ul> -<li>With the corresponding <strong>A</strong> and <strong>AAA</strong> records pointing to the VPS’ IPs (“A” record points to the ipv4 address and “AAA” to the ipv6, basically). I have three records for each type: empty one, “www” and “*” for a wildcard, that way “domain.name”, “www.domain.name”, “anythingelse.domain.name” point to the same VPS (meaning that you can have several VPS for different sub-domains).</li> +<li>With the corresponding <strong>A</strong> and <strong>AAA</strong> records pointing to the VPS’ IPs. I have three records for each type: empty string, “www” and “*” for a wildcard, that way “domain.name”, “www.domain.name”, “anythingelse.domain.name” point to the same VPS (meaning that you can have several VPS for different sub-domains). These depend on the VPS provider.</li> </ul> </li> -<li>A VPS or somewhere else to host it. I’m using <a href="https://www.vultr.com/?ref=8732849">Vultr</a> (also an affiliate link).<ul> +<li>A VPS or somewhere else to host it. I’m using <a href="https://www.vultr.com/?ref=8732849">Vultr</a> (also an affiliate link, btw).<ul> <li>With <code>ssh</code> already configured both on the local machine and on the remote machine.</li> -<li>Firewall already configured to allow ports 80 (HTTP) and 443 (HTTPS). I use <code>ufw</code> so it’s just a matter of doing <code>ufw allow 80,443/tcp</code> as root and you’re golden.</li> -<li><code>cron</code> installed if you follow along (you could use <code>systemd</code> timers, or some other method you prefer to automate running commands every X time).</li> +<li>Firewall already configured to allow ports <code>80</code> (HTTP) and <code>443</code> (HTTPS). I use <code>ufw</code> so it’s just a matter of doing <code>ufw allow 80,443/tcp</code> (for example) as root and you’re golden.</li> +<li><code>cron</code> installed if you follow along (you could use <code>systemd</code> timers, or some other method you prefer to automate running commands every certain time).</li> </ul> </li> </ul> -<h3 id="nginx">Nginx<a class="headerlink" href="#nginx" title="Permanent link">¶</a></h3> +<h2 id="nginx">Nginx<a class="headerlink" href="#nginx" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Nginx">Nginx</a> is a web (HTTP) server and reverse proxy server.</p> <p>You have two options: <code>nginx</code> and <code>nginx-mainline</code>. I prefer <code>nginx-mainline</code> because it’s the “up to date” package even though <code>nginx</code> is labeled to be the “stable” version. Install the package and enable/start the service:</p> <pre><code class="language-sh">pacman -S nginx-mainline @@ -100,7 +121,7 @@ systemctl start nginx.service </code></pre> <p>And that’s it, at this point you can already look at the default initial page of Nginx if you enter the IP of your server in a web browser. You should see something like this:</p> <figure id="__yafg-figure-1"> -<img alt="Nginx welcome page" src="images/b/notes/nginx/nginx_welcome_page.png" title="Nginx welcome page"> +<img alt="Nginx welcome page" src="https://static.luevano.xyz/images/b/notes/nginx/nginx_welcome_page.png" title="Nginx welcome page"> <figcaption>Nginx welcome page</figcaption> </figure> <p>As stated in the welcome page, configuration is needed, head to the directory of Nginx:</p> @@ -167,7 +188,7 @@ systemctl restart nginx </code></pre> <p>If everything goes correctly, you can now go to your website by typing <code>domain.name</code> on a web browser. But you will see a “404 Not Found” page like the following (maybe with different Nginx version):</p> <figure id="__yafg-figure-2"> -<img alt="Nginx 404 Not Found page" src="images/b/notes/nginx/nginx_404_page.png" title="Nginx 404 Not Found page"> +<img alt="Nginx 404 Not Found page" src="https://static.luevano.xyz/images/b/notes/nginx/nginx_404_page.png" title="Nginx 404 Not Found page"> <figcaption>Nginx 404 Not Found page</figcaption> </figure> <p>That’s no problem, because it means that the web server it’s actually working. Just add an <code>index.html</code> file with something simple to see it in action (in the <code>/var/www/some_folder</code> that you decided upon). If you keep seeing the 404 page make sure your <code>root</code> line is correct and that the directory/index file exists.</p> @@ -180,7 +201,7 @@ systemctl restart nginx try_files $uri/index.html $uri.html $uri/ $uri =404; ... </code></pre> -<h3 id="certbot">Certbot<a class="headerlink" href="#certbot" title="Permanent link">¶</a></h3> +<h2 id="certbot">Certbot<a class="headerlink" href="#certbot" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Certbot">Certbot</a> is what provides the SSL certificates via <a href="https://letsencrypt.org/">Let’s Encrypt</a>.</p> <p>The only “bad” (bloated) thing about Certbot, is that it uses <code>python</code>, but for me it doesn’t matter too much. You may want to look up another alternative if you prefer. Install the packages <code>certbot</code> and <code>certbot-nginx</code>:</p> <pre><code class="language-sh">pacman -S certbot certbot-nginx @@ -192,7 +213,7 @@ systemctl restart nginx <p>Now, the certificate given by <code>certbot</code> expires every 3 months or something like that, so you want to renew this certificate every once in a while. Using <code>cron</code>, you can do this by running:</p> <pre><code class="language-sh">crontab -e </code></pre> -<p>And a file will be opened where you need to add a new rule for Certbot, just append the line: <code>1 1 1 * * certbot renew</code> (renew on the first day of every month) and you’re good. Alternatively use <code>systemd</code> timers as stated in the <a href="https://wiki.archlinux.org/title/Certbot#Automatic_renewal">Arch Linux Wiki</a>.</p> +<p>And a file will be opened where you need to add a new rule for Certbot, just append the line: <code>1 1 1 * * certbot renew --quiet --agree-tos --deploy-hook "systemctl reload nginx.service"</code> (renew on the first day of every month) and you’re good. Alternatively use <code>systemd</code> timers as stated in the <a href="https://wiki.archlinux.org/title/Certbot#Automatic_renewal">Arch Linux Wiki</a>.</p> <p>That’s it, you now have a website with SSL certificate.</p> <div class="page-nav"> @@ -223,10 +244,10 @@ systemctl restart nginx <div class="article-info"> <p>By David Luévano</p> <p>Created: Fri, Mar 19, 2021 @ 02:58 UTC</p> - <p>Modified: Tue, Jun 08, 2021 @ 07:27 UTC</p> + <p>Modified: Fri, May 05, 2023 @ 08:34 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> +<a href="https://blog.luevano.xyz/tag/@code.html">code</a>, <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> </div> </div> diff --git a/live/blog/a/xmpp_server_with_prosody.html b/live/blog/a/xmpp_server_with_prosody.html index 20418ca..9a83ac4 100644 --- a/live/blog/a/xmpp_server_with_prosody.html +++ b/live/blog/a/xmpp_server_with_prosody.html @@ -16,14 +16,21 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> + <!-- highlight support for code blocks --> <script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> <script type="text/javascript"> hljs.initHighlightingOnLoad(); </script> <link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + + + <!-- og meta --> <meta property="og:title" content="Create an XMPP server with Prosody compatible with Conversations and Movim -- Luevano's Blog"/> <meta property="og:type" content="article"/> @@ -73,12 +80,29 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Create an XMPP server with Prosody compatible with Conversations and Movim</h1> - <p>Recently I set up an XMPP server (and a Matrix one, too) for my personal use and for friends if they want one; made one for <mark><a href="https://lmcj.xyz">EL ELE EME</a></mark> for example. So, here are the notes on how I set up the server that is compatible with the <a href="https://conversations.im/">Conversations</a> app and the <a href="https://movim.eu/">Movim</a> social network. You can see my addresses in <a href="https://luevano.xyz/contact.html">contact</a> and the XMPP compliance/score of the server.</p> -<p>One of the best resources I found that helped me a lot was <a href="https://community.hetzner.com/tutorials/prosody-debian9">Installing and Configuring Prosody XMPP Server on Debian 9</a>, and of course the <a href="https://wiki.archlinux.org/title/Prosody">Arch Wiki</a> and the <a href="https://prosody.im/">oficial documentation</a>.</p> -<p>As with my other entries, this is under a server running Arch Linux, with the Nginx web server and Certbot certificates. And all commands here are executed as root (unless specified otherwise)</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> + <p><strong>Update</strong>: I no longer host this XMPP server as it consumed a lot of resources and I wasn’t using it that much. I’ll probably re-create it in the future, though.</p> +<p>Recently I set up an <a href="https://xmpp.org/">XMPP</a> server (and a Matrix one, too) for my personal use and for friends if they want one; made one for <a href="https://lmcj.xyz"><mark>EL ELE EME</mark></a> for example. So, here are the notes on how I set up the server that is compatible with the <a href="https://conversations.im/">Conversations</a> app and the <a href="https://movim.eu/">Movim</a> social network. You can see my addresses at <a href="https://luevano.xyz/contact.html">contact</a> and the XMPP compliance/score of the server.</p> +<p>One of the best resources I found that helped me a lot was <a href="https://community.hetzner.com/tutorials/prosody-debian9">Installing and Configuring Prosody XMPP Server on Debian 9</a>, the <a href="https://wiki.archlinux.org/title/Prosody">Arch Wiki</a> and the <a href="https://prosody.im/">oficial documentation</a>.</p> +<p>As with my other entries, this is under a server running Arch Linux, with the Nginx web server and Certbot certificates. And all commands here are executed as root, unless specified otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#prosody">Prosody</a></li> +<li><a href="#nginx-configuration-file">Nginx configuration file</a></li> +<li><a href="#coturn">Coturn</a></li> +<li><a href="#wrapping-up">Wrapping up</a></li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>Same as with my other entries (<a href="https://luevano.xyz/a/website_with_nginx.html">website</a>, <a href="https://blog.luevano.xyz/a/mail_server_with_postfix.html">mail</a> and <a href="https://blog.luevano.xyz/a/git_server_with_cgit.html">git</a>) plus:</p> <ul> <li><strong>A</strong> and (optionally) <strong>AAA</strong> DNS records for:<ul> @@ -90,16 +114,16 @@ </ul> </li> <li>(Optionally, but recommended) the following <strong>SRV</strong> DNS records; make sure it is pointing to an <strong>A</strong> or <strong>AAA</strong> record (matching the records from the last point, for example):<ul> -<li><code>_xmpp-client._tcp.**your.domain**.</code> for port <code>5222</code> pointing to <code>xmpp.**your.domain**.</code></li> -<li><code>_xmpp-server._tcp.**your.domain**.</code> for port <code>5269</code> pointing to <code>xmpp.**your.domain**.</code></li> -<li><code>_xmpp-server._tcp.muc.**your.domain**.</code> for port <code>5269</code> pointing to <code>xmpp.**your.domain**.</code></li> +<li><code>_xmpp-client._tcp.{your.domain}.</code> for port <code>5222</code> pointing to <code>xmpp.{your.domain}.</code></li> +<li><code>_xmpp-server._tcp.{your.domain}.</code> for port <code>5269</code> pointing to <code>xmpp.{your.domain}.</code></li> +<li><code>_xmpp-server._tcp.muc.{your.domain}.</code> for port <code>5269</code> pointing to <code>xmpp.{your.domain}.</code></li> </ul> </li> <li>SSL certificates for the previous subdomains; similar that with my other entries just create the appropriate <code>prosody.conf</code> (where <code>server_name</code> will be all the subdomains defined above) file and run <code>certbot --nginx</code>. You can find the example configuration file almost at the end of this entry.</li> <li>Email addresses for <code>admin</code>, <code>abuse</code>, <code>contact</code>, <code>security</code>, etc. Or use your own email for all of them, doesn’t really matter much as long as you define them in the configuration and are valid, I have aliases so those emails are forwarded to me.</li> <li>Allow ports <code>5000</code>, <code>5222</code>, <code>5269</code>, <code>5280</code> and <code>5281</code> for <a href="https://prosody.im/doc/ports">Prosody</a> and, <code>3478</code> and <code>5349</code> for <a href="https://webrtc.org/getting-started/turn-server">Turnserver</a> which are the defaults for <code>coturn</code>.</li> </ul> -<h3 id="prosody">Prosody<a class="headerlink" href="#prosody" title="Permanent link">¶</a></h3> +<h2 id="prosody">Prosody<a class="headerlink" href="#prosody" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Prosody">Prosody</a> is an implementation of the XMPP protocol that is flexible and extensible.</p> <p>Install the <code>prosody</code> package (with optional dependencies) and the <code>mercurial</code> package:</p> <pre><code class="language-sh">pacman -S prosody, mercurial, lua52-sec, lua52-dbi, lua52-zlib @@ -111,11 +135,11 @@ mkdir modules-enabled </code></pre> <p>You can see that I follow a similar approach that I used with Nginx and the server configuration, where I have all the modules available in a directory, and make a symlink to another to keep track of what is being used. You can update the repository by running <code>hg pull --update</code> while inside the <code>modules-available</code> directory (similar to Git).</p> <p>Make symbolic links to the following modules:</p> -<pre><code>ln -s /var/lib/prosody/modules-available/MODULE_NAME /var/lib/prosody/modules-enabled/ +<pre><code>ln -s /var/lib/prosody/modules-available/{module_name} /var/lib/prosody/modules-enabled/ ... </code></pre> <ul> -<li>Modules:<ul> +<li>Modules (<code>{module_name}</code>):<ul> <li><code>mod_bookmarks</code></li> <li><code>mod_cache_c2s_caps</code></li> <li><code>mod_checkcerts</code></li> @@ -443,8 +467,8 @@ ln -s your.domain.key SUBDOMAIN.your.domain.key ... </code></pre> <p>That’s basically all the configuration that needs Prosody itself, but we still have to configure Nginx and Coturn before starting/enabling the <code>prosody</code> service.</p> -<h3 id="nginx-configuration-file">Nginx configuration file<a class="headerlink" href="#nginx-configuration-file" title="Permanent link">¶</a></h3> -<p>Since this is not an ordinary configuration file I’m going to describe this too. Your <code>prosody.conf</code> file should have the following location blocks under the main server block (the one that listens to HTTPS):</p> +<h2 id="nginx-configuration-file">Nginx configuration file<a class="headerlink" href="#nginx-configuration-file" title="Permanent link">¶</a></h2> +<p>Since this is not an ordinary configuration file I’m going to describe this, too. Your <code>prosody.conf</code> file should have the following location blocks under the main server block (the one that listens to HTTPS):</p> <pre><code class="language-nginx"># HTTPS server block server { root /var/www/prosody/; @@ -537,11 +561,11 @@ server { ] } </code></pre> -<p>Remember to have your <code>prosody.conf</code> file symlinked (or discoverable by Nginx) to the <code>sites-enabled</code> directory. You can now restart your <code>nginx</code> service (and test the configuration, optionally):</p> +<p>Remember to have your <code>prosody.conf</code> file symlinked (or discoverable by Nginx) to the <code>sites-enabled</code> directory. You can now test and restart your <code>nginx</code> service (and test the configuration, optionally):</p> <pre><code class="language-sh">nginx -t systemctl restart nginx.service </code></pre> -<h3 id="coturn">Coturn<a class="headerlink" href="#coturn" title="Permanent link">¶</a></h3> +<h2 id="coturn">Coturn<a class="headerlink" href="#coturn" title="Permanent link">¶</a></h2> <p><a href="https://github.com/coturn/coturn">Coturn</a> is the implementation of TURN and STUN server, which in general is for (at least in the XMPP world) voice support and external service discovery.</p> <p>Install the <code>coturn</code> package:</p> <pre><code class="language-sh">pacman -S coturn @@ -557,7 +581,7 @@ static-auth-secret=YOUR SUPER SECRET TURN PASSWORD systemctl enable turnserver.service </code></pre> <p>You can test if your TURN server works at <a href="https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/">Trickle ICE</a>. You may need to add a user in the <code>turnserver.conf</code> to test this.</p> -<h3 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h3> +<h2 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h2> <p>At this point you should have a working XMPP server, start/enable the <code>prosody</code> service now:</p> <pre><code class="language-sh">systemctl start prosody.service systemctl enable prosody.service @@ -570,7 +594,7 @@ systemctl enable prosody.service <p>Additionally, you can test the security of your server in <a href="https://xmpp.net/index.php">IM Observatory</a>, here you only need to specify your <code>domain.name</code> (not <code>xmpp.domain.name</code>, if you set up the <strong>SRV</strong> DNS records correctly). Again, it should have a similar score to mine:</p> <p><a href='https://xmpp.net/result.php?domain=luevano.xyz&type=client'><img src='https://xmpp.net/badge.php?domain=luevano.xyz' alt='xmpp.net score' /></a></p> <p>You can now log in into your XMPP client of choice, if it asks for the server it should be <code>xmpp.your.domain</code> (or <code>your.domain</code> for some clients) and your login credentials <code>you@your.domain</code> and the password you chose (which you can change in most clients).</p> -<p>That’s it, send me a message <a href="xmpp:david@luevano.xyz">david@luevano.xyz</a> if you were able to set up the server successfully.</p> +<p>That’s it, send me a message at <a href="xmpp:david@luevano.xyz">david@luevano.xyz</a> if you were able to set up the server successfully.</p> <div class="page-nav"> <span class="next"> @@ -600,10 +624,10 @@ systemctl enable prosody.service <div class="article-info"> <p>By David Luévano</p> <p>Created: Wed, Jun 09, 2021 @ 05:24 UTC</p> - <p>Modified: Tue, Dec 20, 2022 @ 04:33 UTC</p> + <p>Modified: Fri, May 05, 2023 @ 08:36 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> +<a href="https://blog.luevano.xyz/tag/@code.html">code</a>, <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a> </p> </div> </div> diff --git a/live/blog/g/flappybird_godot_devlog_1.html b/live/blog/g/flappybird_godot_devlog_1.html index 6f37a66..0162350 100644 --- a/live/blog/g/flappybird_godot_devlog_1.html +++ b/live/blog/g/flappybird_godot_devlog_1.html @@ -16,14 +16,22 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> + + + <!-- highlight support for code blocks --> <script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> <script type="text/javascript"> hljs.initHighlightingOnLoad(); </script> <link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- Specific to GDScript --> + <script type="text/javascript" src="https://static.luevano.xyz/hl/languages/gdscript.min.js"></script> + <!-- og meta --> <meta property="og:title" content="Creating a FlappyBird clone in Godot 3.5 devlog 1 -- Luevano's Blog"/> <meta property="og:type" content="article"/> @@ -73,9 +81,14 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Creating a FlappyBird clone in Godot 3.5 devlog 1</h1> - <p>I just have a bit of experience with Godot and with gamedev in general, so I started with this game as it is pretty straight forward. On a high level the main characteristics of the game are:</p> + <p>I just have a bit of experience with <em>Godot</em> and with gamedev in general, so I started with this game as it is pretty straight forward. On a high level the main characteristics of the game are:</p> <ul> <li>Literally just one sprite going up and down.</li> <li>Constant horizontal move of the world/player.</li> @@ -85,189 +98,246 @@ <p>The game was originally developed with <em>Godot 4.0 alpha 8</em>, but it didn’t support HTML5 (webassembly) export… so I backported to <em>Godot 3.5 rc1</em>.</p> <p>Not going to specify all the details, only the needed parts and what could be confusing, as the source code is available and can be inspected; also this assumes minimal knowledge of <em>Godot</em> in general. Usually when I mention that a set/change of something it usually it’s a property and it can be found under the <em>Inspector</em> on the relevant node, unless stated otherwise; also, all scripts attached have the same name as the scenes, but in <em>snake_case</em> (scenes/nodes in <em>PascalCase</em>).</p> <p>One thing to note, is that I started writing this when I finished the game, so it’s hard to go part by part, and it will be hard to test individual parts when going through this as everything is depending on each other. For the next devlog, I’ll do it as I go and it will include all the changes to the nodes/scripts as I was finding them, probably better idea and easier to follow.</p> -<p>The source code can be found in my GitHub <a href="https://github.com/luevano/flappybird_godot">here</a>, it also contains the exported versions for HTML5, Windows and Linux (be aware that the sound might be too high and I’m too lazy to make it configurable, it was the last thing I added), or you could also go to the itch.io page I setup where it’s playable in the browser:</p> -<p style="text-align:center"><iframe src="https://itch.io/embed/1551015?dark=true" width="552" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/flappybirdgodot">FlappyBirdGodot by Lorentzeus</a></iframe></p> +<p>The source code can be found in my GitHub <a href="https://github.com/luevano/flappybird_godot">here</a>, it also contains the exported versions for HTML5, Windows and Linux (be aware that the sound might be too high and I’m too lazy to make it configurable, it was the last thing I added), or you could also go to the <a href="https://lorentzeus.itch.io/flappybirdgodot">itch.io</a> page I setup where it’s playable in the browser:</p> +<p style="text-align:center"><iframe src="https://itch.io/embed/1551015?dark=true" width="208" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/flappybirdgodot">FlappyBirdGodot by Lorentzeus</a></iframe></p> -<h3 id="initial-project-setup">Initial project setup<a class="headerlink" href="#initial-project-setup" title="Permanent link">¶</a></h3> -<h4 id="directory-structure">Directory structure<a class="headerlink" href="#directory-structure" title="Permanent link">¶</a></h4> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#initial-setup">Initial setup</a><ul> +<li><a href="#directory-structure">Directory structure</a></li> +<li><a href="#config">Config</a><ul> +<li><a href="#default-import-settings">Default import settings</a></li> +<li><a href="#general-settings">General settings</a></li> +<li><a href="#keybindings">Keybindings</a></li> +<li><a href="#layers">Layers</a></li> +</ul> +</li> +</ul> +</li> +<li><a href="#assets">Assets</a><ul> +<li><a href="#importing">Importing</a></li> +</ul> +</li> +<li><a href="#scenes">Scenes</a><ul> +<li><a href="#tilemaps">TileMaps</a><ul> +<li><a href="#default-ground-tiles">Default ground tiles</a></li> +</ul> +</li> +<li><a href="#player">Player</a></li> +<li><a href="#other">Other</a></li> +<li><a href="#game">Game</a></li> +<li><a href="#ui">UI</a><ul> +<li><a href="#fonts">Fonts</a></li> +<li><a href="#scene-setup">Scene setup</a></li> +</ul> +</li> +<li><a href="#main">Main</a></li> +</ul> +</li> +<li><a href="#scripting">Scripting</a><ul> +<li><a href="#player_1">Player</a></li> +<li><a href="#worlddetector">WorldDetector</a></li> +<li><a href="#worldtiles">WorldTiles</a><ul> +<li><a href="#groundtilemap">GroundTileMap</a></li> +<li><a href="#pipetilemap">PipeTileMap</a></li> +</ul> +</li> +<li><a href="#saved-data">Saved data</a></li> +<li><a href="#game_1">Game</a></li> +<li><a href="#ui_1">UI</a></li> +<li><a href="#main_1">Main</a></li> +</ul> +</li> +<li><a href="#final-notes-and-exporting">Final notes and exporting</a><ul> +<li><a href="#preparing-the-files">Preparing the files</a></li> +<li><a href="#exporting">Exporting</a></li> +</ul> +</li> +</ul> +</div> +<h2 id="initial-setup">Initial setup<a class="headerlink" href="#initial-setup" title="Permanent link">¶</a></h2> +<h3 id="directory-structure">Directory structure<a class="headerlink" href="#directory-structure" title="Permanent link">¶</a></h3> <p>I’m basically going with what I wrote on <a href="https://blog.luevano.xyz/g/godot_project_structure.html">Godot project structure</a> recently, and probably with minor changes depending on the situation.</p> -<h4 id="config">Config<a class="headerlink" href="#config" title="Permanent link">¶</a></h4> -<h5 id="default-import-settings">Default import settings<a class="headerlink" href="#default-import-settings" title="Permanent link">¶</a></h5> +<h3 id="config">Config<a class="headerlink" href="#config" title="Permanent link">¶</a></h3> +<h4 id="default-import-settings">Default import settings<a class="headerlink" href="#default-import-settings" title="Permanent link">¶</a></h4> <p>Since this is just pixel art, the importing settings for textures needs to be adjusted so the sprites don’t look blurry. Go to <em>Project -> Project settings… -> Import defaults</em> and on the drop down select <code>Texture</code>, untick everything and make sure <em>Compress/Mode</em> is set to <code>Lossless</code>.</p> <figure id="__yafg-figure-4"> -<img alt="Project settings - Import defaults - Texture settings" src="images/g/flappybird_godot/project_settings_import_texture.png" title="Project settings - Import defaults - Texture settings"> +<img alt="Project settings - Import defaults - Texture settings" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_import_texture.png" title="Project settings - Import defaults - Texture settings"> <figcaption>Project settings - Import defaults - Texture settings</figcaption> </figure> -<h5 id="general-settings">General settings<a class="headerlink" href="#general-settings" title="Permanent link">¶</a></h5> +<h4 id="general-settings">General settings<a class="headerlink" href="#general-settings" title="Permanent link">¶</a></h4> <p>It’s also a good idea to setup some config variables project-wide. To do so, go to <em>Project -> Project settings… -> General</em>, select <em>Application/config</em> and add a new property (there is a text box at the top of the project settings window) for game scale: <code>application/config/game_scale</code> for the type use <code>float</code> and then click on add; configure the new property to <code>3.0</code>; On the same window, also add <code>application/config/version</code> as a <code>string</code>, and make it <code>1.0.0</code> (or whatever number you want).</p> <figure id="__yafg-figure-5"> -<img alt="Project settings - General - Game scale and version properties" src="images/g/flappybird_godot/project_settings_config_properties.png" title="Project settings - General - Game scale and version properties"> +<img alt="Project settings - General - Game scale and version properties" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_config_properties.png" title="Project settings - General - Game scale and version properties"> <figcaption>Project settings - General - Game scale and version properties</figcaption> </figure> -<p>For my personal preferences, also disable some of the <em>GDScript</em> debug warnings that are annoying, this is done at <em>Project -> Project settings… -> General</em>, select <em>Debug/GDScript</em> and toggle off “Unused arguments”, “Unused signal” and “Return value discarded”, and any other that might come up too often and don’t want to see.</p> +<p>For my personal preferences, also disable some of the <em>GDScript</em> debug warnings that are annoying, this is done at <em>Project -> Project settings… -> General</em>, select <em>Debug/GDScript</em> and toggle off <code>Unused arguments</code>, <code>Unused signal</code> and <code>Return value discarded</code>, and any other that might come up too often and don’t want to see.</p> <figure id="__yafg-figure-6"> -<img alt="Project settings - General - GDScript debug warnings" src="images/g/flappybird_godot/project_settings_debug_gdscript.png" title="Project settings - General - GDScript debug warnings"> +<img alt="Project settings - General - GDScript debug warnings" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_debug_gdscript.png" title="Project settings - General - GDScript debug warnings"> <figcaption>Project settings - General - GDScript debug warnings</figcaption> </figure> -<p>Finally, set the initial window size in <em>Project -> Project settings… -> General</em>, select <em>Display/Window</em> and set <em>Size/Width</em> and <em>Size/Height</em> to <code>600</code> and <code>800</code>, respectively. As well as the <em>Stretch/Mode</em> to “viewport”, and <em>Stretch/Aspect</em> to “keep”:</p> +<p>Finally, set the initial window size in <em>Project -> Project settings… -> General</em>, select <em>Display/Window</em> and set <em>Size/Width</em> and <em>Size/Height</em> to <code>600</code> and <code>800</code>, respectively. As well as the <em>Stretch/Mode</em> to <code>viewport</code> , and <em>Stretch/Aspect</em> to <code>keep</code>:</p> <figure id="__yafg-figure-7"> -<img alt="Project settings - General - Initial window size" src="images/g/flappybird_godot/project_settings_window_settings.png" title="Project settings - General - Initial window size"> +<img alt="Project settings - General - Initial window size" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_window_settings.png" title="Project settings - General - Initial window size"> <figcaption>Project settings - General - Initial window size</figcaption> </figure> -<h5 id="keybindings">Keybindings<a class="headerlink" href="#keybindings" title="Permanent link">¶</a></h5> -<p>I only used 3 actions (keybindings): jump, restart and toggle_debug (optional). To add custom keybindings (so that the <code>Input.something()</code> API can be used), go to <em>Project -> Project settings… -> Input Map</em> and on the text box write “jump” and click add, then it will be added to the list and it’s just a matter of clicking the <code>+</code> sign to add a “Physical key”, press any key you want to be used to jump and click ok. Do the same for the rest of the actions.</p> +<h4 id="keybindings">Keybindings<a class="headerlink" href="#keybindings" title="Permanent link">¶</a></h4> +<p>I only used 3 actions (keybindings): jump, restart and toggle_debug (optional). To add custom keybindings (so that the <code>Input.something()</code> API can be used), go to <em>Project -> Project settings… -> Input Map</em> and on the text box write <code>jump</code> and click add, then it will be added to the list and it’s just a matter of clicking the <code>+</code> sign to add a <em>Physical key</em>, press any key you want to be used to jump and click ok. Do the same for the rest of the actions.</p> <figure id="__yafg-figure-8"> -<img alt="Project settings - Input Map - Adding necessary keybindings" src="images/g/flappybird_godot/project_settings_input_map.png" title="Project settings - Input Map - Adding necessary keybindings"> +<img alt="Project settings - Input Map - Adding necessary keybindings" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_input_map.png" title="Project settings - Input Map - Adding necessary keybindings"> <figcaption>Project settings - Input Map - Adding necessary keybindings</figcaption> </figure> -<h5 id="layers">Layers<a class="headerlink" href="#layers" title="Permanent link">¶</a></h5> -<p>Finally, rename the physics layers so we don’t lose track of which layer is which. Go to <em>Project -> Layer Names -> 2d Physics</em> and change the first 5 layer names to (in order): “player”, “ground”, “pipe”, “ceiling” and “score”.</p> +<h4 id="layers">Layers<a class="headerlink" href="#layers" title="Permanent link">¶</a></h4> +<p>Finally, rename the physics layers so we don’t lose track of which layer is which. Go to <em>Project -> Layer Names -> 2d Physics</em> and change the first 5 layer names to (in order): <code>player</code>, <code>ground</code>, <code>pipe</code>, <code>ceiling</code> and <code>score</code>.</p> <figure id="__yafg-figure-9"> -<img alt="Project settings - Layer Names - 2D Physics" src="images/g/flappybird_godot/project_settings_layer_names_2d_physics.png" title="Project settings - Layer Names - 2D Physics"> +<img alt="Project settings - Layer Names - 2D Physics" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_layer_names_2d_physics.png" title="Project settings - Layer Names - 2D Physics"> <figcaption>Project settings - Layer Names - 2D Physics</figcaption> </figure> -<h3 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h3> +<h2 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h2> <p>For the assets I found out about a pack that contains just what I need: <a href="https://megacrash.itch.io/flappy-bird-assets">flappy-bird-assets</a> by <a href="https://megacrash.itch.io/">MegaCrash</a>; I just did some minor modifications on the naming of the files. For the font I used <a href="https://poppyworks.itch.io/silver">Silver</a>, and for the sound the resources from <a href="https://github.com/meeq/FlappyBird-N64">FlappyBird-N64</a> (which seems to be taken from <a href="https://www.101soundboards.com/boards/10178-flappy-bird-sounds">101soundboards.com</a> which the orignal copyright holder is <a href="https://dotgears.com/">.Gears</a> anyways).</p> -<h4 id="importing">Importing<a class="headerlink" href="#importing" title="Permanent link">¶</a></h4> -<p>Create the necessary directories to hold the respective assets and it’s just a matter of dragging and dropping, I used directories: <code>res://entities/actors/player/sprites/</code>, <code>res://fonts/</code>, <code>res://levels/world/background/sprites/</code>, <code>res://levels/world/ground/sprites/</code>, <code>res://levels/world/pipe/sprites/</code>, <code>res://sfx/</code>. For the player sprites, the “FileSystem” window looks like this (<code>entities/actor</code> directories are really not necessary):</p> +<h3 id="importing">Importing<a class="headerlink" href="#importing" title="Permanent link">¶</a></h3> +<p>Create the necessary directories to hold the respective assets and it’s just a matter of dragging and dropping, I used directories: <code>res://entities/actors/player/sprites/</code>, <code>res://fonts/</code>, <code>res://levels/world/background/sprites/</code>, <code>res://levels/world/ground/sprites/</code>, <code>res://levels/world/pipe/sprites/</code>, <code>res://sfx/</code>. For the player sprites, the +<em>FileSystem</em> window looks like this (<code>entities/actor</code> directories are really not necessary):</p> <figure id="__yafg-figure-10"> -<img alt="FileSystem - Player sprite imports" src="images/g/flappybird_godot/player_sprite_imports.png" title="FileSystem - Player sprite imports"> +<img alt="FileSystem - Player sprite imports" src="https://static.luevano.xyz/images/g/flappybird_godot/player_sprite_imports.png" title="FileSystem - Player sprite imports"> <figcaption>FileSystem - Player sprite imports</figcaption> </figure> <p>It should look similar for other directories, except maybe for the file extensions. For example, for the sfx:</p> <figure id="__yafg-figure-11"> -<img alt="FileSystem - SFX imports" src="images/g/flappybird_godot/sfx_imports.png" title="FileSystem - SFX imports"> +<img alt="FileSystem - SFX imports" src="https://static.luevano.xyz/images/g/flappybird_godot/sfx_imports.png" title="FileSystem - SFX imports"> <figcaption>FileSystem - SFX imports</figcaption> </figure> -<h3 id="scenes">Scenes<a class="headerlink" href="#scenes" title="Permanent link">¶</a></h3> +<h2 id="scenes">Scenes<a class="headerlink" href="#scenes" title="Permanent link">¶</a></h2> <p>Now it’s time to actually create the game, by creating the basic scenes that will make up the game. The hardest part and the most confusing is going to be the <em>TileMaps</em>, so that goes first.</p> -<h4 id="tilemaps">TileMaps<a class="headerlink" href="#tilemaps" title="Permanent link">¶</a></h4> -<p>I’m using a scene called “WorldTiles” with a <em>Node2D</em> node as root called the same. With 2 different <em>TileMap</em> nodes as children named “GroundTileMap” and “PipeTileMap” (these are their own scene); yes 2 different <em>TileMaps</em> because we need 2 different physics colliders (In Godot 4.0 you can have a single <em>TileMap</em> with different physics colliders in it). Each node has its own script. It should look something like this:</p> +<h3 id="tilemaps">TileMaps<a class="headerlink" href="#tilemaps" title="Permanent link">¶</a></h3> +<p>I’m using a scene called <code>WorldTiles</code> with a <em>Node2D</em> node as root called the same. With 2 different <em>TileMap</em> nodes as children named <code>GroundTileMap</code> and <code>PipeTileMap</code> (these are their own scene); yes 2 different <em>TileMaps</em> because we need 2 different physics colliders (in <em>Godot 4.0</em> you can have a single <em>TileMap</em> with different physics colliders in it). Each node has its own script. It should look something like this:</p> <figure id="__yafg-figure-12"> -<img alt="Scene - WorldTiles (TileMaps)" src="images/g/flappybird_godot/scene_world_tiles.png" title="Scene - WorldTiles (TileMaps)"> +<img alt="Scene - WorldTiles (TileMaps)" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_world_tiles.png" title="Scene - WorldTiles (TileMaps)"> <figcaption>Scene - WorldTiles (TileMaps)</figcaption> </figure> <p>I used the following directory structure:</p> <figure id="__yafg-figure-13"> -<img alt="Scene - WorldTiles - Directory structure" src="images/g/flappybird_godot/scene_world_tiles_directory_structure.png" title="Scene - WorldTiles - Directory structure"> +<img alt="Scene - WorldTiles - Directory structure" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_world_tiles_directory_structure.png" title="Scene - WorldTiles - Directory structure"> <figcaption>Scene - WorldTiles - Directory structure</figcaption> </figure> -<p>To configure the GroundTileMap, select the node and click on “(empty)” on the <em>TileMap/Tile set</em> property and then click on “New TileSet”, then click where the “(empty)” used to be, a new window should open on the bottom:</p> +<p>To configure the <code>GroundTileMap</code>, select the node and click on <code>(empty)</code> on the <em>TileMap/Tile set</em> property and then click on <code>New TileSet</code>, then click where the <code>(empty)</code> used to be, a new window should open on the bottom:</p> <figure id="__yafg-figure-14"> -<img alt="TileSet - Configuration window" src="images/g/flappybird_godot/tile_set_config_window.png" title="TileSet - Configuration window"> +<img alt="TileSet - Configuration window" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_config_window.png" title="TileSet - Configuration window"> <figcaption>TileSet - Configuration window</figcaption> </figure> -<p>Click on the plus on the bottom left and you can now select the specific tile set to use. Now click on the yellow “+ New Single Tile”, activate the grid and select any of the tiles. Should look like this:</p> +<p>Click on the plus on the bottom left and you can now select the specific tile set to use. Now click on the yellow <code>+ New Single Tile</code>, activate the grid and select any of the tiles. Should look like this:</p> <figure id="__yafg-figure-15"> -<img alt="TileSet - New single tile" src="images/g/flappybird_godot/tile_set_new_single_tile.png" title="TileSet - New single tile"> +<img alt="TileSet - New single tile" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_new_single_tile.png" title="TileSet - New single tile"> <figcaption>TileSet - New single tile</figcaption> </figure> -<p>We need to do this because for some reason we can’t change the snap options before selecting a tile. After selecting a random tile, set up the <em>Snap Options/Step</em> (in the <em>Inspector</em>) and set it to 16x16 (or if using a different tile set, to it’s tile size):</p> +<p>We need to do this because for some reason we can’t change the snap options before selecting a tile. After selecting a random tile, set up the <em>Snap Options/Step</em> (in the <em>Inspector</em>) and set it to <code>16x16</code> (or if using a different tile set, to it’s tile size):</p> <figure id="__yafg-figure-16"> -<img alt="TileSet - Tile - Step snap options" src="images/g/flappybird_godot/tile_set_tile_step_snap_options.png" title="TileSet - Tile - Step snap options"> +<img alt="TileSet - Tile - Step snap options" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_tile_step_snap_options.png" title="TileSet - Tile - Step snap options"> <figcaption>TileSet - Tile - Step snap options</figcaption> </figure> -<p>Now you can select the actual single tile. Once selected click on “Collision”, use the rectangle tool and draw the rectangle corresponding to that tile’s collision:</p> +<p>Now you can select the actual single tile. Once selected click on <code>Collision</code>, use the rectangle tool and draw the rectangle corresponding to that tile’s collision:</p> <figure id="__yafg-figure-17"> -<img alt="TileSet - Tile - Selection and collision" src="images/g/flappybird_godot/tile_set_tile_selection_collision.png" title="TileSet - Tile - Selection and collision"> +<img alt="TileSet - Tile - Selection and collision" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_tile_selection_collision.png" title="TileSet - Tile - Selection and collision"> <figcaption>TileSet - Tile - Selection and collision</figcaption> </figure> <p>Do the same for the other 3 tiles. If you select the <em>TileMap</em> itself again, it should look like this on the right (on default layout it’s on the left of the <em>Inspector</em>):</p> <figure id="__yafg-figure-18"> -<img alt="TileSet - Available tiles" src="images/g/flappybird_godot/tile_set_available_tiles.png" title="TileSet - Available tiles"> +<img alt="TileSet - Available tiles" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_available_tiles.png" title="TileSet - Available tiles"> <figcaption>TileSet - Available tiles</figcaption> </figure> <p>The ordering is important only for the “underground tile”, which is the filler ground, it should be at the end (index 3); if this is not the case, repeat the process (it’s possible to rearrange them but it’s hard to explain as it’s pretty weird).</p> -<p>At this point the tilemap doesn’t have any physics and the cell size is wrong. Select the “GroundTileMap”, set the <em>TileMap/Cell/Size</em> to 16x16, the <em>TileMap/Collision/Layer</em> set to <code>bit 2</code> only (ground layer) and disable any <em>TileMap/Collision/Mask</em> bits. Should look something like this:</p> +<p>At this point the tilemap doesn’t have any physics and the cell size is wrong. Select the <code>GroundTileMap</code>, set the <em>TileMap/Cell/Size</em> to <code>16x16</code>, the <em>TileMap/Collision/Layer</em> set to <code>bit 2</code> only (ground layer) and disable any <em>TileMap/Collision/Mask</em> bits. Should look something like this:</p> <figure id="__yafg-figure-19"> -<img alt="TileMap - Cell size and collision configuration" src="images/g/flappybird_godot/tile_map_cell_collision_configuration.png" title="TileMap - Cell size and collision configuration"> +<img alt="TileMap - Cell size and collision configuration" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_map_cell_collision_configuration.png" title="TileMap - Cell size and collision configuration"> <figcaption>TileMap - Cell size and collision configuration</figcaption> </figure> -<p>Now it’s just a matter of repeating the same for the pipes (“PipeTileMap”), only difference is that when selecting the tiles you need to select 2 tiles, as the pipe is 2 tiles wide, or just set the <em>Snap Options/Step</em> to 32x16, for example, just keep the cell size to 16x16.</p> -<h5 id="default-ground-tiles">Default ground tiles<a class="headerlink" href="#default-ground-tiles" title="Permanent link">¶</a></h5> -<p>I added few default ground tiles to the scene, just for testing purposes but I left them there. These could be place programatically, but I was too lazy to change things. On the “WorldTiles” scene, while selecting the “GroundTileMap”, you can select the tiles you want to paint with, and left click in the grid to paint with the selected tile. Need to place tiles from <code>(-8, 7)</code> to <code>(10, 7)</code> as well as the tile below with the filler ground (the tile position/coordinates show at the bottom left, refer to the image below):</p> +<p>Now it’s just a matter of repeating the same for the pipes (<code>PipeTileMap</code>), only difference is that when selecting the tiles you need to select 2 tiles, as the pipe is 2 tiles wide, or just set the <em>Snap Options/Step</em> to <code>32x16</code>, for example, just keep the cell size to <code>16x16</code>.</p> +<h4 id="default-ground-tiles">Default ground tiles<a class="headerlink" href="#default-ground-tiles" title="Permanent link">¶</a></h4> +<p>I added few default ground tiles to the scene, just for testing purposes but I left them there. These could be place programatically, but I was too lazy to change things. On the <code>WorldTiles</code> scene, while selecting the <code>GroundTileMap</code>, you can select the tiles you want to paint with, and left click in the grid to paint with the selected tile. Need to place tiles from <code>(-8, 7)</code> to <code>(10, 7)</code> as well as the tile below with the filler ground (the tile position/coordinates show at the bottom left, refer to the image below):</p> <figure id="__yafg-figure-20"> -<img alt="Scene - WorldTiles - Default ground tiles" src="images/g/flappybird_godot/world_tiles_default_tiles.png" title="Scene - WorldTiles - Default ground tiles"> +<img alt="Scene - WorldTiles - Default ground tiles" src="https://static.luevano.xyz/images/g/flappybird_godot/world_tiles_default_tiles.png" title="Scene - WorldTiles - Default ground tiles"> <figcaption>Scene - WorldTiles - Default ground tiles</figcaption> </figure> -<h4 id="player">Player<a class="headerlink" href="#player" title="Permanent link">¶</a></h4> -<p>On a new scene called “Player” with a <em>KinematicBody2D</em> node named “Player” as the root of the scene, then for the children: <em>AnimatedSprite</em> as “Sprite”, <em>CollisionShape2D</em> as “Collision” (with a circle shape) and 3 <em>AudioStreamPlayers</em> for “JumpSound”, “DeadSound” and “HitSound”. Not sure if it’s a good practice to have the audio here, since I did that at the end, pretty lazy. Then, attach a script to the “Player” node and then it should look like this:</p> +<h3 id="player">Player<a class="headerlink" href="#player" title="Permanent link">¶</a></h3> +<p>On a new scene called <code>Player</code> with a <em>KinematicBody2D</em> node named <code>Player</code> as the root of the scene, then for the children: <em>AnimatedSprite</em> as <code>Sprite</code>, <em>CollisionShape2D</em> as <code>Collision</code> (with a circle shape) and 3 <em>AudioStreamPlayers</em> for <code>JumpSound</code>, <code>DeadSound</code> and <code>HitSound</code>. Not sure if it’s a good practice to have the audio here, since I did that at the end, pretty lazy. Then, attach a script to the <code>Player</code> node and then it should look like this:</p> <figure id="__yafg-figure-21"> -<img alt="Scene - Player - Node setup" src="images/g/flappybird_godot/scene_player_node_setup.png" title="Scene - Player - Node setup"> +<img alt="Scene - Player - Node setup" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_node_setup.png" title="Scene - Player - Node setup"> <figcaption>Scene - Player - Node setup</figcaption> </figure> -<p>Select the “Player” node and set the <em>CollisionShape2D/Collision/Layer</em> to 1 and the <em>CollisionObject2D/Collision/Mask</em> to 2 and 3 (ground and pipe).</p> -<p>For the “Sprite” node, when selecting it click on the “(empty)” for the <em>AnimatedSprite/Frames</em> property and click “New SpriteFrames”, click again where the “(empty)” used to be and ane window should open on the bottom:</p> +<p>Select the <code>Player</code> node and set the <em>CollisionShape2D/Collision/Layer</em> to <code>1</code> and the <em>CollisionObject2D/Collision/Mask</em> to <code>2</code> and <code>3</code> (ground and pipe).</p> +<p>For the <code>Sprite</code> node, when selecting it click on the <code>(empty)</code> for the <em>AnimatedSprite/Frames</em> property and click <code>New SpriteFrames</code>, click again where the <code>(empty)</code> used to be and ane window should open on the bottom:</p> <figure id="__yafg-figure-22"> -<img alt="Scene - Player - SpriteFrames window" src="images/g/flappybird_godot/scene_player_spriteframes_window.png" title="Scene - Player - SpriteFrames window"> +<img alt="Scene - Player - SpriteFrames window" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_spriteframes_window.png" title="Scene - Player - SpriteFrames window"> <figcaption>Scene - Player - SpriteFrames window</figcaption> </figure> -<p>Right off the bat, set the “Speed” to <code>10 FPS</code> (bottom left) and rename “default” to “bird_1”. With the “bird_1” selected, click on the “Add frames from a Sprite Sheet”, which is the second button under “Animation Frames:” which looks has an icon of a small grid (next to the folder icon), a new window will popup where you need to select the respective sprite sheet to use and configure it for importing. On the “Select Frames” window, change the “Vertical” to 1, and then select all 4 frames (<em>Ctrl + Scroll</em> wheel to zoom in):</p> +<p>Right off the bat, set the <code>Speed</code> to <code>10 FPS</code> (bottom left) and rename <code>default</code> to <code>bird_1</code>. With the <code>bird_1</code> selected, click on the <code>Add frames from a Sprite Sheet</code>, which is the second button under <code>Animation Frames:</code> which looks has an icon of a small grid (next to the folder icon), a new window will popup where you need to select the respective sprite sheet to use and configure it for importing. On the <code>Select Frames</code> window, change the <code>Vertical</code> to <code>1</code>, and then select all 4 frames (<em>Ctrl + Scroll</em> wheel to zoom in):</p> <figure id="__yafg-figure-23"> -<img alt="Scene - Player - Sprite sheet importer" src="images/g/flappybird_godot/scene_player_sprite_sheet_importer.png" title="Scene - Player - Sprite sheet importer"> +<img alt="Scene - Player - Sprite sheet importer" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_sprite_sheet_importer.png" title="Scene - Player - Sprite sheet importer"> <figcaption>Scene - Player - Sprite sheet importer</figcaption> </figure> <p>After that, the <em>SpriteFrames</em> window should look like this:</p> <figure id="__yafg-figure-24"> -<img alt="Scene - Player - SpriteFrames window with sprite sheet configured" src="images/g/flappybird_godot/scene_player_spriteframes_window_with_sprite_sheet.png" title="Scene - Player - SpriteFrames window with sprite sheet configured"> +<img alt="Scene - Player - SpriteFrames window with sprite sheet configured" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_spriteframes_window_with_sprite_sheet.png" title="Scene - Player - SpriteFrames window with sprite sheet configured"> <figcaption>Scene - Player - SpriteFrames window with sprite sheet configured</figcaption> </figure> -<p>Finally, make sure the “Sprite” node has the <em>AnimatedSprite/Animation</em> is set to “bird_1” and that the “Collision” node is configured correctly for its size and position (I just have it as a radius of 7). As well as dropping the SFX files into the corresponding <em>AudioStreamPlayer</em> (into the <em>AudioStreamPlayer/Stream</em> property).</p> -<h4 id="other">Other<a class="headerlink" href="#other" title="Permanent link">¶</a></h4> +<p>Finally, make sure the <code>Sprite</code> node has the <em>AnimatedSprite/Animation</em> is set to <code>bird_1</code> and that the <code>Collision</code> node is configured correctly for its size and position (I just have it as a radius of <code>7</code>). As well as dropping the SFX files into the corresponding <em>AudioStreamPlayer</em> (into the <em>AudioStreamPlayer/Stream</em> property).</p> +<h3 id="other">Other<a class="headerlink" href="#other" title="Permanent link">¶</a></h3> <p>These are really simple scenes that don’t require much setup:</p> <ul> -<li>“CeilingDetector”: just an <em>Area2D</em> node with a <em>CollisionShape2D</em> in the form of a rectangle (<em>CollisionShape2D/Shape/extents</em> to <code>(120, 10)</code>), stretched horizontally so it fits the whole screen. <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 4</code> (ceiling) and <em>CollisionObject2D/Collision/Mask</em> set to bit 1 (player).</li> -<li>“ScoreDetector”: similar to the “CeilingDetector”, but vertical (<em>CollisionShape2D/Shape/extents</em> to <code>(2.5, 128)</code>) and <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 1</code> (player).</li> -<li>“WorldDetector”: <em>Node2D</em> with a script attached, and 3 <em>RayCast2D</em> as children:<ul> -<li>“NewTile”: <em>Raycast2D/Enabled</em> to true (checked), <em>Raycast2D/Cast To</em> <code>(0, 400)</code>, <em>Raycast2D/Collision Mask</em> to <code>bit 2</code> (ground) and <em>Node2D/Transform/Position</em> to <code>(152, -200)</code></li> -<li>“OldTile”: same as “NewTile”, except for the <em>Node2D/Transform/Position</em>, set it to <code>(-152, -200)</code>.</li> -<li>“OldPipe”: same as “OldTile”, except for the <em>Raycast2D/Collision Mask</em>, set it to <code>bit 3</code> (pipe).</li> +<li><code>CeilingDetector</code>: just an <em>Area2D</em> node with a <em>CollisionShape2D</em> in the form of a rectangle (<em>CollisionShape2D/Shape/extents</em> to <code>(120, 10)</code>), stretched horizontally so it fits the whole screen. <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 4</code> (ceiling) and <em>CollisionObject2D/Collision/Mask</em> set to <code>bit 1</code> (player).</li> +<li><code>ScoreDetector</code>: similar to the <code>CeilingDetector</code>, but vertical (<em>CollisionShape2D/Shape/extents</em> to <code>(2.5, 128)</code>) and <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 1</code> (player).</li> +<li><code>WorldDetector</code>: <em>Node2D</em> with a script attached, and 3 <em>RayCast2D</em> as children:<ul> +<li><code>NewTile</code>: <em>Raycast2D/Enabled</em> to true (checked), <em>Raycast2D/Cast To</em> <code>(0, 400)</code>, <em>Raycast2D/Collision Mask</em> to <code>bit 2</code> (ground) and <em>Node2D/Transform/Position</em> to <code>(152, -200)</code></li> +<li><code>OldTile</code>: same as “NewTile”, except for the <em>Node2D/Transform/Position</em>, set it to <code>(-152, -200)</code>.</li> +<li><code>OldPipe</code>: same as “OldTile”, except for the <em>Raycast2D/Collision Mask</em>, set it to <code>bit 3</code> (pipe).</li> </ul> </li> </ul> -<h4 id="game">Game<a class="headerlink" href="#game" title="Permanent link">¶</a></h4> -<p>This is the actual “Game” scene that holds all the playable stuff, here we will drop in all the previous scenes; the root node is a <em>Node2D</em> and also has an attached script. Also need to add 2 additional <em>AudioStreamPlayers</em> for the “start” and “score” sounds, as well as a <em>Sprite</em> for the background (<em>Sprite/Offset/Offset</em> set to <code>(0, 10)</code>) and a <em>Camera2D</em> (<em>Camera2D/Current</em> set to true (checked)). It should look something like this:</p> +<h3 id="game">Game<a class="headerlink" href="#game" title="Permanent link">¶</a></h3> +<p>This is the actual <code>Game</code> scene that holds all the playable stuff, here we will drop in all the previous scenes; the root node is a <em>Node2D</em> and also has an attached script. Also need to add 2 additional <em>AudioStreamPlayers</em> for the “start” and “score” sounds, as well as a <em>Sprite</em> for the background (<em>Sprite/Offset/Offset</em> set to <code>(0, 10)</code>) and a <em>Camera2D</em> (<em>Camera2D/Current</em> set to true (checked)). It should look something like this:</p> <figure id="__yafg-figure-25"> -<img alt="Scene - Game - Node setup" src="images/g/flappybird_godot/scene_game_node_setup.png" title="Scene - Game - Node setup"> +<img alt="Scene - Game - Node setup" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_game_node_setup.png" title="Scene - Game - Node setup"> <figcaption>Scene - Game - Node setup</figcaption> </figure> <p>The scene viewport should look something like the following:</p> <figure id="__yafg-figure-26"> -<img alt="Scene - Game - Viewport" src="images/g/flappybird_godot/scene_game_viewport.png" title="Scene - Game - Viewport"> +<img alt="Scene - Game - Viewport" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_game_viewport.png" title="Scene - Game - Viewport"> <figcaption>Scene - Game - Viewport</figcaption> </figure> -<h4 id="ui">UI<a class="headerlink" href="#ui" title="Permanent link">¶</a></h4> -<h5 id="fonts">Fonts<a class="headerlink" href="#fonts" title="Permanent link">¶</a></h5> -<p>We need some font “Resources” to style the <em>Label</em> fonts. Under the <em>FileSystem</em> window, right click on the fonts directory (create one if needed) and click on “New Resource…” and select <em>DynamicFontData</em>, save it in the “fonts” directory as “SilverDynamicFontData.tres” (“Silver” as it is the font I’m using) then double click the just created resource and set the <em>DynamicFontData/Font Path</em> to the actual “Silver.ttf” font (or whatever you want).</p> -<p>Then create a new resource and this time select <em>DynamicFont</em>, name it “SilverDynamicFont.tres”, then double click to edit and add the “SilverDynamicFontData.tres” to the <em>DynamicFont/Font/Font Data</em> property (and I personally toggled off the <em>DynamicFont/Font/Antialiased</em> property), now just set the <em>DynamicFont/Settings/(Size, Outline Size, Outline Color)</em> to 32, 1 and black, respectively (or any other values you want). It should look something like this:</p> +<h3 id="ui">UI<a class="headerlink" href="#ui" title="Permanent link">¶</a></h3> +<h4 id="fonts">Fonts<a class="headerlink" href="#fonts" title="Permanent link">¶</a></h4> +<p>We need some font <code>Resources</code> to style the <em>Label</em> fonts. Under the <em>FileSystem</em> window, right click on the fonts directory (create one if needed) and click on <code>New Resource...</code> and select <em>DynamicFontData</em>, save it in the “fonts” directory as <code>SilverDynamicFontData.tres</code> (<code>Silver</code> as it is the font I’m using) then double click the just created resource and set the <em>DynamicFontData/Font Path</em> to the actual <code>Silver.ttf</code> font (or whatever you want).</p> +<p>Then create a new resource and this time select <em>DynamicFont</em>, name it <code>SilverDynamicFont.tres</code>, then double click to edit and add the <code>SilverDynamicFontData.tres</code> to the <em>DynamicFont/Font/Font Data</em> property (and I personally toggled off the <em>DynamicFont/Font/Antialiased</em> property), now just set the <em>DynamicFont/Settings/(Size, Outline Size, Outline Color)</em> to <code>32</code>, <code>1</code> and <code>black</code>, respectively (or any other values you want). It should look something like this:</p> <figure id="__yafg-figure-27"> -<img alt="Resource - DynamicFont - Default font" src="images/g/flappybird_godot/resource_dynamic_font.png" title="Resource - DynamicFont - Default font"> +<img alt="Resource - DynamicFont - Default font" src="https://static.luevano.xyz/images/g/flappybird_godot/resource_dynamic_font.png" title="Resource - DynamicFont - Default font"> <figcaption>Resource - DynamicFont - Default font</figcaption> </figure> -<p>Do the same for another <em>DynamicFont</em> which will be used for the score label, named “SilverScoreDynamicFont.tres”. Only changes are <em>Dynamic/Settings/(Size, Outline Size)</em> which are set to 128 and 2, respectively. The final files for the fonts should look something like this:</p> +<p>Do the same for another <em>DynamicFont</em> which will be used for the score label, named <code>SilverScoreDynamicFont.tres</code>. Only changes are <em>Dynamic/Settings/(Size, Outline Size)</em> which are set to <code>128</code> and <code>2</code>, respectively. The final files for the fonts should look something like this:</p> <figure id="__yafg-figure-28"> -<img alt="Resource - Dynamicfont - Directory structure" src="images/g/flappybird_godot/resource_dynamic_font_directory_structure.png" title="Resource - Dynamicfont - Directory structure"> +<img alt="Resource - Dynamicfont - Directory structure" src="https://static.luevano.xyz/images/g/flappybird_godot/resource_dynamic_font_directory_structure.png" title="Resource - Dynamicfont - Directory structure"> <figcaption>Resource - Dynamicfont - Directory structure</figcaption> </figure> -<h5 id="scene-setup">Scene setup<a class="headerlink" href="#scene-setup" title="Permanent link">¶</a></h5> -<p>This has a bunch of nested nodes, so I’ll try to be concise here. The root node is a <em>CanvasLayer</em> named “UI” with its own script attached, and for the children:</p> +<h4 id="scene-setup">Scene setup<a class="headerlink" href="#scene-setup" title="Permanent link">¶</a></h4> +<p>This has a bunch of nested nodes, so I’ll try to be concise here. The root node is a <em>CanvasLayer</em> named <code>UI</code> with its own script attached, and for the children:</p> <ul> -<li>“MarginContainer”: <em>MarginContainer</em> with <em>Control/Margin/(Left, Top)</em> set to <code>10</code> and <em>Control/Margin/(Right, Bottom)</em> set to <code>-10</code>.<ul> -<li>“InfoContainer”: <em>VBoxContainer</em> with <em>Control/Theme Overrides/Constants/Separation</em> set to <code>250</code>.<ul> -<li>“ScoreContainer”: <em>VBoxContainer</em>.<ul> -<li>“Score”: <em>Label</em> with <em>Label/Align</em> set to “Center”, <em>Control/Theme Overrides/Fonts/Font</em> to the “SilverScoreDynamicFont.tres”, if needed adjust the <em>DynamicFont</em> settings.</li> -<li>“HighScore: same as “Score”, escept for the <em>Control/Theme Overrides/Fonts/Font</em> which is set to “SilverDynamicFont.tres”.</li> +<li><code>MarginContainer</code>: <em>MarginContainer</em> with <em>Control/Margin/(Left, Top)</em> set to <code>10</code> and <em>Control/Margin/(Right, Bottom)</em> set to <code>-10</code>.<ul> +<li><code>InfoContainer</code>: <em>VBoxContainer</em> with <em>Control/Theme Overrides/Constants/Separation</em> set to <code>250</code>.<ul> +<li><code>ScoreContainer</code>: <em>VBoxContainer</em>.<ul> +<li><code>Score</code>: <em>Label</em> with <em>Label/Align</em> set to <code>Center</code>, <em>Control/Theme Overrides/Fonts/Font</em> to the <code>SilverScoreDynamicFont.tres</code>, if needed adjust the <em>DynamicFont</em> settings.</li> +<li><code>HighScore</code>: same as <code>Score</code>, escept for the <em>Control/Theme Overrides/Fonts/Font</em> which is set to <code>SilverDynamicFont.tres</code>.</li> </ul> </li> -<li>“StartGame”: Same as “HighScore”.</li> +<li><code>StartGame</code>: Same as <code>HighScore</code>.</li> </ul> </li> -<li>“DebugContainer”: <em>VBoxContainer</em>.<ul> -<li>“FPS”: <em>Label</em>.</li> +<li><code>DebugContainer</code>: <em>VBoxContainer</em>.<ul> +<li><code>FPS</code>: <em>Label</em>.</li> </ul> </li> -<li>“VersionContainer”: <em>VBoxContainer</em> with <em>BoxContainer/Alignment</em> set to “Begin”.<ul> -<li>“Version”: <em>Label</em> with <em>Label/Align</em> set to “Right”.</li> +<li><code>VersionContainer</code>: <em>VBoxContainer</em> with <em>BoxContainer/Alignment</em> set to <code>Begin</code>.<ul> +<li><code>Version</code>: <em>Label</em> with <em>Label/Align</em> set to <code>Right</code>.</li> </ul> </li> </ul> @@ -275,17 +345,17 @@ </ul> <p>The scene ends up looking like this:</p> <figure id="__yafg-figure-29"> -<img alt="Scene - UI - Node setup" src="images/g/flappybird_godot/scene_ui.png" title="Scene - UI - Node setup"> +<img alt="Scene - UI - Node setup" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_ui.png" title="Scene - UI - Node setup"> <figcaption>Scene - UI - Node setup</figcaption> </figure> -<h4 id="main">Main<a class="headerlink" href="#main" title="Permanent link">¶</a></h4> -<p>This is the final scene where we connect the Game and the UI. It’s made of a <em>Node2D</em> with it’s own script attached and an instance of “Game” and “UI” as it’s children.</p> -<p>This is a good time to set the default scene when we run the game by going to <em>Project -> Project settings… -> General</em> and in <em>Application/Run</em> set the <em>Main Scene</em> to the “Main.tscn” scene.</p> -<h3 id="scripting">Scripting<a class="headerlink" href="#scripting" title="Permanent link">¶</a></h3> +<h3 id="main">Main<a class="headerlink" href="#main" title="Permanent link">¶</a></h3> +<p>This is the final scene where we connect the <code>Game</code> and the <code>UI</code>. It’s made of a <em>Node2D</em> with it’s own script attached and an instance of <code>Game</code> and <code>UI</code> as it’s children.</p> +<p>This is a good time to set the default scene when we run the game by going to <em>Project -> Project settings… -> General</em> and in <em>Application/Run</em> set the <em>Main Scene</em> to the <code>Main.tscn</code> scene.</p> +<h2 id="scripting">Scripting<a class="headerlink" href="#scripting" title="Permanent link">¶</a></h2> <p>I’m going to keep this scripting part to the most basic code blocks, as it’s too much code, for a complete view you can head to the <a href="https://github.com/luevano/flappybird_godot">source code</a>.</p> <p>As of now, the game itself doesn’t do anything if we hit play. The first thing to do so we have something going on is to do the minimal player scripting.</p> -<h4 id="player_1">Player<a class="headerlink" href="#player_1" title="Permanent link">¶</a></h4> -<p>The most basic code needed so the bird goes up and down is to just detect “jump” key presses and add a negative jump velocity so it goes up (<code>y</code> coordinate is reversed in godot…), we also check the velocity sign of the <code>y</code> coordinate to decide if the animation is playing or not.</p> +<h3 id="player_1">Player<a class="headerlink" href="#player_1" title="Permanent link">¶</a></h3> +<p>The most basic code needed so the bird goes up and down is to just detect <code>jump</code> key presses and add a negative jump velocity so it goes up (<code>y</code> coordinate is reversed in godot…), we also check the velocity sign of the <code>y</code> coordinate to decide if the animation is playing or not.</p> <pre><code class="language-gdscript">class_name Player extends KinematicBody2D @@ -334,7 +404,7 @@ func _physics_process(delta: float) -> void: dead_sound.play() </code></pre> <p>Finally need to add the actual checks for when the player dies (like collision with ground or pipe) as well as a function that listens to a signal for when the player goes to the ceiling.</p> -<h4 id="worlddetector">WorldDetector<a class="headerlink" href="#worlddetector" title="Permanent link">¶</a></h4> +<h3 id="worlddetector">WorldDetector<a class="headerlink" href="#worlddetector" title="Permanent link">¶</a></h3> <p>The code is pretty simple, we just need a way of detecting if we ran out of ground and send a signal, as well as sending as signal when we start detecting ground/pipes behind us (to remove it) because the world is being generated as we move. The most basic functions needed are:</p> <pre><code class="language-gdscript">func _was_colliding(detector: RayCast2D, flag: bool, signal_name: String) -> bool: if detector.is_colliding(): @@ -353,8 +423,8 @@ func _now_colliding(detector: RayCast2D, flag: bool, signal_name: String) -> return false </code></pre> <p>We need to keep track of 3 “flags”: <code>ground_was_colliding</code>, <code>ground_now_colliding</code> and <code>pipe_now_colliding</code> (and their respective signals), which are going to be used to do the checks inside <code>_physics_process</code>. For example for checking for new ground: <code>ground_now_colliding = _now_colliding(old_ground, ground_now_colliding, "ground_started_colliding")</code>.</p> -<h4 id="worldtiles">WorldTiles<a class="headerlink" href="#worldtiles" title="Permanent link">¶</a></h4> -<p>This script is what handles the “GroundTileMap” as well as the “PipeTileMap” and just basically functions as a “Signal bus” connecting a bunch of signals from the “WorldDetector” with the <em>TileMaps</em> and just tracking how many pipes have been placed:</p> +<h3 id="worldtiles">WorldTiles<a class="headerlink" href="#worldtiles" title="Permanent link">¶</a></h3> +<p>This script is what handles the <code>GroundTileMap</code> as well as the <code>PipeTileMap</code> and just basically functions as a “Signal bus” connecting a bunch of signals from the <code>WorldDetector</code> with the <em>TileMaps</em> and just tracking how many pipes have been placed:</p> <pre><code class="language-gdscript">export(int, 2, 20, 2) var PIPE_SEP: int = 6 var tiles_since_last_pipe: int = PIPE_SEP - 1 @@ -375,7 +445,7 @@ func _on_WorldDetector_ground_started_colliding() -> void: func _on_WorldDetector_pipe_started_colliding() -> void: emit_signal("remove_pipe") </code></pre> -<h5 id="groundtilemap">GroundTileMap<a class="headerlink" href="#groundtilemap" title="Permanent link">¶</a></h5> +<h4 id="groundtilemap">GroundTileMap<a class="headerlink" href="#groundtilemap" title="Permanent link">¶</a></h4> <p>This is the node that actually places the ground tiles upong receiving a signal. In general, what you want is to keep track of the newest tile that you need to place (empty spot) as well as the last tile that is in the tilemap (technically the first one if you count from left to right). I was experimenting with <code>enum</code>s so I used them to define the possible <code>Ground</code> tiles:</p> <pre><code class="language-gdscript">enum Ground { TILE_1, @@ -406,10 +476,10 @@ func _remove_first_ground() -> void: old_tile_position += Vector2.RIGHT </code></pre> <p>Where you might notice that the <code>_initial_new_tile_x</code> is <code>11</code>, instead of <code>10</code>, refer to <a href="#default-ground-tiles">Default ground tiles</a> where we placed tiles from <code>-8</code> to <code>10</code>, so the next empty one is <code>11</code>. These <code>_place_new_ground</code> and <code>_remove_first_ground</code> functions are called upon receiving the signal.</p> -<h5 id="pipetilemap">PipeTileMap<a class="headerlink" href="#pipetilemap" title="Permanent link">¶</a></h5> -<p>This is really similar to the “GroundTileMap” code, instead of defining an <code>enum</code> for the ground tiles, we define it for the pipe patterns (because each pipe is composed of multiple pipe tiles). If your pipe tile set looks like this (notice the index):</p> +<h4 id="pipetilemap">PipeTileMap<a class="headerlink" href="#pipetilemap" title="Permanent link">¶</a></h4> +<p>This is really similar to the <code>GroundTileMap</code> code, instead of defining an <code>enum</code> for the ground tiles, we define it for the pipe patterns (because each pipe is composed of multiple pipe tiles). If your pipe tile set looks like this (notice the index):</p> <figure id="__yafg-figure-30"> -<img alt="PipeTileMap - Tile set indexes" src="images/g/flappybird_godot/tile_set_pipes_indexes.png" title="PipeTileMap - Tile set indexes"> +<img alt="PipeTileMap - Tile set indexes" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_pipes_indexes.png" title="PipeTileMap - Tile set indexes"> <figcaption>PipeTileMap - Tile set indexes</figcaption> </figure> <p>Then you can use the following “pipe patterns”:</p> @@ -422,7 +492,7 @@ func _remove_first_ground() -> void: PipePattern.PIPE_6: [0, 1, 2, 3, 4, -1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 2] } </code></pre> -<p>Now, the pipe system requires a bit more of tracking as we need to instantiate a “ScoreDetector” here, too. I ended up keeping track of the placed pipes/detectors by using a “pipe stack” (and “detector stack”) which is just an array of placed objects from which I pop the first when deleting them:</p> +<p>Now, the pipe system requires a bit more of tracking as we need to instantiate a <code>ScoreDetector</code> here, too. I ended up keeping track of the placed pipes/detectors by using a “pipe stack” (and “detector stack”) which is just an array of placed objects from which I pop the first when deleting them:</p> <pre><code class="language-gdscript">onready var _pipe_sep: int = get_parent().PIPE_SEP const _pipe_size: int = 16 const _ground_level: int = 7 @@ -438,7 +508,7 @@ var detector_scene: PackedScene = preload("res://levels/detectors/score_det var detector_offset: Vector2 = Vector2(16.0, -(_pipe_size / 2.0) * 16.0) var detector_stack: Array </code></pre> -<p>The <code>detector_offset</code> is just me being picky. For placing a new pipe, we get the starting position (bottom pipe tile) and build upwards, then instantiate a new “ScoreDetector” (<code>detector_scene</code>) and set it’s position to the pipe starting position plus the offset, so it’s centered in the pipe, then just need to connect the “body_entered” signal from the detector with the game, so we keep track of the scoring. Finally just add the placed pipe and detector to their corresponding stacks:</p> +<p>The <code>detector_offset</code> is just me being picky. For placing a new pipe, we get the starting position (bottom pipe tile) and build upwards, then instantiate a new <code>ScoreDetector</code> (<code>detector_scene</code>) and set it’s position to the pipe starting position plus the offset, so it’s centered in the pipe, then just need to connect the <code>body_entered</code> signal from the detector with the game, so we keep track of the scoring. Finally just add the placed pipe and detector to their corresponding stacks:</p> <pre><code class="language-gdscript">func _place_new_pipe() -> void: var current_pipe: Vector2 = new_pipe_starting_position for tile in pipe[_get_random_pipe()]: @@ -468,8 +538,8 @@ var detector_stack: Array detector.queue_free() </code></pre> <p>These functions are called when receiving the signal to place/remove pipes.</p> -<h4 id="saved-data">Saved data<a class="headerlink" href="#saved-data" title="Permanent link">¶</a></h4> -<p>Before proceeding, we require a way to save/load data (for the high scores). We’re going to use the <em>ConfigFile</em> node that uses a custom version of the “ini” file format. Need to define where to save the data:</p> +<h3 id="saved-data">Saved data<a class="headerlink" href="#saved-data" title="Permanent link">¶</a></h3> +<p>Before proceeding, we require a way to save/load data (for the high scores). We’re going to use the <em>ConfigFile</em> node that uses a custom version of the <code>ini</code> file format. Need to define where to save the data:</p> <pre><code class="language-gdscript">const DATA_PATH: String = "user://data.cfg" const SCORE_SECTION: String = "score" var _data: ConfigFile @@ -509,12 +579,12 @@ func get_high_score() -> int: set_new_high_score(0) save_data() </code></pre> -<p>Now, this script in particular will need to be a <a href="https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html">Singleton (AutoLoad)</a>, which means that there will be only one instance and will be available across all scripts. To do so, go to <em>Project -> Project settings… -> AutoLoad</em> and select this script in the “Path:” and add a “Node Name:” (I used “SavedData”, if you use something else, be careful while following this devlog) which will be the name we’ll use to access the singleton. Toggle on “Enable” if needed, it should look like this:</p> +<p>Now, this script in particular will need to be a <a href="https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html">Singleton (AutoLoad)</a>, which means that there will be only one instance and will be available across all scripts. To do so, go to <em>Project -> Project settings… -> AutoLoad</em> and select this script in the <code>Path:</code> and add a <code>Node Name:</code> (I used <code>SavedData</code>, if you use something else, be careful while following this devlog) which will be the name we’ll use to access the singleton. Toggle on <code>Enable</code> if needed, it should look like this:</p> <figure id="__yafg-figure-31"> -<img alt="Project settings - AutoLoad - SavedData singleton" src="images/g/flappybird_godot/project_settings_autoload_saved_data.png" title="Project settings - AutoLoad - SavedData singleton"> +<img alt="Project settings - AutoLoad - SavedData singleton" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_autoload_saved_data.png" title="Project settings - AutoLoad - SavedData singleton"> <figcaption>Project settings - AutoLoad - SavedData singleton</figcaption> </figure> -<h4 id="game_1">Game<a class="headerlink" href="#game_1" title="Permanent link">¶</a></h4> +<h3 id="game_1">Game<a class="headerlink" href="#game_1" title="Permanent link">¶</a></h3> <p>The game script it’s also like a “Signal bus” in the sense that it connects all its childs’ signals together, and also has the job of starting/stopping the <code>_process</code> and <code>_physics_process</code> methods from the childs as needed. First, we need to define the signals and and references to all child nodes:</p> <pre><code class="language-gdscript">signal game_started signal game_over @@ -529,7 +599,7 @@ onready var camera: Camera2D = $Camera onready var start_sound: AudioStreamPlayer = $StartSound onready var score_sound: AudioStreamPlayer = $ScoreSound </code></pre> -<p>It’s important to get the actual “player speed”, as we’re using a scale to make the game look bigger (remember, pixel art), to do so we need a reference to the “game_scale” we setup at the beginning and compute the <code>player_speed</code>:</p> +<p>It’s important to get the actual “player speed”, as we’re using a scale to make the game look bigger (remember, pixel art), to do so we need a reference to the <code>game_scale</code> we setup at the beginning and compute the <code>player_speed</code>:</p> <pre><code class="language-gdscript">var _game_scale: float = ProjectSettings.get_setting("application/config/game_scale") var player_speed: float @@ -539,7 +609,7 @@ func _ready() -> void: # so we move at the actual speed of the player player_speed = player.SPEED / _game_scale </code></pre> -<p>This <code>player_speed</code> will be needed as we need to move all the nodes (“Background”, “Camera”, etc.) in the <code>x</code> axis as the player is moving. This is done in the <code>_physics_process</code>:</p> +<p>This <code>player_speed</code> will be needed as we need to move all the nodes (<code>Background</code>, <code>Camera</code>, etc.) in the <code>x</code> axis as the player is moving. This is done in the <code>_physics_process</code>:</p> <pre><code class="language-gdscript">func _physics_process(delta: float) -> void: ceiling_detector.move_local_x(player_speed * delta) world_detector.move_local_x(player_speed * delta) @@ -584,8 +654,8 @@ func _on_ScoreDetector_body_entered(body: Node2D) -> void: emit_signal("new_score", score, high_score) score_sound.play() </code></pre> -<p>When the <code>player</code> dies, we set all processing to <code>false</code>, except for the player itself (so it can drop all the way to the ground). Also, when receiving a “scoring” signal, we manage the current score, as well as saving the new high score when applicable, note that we need to read the <code>high_score</code> at the beginning by calling <code>SavedData.get_high_score()</code>. This signal we emit will be received by the UI so it updates accordingly.</p> -<h4 id="ui_1">UI<a class="headerlink" href="#ui_1" title="Permanent link">¶</a></h4> +<p>When the <code>player</code> dies, we set all processing to <code>false</code>, except for the player itself (so it can drop all the way to the ground). Also, when receiving a “scoring” signal, we manage the current score, as well as saving the new high score when applicable, note that we need to read the <code>high_score</code> at the beginning by calling <code>SavedData.get_high_score()</code>. This signal we emit will be received by the <code>UI</code> so it updates accordingly.</p> +<h3 id="ui_1">UI<a class="headerlink" href="#ui_1" title="Permanent link">¶</a></h3> <p>First thing is to get a reference to all the child <em>Labels</em>, an initial reference to the high score as well as the version defined in the project settings:</p> <pre><code class="language-gdscript">onready var fps_label: Label = $MarginContainer/DebugContainer/FPS onready var version_label: Label = $MarginContainer/VersionContainer/Version @@ -629,8 +699,8 @@ func _on_Game_new_score(score: int, high_score: int) -> void: score_label.set_text(String(score)) high_score_label.set_text("High score: %s" % high_score) </code></pre> -<h4 id="main_1">Main<a class="headerlink" href="#main_1" title="Permanent link">¶</a></h4> -<p>This is the shortest script, it just connects the signals between the “Game” and the “UI”:</p> +<h3 id="main_1">Main<a class="headerlink" href="#main_1" title="Permanent link">¶</a></h3> +<p>This is the shortest script, it just connects the signals between the <code>Game</code> and the <code>UI</code>:</p> <pre><code class="language-gdscript">onready var game: Game = $Game onready var ui: UI = $UI @@ -642,15 +712,15 @@ func _ready() -> void: game.connect("game_over", ui, "_on_Game_game_over") game.connect("new_score", ui, "_on_Game_new_score") </code></pre> -<h3 id="final-notes-and-exporting">Final notes and exporting<a class="headerlink" href="#final-notes-and-exporting" title="Permanent link">¶</a></h3> +<h2 id="final-notes-and-exporting">Final notes and exporting<a class="headerlink" href="#final-notes-and-exporting" title="Permanent link">¶</a></h2> <p>At this point the game should be fully playable (if any detail missing feel free to look into the source code linked at the beginning). Only thing missing is an icon for the game; I did one pretty quicly with the assets I had.</p> -<h4 id="preparing-the-files">Preparing the files<a class="headerlink" href="#preparing-the-files" title="Permanent link">¶</a></h4> +<h3 id="preparing-the-files">Preparing the files<a class="headerlink" href="#preparing-the-files" title="Permanent link">¶</a></h3> <p>If you followed the directory structure I used, then only thing needed is to transform the icon to a native Windows <code>ico</code> format (if exporting to Windows, else ignore this part). For this you need <a href="https://imagemagick.org/index.php">ImageMagick</a> or some other program that can transform <code>png</code> (or whatever file format you used for the icon) to <code>ico</code>. I used [Chocolatey][https://chocolatey.org/] to install <code>imagemagick</code>, then to convert the icon itself used: <code>magick convert icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico</code> as detailed in <em>Godot</em>‘s <a href="https://docs.godotengine.org/en/stable/tutorials/export/changing_application_icon_for_windows.html">Changing application icon for Windows</a>.</p> -<h4 id="exporting">Exporting<a class="headerlink" href="#exporting" title="Permanent link">¶</a></h4> -<p>You need to download the templates for exporting as detailed in <em>Godot</em>‘s <a href="https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html">Exporting projects</a>. Basically you go to <em>Editor -> Manage Export Templates…</em> and download the latest one specific to your <em>Godot</em> version by clicking on “Download and Install”.</p> +<h3 id="exporting">Exporting<a class="headerlink" href="#exporting" title="Permanent link">¶</a></h3> +<p>You need to download the templates for exporting as detailed in <em>Godot</em>‘s <a href="https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html">Exporting projects</a>. Basically you go to <em>Editor -> Manage Export Templates…</em> and download the latest one specific to your <em>Godot</em> version by clicking on <code>Download and Install</code>.</p> <p>If exporting for Windows then you also need to download <code>rcedit</code> from <a href="https://github.com/electron/rcedit/releases/latest">here</a>. Just place it wherever you want (I put it next to the <em>Godot</em> executable).</p> -<p>Then go to <em>Project -> Export…</em> and the Window should be empty, add a new template by clicking on “Add…” at the top and then select the template you want. I used HTML5, Windows Desktop and Linux/X11. Really the only thing you need to set is the “Export Path” for each template, which is te location of where the executable will be written to, and in the case of the Windows Desktop template you could also setup stuff like “Company Name”, “Product Name”, “File/Product Version”, etc..</p> -<p>Once the templates are setup, select any and click on “Export Project” at the bottom, and make sure to untoggle “Export With Debug” in the window that pops up, this checkbox should be at the bottom of the new window.</p> +<p>Then go to <em>Project -> Export…</em> and the Window should be empty, add a new template by clicking on <code>Add...</code> at the top and then select the template you want. I used HTML5, Windows Desktop and Linux/X11. Really the only thing you need to set is the “Export Path” for each template, which is te location of where the executable will be written to, and in the case of the <em>Windows Desktop</em> template you could also setup stuff like <code>Company Name</code>, <code>Product Name</code>, <code>File/Product Version</code>, etc..</p> +<p>Once the templates are setup, select any and click on <code>Export Project</code> at the bottom, and make sure to untoggle <code>Export With Debug</code> in the window that pops up, this checkbox should be at the bottom of the new window.</p> <div class="page-nav"> <span class="next"> @@ -680,10 +750,10 @@ func _ready() -> void: <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, May 29, 2022 @ 03:38 UTC</p> - <p>Modified: Sun, May 29, 2022 @ 03:44 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 18:26 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a> </p> +<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@gdscript.html">gdscript</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a> </p> </div> </div> diff --git a/live/blog/g/godot_project_structure.html b/live/blog/g/godot_project_structure.html index a45692f..fd6c56e 100644 --- a/live/blog/g/godot_project_structure.html +++ b/live/blog/g/godot_project_structure.html @@ -16,13 +16,12 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + <!-- og meta --> <meta property="og:title" content="General Godot project structure -- Luevano's Blog"/> @@ -73,6 +72,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>General Godot project structure</h1> <p>One of my first issues when starting a project is how to structure everything. So I had to spend some time researching best practices and go with what I like the most and after trying some of them I wanted to write down somewhere what I’m sticking with.</p> @@ -226,10 +230,10 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Sun, May 22, 2022 @ 01:16 UTC</p> - <p>Modified: Tue, May 24, 2022 @ 04:35 UTC</p> + <p>Modified: Fri, May 05, 2023 @ 08:37 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a> </p> +<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a> </p> </div> </div> diff --git a/live/blog/g/gogodot_jam3_devlog_1.html b/live/blog/g/gogodot_jam3_devlog_1.html index 31060cb..55c3e1c 100644 --- a/live/blog/g/gogodot_jam3_devlog_1.html +++ b/live/blog/g/gogodot_jam3_devlog_1.html @@ -16,14 +16,23 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> + + + + <!-- highlight support for code blocks --> <script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> <script type="text/javascript"> hljs.initHighlightingOnLoad(); </script> <link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + <!-- Specific to GDScript --> + <script type="text/javascript" src="https://static.luevano.xyz/hl/languages/gdscript.min.js"></script> + <!-- og meta --> <meta property="og:title" content="Creating my Go Godot Jam 3 entry using Godot 3.5 devlog 1 -- Luevano's Blog"/> <meta property="og:type" content="article"/> @@ -73,35 +82,70 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Creating my Go Godot Jam 3 entry using Godot 3.5 devlog 1</h1> - <p>The jam’s theme is Evolution and all the details are listed <a href="https://itch.io/jam/go-godot-jam-3">here</a>. <del>This time I’m logging as I go, so there might be some changes to the script or scenes along the way</del> <ins>I couldn’t actually do this, as I was running out of time.</ins>. Note that I’m not going to go into much details, the obvious will be ommitted.</p> + <p>The jam’s theme is Evolution and all the details are listed <a href="https://itch.io/jam/go-godot-jam-3">here</a>. <del>This time I’m logging as I go, so there might be some changes to the script or scenes along the way.</del> <ins>I couldn’t actually do this, as I was running out of time</ins>. Note that I’m not going to go into much details, the obvious will be ommitted.</p> <p>I wanted to do a <em>Snake</em> clone, and I’m using this jam as an excuse to do it and add something to it. The features include:</p> <ul> <li>Snakes will pass their stats in some form to the next snakes.</li> <li>Non-grid snake movement. I just hate the grid constraint, so I wanted to make it move in any direction.</li> -<li>Depending on the food you eat, you’ll gain new mutations/abilities <del>and the more you eat the more that mutation develops.</del> <ins>didn’t have time to add this feature, sad.</ins></li> +<li>Depending on the food you eat, you’ll gain new mutations/abilities <del>and the more you eat the more that mutation develops</del> <ins>didn’t have time to add this feature, sad</ins>.</li> <li>Procedural map creation.</li> </ul> -<p>I created this game using <em>Godot 3.5-rc3</em>. You can find the source code in my GitHub <a href="https://github.com/luevano/gogodot_jam3">here</a> which at the time of writing this it doesn’t contain any exported files, for that you can go ahead and play it in your browser at itch.io, which you can find below:</p> -<p style="text-align:center"><iframe src="https://itch.io/embed/1562701?dark=true" width="552" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/snake-tronic">Snake-tronic by Lorentzeus</a></iframe></p> +<p>I created this game using <em>Godot 3.5-rc3</em>. You can find the source code in my GitHub <a href="https://github.com/luevano/gogodot_jam3">here</a> which at the time of writing this it doesn’t contain any exported files, for that you can go ahead and play it in your browser at <a href="https://lorentzeus.itch.io/snake-tronic">itch.io</a>, which you can find below:</p> +<p style="text-align:center"><iframe src="https://itch.io/embed/1562701?dark=true" width="208" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/snake-tronic">Snake-tronic by Lorentzeus</a></iframe></p> <p>You can also find the jam entry <a href="https://itch.io/jam/go-godot-jam-3/rate/1562701">here</a>.</p> <p>Similarly with the my FlappyBird clone, I plan to update this to a better state.</p> -<h3 id="initial-setup">Initial setup<a class="headerlink" href="#initial-setup" title="Permanent link">¶</a></h3> -<p>Again, similar to the <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1.html">FlappyBird</a> clone I developed, I’m using the directory structure I wrote about on <a href="https://blog.luevano.xyz/g/godot_project_structure.html">Godot project structure</a> with slight modifications to test things out. Also using similar <em>Project settings</em> as those from the <em>FlappyBird</em> clone like the pixel art texture imports, keybindings, layers, etc..</p> -<p>I’ve also setup <a href="https://github.com/bram-dingelstad/godot-gifmaker">GifMaker</a>, with slight modifications as the <em>AssetLib</em> doesn’t install it correctly and contains unnecessry stuff: moved necessary files to the <code>res://addons</code> directory, deleted test scenes and files in general, and copied the license to the <code>res://docs</code> directory. Setting this up was a bit annoying because the tutorial it’s bad (with all due respect). I might do a separate entry just to explain how to set it up, because I couldn’t find it anywhere other than by inspecting some of the code/scenes.<ins>I ended up not leaving this enabled in the game as it lagged the game out, but it’s an option I’ll end up researching more.</ins></p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#initial-setup">Initial setup</a></li> +<li><a href="#assets">Assets</a></li> +<li><a href="#the-snake">The snake</a><ul> +<li><a href="#basic-movement">Basic movement</a></li> +<li><a href="#setting-up-path-following">Setting up path following</a></li> +<li><a href="#define-body-parts-for-the-snake">Define body parts for the snake</a></li> +<li><a href="#adding-body-parts">Adding body parts</a></li> +<li><a href="#fix-on-body-segments-following-head">Fix on body segments following head</a></li> +</ul> +</li> +<li><a href="#the-food">The food</a></li> +<li><a href="#za-warudo-the-world">Za warudo! (The world)</a><ul> +<li><a href="#food-placement">Food placement</a></li> +</ul> +</li> +<li><a href="#stats-clas-and-loadingsaving-data">Stats clas and loading/saving data</a><ul> +<li><a href="#stats-class">Stats class</a></li> +<li><a href="#loadsave-data">Load/save data</a></li> +</ul> +</li> +<li><a href="#scoring">Scoring</a></li> +<li><a href="#snake-redesigned-with-the-state-machine-pattern">Snake redesigned with the state machine pattern</a></li> +<li><a href="#other-minor-stuff">Other minor stuff</a></li> +<li><a href="#final-notes">Final notes</a></li> +</ul> +</div> +<h2 id="initial-setup">Initial setup<a class="headerlink" href="#initial-setup" title="Permanent link">¶</a></h2> +<p>Again, similar to the <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1.html">FlappyBird</a> clone I created, I’m using the directory structure I wrote about on <a href="https://blog.luevano.xyz/g/godot_project_structure.html">Godot project structure</a> with slight modifications to test things out. Also using similar <em>Project settings</em> as those from the <em>FlappyBird</em> clone like the pixel art texture imports, keybindings, layers, etc..</p> +<p>I’ve also setup <a href="https://github.com/bram-dingelstad/godot-gifmaker">GifMaker</a>, with slight modifications as the <em>AssetLib</em> doesn’t install it correctly and contains unnecessry stuff: moved necessary files to the <code>res://addons</code> directory, deleted test scenes and files in general, and copied the license to the <code>res://docs</code> directory. Setting this up was a bit annoying because the tutorial it’s bad (with all due respect). I might do a separate entry just to explain how to set it up, because I couldn’t find it anywhere other than by inspecting some of the code/scenes. <ins>I ended up leaving this disabled in the game as it hit the performance by a lot, but it’s an option I’ll end up researching more</ins>.</p> <p>This time I’m also going to be using an <a href="https://www.gdquest.com/docs/guidelines/best-practices/godot-gdscript/event-bus/">Event bus</a> singleton (which I’m going to just call <em>Event</em>) as managing signals was pretty annoying on my last project; as well as a <em>Global</em> singleton for essential stuff so I don’t have to do as many cross references between nodes/scenes.</p> -<h3 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h3> +<h2 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h2> <p>This time I’ll be creating my own assets in <a href="https://www.aseprite.org/">Aseprite</a>, wont be that good, but enough to prototype and get things going.</p> <p>Other than that I used few key sprites from <a href="https://vryell.itch.io/">vryell</a>: <a href="https://vryell.itch.io/controller-keyboard-icons">Controller & Keyboard Icons</a> and a font from <a href="https://datagoblin.itch.io/">datagoblin</a>: <a href="https://datagoblin.itch.io/monogram">Monogram</a>.</p> -<h3 id="the-snake">The snake<a class="headerlink" href="#the-snake" title="Permanent link">¶</a></h3> +<h2 id="the-snake">The snake<a class="headerlink" href="#the-snake" title="Permanent link">¶</a></h2> <p>This is the most challenging part in my opinion as making all the body parts follow the head in a user defined path it’s kinda hard. I tried with like 4-5 options and the one I’m detailing here is the only one that worked as I wanted for me. This time the directory structure I’m using is the following:</p> <figure id="__yafg-figure-32"> -<img alt="FileSystem - Snake dir structure" src="images/g/gogodot_jam3/file_system_snake_dir_structure.png" title="FileSystem - Snake dir structure"> +<img alt="FileSystem - Snake dir structure" src="https://static.luevano.xyz/images/g/gogodot_jam3/file_system_snake_dir_structure.png" title="FileSystem - Snake dir structure"> <figcaption>FileSystem - Snake dir structure</figcaption> </figure> -<h4 id="basic-movement">Basic movement<a class="headerlink" href="#basic-movement" title="Permanent link">¶</a></h4> +<h3 id="basic-movement">Basic movement<a class="headerlink" href="#basic-movement" title="Permanent link">¶</a></h3> <p>The most basic thing is to move the head, this is what we have control of. Create a scene called <code>Head.tscn</code> and setup the basic <em>KinematicBody2D</em> with it’s own <em>Sprite</em> and <em>CollisionShape2D</em> (I used a small circle for the tip of the head), and set the <em>Collision Layer/Mask</em> accordingly, for now just <code>layer = bit 1</code>. And all we need to do, is keep moving the snake forwards and be able to rotate left or right. Created a new script called <code>head.gd</code> attached to the root (<em>KinematicBody2D</em>) and added:</p> <pre><code class="language-gdscript">extends KinematicBody2D @@ -132,10 +176,10 @@ func _rotate_to(direction: int) -> void: </code></pre> <p>After tunning all the necessary parameters you should get something like this:</p> <figure id="__yafg-figure-33"> -<img alt="Snake - Basic movement (left and right controls)" src="images/g/gogodot_jam3/snake_basic_movement.gif" title="Snake - Basic movement (left and right controls)"> +<img alt="Snake - Basic movement (left and right controls)" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement.gif" title="Snake - Basic movement (left and right controls)"> <figcaption>Snake - Basic movement (left and right controls)</figcaption> </figure> -<h4 id="setting-up-path-following">Setting up path following<a class="headerlink" href="#setting-up-path-following" title="Permanent link">¶</a></h4> +<h3 id="setting-up-path-following">Setting up path following<a class="headerlink" href="#setting-up-path-following" title="Permanent link">¶</a></h3> <p>To move other snake parts by following the snake head the only solution I found was to use the <em>Path2D</em> and <em>PathFollow2D</em> nodes. <em>Path2D</em> basically just handles the curve/path that <em>PathFollow2D</em> will use to move its child node; and I say “child node” in singular… as <em>PathFollow2D</em> can only handle one damn child, all the other ones will have weird transformations and/or rotations. So, the next thing to do is to setup a way to compute (and draw so we can validate) the snake’s path/curve.</p> <p>Added the signal <code>snake_path_new_point(coordinates)</code> to the <em>Event</em> singleton and then add the following to <code>head.gd</code>:</p> <pre><code class="language-gdscript">var _time_elapsed: float = 0.0 @@ -169,10 +213,10 @@ func _on_Head_snake_path_new_point(coordinates: Vector2) -> void: </code></pre> <p>With this, we’re now populating the <em>Path2D</em> curve points with the position of the snake head. You should be able to see it because of the <code>_draw</code> call. If you run it you should see something like this:</p> <figure id="__yafg-figure-34"> -<img alt="Snake - Basic movement with path" src="images/g/gogodot_jam3/snake_basic_movement_with_path.gif" title="Snake - Basic movement with path"> +<img alt="Snake - Basic movement with path" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement_with_path.gif" title="Snake - Basic movement with path"> <figcaption>Snake - Basic movement with path</figcaption> </figure> -<h4 id="define-body-parts-for-the-snake">Define body parts for the snake<a class="headerlink" href="#define-body-parts-for-the-snake" title="Permanent link">¶</a></h4> +<h3 id="define-body-parts-for-the-snake">Define body parts for the snake<a class="headerlink" href="#define-body-parts-for-the-snake" title="Permanent link">¶</a></h3> <p>At this point the only thing to do is to add the corresponding next body parts and tail of the snake. To do so, we need a <em>PathFollow2D</em> to use the live-generating <em>Path2D</em>, the only caveat is that we need one of these per body part/tail (this took me hours to figure out, <em>thanks documentation</em>).</p> <p>Create a new scene called <code>Body.tscn</code> with a <em>PathFollow2D</em> as its root and an <em>Area2D</em> as its child, then just add the necessary <em>Sprite</em> and <em>CollisionShap2D</em> for the <em>Area2D</em>, I’m using <code>layer = bit 2</code> for its collision. Create a new script called <code>generic_segment.gd</code> with the following code:</p> <pre><code class="language-gdscript">extends PathFollow2D @@ -184,7 +228,7 @@ func _physics_process(delta: float) -> void: offset += Global.SNAKE_SPEED * delta </code></pre> <p>And this can be attached to the <em>Body</em>‘s root node (<em>PathFollow2D</em>), no extra setup needed. Repeat the same steps for creating the <code>Tail.tscn</code> scene and when attaching the <code>generic_segment.gd</code> script just configure the <code>Type</code> parameter to <code>tail</code> in the GUI (by selecting the node with the script attached and editing in the <em>Inspector</em>).</p> -<h4 id="adding-body-parts">Adding body parts<a class="headerlink" href="#adding-body-parts" title="Permanent link">¶</a></h4> +<h3 id="adding-body-parts">Adding body parts<a class="headerlink" href="#adding-body-parts" title="Permanent link">¶</a></h3> <p>Now it’s just a matter of handling when to add new body parts in the <code>snake.gd</code> script. For now I’ve only setup for adding body parts to fulfill the initial length of the snake (this doesn’t include the head or tail). The extra code needed is the following:</p> <pre><code class="language-gdscript">export(PackedScene) var BODY_SEGMENT_NP: PackedScene export(PackedScene) var TAIL_SEGMENT_NP: PackedScene @@ -213,7 +257,7 @@ func _on_Head_snake_path_new_point(coordinates: Vector2) -> void: </code></pre> <p>Select the <em>Snake</em> node and add the <em>Body</em> and <em>Tail</em> scene to the parameters, respectively. Then when running you should see something like this:</p> <figure id="__yafg-figure-35"> -<img alt="Snake - Basic movement with all body parts" src="images/g/gogodot_jam3/snake_basic_movement_added_body_parts.gif" title="Snake - Basic movement with all body parts"> +<img alt="Snake - Basic movement with all body parts" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement_added_body_parts.gif" title="Snake - Basic movement with all body parts"> <figcaption>Snake - Basic movement with all body parts</figcaption> </figure> <p>Now, we need to handle adding body parts after the snake is complete and already moved for a bit, this will require a queue so we can add part by part in the case that we eat multiple pieces of food in a short period of time. For this we need to add some signals: <code>snake_adding_new_segment(type)</code>, <code>snake_added_new_segment(type)</code>, <code>snake_added_initial_segments</code> and use them when makes sense. Now we need to add the following:</p> @@ -254,9 +298,9 @@ func _add_segment_to_queue() -> void: else: body_segment_queue.append(body_segment_queue.back() + Global.SNAKE_SEGMENT_SIZE) </code></pre> -<p>With everything implemented and connected accordingly then we can add segments on demand (for testing I’m adding with a keystroke), it should look like this:</p> +<p>With everything implemented and connected accordingly then we can add segments on demand (for testing I’m adding with a key press), it should look like this:</p> <figure id="__yafg-figure-36"> -<img alt="Snake - Basic movement with dynamic addition of new segments" src="images/g/gogodot_jam3/snake_basic_movement_with_dynamic_segments.gif" title="Snake - Basic movement with dynamic addition of new segments"> +<img alt="Snake - Basic movement with dynamic addition of new segments" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement_with_dynamic_segments.gif" title="Snake - Basic movement with dynamic addition of new segments"> <figcaption>Snake - Basic movement with dynamic addition of new segments</figcaption> </figure> <p>For now, this should be enough, I’ll add more stuff as needed as I go. Last thing is that after finished testing that the movement felt ok, I just added a way to stop the snake whenever it collides with itself by using the following code (and the signal <code>snake_segment_body_entered(body)</code>) in a <code>main.gd</code> script that is the entry point for the game:</p> @@ -268,13 +312,13 @@ func _add_segment_to_queue() -> void: _snake.propagate_call("set_process_input", [on_off]) </code></pre> <p>Which will stop the snake node and all children.</p> -<h4 id="fix-on-body-segments-following-head">Fix on body segments following head<a class="headerlink" href="#fix-on-body-segments-following-head" title="Permanent link">¶</a></h4> +<h3 id="fix-on-body-segments-following-head">Fix on body segments following head<a class="headerlink" href="#fix-on-body-segments-following-head" title="Permanent link">¶</a></h3> <p>After a while of testing and developing, I noticed that sometimes the head “detaches” from the body when a lot of rotations happen (moving the snake left or right), because of how imprecise the <em>Curve2D</em> is. To do this I just send a signal (<code>snake_rotated</code>) whenever the snake rotates and make a small correction (in <code>generic_segment.gd</code>):</p> <pre><code class="language-gdscript">func _on_snake_rotated() -> void: offset -= 0.75 * Global.SNAKE_SPEED * pow(get_physics_process_delta_time(), 2) </code></pre> <p>This is completely random, I tweaked it manually after a lot of iterations.</p> -<h3 id="the-food">The food<a class="headerlink" href="#the-food" title="Permanent link">¶</a></h3> +<h2 id="the-food">The food<a class="headerlink" href="#the-food" title="Permanent link">¶</a></h2> <p>For now I just decided to setup a simple system to see everything works fine. The idea is to make some kind of generic food node/scene and a “food manager” to spawn them, for now in totally random locations. For this I added the following signals: <code>food_placing_new_food(type)</code>, <code>food_placed_new_food(type)</code> and <code>food_eaten(type)</code>.</p> <p>First thing is creating the <code>Food.tscn</code> which is just an <em>Area2D</em> with its necessary children with an attached script called <code>food.gd</code>. The script is really simple:</p> <pre><code class="language-gdscript">class_name Food # needed to access Type enum outside of the script, this registers this script as a node @@ -319,21 +363,21 @@ func _on_body_entered(body: Node) -> void: </code></pre> <p>And this is used in <code>_process</code> to place new food whenever needed. For now I added a condition to add food until 10 pieces are in place, and keep adding whenever the food is is lower than 10. After setting everything up, this is the result:</p> <figure id="__yafg-figure-37"> -<img alt="Snake - Food basic interaction" src="images/g/gogodot_jam3/snake_food_basic_interaction.gif" title="Snake - Food basic interaction"> +<img alt="Snake - Food basic interaction" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_food_basic_interaction.gif" title="Snake - Food basic interaction"> <figcaption>Snake - Food basic interaction</figcaption> </figure> -<h3 id="za-warudo-the-world">Za warudo! (The world)<a class="headerlink" href="#za-warudo-the-world" title="Permanent link">¶</a></h3> +<h2 id="za-warudo-the-world">Za warudo! (The world)<a class="headerlink" href="#za-warudo-the-world" title="Permanent link">¶</a></h2> <p>It just happend that I saw a video to create random maps by using a method called <a href="https://www.mit.edu/~kardar/teaching/projects/chemotaxis(AndreaSchmidt)/random.htm">random walks</a>, this video was made by <a href="https://www.youtube.com/c/NADLABS">NAD LABS</a>: <a href="https://www.youtube.com/watch?v=ppP2Doq3p7s">Nuclear Throne Like Map Generation In Godot</a>. It’s a pretty simple but powerful script, he provided the source code from which I based my random walker, just tweaked a few things and added others. Some of the maps than can be generated with this method (already aded some random sprites):</p> <figure id="__yafg-figure-38"> -<img alt="World map generator - Random map 1" src="images/g/gogodot_jam3/world_generator_1.png" title="World map generator - Random map 1"> +<img alt="World map generator - Random map 1" src="https://static.luevano.xyz/images/g/gogodot_jam3/world_generator_1.png" title="World map generator - Random map 1"> <figcaption>World map generator - Random map 1</figcaption> </figure> <figure id="__yafg-figure-39"> -<img alt="World map generator - Random map 2" src="images/g/gogodot_jam3/world_generator_2.png" title="World map generator - Random map 2"> +<img alt="World map generator - Random map 2" src="https://static.luevano.xyz/images/g/gogodot_jam3/world_generator_2.png" title="World map generator - Random map 2"> <figcaption>World map generator - Random map 2</figcaption> </figure> <figure id="__yafg-figure-40"> -<img alt="World map generator - Random map 3" src="images/g/gogodot_jam3/world_generator_3.png" title="World map generator - Random map 3"> +<img alt="World map generator - Random map 3" src="https://static.luevano.xyz/images/g/gogodot_jam3/world_generator_3.png" title="World map generator - Random map 3"> <figcaption>World map generator - Random map 3</figcaption> </figure> <p>It started with just black and white tiles, but I ended up adding some sprites as it was really harsh to the eyes. My implementation is basically the same as <em>NAD LABS</em>‘ with few changes, most importantly: I separated the generation in 2 diferent tilemaps (floor and wall) to have better control as well as wrapped everything in a single scene with a “main” script with the following important functions:</p> @@ -350,7 +394,7 @@ func get_centered_world_position(location: Vector2) -> Vector2: </code></pre> <p>Where <code>get_cells_around</code> is just a function that gets the safe cells around the origin. And this <code>get_valid_map_coords</code> just returns used cells minus the safe cells, to place food. <code>get_centered_world_position</code> is so we can center the food in the tiles.</p> <p>Some signals I used for the world gen: <code>world_gen_walker_started(id)</code>, <code>world_gen_walker_finished(id)</code>, <code>world_gen_walker_died(id)</code> and <code>world_gen_spawn_walker_unit(location)</code>.</p> -<h4 id="food-placement">Food placement<a class="headerlink" href="#food-placement" title="Permanent link">¶</a></h4> +<h3 id="food-placement">Food placement<a class="headerlink" href="#food-placement" title="Permanent link">¶</a></h3> <p>The last food algorithm doesn’t check anything related to the world, and thus the food could spawn in the walls and outside the map.</p> <p>First thing is I generalized the food into a single script and added basic food and special food which inherit from base food. The most important stuff for the base food is to be able to set all necessary properties at first:</p> <pre><code class="language-gdscript">func update_texture() -> void: @@ -400,10 +444,10 @@ func _ready(): return [world_generator.get_centered_world_position(location), location] </code></pre> <p>Other than that, there are some differences between placing normal and special food (specially the signal they send, and if an extra “special points” property is set). Some of the signals that I used that might be important: <code>food_placing_new_food(type)</code>, <code>food_placed_new_food(type, location)</code> and <code>food_eaten(type, location)</code>.</p> -<h3 id="stats-clas-and-loadingsaving-data">Stats clas and loading/saving data<a class="headerlink" href="#stats-clas-and-loadingsaving-data" title="Permanent link">¶</a></h3> -<p>I got the idea of saving the current stats (points, max body segments, etc.) in a separate <em>Stats</em> class for easier load/save data. This option I went with didn’t work as I would liked it to work, as it was a pain in the ass to setup and each time a new property is added you have to manually setup the load/save helper functions… so not the best option. This option I used was json but saving a Node directly could work better or using resources (saving <code>tres</code> files).</p> -<h4 id="stats-class">Stats class<a class="headerlink" href="#stats-class" title="Permanent link">¶</a></h4> -<p>The <em>Stats</em> “class” is just a script that extends from <em>Node</em> called <code>stats.gd</code>. It needs to define the <code>class_name</code> as <code>Stats</code>. The main content:</p> +<h2 id="stats-clas-and-loadingsaving-data">Stats clas and loading/saving data<a class="headerlink" href="#stats-clas-and-loadingsaving-data" title="Permanent link">¶</a></h2> +<p>I got the idea of saving the current stats (points, max body segments, etc.) in a separate <code>Stats</code> class for easier load/save data. This option I went with didn’t work as I would liked it to work, as it was a pain in the ass to setup and each time a new property is added you have to manually setup the load/save helper functions… so not the best option. This option I used was json but saving a Node directly could work better or using resources (saving <code>tres</code> files).</p> +<h3 id="stats-class">Stats class<a class="headerlink" href="#stats-class" title="Permanent link">¶</a></h3> +<p>The <code>Stats</code> “class” is just a script that extends from <em>Node</em> called <code>stats.gd</code>. It needs to define the <code>class_name</code> as <code>Stats</code>. The main content:</p> <pre><code class="language-gdscript"># main var points: int = 0 var segments: int = 0 @@ -465,8 +509,8 @@ func set_stats(stats: Dictionary) -> void: trait_jump = stats["trait_jump"] </code></pre> <p>And this is not scalable at all, but I had to do this at the end of the jam so no way of optimizing and/or doing it correctly, sadly.</p> -<h4 id="loadsave-data">Load/save data<a class="headerlink" href="#loadsave-data" title="Permanent link">¶</a></h4> -<p>The load/save function is pretty standard. It’s a singleton/autoload called <em>SavedData</em> with a script that extends from <em>Node</em> called <code>save_data.gd</code>:</p> +<h3 id="loadsave-data">Load/save data<a class="headerlink" href="#loadsave-data" title="Permanent link">¶</a></h3> +<p>The load/save function is pretty standard. It’s a singleton/autoload called <code>SavedData</code> with a script that extends from <em>Node</em> called <code>save_data.gd</code>:</p> <pre><code class="language-gdscript">const DATA_PATH: String = "user://data.save" var _stats: Stats @@ -508,9 +552,9 @@ func _handle_new_file() -> void: file.store_line(to_json(_stats.get_stats())) file.close() </code></pre> -<p>It uses json as the file format, but I might end up changing this in the future to something else more reliable and easier to use (<em>Stats</em> class related issues).</p> -<h3 id="scoring">Scoring<a class="headerlink" href="#scoring" title="Permanent link">¶</a></h3> -<p>For this I created a scoring mechanisms and just called it <em>ScoreManager</em> (<code>score_manager.gd</code>) which just basically listens to <code>food_eaten</code> signal and adds points accordingly to the current <em>Stats</em> object loaded. The main function is:</p> +<p>It uses json as the file format, but I might end up changing this in the future to something else more reliable and easier to use (<code>Stats</code> class related issues).</p> +<h2 id="scoring">Scoring<a class="headerlink" href="#scoring" title="Permanent link">¶</a></h2> +<p>For this I created a scoring mechanisms and just called it <code>ScoreManager</code> (<code>score_manager.gd</code>) which just basically listens to <code>food_eaten</code> signal and adds points accordingly to the current <em>Stats</em> object loaded. The main function is:</p> <pre><code class="language-gdscript">func _on_food_eaten(properties: Dictionary) -> void: var is_special: bool = properties["special"] var type: int = properties["type"] @@ -550,7 +594,7 @@ func _handle_new_file() -> void: </code></pre> <p>Which will add the necessary points to <code>Stats.points</code> and return the amount of new snake segments to grow. After this <code>_spawn_added_score_segment</code> and <code>_spawn_added_segment_text</code> just spawn a <em>Label</em> with the info on the points/segments gained; this is custom UI I created, nothing fancy.</p> <p>Last thing is taht in <code>_process_points</code> there is a check at the end, where if the food eaten is “special” then a custom variation of the last 3 functions are executed. These are really similar, just specific to each kind of food.</p> -<p>This <em>ScoreManager</em> also handles the calculation for the <code>game_over</code> signal, to calculte progress, set necessary <em>Stats</em> values and save the data:</p> +<p>This <code>ScoreManager</code> also handles the calculation for the <code>game_over</code> signal, to calculte progress, set necessary <code>Stats</code> values and save the data:</p> <pre><code class="language-gdscript">func _on_game_over() -> void: var max_stats: Stats = _get_max_stats() SaveData.save_data(max_stats) @@ -577,8 +621,8 @@ func _get_max_stats() -> Stats: return max_stats </code></pre> <p>Then this sends a signal <code>display_stats</code> to activate UI elements that shows the progression.</p> -<p>Naturally, the saved <em>Stats</em> are loaded whenever needed. For example, for the <em>Snake</em>, we load the stats and setup any value needed from there (like a flag to know if any ability is enabled), and since we’re saving the new <em>Stats</em> at the end, then on restart we load the updated one.</p> -<h3 id="snake-redesigned-with-the-state-machine-pattern">Snake redesigned with the state machine pattern<a class="headerlink" href="#snake-redesigned-with-the-state-machine-pattern" title="Permanent link">¶</a></h3> +<p>Naturally, the saved <code>Stats</code> are loaded whenever needed. For example, for the <code>Snake</code>, we load the stats and setup any value needed from there (like a flag to know if any ability is enabled), and since we’re saving the new <code>Stats</code> at the end, then on restart we load the updated one.</p> +<h2 id="snake-redesigned-with-the-state-machine-pattern">Snake redesigned with the state machine pattern<a class="headerlink" href="#snake-redesigned-with-the-state-machine-pattern" title="Permanent link">¶</a></h2> <p>I redesigned the snake code (the head, actually) to use the state machine pattern by following <a href="https://gdscript.com/solutions/godot-state-machine/">this guide</a> which is definitely a great guide, straight to the point and easy to implement.</p> <p>Other than what is shown in the guide, I implemented some important functions in the <code>state_machine.gd</code> script itself, to be used by each of the states as needed:</p> <pre><code class="language-gdscript">func rotate_on_input() -> void: @@ -600,7 +644,7 @@ func handle_slow_speeds() -> void: Global.SNAKE_SPEED = Global.SNAKE_SPEED_BACKUP Event.emit_signal("game_over") </code></pre> -<p>And then in the <em>StateMachine</em>‘s <code>_process</code>:</p> +<p>And then in the <code>StateMachine</code>‘s <code>_process</code>:</p> <pre><code class="language-gdscript">func _physics_process(delta: float) -> void: # state specific code, move_and_slide is called here if state.has_method("physics_process"): @@ -652,7 +696,7 @@ func physics_process(delta: float) -> void: </code></pre> <p>Where the important parts happen in the <code>enter</code> and <code>exit</code> functions. We need to change the <code>Global.SNAKE_SPEED</code> with the <code>Global.SNAKE_DASH_SPEED</code> on <code>start</code>and start the timer for how long should the dash last. And on the <code>exit</code> we reset the <code>Global.SNAKE_SPEED</code> back to normal. There is probably a better way of updating the <code>Global.SNAKE_SPEED</code> but this works just fine.</p> <p>For the other ones is the same. Only difference with the <code>jump_state.gd</code> is that the collision from head to body is disabled, and no rotation is allowed (by not calling the <code>rotate_on_input</code> function).</p> -<h3 id="other-minor-stuff">Other minor stuff<a class="headerlink" href="#other-minor-stuff" title="Permanent link">¶</a></h3> +<h2 id="other-minor-stuff">Other minor stuff<a class="headerlink" href="#other-minor-stuff" title="Permanent link">¶</a></h2> <p>Not as important but worth mentioning:</p> <ul> <li>Added restartability function.</li> @@ -666,9 +710,9 @@ func physics_process(delta: float) -> void: <li>Refactored the nodes to make it work with <code>change_scene_to</code>, and added a main menu.</li> <li>Added GUI for dead screen, showing the progress.</li> </ul> -<h3 id="final-notes">Final notes<a class="headerlink" href="#final-notes" title="Permanent link">¶</a></h3> -<p>I actually didn’t finish this game (as how I visualized it), but I got it in a playable state which is good. My big learning during this jam is the time management that it requires to plan and design a game. I lost a lot of time trying to implement some mechanics because I was facing many issues, because of my lack of practice (which was expected) as well as trying to blog and create the necessary sprites myself. Next time I should just get an asset pack and do something with it, as well as keeping the scope of my game shorter.</p> -<p>For exporting and everything else, I went with what I did for my <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1#final-notes-and-exporting">FlappyBird Godot clone</a></p> +<h2 id="final-notes">Final notes<a class="headerlink" href="#final-notes" title="Permanent link">¶</a></h2> +<p>I actually didn’t finish this game (as how I visualized it), but I got it in a <em>semi-playable</em> state which is good. My big learning during this jam is the time management that it requires to plan and design a game. I lost a lot of time trying to implement some mechanics because I was facing many issues, because of my lack of practice (which was expected) as well as trying to blog and create the necessary sprites myself. Next time I should just get an asset pack and do something with it, as well as keeping the scope of my game shorter.</p> +<p>For exporting and everything else, I went with what I did for my <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1#final-notes-and-exporting">FlappyBird Godot clone: final notes and exporting</a></p> <div class="page-nav"> <span class="next"> @@ -698,9 +742,10 @@ func physics_process(delta: float) -> void: <div class="article-info"> <p>By David Luévano</p> <p>Created: Fri, Jun 10, 2022 @ 09:17 UTC</p> + <p>Modified: Thu, May 04, 2023 @ 17:05 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@gamejam.html">gamejam</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a> </p> +<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@gamejam.html">gamejam</a>, <a href="https://blog.luevano.xyz/tag/@gdscript.html">gdscript</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a> </p> </div> </div> diff --git a/live/blog/g/starting_gamedev_blogging.html b/live/blog/g/starting_gamedev_blogging.html index 20fc5ce..82c4cd2 100644 --- a/live/blog/g/starting_gamedev_blogging.html +++ b/live/blog/g/starting_gamedev_blogging.html @@ -16,13 +16,13 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> -<!-- highlight support for code blocks --> -<script type="text/javascript" src="https://static.luevano.xyz/hl/highlight.min.js"></script> -<script type="text/javascript"> - hljs.initHighlightingOnLoad(); -</script> -<link id="code-theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/hl/styles/nord.min.css"> + + + + <!-- og meta --> <meta property="og:title" content="Will start blogging about gamedev -- Luevano's Blog"/> @@ -73,11 +73,17 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Will start blogging about gamedev</h1> - <p>I’ve been wanting to get into gamedev for a while now, but it’s always a pain to stay consistent. I just recently started to get into gamedev again, and this time I’m trying to actually do stuff.</p> + <p>I’ve been wanting to get into gamedev for a while now, but it’s always a pain to stay consistent. I just recently started to get into it again, and this time I’m trying to actually do stuff.</p> <p>So, the plan is to blog about my progress and clone some simple games just to get started. I’m thinking on sticking with <a href="https://godotengine.org/">Godot</a> just because I like that it’s open source, it’s getting better and better overtime (big rewrite happening right now) and I already like how the engine works. <del>Specifically I’ll start using <em>Godot 4</em> even though it’s not done yet, to get used to the new features, specifically pumped for <a href="https://godotengine.org/article/gdscript-progress-report-feature-complete-40">GDScript 2.0</a>.</del> <ins>Actually… (for the small clones/ripoffs) I’ll need to use <em>Godot 3.X</em> (probably 3.5), as <em>Godot 4</em> doesn’t have support to export to webassembly (HTML5) yet, and I want that to publish to <a href="https://itch.io/">itch.io</a> and my website. I’ll continue to use <em>Godot 4</em> for bigger projects, as they will take longer and I hope that by the time I need to publish, there’s no issues to export.</ins></p> <p>For a moment I almost started a new subdomain just for gamedev stuff, but decided to just use a different directory for subtleness; this directory and use of tags should be enough. I’ll be posting the entry about the first rip-off I’m <em>developing</em> (FlappyBird L O L) shortly.</p> +<p><strong>Update</strong>: <a href="https://godotengine.org/article/godot-4-0-sets-sail/">Godot 4</a> already released and it now has HTML5 support, so back to the original plan.</p> <div class="page-nav"> <span class="next"> @@ -107,10 +113,10 @@ <div class="article-info"> <p>By David Luévano</p> <p>Created: Tue, May 17, 2022 @ 05:19 UTC</p> - <p>Modified: Sun, May 22, 2022 @ 00:27 UTC</p> + <p>Modified: Fri, May 05, 2023 @ 08:37 UTC</p> <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> +<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> </div> </div> diff --git a/live/blog/index.html b/live/blog/index.html index 6183fee..3e9f993 100644 --- a/live/blog/index.html +++ b/live/blog/index.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Index -- Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Index -- Luevano's Blog</h1> <p>Welcome to my blog where I'll post whatever I please, ranging from rants to how-to's. Además, este pex va a estar en español e inglés porque quiero (no una mezcla en cada entrada, pero sí entradas completas en diferentes lenguajes).</p> @@ -74,7 +81,7 @@ <div class="article-tags"> <p>Tags: -<a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@gamejam.html">gamejam</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a>, <a href="https://blog.luevano.xyz/tag/@rant.html">rant</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@spanish.html">spanish</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> +<a href="https://blog.luevano.xyz/tag/@code.html">code</a>, <a href="https://blog.luevano.xyz/tag/@english.html">english</a>, <a href="https://blog.luevano.xyz/tag/@gamedev.html">gamedev</a>, <a href="https://blog.luevano.xyz/tag/@gamejam.html">gamejam</a>, <a href="https://blog.luevano.xyz/tag/@gdscript.html">gdscript</a>, <a href="https://blog.luevano.xyz/tag/@godot.html">godot</a>, <a href="https://blog.luevano.xyz/tag/@rant.html">rant</a>, <a href="https://blog.luevano.xyz/tag/@server.html">server</a>, <a href="https://blog.luevano.xyz/tag/@short.html">short</a>, <a href="https://blog.luevano.xyz/tag/@spanish.html">spanish</a>, <a href="https://blog.luevano.xyz/tag/@tools.html">tools</a>, <a href="https://blog.luevano.xyz/tag/@tutorial.html">tutorial</a>, <a href="https://blog.luevano.xyz/tag/@update.html">update</a> </p> </div> @@ -96,7 +103,7 @@ <li>Aug 01 - <a href="https://blog.luevano.xyz/a/vpn_server_with_openvpn.html">Create a VPN server with OpenVPN (IPv4)</a></li> <h3>July 2021</h3> <li>Jul 28 - <a href="https://blog.luevano.xyz/a/hoy_toco_desarrollo_personaje.html">Hoy me tocó desarrollo de personaje</a></li> - <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenia este pex algo descuidado</a></li> + <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenía este pex algo descuidado</a></li> <h3>June 2021</h3> <li>Jun 09 - <a href="https://blog.luevano.xyz/a/xmpp_server_with_prosody.html">Create an XMPP server with Prosody compatible with Conversations and Movim</a></li> <li>Jun 06 - <a href="https://blog.luevano.xyz/a/acomodada_la_pagina_de_arte.html">Al fin ya me acomodé la página pa' los dibujos</a></li> diff --git a/live/blog/rss.xml b/live/blog/rss.xml index ef21a4e..dd6e44a 100644 --- a/live/blog/rss.xml +++ b/live/blog/rss.xml @@ -32,7 +32,7 @@ <category>Tools</category> <category>Update</category> <description>Rewrote pyssg to make it more flexible and to work with YAML configuration files.</description> - <content:encoded><![CDATA[<p>I’ve been wanting to change the way <a href="https://github.com/luevano/pyssg">pyssg</a> reads config files and generates <code>HTML</code> files so that it is more flexible and I don’t need to have 2 separate build commands and configs (for <a href="https://blog.luevano.xyz">blog</a> and <a href="https://art.luevano.xyz">art</a>), and also to handle other types of “sites”; because <code>pyssg</code> was built with blogging in mind, so it was a bit limited to how it could be used. So I had to kind of <em>rewrite</em> <code>pyssg</code>, and with the latest version I can now generate the whole site and use the same templates for everything, quite neat for my use case.</p> + <content:encoded><![CDATA[<p>I’ve been wanting to change the way <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> reads config files and generates <code>HTML</code> files so that it is more flexible and I don’t need to have 2 separate build commands and configs (for <a href="https://blog.luevano.xyz">blog</a> and <a href="https://art.luevano.xyz">art</a>), and also to handle other types of “sites”; because <code>pyssg</code> was built with blogging in mind, so it was a bit limited to how it could be used. So I had to kind of <em>rewrite</em> <code>pyssg</code>, and with the latest version I can now generate the whole site and use the same templates for everything, quite neat for my use case.</p> <p>Anyways, so I bought a new domain for all <code>pyssg</code> related stuff, mostly because I wanted somewhere to test live builds while developing, it is of course <a href="https://pyssg.xyz">pyssg.xyz</a>; as of now it is the same template, CSS and scripts that I use here, probably will change in the future. I’ll be testing new features and anything <code>pyssg</code> related stuff.</p> <p>I should start pointing all links to <code>pyssg</code> to the actual site instead of the github repository (or my <a href="https://git.luevano.xyz">git</a> repository), but I haven’t decided how to handle everything.</p>]]></content:encoded> </item> @@ -44,35 +44,66 @@ <category>English</category> <category>Gamedev</category> <category>Gamejam</category> + <category>Gdscript</category> <category>Godot</category> <description>Details on the implementation for the game I created for the Go Godot Jam 3, which theme is Evolution.</description> - <content:encoded><![CDATA[<p>The jam’s theme is Evolution and all the details are listed <a href="https://itch.io/jam/go-godot-jam-3">here</a>. <del>This time I’m logging as I go, so there might be some changes to the script or scenes along the way</del> <ins>I couldn’t actually do this, as I was running out of time.</ins>. Note that I’m not going to go into much details, the obvious will be ommitted.</p> + <content:encoded><![CDATA[<p>The jam’s theme is Evolution and all the details are listed <a href="https://itch.io/jam/go-godot-jam-3">here</a>. <del>This time I’m logging as I go, so there might be some changes to the script or scenes along the way.</del> <ins>I couldn’t actually do this, as I was running out of time</ins>. Note that I’m not going to go into much details, the obvious will be ommitted.</p> <p>I wanted to do a <em>Snake</em> clone, and I’m using this jam as an excuse to do it and add something to it. The features include:</p> <ul> <li>Snakes will pass their stats in some form to the next snakes.</li> <li>Non-grid snake movement. I just hate the grid constraint, so I wanted to make it move in any direction.</li> -<li>Depending on the food you eat, you’ll gain new mutations/abilities <del>and the more you eat the more that mutation develops.</del> <ins>didn’t have time to add this feature, sad.</ins></li> +<li>Depending on the food you eat, you’ll gain new mutations/abilities <del>and the more you eat the more that mutation develops</del> <ins>didn’t have time to add this feature, sad</ins>.</li> <li>Procedural map creation.</li> </ul> -<p>I created this game using <em>Godot 3.5-rc3</em>. You can find the source code in my GitHub <a href="https://github.com/luevano/gogodot_jam3">here</a> which at the time of writing this it doesn’t contain any exported files, for that you can go ahead and play it in your browser at itch.io, which you can find below:</p> -<p style="text-align:center"><iframe src="https://itch.io/embed/1562701?dark=true" width="552" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/snake-tronic">Snake-tronic by Lorentzeus</a></iframe></p> +<p>I created this game using <em>Godot 3.5-rc3</em>. You can find the source code in my GitHub <a href="https://github.com/luevano/gogodot_jam3">here</a> which at the time of writing this it doesn’t contain any exported files, for that you can go ahead and play it in your browser at <a href="https://lorentzeus.itch.io/snake-tronic">itch.io</a>, which you can find below:</p> +<p style="text-align:center"><iframe src="https://itch.io/embed/1562701?dark=true" width="208" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/snake-tronic">Snake-tronic by Lorentzeus</a></iframe></p> <p>You can also find the jam entry <a href="https://itch.io/jam/go-godot-jam-3/rate/1562701">here</a>.</p> <p>Similarly with the my FlappyBird clone, I plan to update this to a better state.</p> -<h3 id="initial-setup">Initial setup<a class="headerlink" href="#initial-setup" title="Permanent link">¶</a></h3> -<p>Again, similar to the <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1.html">FlappyBird</a> clone I developed, I’m using the directory structure I wrote about on <a href="https://blog.luevano.xyz/g/godot_project_structure.html">Godot project structure</a> with slight modifications to test things out. Also using similar <em>Project settings</em> as those from the <em>FlappyBird</em> clone like the pixel art texture imports, keybindings, layers, etc..</p> -<p>I’ve also setup <a href="https://github.com/bram-dingelstad/godot-gifmaker">GifMaker</a>, with slight modifications as the <em>AssetLib</em> doesn’t install it correctly and contains unnecessry stuff: moved necessary files to the <code>res://addons</code> directory, deleted test scenes and files in general, and copied the license to the <code>res://docs</code> directory. Setting this up was a bit annoying because the tutorial it’s bad (with all due respect). I might do a separate entry just to explain how to set it up, because I couldn’t find it anywhere other than by inspecting some of the code/scenes.<ins>I ended up not leaving this enabled in the game as it lagged the game out, but it’s an option I’ll end up researching more.</ins></p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#initial-setup">Initial setup</a></li> +<li><a href="#assets">Assets</a></li> +<li><a href="#the-snake">The snake</a><ul> +<li><a href="#basic-movement">Basic movement</a></li> +<li><a href="#setting-up-path-following">Setting up path following</a></li> +<li><a href="#define-body-parts-for-the-snake">Define body parts for the snake</a></li> +<li><a href="#adding-body-parts">Adding body parts</a></li> +<li><a href="#fix-on-body-segments-following-head">Fix on body segments following head</a></li> +</ul> +</li> +<li><a href="#the-food">The food</a></li> +<li><a href="#za-warudo-the-world">Za warudo! (The world)</a><ul> +<li><a href="#food-placement">Food placement</a></li> +</ul> +</li> +<li><a href="#stats-clas-and-loadingsaving-data">Stats clas and loading/saving data</a><ul> +<li><a href="#stats-class">Stats class</a></li> +<li><a href="#loadsave-data">Load/save data</a></li> +</ul> +</li> +<li><a href="#scoring">Scoring</a></li> +<li><a href="#snake-redesigned-with-the-state-machine-pattern">Snake redesigned with the state machine pattern</a></li> +<li><a href="#other-minor-stuff">Other minor stuff</a></li> +<li><a href="#final-notes">Final notes</a></li> +</ul> +</div> +<h2 id="initial-setup">Initial setup<a class="headerlink" href="#initial-setup" title="Permanent link">¶</a></h2> +<p>Again, similar to the <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1.html">FlappyBird</a> clone I created, I’m using the directory structure I wrote about on <a href="https://blog.luevano.xyz/g/godot_project_structure.html">Godot project structure</a> with slight modifications to test things out. Also using similar <em>Project settings</em> as those from the <em>FlappyBird</em> clone like the pixel art texture imports, keybindings, layers, etc..</p> +<p>I’ve also setup <a href="https://github.com/bram-dingelstad/godot-gifmaker">GifMaker</a>, with slight modifications as the <em>AssetLib</em> doesn’t install it correctly and contains unnecessry stuff: moved necessary files to the <code>res://addons</code> directory, deleted test scenes and files in general, and copied the license to the <code>res://docs</code> directory. Setting this up was a bit annoying because the tutorial it’s bad (with all due respect). I might do a separate entry just to explain how to set it up, because I couldn’t find it anywhere other than by inspecting some of the code/scenes. <ins>I ended up leaving this disabled in the game as it hit the performance by a lot, but it’s an option I’ll end up researching more</ins>.</p> <p>This time I’m also going to be using an <a href="https://www.gdquest.com/docs/guidelines/best-practices/godot-gdscript/event-bus/">Event bus</a> singleton (which I’m going to just call <em>Event</em>) as managing signals was pretty annoying on my last project; as well as a <em>Global</em> singleton for essential stuff so I don’t have to do as many cross references between nodes/scenes.</p> -<h3 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h3> +<h2 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h2> <p>This time I’ll be creating my own assets in <a href="https://www.aseprite.org/">Aseprite</a>, wont be that good, but enough to prototype and get things going.</p> <p>Other than that I used few key sprites from <a href="https://vryell.itch.io/">vryell</a>: <a href="https://vryell.itch.io/controller-keyboard-icons">Controller & Keyboard Icons</a> and a font from <a href="https://datagoblin.itch.io/">datagoblin</a>: <a href="https://datagoblin.itch.io/monogram">Monogram</a>.</p> -<h3 id="the-snake">The snake<a class="headerlink" href="#the-snake" title="Permanent link">¶</a></h3> +<h2 id="the-snake">The snake<a class="headerlink" href="#the-snake" title="Permanent link">¶</a></h2> <p>This is the most challenging part in my opinion as making all the body parts follow the head in a user defined path it’s kinda hard. I tried with like 4-5 options and the one I’m detailing here is the only one that worked as I wanted for me. This time the directory structure I’m using is the following:</p> <figure id="__yafg-figure-32"> -<img alt="FileSystem - Snake dir structure" src="images/g/gogodot_jam3/file_system_snake_dir_structure.png" title="FileSystem - Snake dir structure"> +<img alt="FileSystem - Snake dir structure" src="https://static.luevano.xyz/images/g/gogodot_jam3/file_system_snake_dir_structure.png" title="FileSystem - Snake dir structure"> <figcaption>FileSystem - Snake dir structure</figcaption> </figure> -<h4 id="basic-movement">Basic movement<a class="headerlink" href="#basic-movement" title="Permanent link">¶</a></h4> +<h3 id="basic-movement">Basic movement<a class="headerlink" href="#basic-movement" title="Permanent link">¶</a></h3> <p>The most basic thing is to move the head, this is what we have control of. Create a scene called <code>Head.tscn</code> and setup the basic <em>KinematicBody2D</em> with it’s own <em>Sprite</em> and <em>CollisionShape2D</em> (I used a small circle for the tip of the head), and set the <em>Collision Layer/Mask</em> accordingly, for now just <code>layer = bit 1</code>. And all we need to do, is keep moving the snake forwards and be able to rotate left or right. Created a new script called <code>head.gd</code> attached to the root (<em>KinematicBody2D</em>) and added:</p> <pre><code class="language-gdscript">extends KinematicBody2D @@ -103,10 +134,10 @@ func _rotate_to(direction: int) -> void: </code></pre> <p>After tunning all the necessary parameters you should get something like this:</p> <figure id="__yafg-figure-33"> -<img alt="Snake - Basic movement (left and right controls)" src="images/g/gogodot_jam3/snake_basic_movement.gif" title="Snake - Basic movement (left and right controls)"> +<img alt="Snake - Basic movement (left and right controls)" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement.gif" title="Snake - Basic movement (left and right controls)"> <figcaption>Snake - Basic movement (left and right controls)</figcaption> </figure> -<h4 id="setting-up-path-following">Setting up path following<a class="headerlink" href="#setting-up-path-following" title="Permanent link">¶</a></h4> +<h3 id="setting-up-path-following">Setting up path following<a class="headerlink" href="#setting-up-path-following" title="Permanent link">¶</a></h3> <p>To move other snake parts by following the snake head the only solution I found was to use the <em>Path2D</em> and <em>PathFollow2D</em> nodes. <em>Path2D</em> basically just handles the curve/path that <em>PathFollow2D</em> will use to move its child node; and I say “child node” in singular… as <em>PathFollow2D</em> can only handle one damn child, all the other ones will have weird transformations and/or rotations. So, the next thing to do is to setup a way to compute (and draw so we can validate) the snake’s path/curve.</p> <p>Added the signal <code>snake_path_new_point(coordinates)</code> to the <em>Event</em> singleton and then add the following to <code>head.gd</code>:</p> <pre><code class="language-gdscript">var _time_elapsed: float = 0.0 @@ -140,10 +171,10 @@ func _on_Head_snake_path_new_point(coordinates: Vector2) -> void: </code></pre> <p>With this, we’re now populating the <em>Path2D</em> curve points with the position of the snake head. You should be able to see it because of the <code>_draw</code> call. If you run it you should see something like this:</p> <figure id="__yafg-figure-34"> -<img alt="Snake - Basic movement with path" src="images/g/gogodot_jam3/snake_basic_movement_with_path.gif" title="Snake - Basic movement with path"> +<img alt="Snake - Basic movement with path" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement_with_path.gif" title="Snake - Basic movement with path"> <figcaption>Snake - Basic movement with path</figcaption> </figure> -<h4 id="define-body-parts-for-the-snake">Define body parts for the snake<a class="headerlink" href="#define-body-parts-for-the-snake" title="Permanent link">¶</a></h4> +<h3 id="define-body-parts-for-the-snake">Define body parts for the snake<a class="headerlink" href="#define-body-parts-for-the-snake" title="Permanent link">¶</a></h3> <p>At this point the only thing to do is to add the corresponding next body parts and tail of the snake. To do so, we need a <em>PathFollow2D</em> to use the live-generating <em>Path2D</em>, the only caveat is that we need one of these per body part/tail (this took me hours to figure out, <em>thanks documentation</em>).</p> <p>Create a new scene called <code>Body.tscn</code> with a <em>PathFollow2D</em> as its root and an <em>Area2D</em> as its child, then just add the necessary <em>Sprite</em> and <em>CollisionShap2D</em> for the <em>Area2D</em>, I’m using <code>layer = bit 2</code> for its collision. Create a new script called <code>generic_segment.gd</code> with the following code:</p> <pre><code class="language-gdscript">extends PathFollow2D @@ -155,7 +186,7 @@ func _physics_process(delta: float) -> void: offset += Global.SNAKE_SPEED * delta </code></pre> <p>And this can be attached to the <em>Body</em>‘s root node (<em>PathFollow2D</em>), no extra setup needed. Repeat the same steps for creating the <code>Tail.tscn</code> scene and when attaching the <code>generic_segment.gd</code> script just configure the <code>Type</code> parameter to <code>tail</code> in the GUI (by selecting the node with the script attached and editing in the <em>Inspector</em>).</p> -<h4 id="adding-body-parts">Adding body parts<a class="headerlink" href="#adding-body-parts" title="Permanent link">¶</a></h4> +<h3 id="adding-body-parts">Adding body parts<a class="headerlink" href="#adding-body-parts" title="Permanent link">¶</a></h3> <p>Now it’s just a matter of handling when to add new body parts in the <code>snake.gd</code> script. For now I’ve only setup for adding body parts to fulfill the initial length of the snake (this doesn’t include the head or tail). The extra code needed is the following:</p> <pre><code class="language-gdscript">export(PackedScene) var BODY_SEGMENT_NP: PackedScene export(PackedScene) var TAIL_SEGMENT_NP: PackedScene @@ -184,7 +215,7 @@ func _on_Head_snake_path_new_point(coordinates: Vector2) -> void: </code></pre> <p>Select the <em>Snake</em> node and add the <em>Body</em> and <em>Tail</em> scene to the parameters, respectively. Then when running you should see something like this:</p> <figure id="__yafg-figure-35"> -<img alt="Snake - Basic movement with all body parts" src="images/g/gogodot_jam3/snake_basic_movement_added_body_parts.gif" title="Snake - Basic movement with all body parts"> +<img alt="Snake - Basic movement with all body parts" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement_added_body_parts.gif" title="Snake - Basic movement with all body parts"> <figcaption>Snake - Basic movement with all body parts</figcaption> </figure> <p>Now, we need to handle adding body parts after the snake is complete and already moved for a bit, this will require a queue so we can add part by part in the case that we eat multiple pieces of food in a short period of time. For this we need to add some signals: <code>snake_adding_new_segment(type)</code>, <code>snake_added_new_segment(type)</code>, <code>snake_added_initial_segments</code> and use them when makes sense. Now we need to add the following:</p> @@ -225,9 +256,9 @@ func _add_segment_to_queue() -> void: else: body_segment_queue.append(body_segment_queue.back() + Global.SNAKE_SEGMENT_SIZE) </code></pre> -<p>With everything implemented and connected accordingly then we can add segments on demand (for testing I’m adding with a keystroke), it should look like this:</p> +<p>With everything implemented and connected accordingly then we can add segments on demand (for testing I’m adding with a key press), it should look like this:</p> <figure id="__yafg-figure-36"> -<img alt="Snake - Basic movement with dynamic addition of new segments" src="images/g/gogodot_jam3/snake_basic_movement_with_dynamic_segments.gif" title="Snake - Basic movement with dynamic addition of new segments"> +<img alt="Snake - Basic movement with dynamic addition of new segments" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_basic_movement_with_dynamic_segments.gif" title="Snake - Basic movement with dynamic addition of new segments"> <figcaption>Snake - Basic movement with dynamic addition of new segments</figcaption> </figure> <p>For now, this should be enough, I’ll add more stuff as needed as I go. Last thing is that after finished testing that the movement felt ok, I just added a way to stop the snake whenever it collides with itself by using the following code (and the signal <code>snake_segment_body_entered(body)</code>) in a <code>main.gd</code> script that is the entry point for the game:</p> @@ -239,13 +270,13 @@ func _add_segment_to_queue() -> void: _snake.propagate_call("set_process_input", [on_off]) </code></pre> <p>Which will stop the snake node and all children.</p> -<h4 id="fix-on-body-segments-following-head">Fix on body segments following head<a class="headerlink" href="#fix-on-body-segments-following-head" title="Permanent link">¶</a></h4> +<h3 id="fix-on-body-segments-following-head">Fix on body segments following head<a class="headerlink" href="#fix-on-body-segments-following-head" title="Permanent link">¶</a></h3> <p>After a while of testing and developing, I noticed that sometimes the head “detaches” from the body when a lot of rotations happen (moving the snake left or right), because of how imprecise the <em>Curve2D</em> is. To do this I just send a signal (<code>snake_rotated</code>) whenever the snake rotates and make a small correction (in <code>generic_segment.gd</code>):</p> <pre><code class="language-gdscript">func _on_snake_rotated() -> void: offset -= 0.75 * Global.SNAKE_SPEED * pow(get_physics_process_delta_time(), 2) </code></pre> <p>This is completely random, I tweaked it manually after a lot of iterations.</p> -<h3 id="the-food">The food<a class="headerlink" href="#the-food" title="Permanent link">¶</a></h3> +<h2 id="the-food">The food<a class="headerlink" href="#the-food" title="Permanent link">¶</a></h2> <p>For now I just decided to setup a simple system to see everything works fine. The idea is to make some kind of generic food node/scene and a “food manager” to spawn them, for now in totally random locations. For this I added the following signals: <code>food_placing_new_food(type)</code>, <code>food_placed_new_food(type)</code> and <code>food_eaten(type)</code>.</p> <p>First thing is creating the <code>Food.tscn</code> which is just an <em>Area2D</em> with its necessary children with an attached script called <code>food.gd</code>. The script is really simple:</p> <pre><code class="language-gdscript">class_name Food # needed to access Type enum outside of the script, this registers this script as a node @@ -290,21 +321,21 @@ func _on_body_entered(body: Node) -> void: </code></pre> <p>And this is used in <code>_process</code> to place new food whenever needed. For now I added a condition to add food until 10 pieces are in place, and keep adding whenever the food is is lower than 10. After setting everything up, this is the result:</p> <figure id="__yafg-figure-37"> -<img alt="Snake - Food basic interaction" src="images/g/gogodot_jam3/snake_food_basic_interaction.gif" title="Snake - Food basic interaction"> +<img alt="Snake - Food basic interaction" src="https://static.luevano.xyz/images/g/gogodot_jam3/snake_food_basic_interaction.gif" title="Snake - Food basic interaction"> <figcaption>Snake - Food basic interaction</figcaption> </figure> -<h3 id="za-warudo-the-world">Za warudo! (The world)<a class="headerlink" href="#za-warudo-the-world" title="Permanent link">¶</a></h3> +<h2 id="za-warudo-the-world">Za warudo! (The world)<a class="headerlink" href="#za-warudo-the-world" title="Permanent link">¶</a></h2> <p>It just happend that I saw a video to create random maps by using a method called <a href="https://www.mit.edu/~kardar/teaching/projects/chemotaxis(AndreaSchmidt)/random.htm">random walks</a>, this video was made by <a href="https://www.youtube.com/c/NADLABS">NAD LABS</a>: <a href="https://www.youtube.com/watch?v=ppP2Doq3p7s">Nuclear Throne Like Map Generation In Godot</a>. It’s a pretty simple but powerful script, he provided the source code from which I based my random walker, just tweaked a few things and added others. Some of the maps than can be generated with this method (already aded some random sprites):</p> <figure id="__yafg-figure-38"> -<img alt="World map generator - Random map 1" src="images/g/gogodot_jam3/world_generator_1.png" title="World map generator - Random map 1"> +<img alt="World map generator - Random map 1" src="https://static.luevano.xyz/images/g/gogodot_jam3/world_generator_1.png" title="World map generator - Random map 1"> <figcaption>World map generator - Random map 1</figcaption> </figure> <figure id="__yafg-figure-39"> -<img alt="World map generator - Random map 2" src="images/g/gogodot_jam3/world_generator_2.png" title="World map generator - Random map 2"> +<img alt="World map generator - Random map 2" src="https://static.luevano.xyz/images/g/gogodot_jam3/world_generator_2.png" title="World map generator - Random map 2"> <figcaption>World map generator - Random map 2</figcaption> </figure> <figure id="__yafg-figure-40"> -<img alt="World map generator - Random map 3" src="images/g/gogodot_jam3/world_generator_3.png" title="World map generator - Random map 3"> +<img alt="World map generator - Random map 3" src="https://static.luevano.xyz/images/g/gogodot_jam3/world_generator_3.png" title="World map generator - Random map 3"> <figcaption>World map generator - Random map 3</figcaption> </figure> <p>It started with just black and white tiles, but I ended up adding some sprites as it was really harsh to the eyes. My implementation is basically the same as <em>NAD LABS</em>‘ with few changes, most importantly: I separated the generation in 2 diferent tilemaps (floor and wall) to have better control as well as wrapped everything in a single scene with a “main” script with the following important functions:</p> @@ -321,7 +352,7 @@ func get_centered_world_position(location: Vector2) -> Vector2: </code></pre> <p>Where <code>get_cells_around</code> is just a function that gets the safe cells around the origin. And this <code>get_valid_map_coords</code> just returns used cells minus the safe cells, to place food. <code>get_centered_world_position</code> is so we can center the food in the tiles.</p> <p>Some signals I used for the world gen: <code>world_gen_walker_started(id)</code>, <code>world_gen_walker_finished(id)</code>, <code>world_gen_walker_died(id)</code> and <code>world_gen_spawn_walker_unit(location)</code>.</p> -<h4 id="food-placement">Food placement<a class="headerlink" href="#food-placement" title="Permanent link">¶</a></h4> +<h3 id="food-placement">Food placement<a class="headerlink" href="#food-placement" title="Permanent link">¶</a></h3> <p>The last food algorithm doesn’t check anything related to the world, and thus the food could spawn in the walls and outside the map.</p> <p>First thing is I generalized the food into a single script and added basic food and special food which inherit from base food. The most important stuff for the base food is to be able to set all necessary properties at first:</p> <pre><code class="language-gdscript">func update_texture() -> void: @@ -371,10 +402,10 @@ func _ready(): return [world_generator.get_centered_world_position(location), location] </code></pre> <p>Other than that, there are some differences between placing normal and special food (specially the signal they send, and if an extra “special points” property is set). Some of the signals that I used that might be important: <code>food_placing_new_food(type)</code>, <code>food_placed_new_food(type, location)</code> and <code>food_eaten(type, location)</code>.</p> -<h3 id="stats-clas-and-loadingsaving-data">Stats clas and loading/saving data<a class="headerlink" href="#stats-clas-and-loadingsaving-data" title="Permanent link">¶</a></h3> -<p>I got the idea of saving the current stats (points, max body segments, etc.) in a separate <em>Stats</em> class for easier load/save data. This option I went with didn’t work as I would liked it to work, as it was a pain in the ass to setup and each time a new property is added you have to manually setup the load/save helper functions… so not the best option. This option I used was json but saving a Node directly could work better or using resources (saving <code>tres</code> files).</p> -<h4 id="stats-class">Stats class<a class="headerlink" href="#stats-class" title="Permanent link">¶</a></h4> -<p>The <em>Stats</em> “class” is just a script that extends from <em>Node</em> called <code>stats.gd</code>. It needs to define the <code>class_name</code> as <code>Stats</code>. The main content:</p> +<h2 id="stats-clas-and-loadingsaving-data">Stats clas and loading/saving data<a class="headerlink" href="#stats-clas-and-loadingsaving-data" title="Permanent link">¶</a></h2> +<p>I got the idea of saving the current stats (points, max body segments, etc.) in a separate <code>Stats</code> class for easier load/save data. This option I went with didn’t work as I would liked it to work, as it was a pain in the ass to setup and each time a new property is added you have to manually setup the load/save helper functions… so not the best option. This option I used was json but saving a Node directly could work better or using resources (saving <code>tres</code> files).</p> +<h3 id="stats-class">Stats class<a class="headerlink" href="#stats-class" title="Permanent link">¶</a></h3> +<p>The <code>Stats</code> “class” is just a script that extends from <em>Node</em> called <code>stats.gd</code>. It needs to define the <code>class_name</code> as <code>Stats</code>. The main content:</p> <pre><code class="language-gdscript"># main var points: int = 0 var segments: int = 0 @@ -436,8 +467,8 @@ func set_stats(stats: Dictionary) -> void: trait_jump = stats["trait_jump"] </code></pre> <p>And this is not scalable at all, but I had to do this at the end of the jam so no way of optimizing and/or doing it correctly, sadly.</p> -<h4 id="loadsave-data">Load/save data<a class="headerlink" href="#loadsave-data" title="Permanent link">¶</a></h4> -<p>The load/save function is pretty standard. It’s a singleton/autoload called <em>SavedData</em> with a script that extends from <em>Node</em> called <code>save_data.gd</code>:</p> +<h3 id="loadsave-data">Load/save data<a class="headerlink" href="#loadsave-data" title="Permanent link">¶</a></h3> +<p>The load/save function is pretty standard. It’s a singleton/autoload called <code>SavedData</code> with a script that extends from <em>Node</em> called <code>save_data.gd</code>:</p> <pre><code class="language-gdscript">const DATA_PATH: String = "user://data.save" var _stats: Stats @@ -479,9 +510,9 @@ func _handle_new_file() -> void: file.store_line(to_json(_stats.get_stats())) file.close() </code></pre> -<p>It uses json as the file format, but I might end up changing this in the future to something else more reliable and easier to use (<em>Stats</em> class related issues).</p> -<h3 id="scoring">Scoring<a class="headerlink" href="#scoring" title="Permanent link">¶</a></h3> -<p>For this I created a scoring mechanisms and just called it <em>ScoreManager</em> (<code>score_manager.gd</code>) which just basically listens to <code>food_eaten</code> signal and adds points accordingly to the current <em>Stats</em> object loaded. The main function is:</p> +<p>It uses json as the file format, but I might end up changing this in the future to something else more reliable and easier to use (<code>Stats</code> class related issues).</p> +<h2 id="scoring">Scoring<a class="headerlink" href="#scoring" title="Permanent link">¶</a></h2> +<p>For this I created a scoring mechanisms and just called it <code>ScoreManager</code> (<code>score_manager.gd</code>) which just basically listens to <code>food_eaten</code> signal and adds points accordingly to the current <em>Stats</em> object loaded. The main function is:</p> <pre><code class="language-gdscript">func _on_food_eaten(properties: Dictionary) -> void: var is_special: bool = properties["special"] var type: int = properties["type"] @@ -521,7 +552,7 @@ func _handle_new_file() -> void: </code></pre> <p>Which will add the necessary points to <code>Stats.points</code> and return the amount of new snake segments to grow. After this <code>_spawn_added_score_segment</code> and <code>_spawn_added_segment_text</code> just spawn a <em>Label</em> with the info on the points/segments gained; this is custom UI I created, nothing fancy.</p> <p>Last thing is taht in <code>_process_points</code> there is a check at the end, where if the food eaten is “special” then a custom variation of the last 3 functions are executed. These are really similar, just specific to each kind of food.</p> -<p>This <em>ScoreManager</em> also handles the calculation for the <code>game_over</code> signal, to calculte progress, set necessary <em>Stats</em> values and save the data:</p> +<p>This <code>ScoreManager</code> also handles the calculation for the <code>game_over</code> signal, to calculte progress, set necessary <code>Stats</code> values and save the data:</p> <pre><code class="language-gdscript">func _on_game_over() -> void: var max_stats: Stats = _get_max_stats() SaveData.save_data(max_stats) @@ -548,8 +579,8 @@ func _get_max_stats() -> Stats: return max_stats </code></pre> <p>Then this sends a signal <code>display_stats</code> to activate UI elements that shows the progression.</p> -<p>Naturally, the saved <em>Stats</em> are loaded whenever needed. For example, for the <em>Snake</em>, we load the stats and setup any value needed from there (like a flag to know if any ability is enabled), and since we’re saving the new <em>Stats</em> at the end, then on restart we load the updated one.</p> -<h3 id="snake-redesigned-with-the-state-machine-pattern">Snake redesigned with the state machine pattern<a class="headerlink" href="#snake-redesigned-with-the-state-machine-pattern" title="Permanent link">¶</a></h3> +<p>Naturally, the saved <code>Stats</code> are loaded whenever needed. For example, for the <code>Snake</code>, we load the stats and setup any value needed from there (like a flag to know if any ability is enabled), and since we’re saving the new <code>Stats</code> at the end, then on restart we load the updated one.</p> +<h2 id="snake-redesigned-with-the-state-machine-pattern">Snake redesigned with the state machine pattern<a class="headerlink" href="#snake-redesigned-with-the-state-machine-pattern" title="Permanent link">¶</a></h2> <p>I redesigned the snake code (the head, actually) to use the state machine pattern by following <a href="https://gdscript.com/solutions/godot-state-machine/">this guide</a> which is definitely a great guide, straight to the point and easy to implement.</p> <p>Other than what is shown in the guide, I implemented some important functions in the <code>state_machine.gd</code> script itself, to be used by each of the states as needed:</p> <pre><code class="language-gdscript">func rotate_on_input() -> void: @@ -571,7 +602,7 @@ func handle_slow_speeds() -> void: Global.SNAKE_SPEED = Global.SNAKE_SPEED_BACKUP Event.emit_signal("game_over") </code></pre> -<p>And then in the <em>StateMachine</em>‘s <code>_process</code>:</p> +<p>And then in the <code>StateMachine</code>‘s <code>_process</code>:</p> <pre><code class="language-gdscript">func _physics_process(delta: float) -> void: # state specific code, move_and_slide is called here if state.has_method("physics_process"): @@ -623,7 +654,7 @@ func physics_process(delta: float) -> void: </code></pre> <p>Where the important parts happen in the <code>enter</code> and <code>exit</code> functions. We need to change the <code>Global.SNAKE_SPEED</code> with the <code>Global.SNAKE_DASH_SPEED</code> on <code>start</code>and start the timer for how long should the dash last. And on the <code>exit</code> we reset the <code>Global.SNAKE_SPEED</code> back to normal. There is probably a better way of updating the <code>Global.SNAKE_SPEED</code> but this works just fine.</p> <p>For the other ones is the same. Only difference with the <code>jump_state.gd</code> is that the collision from head to body is disabled, and no rotation is allowed (by not calling the <code>rotate_on_input</code> function).</p> -<h3 id="other-minor-stuff">Other minor stuff<a class="headerlink" href="#other-minor-stuff" title="Permanent link">¶</a></h3> +<h2 id="other-minor-stuff">Other minor stuff<a class="headerlink" href="#other-minor-stuff" title="Permanent link">¶</a></h2> <p>Not as important but worth mentioning:</p> <ul> <li>Added restartability function.</li> @@ -637,9 +668,9 @@ func physics_process(delta: float) -> void: <li>Refactored the nodes to make it work with <code>change_scene_to</code>, and added a main menu.</li> <li>Added GUI for dead screen, showing the progress.</li> </ul> -<h3 id="final-notes">Final notes<a class="headerlink" href="#final-notes" title="Permanent link">¶</a></h3> -<p>I actually didn’t finish this game (as how I visualized it), but I got it in a playable state which is good. My big learning during this jam is the time management that it requires to plan and design a game. I lost a lot of time trying to implement some mechanics because I was facing many issues, because of my lack of practice (which was expected) as well as trying to blog and create the necessary sprites myself. Next time I should just get an asset pack and do something with it, as well as keeping the scope of my game shorter.</p> -<p>For exporting and everything else, I went with what I did for my <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1#final-notes-and-exporting">FlappyBird Godot clone</a></p>]]></content:encoded> +<h2 id="final-notes">Final notes<a class="headerlink" href="#final-notes" title="Permanent link">¶</a></h2> +<p>I actually didn’t finish this game (as how I visualized it), but I got it in a <em>semi-playable</em> state which is good. My big learning during this jam is the time management that it requires to plan and design a game. I lost a lot of time trying to implement some mechanics because I was facing many issues, because of my lack of practice (which was expected) as well as trying to blog and create the necessary sprites myself. Next time I should just get an asset pack and do something with it, as well as keeping the scope of my game shorter.</p> +<p>For exporting and everything else, I went with what I did for my <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1#final-notes-and-exporting">FlappyBird Godot clone: final notes and exporting</a></p>]]></content:encoded> </item> <item> <title>Creating a FlappyBird clone in Godot 3.5 devlog 1</title> @@ -648,9 +679,10 @@ func physics_process(delta: float) -> void: <pubDate>Sun, 29 May 2022 03:38:43 GMT</pubDate> <category>English</category> <category>Gamedev</category> + <category>Gdscript</category> <category>Godot</category> <description>Since I'm starting to get more into gamedev stuff, I'll start blogging about it just to keep consistent. This shows as "devlog 1" just in case I want to include more parts for extra stuff.</description> - <content:encoded><![CDATA[<p>I just have a bit of experience with Godot and with gamedev in general, so I started with this game as it is pretty straight forward. On a high level the main characteristics of the game are:</p> + <content:encoded><![CDATA[<p>I just have a bit of experience with <em>Godot</em> and with gamedev in general, so I started with this game as it is pretty straight forward. On a high level the main characteristics of the game are:</p> <ul> <li>Literally just one sprite going up and down.</li> <li>Constant horizontal move of the world/player.</li> @@ -660,189 +692,246 @@ func physics_process(delta: float) -> void: <p>The game was originally developed with <em>Godot 4.0 alpha 8</em>, but it didn’t support HTML5 (webassembly) export… so I backported to <em>Godot 3.5 rc1</em>.</p> <p>Not going to specify all the details, only the needed parts and what could be confusing, as the source code is available and can be inspected; also this assumes minimal knowledge of <em>Godot</em> in general. Usually when I mention that a set/change of something it usually it’s a property and it can be found under the <em>Inspector</em> on the relevant node, unless stated otherwise; also, all scripts attached have the same name as the scenes, but in <em>snake_case</em> (scenes/nodes in <em>PascalCase</em>).</p> <p>One thing to note, is that I started writing this when I finished the game, so it’s hard to go part by part, and it will be hard to test individual parts when going through this as everything is depending on each other. For the next devlog, I’ll do it as I go and it will include all the changes to the nodes/scripts as I was finding them, probably better idea and easier to follow.</p> -<p>The source code can be found in my GitHub <a href="https://github.com/luevano/flappybird_godot">here</a>, it also contains the exported versions for HTML5, Windows and Linux (be aware that the sound might be too high and I’m too lazy to make it configurable, it was the last thing I added), or you could also go to the itch.io page I setup where it’s playable in the browser:</p> -<p style="text-align:center"><iframe src="https://itch.io/embed/1551015?dark=true" width="552" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/flappybirdgodot">FlappyBirdGodot by Lorentzeus</a></iframe></p> +<p>The source code can be found in my GitHub <a href="https://github.com/luevano/flappybird_godot">here</a>, it also contains the exported versions for HTML5, Windows and Linux (be aware that the sound might be too high and I’m too lazy to make it configurable, it was the last thing I added), or you could also go to the <a href="https://lorentzeus.itch.io/flappybirdgodot">itch.io</a> page I setup where it’s playable in the browser:</p> +<p style="text-align:center"><iframe src="https://itch.io/embed/1551015?dark=true" width="208" height="167" frameborder="0"><a href="https://lorentzeus.itch.io/flappybirdgodot">FlappyBirdGodot by Lorentzeus</a></iframe></p> -<h3 id="initial-project-setup">Initial project setup<a class="headerlink" href="#initial-project-setup" title="Permanent link">¶</a></h3> -<h4 id="directory-structure">Directory structure<a class="headerlink" href="#directory-structure" title="Permanent link">¶</a></h4> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#initial-setup">Initial setup</a><ul> +<li><a href="#directory-structure">Directory structure</a></li> +<li><a href="#config">Config</a><ul> +<li><a href="#default-import-settings">Default import settings</a></li> +<li><a href="#general-settings">General settings</a></li> +<li><a href="#keybindings">Keybindings</a></li> +<li><a href="#layers">Layers</a></li> +</ul> +</li> +</ul> +</li> +<li><a href="#assets">Assets</a><ul> +<li><a href="#importing">Importing</a></li> +</ul> +</li> +<li><a href="#scenes">Scenes</a><ul> +<li><a href="#tilemaps">TileMaps</a><ul> +<li><a href="#default-ground-tiles">Default ground tiles</a></li> +</ul> +</li> +<li><a href="#player">Player</a></li> +<li><a href="#other">Other</a></li> +<li><a href="#game">Game</a></li> +<li><a href="#ui">UI</a><ul> +<li><a href="#fonts">Fonts</a></li> +<li><a href="#scene-setup">Scene setup</a></li> +</ul> +</li> +<li><a href="#main">Main</a></li> +</ul> +</li> +<li><a href="#scripting">Scripting</a><ul> +<li><a href="#player_1">Player</a></li> +<li><a href="#worlddetector">WorldDetector</a></li> +<li><a href="#worldtiles">WorldTiles</a><ul> +<li><a href="#groundtilemap">GroundTileMap</a></li> +<li><a href="#pipetilemap">PipeTileMap</a></li> +</ul> +</li> +<li><a href="#saved-data">Saved data</a></li> +<li><a href="#game_1">Game</a></li> +<li><a href="#ui_1">UI</a></li> +<li><a href="#main_1">Main</a></li> +</ul> +</li> +<li><a href="#final-notes-and-exporting">Final notes and exporting</a><ul> +<li><a href="#preparing-the-files">Preparing the files</a></li> +<li><a href="#exporting">Exporting</a></li> +</ul> +</li> +</ul> +</div> +<h2 id="initial-setup">Initial setup<a class="headerlink" href="#initial-setup" title="Permanent link">¶</a></h2> +<h3 id="directory-structure">Directory structure<a class="headerlink" href="#directory-structure" title="Permanent link">¶</a></h3> <p>I’m basically going with what I wrote on <a href="https://blog.luevano.xyz/g/godot_project_structure.html">Godot project structure</a> recently, and probably with minor changes depending on the situation.</p> -<h4 id="config">Config<a class="headerlink" href="#config" title="Permanent link">¶</a></h4> -<h5 id="default-import-settings">Default import settings<a class="headerlink" href="#default-import-settings" title="Permanent link">¶</a></h5> +<h3 id="config">Config<a class="headerlink" href="#config" title="Permanent link">¶</a></h3> +<h4 id="default-import-settings">Default import settings<a class="headerlink" href="#default-import-settings" title="Permanent link">¶</a></h4> <p>Since this is just pixel art, the importing settings for textures needs to be adjusted so the sprites don’t look blurry. Go to <em>Project -> Project settings… -> Import defaults</em> and on the drop down select <code>Texture</code>, untick everything and make sure <em>Compress/Mode</em> is set to <code>Lossless</code>.</p> <figure id="__yafg-figure-4"> -<img alt="Project settings - Import defaults - Texture settings" src="images/g/flappybird_godot/project_settings_import_texture.png" title="Project settings - Import defaults - Texture settings"> +<img alt="Project settings - Import defaults - Texture settings" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_import_texture.png" title="Project settings - Import defaults - Texture settings"> <figcaption>Project settings - Import defaults - Texture settings</figcaption> </figure> -<h5 id="general-settings">General settings<a class="headerlink" href="#general-settings" title="Permanent link">¶</a></h5> +<h4 id="general-settings">General settings<a class="headerlink" href="#general-settings" title="Permanent link">¶</a></h4> <p>It’s also a good idea to setup some config variables project-wide. To do so, go to <em>Project -> Project settings… -> General</em>, select <em>Application/config</em> and add a new property (there is a text box at the top of the project settings window) for game scale: <code>application/config/game_scale</code> for the type use <code>float</code> and then click on add; configure the new property to <code>3.0</code>; On the same window, also add <code>application/config/version</code> as a <code>string</code>, and make it <code>1.0.0</code> (or whatever number you want).</p> <figure id="__yafg-figure-5"> -<img alt="Project settings - General - Game scale and version properties" src="images/g/flappybird_godot/project_settings_config_properties.png" title="Project settings - General - Game scale and version properties"> +<img alt="Project settings - General - Game scale and version properties" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_config_properties.png" title="Project settings - General - Game scale and version properties"> <figcaption>Project settings - General - Game scale and version properties</figcaption> </figure> -<p>For my personal preferences, also disable some of the <em>GDScript</em> debug warnings that are annoying, this is done at <em>Project -> Project settings… -> General</em>, select <em>Debug/GDScript</em> and toggle off “Unused arguments”, “Unused signal” and “Return value discarded”, and any other that might come up too often and don’t want to see.</p> +<p>For my personal preferences, also disable some of the <em>GDScript</em> debug warnings that are annoying, this is done at <em>Project -> Project settings… -> General</em>, select <em>Debug/GDScript</em> and toggle off <code>Unused arguments</code>, <code>Unused signal</code> and <code>Return value discarded</code>, and any other that might come up too often and don’t want to see.</p> <figure id="__yafg-figure-6"> -<img alt="Project settings - General - GDScript debug warnings" src="images/g/flappybird_godot/project_settings_debug_gdscript.png" title="Project settings - General - GDScript debug warnings"> +<img alt="Project settings - General - GDScript debug warnings" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_debug_gdscript.png" title="Project settings - General - GDScript debug warnings"> <figcaption>Project settings - General - GDScript debug warnings</figcaption> </figure> -<p>Finally, set the initial window size in <em>Project -> Project settings… -> General</em>, select <em>Display/Window</em> and set <em>Size/Width</em> and <em>Size/Height</em> to <code>600</code> and <code>800</code>, respectively. As well as the <em>Stretch/Mode</em> to “viewport”, and <em>Stretch/Aspect</em> to “keep”:</p> +<p>Finally, set the initial window size in <em>Project -> Project settings… -> General</em>, select <em>Display/Window</em> and set <em>Size/Width</em> and <em>Size/Height</em> to <code>600</code> and <code>800</code>, respectively. As well as the <em>Stretch/Mode</em> to <code>viewport</code> , and <em>Stretch/Aspect</em> to <code>keep</code>:</p> <figure id="__yafg-figure-7"> -<img alt="Project settings - General - Initial window size" src="images/g/flappybird_godot/project_settings_window_settings.png" title="Project settings - General - Initial window size"> +<img alt="Project settings - General - Initial window size" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_window_settings.png" title="Project settings - General - Initial window size"> <figcaption>Project settings - General - Initial window size</figcaption> </figure> -<h5 id="keybindings">Keybindings<a class="headerlink" href="#keybindings" title="Permanent link">¶</a></h5> -<p>I only used 3 actions (keybindings): jump, restart and toggle_debug (optional). To add custom keybindings (so that the <code>Input.something()</code> API can be used), go to <em>Project -> Project settings… -> Input Map</em> and on the text box write “jump” and click add, then it will be added to the list and it’s just a matter of clicking the <code>+</code> sign to add a “Physical key”, press any key you want to be used to jump and click ok. Do the same for the rest of the actions.</p> +<h4 id="keybindings">Keybindings<a class="headerlink" href="#keybindings" title="Permanent link">¶</a></h4> +<p>I only used 3 actions (keybindings): jump, restart and toggle_debug (optional). To add custom keybindings (so that the <code>Input.something()</code> API can be used), go to <em>Project -> Project settings… -> Input Map</em> and on the text box write <code>jump</code> and click add, then it will be added to the list and it’s just a matter of clicking the <code>+</code> sign to add a <em>Physical key</em>, press any key you want to be used to jump and click ok. Do the same for the rest of the actions.</p> <figure id="__yafg-figure-8"> -<img alt="Project settings - Input Map - Adding necessary keybindings" src="images/g/flappybird_godot/project_settings_input_map.png" title="Project settings - Input Map - Adding necessary keybindings"> +<img alt="Project settings - Input Map - Adding necessary keybindings" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_input_map.png" title="Project settings - Input Map - Adding necessary keybindings"> <figcaption>Project settings - Input Map - Adding necessary keybindings</figcaption> </figure> -<h5 id="layers">Layers<a class="headerlink" href="#layers" title="Permanent link">¶</a></h5> -<p>Finally, rename the physics layers so we don’t lose track of which layer is which. Go to <em>Project -> Layer Names -> 2d Physics</em> and change the first 5 layer names to (in order): “player”, “ground”, “pipe”, “ceiling” and “score”.</p> +<h4 id="layers">Layers<a class="headerlink" href="#layers" title="Permanent link">¶</a></h4> +<p>Finally, rename the physics layers so we don’t lose track of which layer is which. Go to <em>Project -> Layer Names -> 2d Physics</em> and change the first 5 layer names to (in order): <code>player</code>, <code>ground</code>, <code>pipe</code>, <code>ceiling</code> and <code>score</code>.</p> <figure id="__yafg-figure-9"> -<img alt="Project settings - Layer Names - 2D Physics" src="images/g/flappybird_godot/project_settings_layer_names_2d_physics.png" title="Project settings - Layer Names - 2D Physics"> +<img alt="Project settings - Layer Names - 2D Physics" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_layer_names_2d_physics.png" title="Project settings - Layer Names - 2D Physics"> <figcaption>Project settings - Layer Names - 2D Physics</figcaption> </figure> -<h3 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h3> +<h2 id="assets">Assets<a class="headerlink" href="#assets" title="Permanent link">¶</a></h2> <p>For the assets I found out about a pack that contains just what I need: <a href="https://megacrash.itch.io/flappy-bird-assets">flappy-bird-assets</a> by <a href="https://megacrash.itch.io/">MegaCrash</a>; I just did some minor modifications on the naming of the files. For the font I used <a href="https://poppyworks.itch.io/silver">Silver</a>, and for the sound the resources from <a href="https://github.com/meeq/FlappyBird-N64">FlappyBird-N64</a> (which seems to be taken from <a href="https://www.101soundboards.com/boards/10178-flappy-bird-sounds">101soundboards.com</a> which the orignal copyright holder is <a href="https://dotgears.com/">.Gears</a> anyways).</p> -<h4 id="importing">Importing<a class="headerlink" href="#importing" title="Permanent link">¶</a></h4> -<p>Create the necessary directories to hold the respective assets and it’s just a matter of dragging and dropping, I used directories: <code>res://entities/actors/player/sprites/</code>, <code>res://fonts/</code>, <code>res://levels/world/background/sprites/</code>, <code>res://levels/world/ground/sprites/</code>, <code>res://levels/world/pipe/sprites/</code>, <code>res://sfx/</code>. For the player sprites, the “FileSystem” window looks like this (<code>entities/actor</code> directories are really not necessary):</p> +<h3 id="importing">Importing<a class="headerlink" href="#importing" title="Permanent link">¶</a></h3> +<p>Create the necessary directories to hold the respective assets and it’s just a matter of dragging and dropping, I used directories: <code>res://entities/actors/player/sprites/</code>, <code>res://fonts/</code>, <code>res://levels/world/background/sprites/</code>, <code>res://levels/world/ground/sprites/</code>, <code>res://levels/world/pipe/sprites/</code>, <code>res://sfx/</code>. For the player sprites, the +<em>FileSystem</em> window looks like this (<code>entities/actor</code> directories are really not necessary):</p> <figure id="__yafg-figure-10"> -<img alt="FileSystem - Player sprite imports" src="images/g/flappybird_godot/player_sprite_imports.png" title="FileSystem - Player sprite imports"> +<img alt="FileSystem - Player sprite imports" src="https://static.luevano.xyz/images/g/flappybird_godot/player_sprite_imports.png" title="FileSystem - Player sprite imports"> <figcaption>FileSystem - Player sprite imports</figcaption> </figure> <p>It should look similar for other directories, except maybe for the file extensions. For example, for the sfx:</p> <figure id="__yafg-figure-11"> -<img alt="FileSystem - SFX imports" src="images/g/flappybird_godot/sfx_imports.png" title="FileSystem - SFX imports"> +<img alt="FileSystem - SFX imports" src="https://static.luevano.xyz/images/g/flappybird_godot/sfx_imports.png" title="FileSystem - SFX imports"> <figcaption>FileSystem - SFX imports</figcaption> </figure> -<h3 id="scenes">Scenes<a class="headerlink" href="#scenes" title="Permanent link">¶</a></h3> +<h2 id="scenes">Scenes<a class="headerlink" href="#scenes" title="Permanent link">¶</a></h2> <p>Now it’s time to actually create the game, by creating the basic scenes that will make up the game. The hardest part and the most confusing is going to be the <em>TileMaps</em>, so that goes first.</p> -<h4 id="tilemaps">TileMaps<a class="headerlink" href="#tilemaps" title="Permanent link">¶</a></h4> -<p>I’m using a scene called “WorldTiles” with a <em>Node2D</em> node as root called the same. With 2 different <em>TileMap</em> nodes as children named “GroundTileMap” and “PipeTileMap” (these are their own scene); yes 2 different <em>TileMaps</em> because we need 2 different physics colliders (In Godot 4.0 you can have a single <em>TileMap</em> with different physics colliders in it). Each node has its own script. It should look something like this:</p> +<h3 id="tilemaps">TileMaps<a class="headerlink" href="#tilemaps" title="Permanent link">¶</a></h3> +<p>I’m using a scene called <code>WorldTiles</code> with a <em>Node2D</em> node as root called the same. With 2 different <em>TileMap</em> nodes as children named <code>GroundTileMap</code> and <code>PipeTileMap</code> (these are their own scene); yes 2 different <em>TileMaps</em> because we need 2 different physics colliders (in <em>Godot 4.0</em> you can have a single <em>TileMap</em> with different physics colliders in it). Each node has its own script. It should look something like this:</p> <figure id="__yafg-figure-12"> -<img alt="Scene - WorldTiles (TileMaps)" src="images/g/flappybird_godot/scene_world_tiles.png" title="Scene - WorldTiles (TileMaps)"> +<img alt="Scene - WorldTiles (TileMaps)" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_world_tiles.png" title="Scene - WorldTiles (TileMaps)"> <figcaption>Scene - WorldTiles (TileMaps)</figcaption> </figure> <p>I used the following directory structure:</p> <figure id="__yafg-figure-13"> -<img alt="Scene - WorldTiles - Directory structure" src="images/g/flappybird_godot/scene_world_tiles_directory_structure.png" title="Scene - WorldTiles - Directory structure"> +<img alt="Scene - WorldTiles - Directory structure" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_world_tiles_directory_structure.png" title="Scene - WorldTiles - Directory structure"> <figcaption>Scene - WorldTiles - Directory structure</figcaption> </figure> -<p>To configure the GroundTileMap, select the node and click on “(empty)” on the <em>TileMap/Tile set</em> property and then click on “New TileSet”, then click where the “(empty)” used to be, a new window should open on the bottom:</p> +<p>To configure the <code>GroundTileMap</code>, select the node and click on <code>(empty)</code> on the <em>TileMap/Tile set</em> property and then click on <code>New TileSet</code>, then click where the <code>(empty)</code> used to be, a new window should open on the bottom:</p> <figure id="__yafg-figure-14"> -<img alt="TileSet - Configuration window" src="images/g/flappybird_godot/tile_set_config_window.png" title="TileSet - Configuration window"> +<img alt="TileSet - Configuration window" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_config_window.png" title="TileSet - Configuration window"> <figcaption>TileSet - Configuration window</figcaption> </figure> -<p>Click on the plus on the bottom left and you can now select the specific tile set to use. Now click on the yellow “+ New Single Tile”, activate the grid and select any of the tiles. Should look like this:</p> +<p>Click on the plus on the bottom left and you can now select the specific tile set to use. Now click on the yellow <code>+ New Single Tile</code>, activate the grid and select any of the tiles. Should look like this:</p> <figure id="__yafg-figure-15"> -<img alt="TileSet - New single tile" src="images/g/flappybird_godot/tile_set_new_single_tile.png" title="TileSet - New single tile"> +<img alt="TileSet - New single tile" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_new_single_tile.png" title="TileSet - New single tile"> <figcaption>TileSet - New single tile</figcaption> </figure> -<p>We need to do this because for some reason we can’t change the snap options before selecting a tile. After selecting a random tile, set up the <em>Snap Options/Step</em> (in the <em>Inspector</em>) and set it to 16x16 (or if using a different tile set, to it’s tile size):</p> +<p>We need to do this because for some reason we can’t change the snap options before selecting a tile. After selecting a random tile, set up the <em>Snap Options/Step</em> (in the <em>Inspector</em>) and set it to <code>16x16</code> (or if using a different tile set, to it’s tile size):</p> <figure id="__yafg-figure-16"> -<img alt="TileSet - Tile - Step snap options" src="images/g/flappybird_godot/tile_set_tile_step_snap_options.png" title="TileSet - Tile - Step snap options"> +<img alt="TileSet - Tile - Step snap options" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_tile_step_snap_options.png" title="TileSet - Tile - Step snap options"> <figcaption>TileSet - Tile - Step snap options</figcaption> </figure> -<p>Now you can select the actual single tile. Once selected click on “Collision”, use the rectangle tool and draw the rectangle corresponding to that tile’s collision:</p> +<p>Now you can select the actual single tile. Once selected click on <code>Collision</code>, use the rectangle tool and draw the rectangle corresponding to that tile’s collision:</p> <figure id="__yafg-figure-17"> -<img alt="TileSet - Tile - Selection and collision" src="images/g/flappybird_godot/tile_set_tile_selection_collision.png" title="TileSet - Tile - Selection and collision"> +<img alt="TileSet - Tile - Selection and collision" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_tile_selection_collision.png" title="TileSet - Tile - Selection and collision"> <figcaption>TileSet - Tile - Selection and collision</figcaption> </figure> <p>Do the same for the other 3 tiles. If you select the <em>TileMap</em> itself again, it should look like this on the right (on default layout it’s on the left of the <em>Inspector</em>):</p> <figure id="__yafg-figure-18"> -<img alt="TileSet - Available tiles" src="images/g/flappybird_godot/tile_set_available_tiles.png" title="TileSet - Available tiles"> +<img alt="TileSet - Available tiles" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_available_tiles.png" title="TileSet - Available tiles"> <figcaption>TileSet - Available tiles</figcaption> </figure> <p>The ordering is important only for the “underground tile”, which is the filler ground, it should be at the end (index 3); if this is not the case, repeat the process (it’s possible to rearrange them but it’s hard to explain as it’s pretty weird).</p> -<p>At this point the tilemap doesn’t have any physics and the cell size is wrong. Select the “GroundTileMap”, set the <em>TileMap/Cell/Size</em> to 16x16, the <em>TileMap/Collision/Layer</em> set to <code>bit 2</code> only (ground layer) and disable any <em>TileMap/Collision/Mask</em> bits. Should look something like this:</p> +<p>At this point the tilemap doesn’t have any physics and the cell size is wrong. Select the <code>GroundTileMap</code>, set the <em>TileMap/Cell/Size</em> to <code>16x16</code>, the <em>TileMap/Collision/Layer</em> set to <code>bit 2</code> only (ground layer) and disable any <em>TileMap/Collision/Mask</em> bits. Should look something like this:</p> <figure id="__yafg-figure-19"> -<img alt="TileMap - Cell size and collision configuration" src="images/g/flappybird_godot/tile_map_cell_collision_configuration.png" title="TileMap - Cell size and collision configuration"> +<img alt="TileMap - Cell size and collision configuration" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_map_cell_collision_configuration.png" title="TileMap - Cell size and collision configuration"> <figcaption>TileMap - Cell size and collision configuration</figcaption> </figure> -<p>Now it’s just a matter of repeating the same for the pipes (“PipeTileMap”), only difference is that when selecting the tiles you need to select 2 tiles, as the pipe is 2 tiles wide, or just set the <em>Snap Options/Step</em> to 32x16, for example, just keep the cell size to 16x16.</p> -<h5 id="default-ground-tiles">Default ground tiles<a class="headerlink" href="#default-ground-tiles" title="Permanent link">¶</a></h5> -<p>I added few default ground tiles to the scene, just for testing purposes but I left them there. These could be place programatically, but I was too lazy to change things. On the “WorldTiles” scene, while selecting the “GroundTileMap”, you can select the tiles you want to paint with, and left click in the grid to paint with the selected tile. Need to place tiles from <code>(-8, 7)</code> to <code>(10, 7)</code> as well as the tile below with the filler ground (the tile position/coordinates show at the bottom left, refer to the image below):</p> +<p>Now it’s just a matter of repeating the same for the pipes (<code>PipeTileMap</code>), only difference is that when selecting the tiles you need to select 2 tiles, as the pipe is 2 tiles wide, or just set the <em>Snap Options/Step</em> to <code>32x16</code>, for example, just keep the cell size to <code>16x16</code>.</p> +<h4 id="default-ground-tiles">Default ground tiles<a class="headerlink" href="#default-ground-tiles" title="Permanent link">¶</a></h4> +<p>I added few default ground tiles to the scene, just for testing purposes but I left them there. These could be place programatically, but I was too lazy to change things. On the <code>WorldTiles</code> scene, while selecting the <code>GroundTileMap</code>, you can select the tiles you want to paint with, and left click in the grid to paint with the selected tile. Need to place tiles from <code>(-8, 7)</code> to <code>(10, 7)</code> as well as the tile below with the filler ground (the tile position/coordinates show at the bottom left, refer to the image below):</p> <figure id="__yafg-figure-20"> -<img alt="Scene - WorldTiles - Default ground tiles" src="images/g/flappybird_godot/world_tiles_default_tiles.png" title="Scene - WorldTiles - Default ground tiles"> +<img alt="Scene - WorldTiles - Default ground tiles" src="https://static.luevano.xyz/images/g/flappybird_godot/world_tiles_default_tiles.png" title="Scene - WorldTiles - Default ground tiles"> <figcaption>Scene - WorldTiles - Default ground tiles</figcaption> </figure> -<h4 id="player">Player<a class="headerlink" href="#player" title="Permanent link">¶</a></h4> -<p>On a new scene called “Player” with a <em>KinematicBody2D</em> node named “Player” as the root of the scene, then for the children: <em>AnimatedSprite</em> as “Sprite”, <em>CollisionShape2D</em> as “Collision” (with a circle shape) and 3 <em>AudioStreamPlayers</em> for “JumpSound”, “DeadSound” and “HitSound”. Not sure if it’s a good practice to have the audio here, since I did that at the end, pretty lazy. Then, attach a script to the “Player” node and then it should look like this:</p> +<h3 id="player">Player<a class="headerlink" href="#player" title="Permanent link">¶</a></h3> +<p>On a new scene called <code>Player</code> with a <em>KinematicBody2D</em> node named <code>Player</code> as the root of the scene, then for the children: <em>AnimatedSprite</em> as <code>Sprite</code>, <em>CollisionShape2D</em> as <code>Collision</code> (with a circle shape) and 3 <em>AudioStreamPlayers</em> for <code>JumpSound</code>, <code>DeadSound</code> and <code>HitSound</code>. Not sure if it’s a good practice to have the audio here, since I did that at the end, pretty lazy. Then, attach a script to the <code>Player</code> node and then it should look like this:</p> <figure id="__yafg-figure-21"> -<img alt="Scene - Player - Node setup" src="images/g/flappybird_godot/scene_player_node_setup.png" title="Scene - Player - Node setup"> +<img alt="Scene - Player - Node setup" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_node_setup.png" title="Scene - Player - Node setup"> <figcaption>Scene - Player - Node setup</figcaption> </figure> -<p>Select the “Player” node and set the <em>CollisionShape2D/Collision/Layer</em> to 1 and the <em>CollisionObject2D/Collision/Mask</em> to 2 and 3 (ground and pipe).</p> -<p>For the “Sprite” node, when selecting it click on the “(empty)” for the <em>AnimatedSprite/Frames</em> property and click “New SpriteFrames”, click again where the “(empty)” used to be and ane window should open on the bottom:</p> +<p>Select the <code>Player</code> node and set the <em>CollisionShape2D/Collision/Layer</em> to <code>1</code> and the <em>CollisionObject2D/Collision/Mask</em> to <code>2</code> and <code>3</code> (ground and pipe).</p> +<p>For the <code>Sprite</code> node, when selecting it click on the <code>(empty)</code> for the <em>AnimatedSprite/Frames</em> property and click <code>New SpriteFrames</code>, click again where the <code>(empty)</code> used to be and ane window should open on the bottom:</p> <figure id="__yafg-figure-22"> -<img alt="Scene - Player - SpriteFrames window" src="images/g/flappybird_godot/scene_player_spriteframes_window.png" title="Scene - Player - SpriteFrames window"> +<img alt="Scene - Player - SpriteFrames window" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_spriteframes_window.png" title="Scene - Player - SpriteFrames window"> <figcaption>Scene - Player - SpriteFrames window</figcaption> </figure> -<p>Right off the bat, set the “Speed” to <code>10 FPS</code> (bottom left) and rename “default” to “bird_1”. With the “bird_1” selected, click on the “Add frames from a Sprite Sheet”, which is the second button under “Animation Frames:” which looks has an icon of a small grid (next to the folder icon), a new window will popup where you need to select the respective sprite sheet to use and configure it for importing. On the “Select Frames” window, change the “Vertical” to 1, and then select all 4 frames (<em>Ctrl + Scroll</em> wheel to zoom in):</p> +<p>Right off the bat, set the <code>Speed</code> to <code>10 FPS</code> (bottom left) and rename <code>default</code> to <code>bird_1</code>. With the <code>bird_1</code> selected, click on the <code>Add frames from a Sprite Sheet</code>, which is the second button under <code>Animation Frames:</code> which looks has an icon of a small grid (next to the folder icon), a new window will popup where you need to select the respective sprite sheet to use and configure it for importing. On the <code>Select Frames</code> window, change the <code>Vertical</code> to <code>1</code>, and then select all 4 frames (<em>Ctrl + Scroll</em> wheel to zoom in):</p> <figure id="__yafg-figure-23"> -<img alt="Scene - Player - Sprite sheet importer" src="images/g/flappybird_godot/scene_player_sprite_sheet_importer.png" title="Scene - Player - Sprite sheet importer"> +<img alt="Scene - Player - Sprite sheet importer" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_sprite_sheet_importer.png" title="Scene - Player - Sprite sheet importer"> <figcaption>Scene - Player - Sprite sheet importer</figcaption> </figure> <p>After that, the <em>SpriteFrames</em> window should look like this:</p> <figure id="__yafg-figure-24"> -<img alt="Scene - Player - SpriteFrames window with sprite sheet configured" src="images/g/flappybird_godot/scene_player_spriteframes_window_with_sprite_sheet.png" title="Scene - Player - SpriteFrames window with sprite sheet configured"> +<img alt="Scene - Player - SpriteFrames window with sprite sheet configured" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_player_spriteframes_window_with_sprite_sheet.png" title="Scene - Player - SpriteFrames window with sprite sheet configured"> <figcaption>Scene - Player - SpriteFrames window with sprite sheet configured</figcaption> </figure> -<p>Finally, make sure the “Sprite” node has the <em>AnimatedSprite/Animation</em> is set to “bird_1” and that the “Collision” node is configured correctly for its size and position (I just have it as a radius of 7). As well as dropping the SFX files into the corresponding <em>AudioStreamPlayer</em> (into the <em>AudioStreamPlayer/Stream</em> property).</p> -<h4 id="other">Other<a class="headerlink" href="#other" title="Permanent link">¶</a></h4> +<p>Finally, make sure the <code>Sprite</code> node has the <em>AnimatedSprite/Animation</em> is set to <code>bird_1</code> and that the <code>Collision</code> node is configured correctly for its size and position (I just have it as a radius of <code>7</code>). As well as dropping the SFX files into the corresponding <em>AudioStreamPlayer</em> (into the <em>AudioStreamPlayer/Stream</em> property).</p> +<h3 id="other">Other<a class="headerlink" href="#other" title="Permanent link">¶</a></h3> <p>These are really simple scenes that don’t require much setup:</p> <ul> -<li>“CeilingDetector”: just an <em>Area2D</em> node with a <em>CollisionShape2D</em> in the form of a rectangle (<em>CollisionShape2D/Shape/extents</em> to <code>(120, 10)</code>), stretched horizontally so it fits the whole screen. <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 4</code> (ceiling) and <em>CollisionObject2D/Collision/Mask</em> set to bit 1 (player).</li> -<li>“ScoreDetector”: similar to the “CeilingDetector”, but vertical (<em>CollisionShape2D/Shape/extents</em> to <code>(2.5, 128)</code>) and <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 1</code> (player).</li> -<li>“WorldDetector”: <em>Node2D</em> with a script attached, and 3 <em>RayCast2D</em> as children:<ul> -<li>“NewTile”: <em>Raycast2D/Enabled</em> to true (checked), <em>Raycast2D/Cast To</em> <code>(0, 400)</code>, <em>Raycast2D/Collision Mask</em> to <code>bit 2</code> (ground) and <em>Node2D/Transform/Position</em> to <code>(152, -200)</code></li> -<li>“OldTile”: same as “NewTile”, except for the <em>Node2D/Transform/Position</em>, set it to <code>(-152, -200)</code>.</li> -<li>“OldPipe”: same as “OldTile”, except for the <em>Raycast2D/Collision Mask</em>, set it to <code>bit 3</code> (pipe).</li> +<li><code>CeilingDetector</code>: just an <em>Area2D</em> node with a <em>CollisionShape2D</em> in the form of a rectangle (<em>CollisionShape2D/Shape/extents</em> to <code>(120, 10)</code>), stretched horizontally so it fits the whole screen. <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 4</code> (ceiling) and <em>CollisionObject2D/Collision/Mask</em> set to <code>bit 1</code> (player).</li> +<li><code>ScoreDetector</code>: similar to the <code>CeilingDetector</code>, but vertical (<em>CollisionShape2D/Shape/extents</em> to <code>(2.5, 128)</code>) and <em>CollisionObject2D/Collision/Layer</em> set to <code>bit 1</code> (player).</li> +<li><code>WorldDetector</code>: <em>Node2D</em> with a script attached, and 3 <em>RayCast2D</em> as children:<ul> +<li><code>NewTile</code>: <em>Raycast2D/Enabled</em> to true (checked), <em>Raycast2D/Cast To</em> <code>(0, 400)</code>, <em>Raycast2D/Collision Mask</em> to <code>bit 2</code> (ground) and <em>Node2D/Transform/Position</em> to <code>(152, -200)</code></li> +<li><code>OldTile</code>: same as “NewTile”, except for the <em>Node2D/Transform/Position</em>, set it to <code>(-152, -200)</code>.</li> +<li><code>OldPipe</code>: same as “OldTile”, except for the <em>Raycast2D/Collision Mask</em>, set it to <code>bit 3</code> (pipe).</li> </ul> </li> </ul> -<h4 id="game">Game<a class="headerlink" href="#game" title="Permanent link">¶</a></h4> -<p>This is the actual “Game” scene that holds all the playable stuff, here we will drop in all the previous scenes; the root node is a <em>Node2D</em> and also has an attached script. Also need to add 2 additional <em>AudioStreamPlayers</em> for the “start” and “score” sounds, as well as a <em>Sprite</em> for the background (<em>Sprite/Offset/Offset</em> set to <code>(0, 10)</code>) and a <em>Camera2D</em> (<em>Camera2D/Current</em> set to true (checked)). It should look something like this:</p> +<h3 id="game">Game<a class="headerlink" href="#game" title="Permanent link">¶</a></h3> +<p>This is the actual <code>Game</code> scene that holds all the playable stuff, here we will drop in all the previous scenes; the root node is a <em>Node2D</em> and also has an attached script. Also need to add 2 additional <em>AudioStreamPlayers</em> for the “start” and “score” sounds, as well as a <em>Sprite</em> for the background (<em>Sprite/Offset/Offset</em> set to <code>(0, 10)</code>) and a <em>Camera2D</em> (<em>Camera2D/Current</em> set to true (checked)). It should look something like this:</p> <figure id="__yafg-figure-25"> -<img alt="Scene - Game - Node setup" src="images/g/flappybird_godot/scene_game_node_setup.png" title="Scene - Game - Node setup"> +<img alt="Scene - Game - Node setup" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_game_node_setup.png" title="Scene - Game - Node setup"> <figcaption>Scene - Game - Node setup</figcaption> </figure> <p>The scene viewport should look something like the following:</p> <figure id="__yafg-figure-26"> -<img alt="Scene - Game - Viewport" src="images/g/flappybird_godot/scene_game_viewport.png" title="Scene - Game - Viewport"> +<img alt="Scene - Game - Viewport" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_game_viewport.png" title="Scene - Game - Viewport"> <figcaption>Scene - Game - Viewport</figcaption> </figure> -<h4 id="ui">UI<a class="headerlink" href="#ui" title="Permanent link">¶</a></h4> -<h5 id="fonts">Fonts<a class="headerlink" href="#fonts" title="Permanent link">¶</a></h5> -<p>We need some font “Resources” to style the <em>Label</em> fonts. Under the <em>FileSystem</em> window, right click on the fonts directory (create one if needed) and click on “New Resource…” and select <em>DynamicFontData</em>, save it in the “fonts” directory as “SilverDynamicFontData.tres” (“Silver” as it is the font I’m using) then double click the just created resource and set the <em>DynamicFontData/Font Path</em> to the actual “Silver.ttf” font (or whatever you want).</p> -<p>Then create a new resource and this time select <em>DynamicFont</em>, name it “SilverDynamicFont.tres”, then double click to edit and add the “SilverDynamicFontData.tres” to the <em>DynamicFont/Font/Font Data</em> property (and I personally toggled off the <em>DynamicFont/Font/Antialiased</em> property), now just set the <em>DynamicFont/Settings/(Size, Outline Size, Outline Color)</em> to 32, 1 and black, respectively (or any other values you want). It should look something like this:</p> +<h3 id="ui">UI<a class="headerlink" href="#ui" title="Permanent link">¶</a></h3> +<h4 id="fonts">Fonts<a class="headerlink" href="#fonts" title="Permanent link">¶</a></h4> +<p>We need some font <code>Resources</code> to style the <em>Label</em> fonts. Under the <em>FileSystem</em> window, right click on the fonts directory (create one if needed) and click on <code>New Resource...</code> and select <em>DynamicFontData</em>, save it in the “fonts” directory as <code>SilverDynamicFontData.tres</code> (<code>Silver</code> as it is the font I’m using) then double click the just created resource and set the <em>DynamicFontData/Font Path</em> to the actual <code>Silver.ttf</code> font (or whatever you want).</p> +<p>Then create a new resource and this time select <em>DynamicFont</em>, name it <code>SilverDynamicFont.tres</code>, then double click to edit and add the <code>SilverDynamicFontData.tres</code> to the <em>DynamicFont/Font/Font Data</em> property (and I personally toggled off the <em>DynamicFont/Font/Antialiased</em> property), now just set the <em>DynamicFont/Settings/(Size, Outline Size, Outline Color)</em> to <code>32</code>, <code>1</code> and <code>black</code>, respectively (or any other values you want). It should look something like this:</p> <figure id="__yafg-figure-27"> -<img alt="Resource - DynamicFont - Default font" src="images/g/flappybird_godot/resource_dynamic_font.png" title="Resource - DynamicFont - Default font"> +<img alt="Resource - DynamicFont - Default font" src="https://static.luevano.xyz/images/g/flappybird_godot/resource_dynamic_font.png" title="Resource - DynamicFont - Default font"> <figcaption>Resource - DynamicFont - Default font</figcaption> </figure> -<p>Do the same for another <em>DynamicFont</em> which will be used for the score label, named “SilverScoreDynamicFont.tres”. Only changes are <em>Dynamic/Settings/(Size, Outline Size)</em> which are set to 128 and 2, respectively. The final files for the fonts should look something like this:</p> +<p>Do the same for another <em>DynamicFont</em> which will be used for the score label, named <code>SilverScoreDynamicFont.tres</code>. Only changes are <em>Dynamic/Settings/(Size, Outline Size)</em> which are set to <code>128</code> and <code>2</code>, respectively. The final files for the fonts should look something like this:</p> <figure id="__yafg-figure-28"> -<img alt="Resource - Dynamicfont - Directory structure" src="images/g/flappybird_godot/resource_dynamic_font_directory_structure.png" title="Resource - Dynamicfont - Directory structure"> +<img alt="Resource - Dynamicfont - Directory structure" src="https://static.luevano.xyz/images/g/flappybird_godot/resource_dynamic_font_directory_structure.png" title="Resource - Dynamicfont - Directory structure"> <figcaption>Resource - Dynamicfont - Directory structure</figcaption> </figure> -<h5 id="scene-setup">Scene setup<a class="headerlink" href="#scene-setup" title="Permanent link">¶</a></h5> -<p>This has a bunch of nested nodes, so I’ll try to be concise here. The root node is a <em>CanvasLayer</em> named “UI” with its own script attached, and for the children:</p> +<h4 id="scene-setup">Scene setup<a class="headerlink" href="#scene-setup" title="Permanent link">¶</a></h4> +<p>This has a bunch of nested nodes, so I’ll try to be concise here. The root node is a <em>CanvasLayer</em> named <code>UI</code> with its own script attached, and for the children:</p> <ul> -<li>“MarginContainer”: <em>MarginContainer</em> with <em>Control/Margin/(Left, Top)</em> set to <code>10</code> and <em>Control/Margin/(Right, Bottom)</em> set to <code>-10</code>.<ul> -<li>“InfoContainer”: <em>VBoxContainer</em> with <em>Control/Theme Overrides/Constants/Separation</em> set to <code>250</code>.<ul> -<li>“ScoreContainer”: <em>VBoxContainer</em>.<ul> -<li>“Score”: <em>Label</em> with <em>Label/Align</em> set to “Center”, <em>Control/Theme Overrides/Fonts/Font</em> to the “SilverScoreDynamicFont.tres”, if needed adjust the <em>DynamicFont</em> settings.</li> -<li>“HighScore: same as “Score”, escept for the <em>Control/Theme Overrides/Fonts/Font</em> which is set to “SilverDynamicFont.tres”.</li> +<li><code>MarginContainer</code>: <em>MarginContainer</em> with <em>Control/Margin/(Left, Top)</em> set to <code>10</code> and <em>Control/Margin/(Right, Bottom)</em> set to <code>-10</code>.<ul> +<li><code>InfoContainer</code>: <em>VBoxContainer</em> with <em>Control/Theme Overrides/Constants/Separation</em> set to <code>250</code>.<ul> +<li><code>ScoreContainer</code>: <em>VBoxContainer</em>.<ul> +<li><code>Score</code>: <em>Label</em> with <em>Label/Align</em> set to <code>Center</code>, <em>Control/Theme Overrides/Fonts/Font</em> to the <code>SilverScoreDynamicFont.tres</code>, if needed adjust the <em>DynamicFont</em> settings.</li> +<li><code>HighScore</code>: same as <code>Score</code>, escept for the <em>Control/Theme Overrides/Fonts/Font</em> which is set to <code>SilverDynamicFont.tres</code>.</li> </ul> </li> -<li>“StartGame”: Same as “HighScore”.</li> +<li><code>StartGame</code>: Same as <code>HighScore</code>.</li> </ul> </li> -<li>“DebugContainer”: <em>VBoxContainer</em>.<ul> -<li>“FPS”: <em>Label</em>.</li> +<li><code>DebugContainer</code>: <em>VBoxContainer</em>.<ul> +<li><code>FPS</code>: <em>Label</em>.</li> </ul> </li> -<li>“VersionContainer”: <em>VBoxContainer</em> with <em>BoxContainer/Alignment</em> set to “Begin”.<ul> -<li>“Version”: <em>Label</em> with <em>Label/Align</em> set to “Right”.</li> +<li><code>VersionContainer</code>: <em>VBoxContainer</em> with <em>BoxContainer/Alignment</em> set to <code>Begin</code>.<ul> +<li><code>Version</code>: <em>Label</em> with <em>Label/Align</em> set to <code>Right</code>.</li> </ul> </li> </ul> @@ -850,17 +939,17 @@ func physics_process(delta: float) -> void: </ul> <p>The scene ends up looking like this:</p> <figure id="__yafg-figure-29"> -<img alt="Scene - UI - Node setup" src="images/g/flappybird_godot/scene_ui.png" title="Scene - UI - Node setup"> +<img alt="Scene - UI - Node setup" src="https://static.luevano.xyz/images/g/flappybird_godot/scene_ui.png" title="Scene - UI - Node setup"> <figcaption>Scene - UI - Node setup</figcaption> </figure> -<h4 id="main">Main<a class="headerlink" href="#main" title="Permanent link">¶</a></h4> -<p>This is the final scene where we connect the Game and the UI. It’s made of a <em>Node2D</em> with it’s own script attached and an instance of “Game” and “UI” as it’s children.</p> -<p>This is a good time to set the default scene when we run the game by going to <em>Project -> Project settings… -> General</em> and in <em>Application/Run</em> set the <em>Main Scene</em> to the “Main.tscn” scene.</p> -<h3 id="scripting">Scripting<a class="headerlink" href="#scripting" title="Permanent link">¶</a></h3> +<h3 id="main">Main<a class="headerlink" href="#main" title="Permanent link">¶</a></h3> +<p>This is the final scene where we connect the <code>Game</code> and the <code>UI</code>. It’s made of a <em>Node2D</em> with it’s own script attached and an instance of <code>Game</code> and <code>UI</code> as it’s children.</p> +<p>This is a good time to set the default scene when we run the game by going to <em>Project -> Project settings… -> General</em> and in <em>Application/Run</em> set the <em>Main Scene</em> to the <code>Main.tscn</code> scene.</p> +<h2 id="scripting">Scripting<a class="headerlink" href="#scripting" title="Permanent link">¶</a></h2> <p>I’m going to keep this scripting part to the most basic code blocks, as it’s too much code, for a complete view you can head to the <a href="https://github.com/luevano/flappybird_godot">source code</a>.</p> <p>As of now, the game itself doesn’t do anything if we hit play. The first thing to do so we have something going on is to do the minimal player scripting.</p> -<h4 id="player_1">Player<a class="headerlink" href="#player_1" title="Permanent link">¶</a></h4> -<p>The most basic code needed so the bird goes up and down is to just detect “jump” key presses and add a negative jump velocity so it goes up (<code>y</code> coordinate is reversed in godot…), we also check the velocity sign of the <code>y</code> coordinate to decide if the animation is playing or not.</p> +<h3 id="player_1">Player<a class="headerlink" href="#player_1" title="Permanent link">¶</a></h3> +<p>The most basic code needed so the bird goes up and down is to just detect <code>jump</code> key presses and add a negative jump velocity so it goes up (<code>y</code> coordinate is reversed in godot…), we also check the velocity sign of the <code>y</code> coordinate to decide if the animation is playing or not.</p> <pre><code class="language-gdscript">class_name Player extends KinematicBody2D @@ -909,7 +998,7 @@ func _physics_process(delta: float) -> void: dead_sound.play() </code></pre> <p>Finally need to add the actual checks for when the player dies (like collision with ground or pipe) as well as a function that listens to a signal for when the player goes to the ceiling.</p> -<h4 id="worlddetector">WorldDetector<a class="headerlink" href="#worlddetector" title="Permanent link">¶</a></h4> +<h3 id="worlddetector">WorldDetector<a class="headerlink" href="#worlddetector" title="Permanent link">¶</a></h3> <p>The code is pretty simple, we just need a way of detecting if we ran out of ground and send a signal, as well as sending as signal when we start detecting ground/pipes behind us (to remove it) because the world is being generated as we move. The most basic functions needed are:</p> <pre><code class="language-gdscript">func _was_colliding(detector: RayCast2D, flag: bool, signal_name: String) -> bool: if detector.is_colliding(): @@ -928,8 +1017,8 @@ func _now_colliding(detector: RayCast2D, flag: bool, signal_name: String) -> return false </code></pre> <p>We need to keep track of 3 “flags”: <code>ground_was_colliding</code>, <code>ground_now_colliding</code> and <code>pipe_now_colliding</code> (and their respective signals), which are going to be used to do the checks inside <code>_physics_process</code>. For example for checking for new ground: <code>ground_now_colliding = _now_colliding(old_ground, ground_now_colliding, "ground_started_colliding")</code>.</p> -<h4 id="worldtiles">WorldTiles<a class="headerlink" href="#worldtiles" title="Permanent link">¶</a></h4> -<p>This script is what handles the “GroundTileMap” as well as the “PipeTileMap” and just basically functions as a “Signal bus” connecting a bunch of signals from the “WorldDetector” with the <em>TileMaps</em> and just tracking how many pipes have been placed:</p> +<h3 id="worldtiles">WorldTiles<a class="headerlink" href="#worldtiles" title="Permanent link">¶</a></h3> +<p>This script is what handles the <code>GroundTileMap</code> as well as the <code>PipeTileMap</code> and just basically functions as a “Signal bus” connecting a bunch of signals from the <code>WorldDetector</code> with the <em>TileMaps</em> and just tracking how many pipes have been placed:</p> <pre><code class="language-gdscript">export(int, 2, 20, 2) var PIPE_SEP: int = 6 var tiles_since_last_pipe: int = PIPE_SEP - 1 @@ -950,7 +1039,7 @@ func _on_WorldDetector_ground_started_colliding() -> void: func _on_WorldDetector_pipe_started_colliding() -> void: emit_signal("remove_pipe") </code></pre> -<h5 id="groundtilemap">GroundTileMap<a class="headerlink" href="#groundtilemap" title="Permanent link">¶</a></h5> +<h4 id="groundtilemap">GroundTileMap<a class="headerlink" href="#groundtilemap" title="Permanent link">¶</a></h4> <p>This is the node that actually places the ground tiles upong receiving a signal. In general, what you want is to keep track of the newest tile that you need to place (empty spot) as well as the last tile that is in the tilemap (technically the first one if you count from left to right). I was experimenting with <code>enum</code>s so I used them to define the possible <code>Ground</code> tiles:</p> <pre><code class="language-gdscript">enum Ground { TILE_1, @@ -981,10 +1070,10 @@ func _remove_first_ground() -> void: old_tile_position += Vector2.RIGHT </code></pre> <p>Where you might notice that the <code>_initial_new_tile_x</code> is <code>11</code>, instead of <code>10</code>, refer to <a href="#default-ground-tiles">Default ground tiles</a> where we placed tiles from <code>-8</code> to <code>10</code>, so the next empty one is <code>11</code>. These <code>_place_new_ground</code> and <code>_remove_first_ground</code> functions are called upon receiving the signal.</p> -<h5 id="pipetilemap">PipeTileMap<a class="headerlink" href="#pipetilemap" title="Permanent link">¶</a></h5> -<p>This is really similar to the “GroundTileMap” code, instead of defining an <code>enum</code> for the ground tiles, we define it for the pipe patterns (because each pipe is composed of multiple pipe tiles). If your pipe tile set looks like this (notice the index):</p> +<h4 id="pipetilemap">PipeTileMap<a class="headerlink" href="#pipetilemap" title="Permanent link">¶</a></h4> +<p>This is really similar to the <code>GroundTileMap</code> code, instead of defining an <code>enum</code> for the ground tiles, we define it for the pipe patterns (because each pipe is composed of multiple pipe tiles). If your pipe tile set looks like this (notice the index):</p> <figure id="__yafg-figure-30"> -<img alt="PipeTileMap - Tile set indexes" src="images/g/flappybird_godot/tile_set_pipes_indexes.png" title="PipeTileMap - Tile set indexes"> +<img alt="PipeTileMap - Tile set indexes" src="https://static.luevano.xyz/images/g/flappybird_godot/tile_set_pipes_indexes.png" title="PipeTileMap - Tile set indexes"> <figcaption>PipeTileMap - Tile set indexes</figcaption> </figure> <p>Then you can use the following “pipe patterns”:</p> @@ -997,7 +1086,7 @@ func _remove_first_ground() -> void: PipePattern.PIPE_6: [0, 1, 2, 3, 4, -1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 2] } </code></pre> -<p>Now, the pipe system requires a bit more of tracking as we need to instantiate a “ScoreDetector” here, too. I ended up keeping track of the placed pipes/detectors by using a “pipe stack” (and “detector stack”) which is just an array of placed objects from which I pop the first when deleting them:</p> +<p>Now, the pipe system requires a bit more of tracking as we need to instantiate a <code>ScoreDetector</code> here, too. I ended up keeping track of the placed pipes/detectors by using a “pipe stack” (and “detector stack”) which is just an array of placed objects from which I pop the first when deleting them:</p> <pre><code class="language-gdscript">onready var _pipe_sep: int = get_parent().PIPE_SEP const _pipe_size: int = 16 const _ground_level: int = 7 @@ -1013,7 +1102,7 @@ var detector_scene: PackedScene = preload("res://levels/detectors/score_det var detector_offset: Vector2 = Vector2(16.0, -(_pipe_size / 2.0) * 16.0) var detector_stack: Array </code></pre> -<p>The <code>detector_offset</code> is just me being picky. For placing a new pipe, we get the starting position (bottom pipe tile) and build upwards, then instantiate a new “ScoreDetector” (<code>detector_scene</code>) and set it’s position to the pipe starting position plus the offset, so it’s centered in the pipe, then just need to connect the “body_entered” signal from the detector with the game, so we keep track of the scoring. Finally just add the placed pipe and detector to their corresponding stacks:</p> +<p>The <code>detector_offset</code> is just me being picky. For placing a new pipe, we get the starting position (bottom pipe tile) and build upwards, then instantiate a new <code>ScoreDetector</code> (<code>detector_scene</code>) and set it’s position to the pipe starting position plus the offset, so it’s centered in the pipe, then just need to connect the <code>body_entered</code> signal from the detector with the game, so we keep track of the scoring. Finally just add the placed pipe and detector to their corresponding stacks:</p> <pre><code class="language-gdscript">func _place_new_pipe() -> void: var current_pipe: Vector2 = new_pipe_starting_position for tile in pipe[_get_random_pipe()]: @@ -1043,8 +1132,8 @@ var detector_stack: Array detector.queue_free() </code></pre> <p>These functions are called when receiving the signal to place/remove pipes.</p> -<h4 id="saved-data">Saved data<a class="headerlink" href="#saved-data" title="Permanent link">¶</a></h4> -<p>Before proceeding, we require a way to save/load data (for the high scores). We’re going to use the <em>ConfigFile</em> node that uses a custom version of the “ini” file format. Need to define where to save the data:</p> +<h3 id="saved-data">Saved data<a class="headerlink" href="#saved-data" title="Permanent link">¶</a></h3> +<p>Before proceeding, we require a way to save/load data (for the high scores). We’re going to use the <em>ConfigFile</em> node that uses a custom version of the <code>ini</code> file format. Need to define where to save the data:</p> <pre><code class="language-gdscript">const DATA_PATH: String = "user://data.cfg" const SCORE_SECTION: String = "score" var _data: ConfigFile @@ -1084,12 +1173,12 @@ func get_high_score() -> int: set_new_high_score(0) save_data() </code></pre> -<p>Now, this script in particular will need to be a <a href="https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html">Singleton (AutoLoad)</a>, which means that there will be only one instance and will be available across all scripts. To do so, go to <em>Project -> Project settings… -> AutoLoad</em> and select this script in the “Path:” and add a “Node Name:” (I used “SavedData”, if you use something else, be careful while following this devlog) which will be the name we’ll use to access the singleton. Toggle on “Enable” if needed, it should look like this:</p> +<p>Now, this script in particular will need to be a <a href="https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html">Singleton (AutoLoad)</a>, which means that there will be only one instance and will be available across all scripts. To do so, go to <em>Project -> Project settings… -> AutoLoad</em> and select this script in the <code>Path:</code> and add a <code>Node Name:</code> (I used <code>SavedData</code>, if you use something else, be careful while following this devlog) which will be the name we’ll use to access the singleton. Toggle on <code>Enable</code> if needed, it should look like this:</p> <figure id="__yafg-figure-31"> -<img alt="Project settings - AutoLoad - SavedData singleton" src="images/g/flappybird_godot/project_settings_autoload_saved_data.png" title="Project settings - AutoLoad - SavedData singleton"> +<img alt="Project settings - AutoLoad - SavedData singleton" src="https://static.luevano.xyz/images/g/flappybird_godot/project_settings_autoload_saved_data.png" title="Project settings - AutoLoad - SavedData singleton"> <figcaption>Project settings - AutoLoad - SavedData singleton</figcaption> </figure> -<h4 id="game_1">Game<a class="headerlink" href="#game_1" title="Permanent link">¶</a></h4> +<h3 id="game_1">Game<a class="headerlink" href="#game_1" title="Permanent link">¶</a></h3> <p>The game script it’s also like a “Signal bus” in the sense that it connects all its childs’ signals together, and also has the job of starting/stopping the <code>_process</code> and <code>_physics_process</code> methods from the childs as needed. First, we need to define the signals and and references to all child nodes:</p> <pre><code class="language-gdscript">signal game_started signal game_over @@ -1104,7 +1193,7 @@ onready var camera: Camera2D = $Camera onready var start_sound: AudioStreamPlayer = $StartSound onready var score_sound: AudioStreamPlayer = $ScoreSound </code></pre> -<p>It’s important to get the actual “player speed”, as we’re using a scale to make the game look bigger (remember, pixel art), to do so we need a reference to the “game_scale” we setup at the beginning and compute the <code>player_speed</code>:</p> +<p>It’s important to get the actual “player speed”, as we’re using a scale to make the game look bigger (remember, pixel art), to do so we need a reference to the <code>game_scale</code> we setup at the beginning and compute the <code>player_speed</code>:</p> <pre><code class="language-gdscript">var _game_scale: float = ProjectSettings.get_setting("application/config/game_scale") var player_speed: float @@ -1114,7 +1203,7 @@ func _ready() -> void: # so we move at the actual speed of the player player_speed = player.SPEED / _game_scale </code></pre> -<p>This <code>player_speed</code> will be needed as we need to move all the nodes (“Background”, “Camera”, etc.) in the <code>x</code> axis as the player is moving. This is done in the <code>_physics_process</code>:</p> +<p>This <code>player_speed</code> will be needed as we need to move all the nodes (<code>Background</code>, <code>Camera</code>, etc.) in the <code>x</code> axis as the player is moving. This is done in the <code>_physics_process</code>:</p> <pre><code class="language-gdscript">func _physics_process(delta: float) -> void: ceiling_detector.move_local_x(player_speed * delta) world_detector.move_local_x(player_speed * delta) @@ -1159,8 +1248,8 @@ func _on_ScoreDetector_body_entered(body: Node2D) -> void: emit_signal("new_score", score, high_score) score_sound.play() </code></pre> -<p>When the <code>player</code> dies, we set all processing to <code>false</code>, except for the player itself (so it can drop all the way to the ground). Also, when receiving a “scoring” signal, we manage the current score, as well as saving the new high score when applicable, note that we need to read the <code>high_score</code> at the beginning by calling <code>SavedData.get_high_score()</code>. This signal we emit will be received by the UI so it updates accordingly.</p> -<h4 id="ui_1">UI<a class="headerlink" href="#ui_1" title="Permanent link">¶</a></h4> +<p>When the <code>player</code> dies, we set all processing to <code>false</code>, except for the player itself (so it can drop all the way to the ground). Also, when receiving a “scoring” signal, we manage the current score, as well as saving the new high score when applicable, note that we need to read the <code>high_score</code> at the beginning by calling <code>SavedData.get_high_score()</code>. This signal we emit will be received by the <code>UI</code> so it updates accordingly.</p> +<h3 id="ui_1">UI<a class="headerlink" href="#ui_1" title="Permanent link">¶</a></h3> <p>First thing is to get a reference to all the child <em>Labels</em>, an initial reference to the high score as well as the version defined in the project settings:</p> <pre><code class="language-gdscript">onready var fps_label: Label = $MarginContainer/DebugContainer/FPS onready var version_label: Label = $MarginContainer/VersionContainer/Version @@ -1204,8 +1293,8 @@ func _on_Game_new_score(score: int, high_score: int) -> void: score_label.set_text(String(score)) high_score_label.set_text("High score: %s" % high_score) </code></pre> -<h4 id="main_1">Main<a class="headerlink" href="#main_1" title="Permanent link">¶</a></h4> -<p>This is the shortest script, it just connects the signals between the “Game” and the “UI”:</p> +<h3 id="main_1">Main<a class="headerlink" href="#main_1" title="Permanent link">¶</a></h3> +<p>This is the shortest script, it just connects the signals between the <code>Game</code> and the <code>UI</code>:</p> <pre><code class="language-gdscript">onready var game: Game = $Game onready var ui: UI = $UI @@ -1217,15 +1306,15 @@ func _ready() -> void: game.connect("game_over", ui, "_on_Game_game_over") game.connect("new_score", ui, "_on_Game_new_score") </code></pre> -<h3 id="final-notes-and-exporting">Final notes and exporting<a class="headerlink" href="#final-notes-and-exporting" title="Permanent link">¶</a></h3> +<h2 id="final-notes-and-exporting">Final notes and exporting<a class="headerlink" href="#final-notes-and-exporting" title="Permanent link">¶</a></h2> <p>At this point the game should be fully playable (if any detail missing feel free to look into the source code linked at the beginning). Only thing missing is an icon for the game; I did one pretty quicly with the assets I had.</p> -<h4 id="preparing-the-files">Preparing the files<a class="headerlink" href="#preparing-the-files" title="Permanent link">¶</a></h4> +<h3 id="preparing-the-files">Preparing the files<a class="headerlink" href="#preparing-the-files" title="Permanent link">¶</a></h3> <p>If you followed the directory structure I used, then only thing needed is to transform the icon to a native Windows <code>ico</code> format (if exporting to Windows, else ignore this part). For this you need <a href="https://imagemagick.org/index.php">ImageMagick</a> or some other program that can transform <code>png</code> (or whatever file format you used for the icon) to <code>ico</code>. I used [Chocolatey][https://chocolatey.org/] to install <code>imagemagick</code>, then to convert the icon itself used: <code>magick convert icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico</code> as detailed in <em>Godot</em>‘s <a href="https://docs.godotengine.org/en/stable/tutorials/export/changing_application_icon_for_windows.html">Changing application icon for Windows</a>.</p> -<h4 id="exporting">Exporting<a class="headerlink" href="#exporting" title="Permanent link">¶</a></h4> -<p>You need to download the templates for exporting as detailed in <em>Godot</em>‘s <a href="https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html">Exporting projects</a>. Basically you go to <em>Editor -> Manage Export Templates…</em> and download the latest one specific to your <em>Godot</em> version by clicking on “Download and Install”.</p> +<h3 id="exporting">Exporting<a class="headerlink" href="#exporting" title="Permanent link">¶</a></h3> +<p>You need to download the templates for exporting as detailed in <em>Godot</em>‘s <a href="https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html">Exporting projects</a>. Basically you go to <em>Editor -> Manage Export Templates…</em> and download the latest one specific to your <em>Godot</em> version by clicking on <code>Download and Install</code>.</p> <p>If exporting for Windows then you also need to download <code>rcedit</code> from <a href="https://github.com/electron/rcedit/releases/latest">here</a>. Just place it wherever you want (I put it next to the <em>Godot</em> executable).</p> -<p>Then go to <em>Project -> Export…</em> and the Window should be empty, add a new template by clicking on “Add…” at the top and then select the template you want. I used HTML5, Windows Desktop and Linux/X11. Really the only thing you need to set is the “Export Path” for each template, which is te location of where the executable will be written to, and in the case of the Windows Desktop template you could also setup stuff like “Company Name”, “Product Name”, “File/Product Version”, etc..</p> -<p>Once the templates are setup, select any and click on “Export Project” at the bottom, and make sure to untoggle “Export With Debug” in the window that pops up, this checkbox should be at the bottom of the new window.</p>]]></content:encoded> +<p>Then go to <em>Project -> Export…</em> and the Window should be empty, add a new template by clicking on <code>Add...</code> at the top and then select the template you want. I used HTML5, Windows Desktop and Linux/X11. Really the only thing you need to set is the “Export Path” for each template, which is te location of where the executable will be written to, and in the case of the <em>Windows Desktop</em> template you could also setup stuff like <code>Company Name</code>, <code>Product Name</code>, <code>File/Product Version</code>, etc..</p> +<p>Once the templates are setup, select any and click on <code>Export Project</code> at the bottom, and make sure to untoggle <code>Export With Debug</code> in the window that pops up, this checkbox should be at the bottom of the new window.</p>]]></content:encoded> </item> <item> <title>General Godot project structure</title> @@ -1234,6 +1323,7 @@ func _ready() -> void: <pubDate>Sun, 22 May 2022 01:16:10 GMT</pubDate> <category>English</category> <category>Gamedev</category> + <category>Godot</category> <category>Short</category> <description>Details on the project structure I'm using for Godot, based on preference and some research I did.</description> <content:encoded><![CDATA[<p>One of my first issues when starting a project is how to structure everything. So I had to spend some time researching best practices and go with what I like the most and after trying some of them I wanted to write down somewhere what I’m sticking with.</p> @@ -1366,12 +1456,14 @@ func _ready() -> void: <pubDate>Tue, 17 May 2022 05:19:54 GMT</pubDate> <category>English</category> <category>Gamedev</category> + <category>Godot</category> <category>Short</category> <category>Update</category> <description>Since I'm starting to get more into gamedev stuff, I'll start blogging about it just to keep consistent.</description> - <content:encoded><![CDATA[<p>I’ve been wanting to get into gamedev for a while now, but it’s always a pain to stay consistent. I just recently started to get into gamedev again, and this time I’m trying to actually do stuff.</p> + <content:encoded><![CDATA[<p>I’ve been wanting to get into gamedev for a while now, but it’s always a pain to stay consistent. I just recently started to get into it again, and this time I’m trying to actually do stuff.</p> <p>So, the plan is to blog about my progress and clone some simple games just to get started. I’m thinking on sticking with <a href="https://godotengine.org/">Godot</a> just because I like that it’s open source, it’s getting better and better overtime (big rewrite happening right now) and I already like how the engine works. <del>Specifically I’ll start using <em>Godot 4</em> even though it’s not done yet, to get used to the new features, specifically pumped for <a href="https://godotengine.org/article/gdscript-progress-report-feature-complete-40">GDScript 2.0</a>.</del> <ins>Actually… (for the small clones/ripoffs) I’ll need to use <em>Godot 3.X</em> (probably 3.5), as <em>Godot 4</em> doesn’t have support to export to webassembly (HTML5) yet, and I want that to publish to <a href="https://itch.io/">itch.io</a> and my website. I’ll continue to use <em>Godot 4</em> for bigger projects, as they will take longer and I hope that by the time I need to publish, there’s no issues to export.</ins></p> -<p>For a moment I almost started a new subdomain just for gamedev stuff, but decided to just use a different directory for subtleness; this directory and use of tags should be enough. I’ll be posting the entry about the first rip-off I’m <em>developing</em> (FlappyBird L O L) shortly.</p>]]></content:encoded> +<p>For a moment I almost started a new subdomain just for gamedev stuff, but decided to just use a different directory for subtleness; this directory and use of tags should be enough. I’ll be posting the entry about the first rip-off I’m <em>developing</em> (FlappyBird L O L) shortly.</p> +<p><strong>Update</strong>: <a href="https://godotengine.org/article/godot-4-0-sets-sail/">Godot 4</a> already released and it now has HTML5 support, so back to the original plan.</p>]]></content:encoded> </item> <item> <title>My setup for a password manager and MFA authenticator</title> @@ -1383,7 +1475,7 @@ func _ready() -> void: <category>Tools</category> <description>A short description on my personal setup regarding a password manager and alternatives to G\*\*gl\* authenticator.</description> <content:encoded><![CDATA[<p><strong>Disclaimer</strong>: I won’t go into many technical details here of how to install/configure/use the software, this is just supposed to be a short description on my setup.</p> -<p>It’s been a while since I started using a password manager at all, and I’m happy that I started with <a href="https://keepassxc.org/">KeePassXC</a> (open source, multiplatform password manager that it’s completely offline) as a direct recommendation from <a href="https://www.lmcj.xyz/">lm</a>; before this I was using the same password for everything (like a lot of people), which is a well know privacy issue as noted in detail by <a href="https://askleo.com/different-passwords-for-everything/">Leo</a> (I don’t personally recommed LastPass as Leo does). Note that you will still need a <em>master password</em> to lock/unlock your password database (you can additionally use a hardware key and a key file).</p> +<p>It’s been a while since I started using a password manager at all, and I’m happy that I started with <a href="https://keepassxc.org/">KeePassXC</a> (open source, multiplatform password manager that it’s completely offline) as a direct recommendation from <a href="https://www.lmcj.xyz/"><mark>EL ELE EME</mark></a>; before this I was using the same password for everything (like a lot of people), which is a well know privacy issue as noted in detail by <a href="https://askleo.com/different-passwords-for-everything/">Leo</a> (I don’t personally recommed LastPass as Leo does). Note that you will still need a <em>master password</em> to lock/unlock your password database (you can additionally use a hardware key and a key file).</p> <p>Anyways, setting up <em>keepass</em> is pretty simple, as there is a client for almost any device; note that <em>keepass</em> is basically just the format and the base for all of the clients, as its common with pretty much any open source software. In my case I’m using <a href="https://keepassxc.org/">KeePassXC</a> in my computer and <a href="https://www.keepassdx.com/">KeePassDX</a> in my phone (Android). The only concern is keeping everything in sync because <em>keepass</em> doesn’t have any automatic method of synchronizing between devices because of security reasons (as far as I know), meaning that you have to manage that yourself.</p> <p>Usually you can use something like G**gl* drive, dropbox, mega, nextcloud, or any other cloud solution that you like to sync your <em>keepass</em> database between devices; I personally prefer to use <a href="https://syncthing.net/">Syncthing</a> as it’s open source, it’s really easy to setup and has worked wonders for me since I started using it, also it keeps versions of your files that can serve as backups in any scenario where the database gets corrupted or something.</p> <p>Finally, when I went through the issue with the micro SD and the <em>adoptable storage</em> bullshit (you can find the rant <a href="https://blog.luevano.xyz/a/devs_android_me_trozaron.html">here</a>, in spanish) I had to also migrate from <em>G**gl* authenticator</em> (<em>gauth</em>) to something else for the simple reason that <em>gauth</em> doesn’t even let you do backups, nor it’s synched with your account… nothing, it is just standalone and if you ever lose your phone you’re fucked; so I decided to go with <a href="https://getaegis.app/">Aegis authenticator</a>, as it is open source, you have control over all your secret keys, you can do backups directly to the filesystem, you can secure your database with an extra password, etc., etc.. In general <em>aegis</em> is the superior MFA authenticator (at least compared with <em>gauth</em>) and everything that’s compatible with <em>gauth</em> is compatible with <em>aegis</em> as the format is a standard (as a matter of fact, <em>keepass</em> also has this MFA feature which is called TOPT and is also compatible, but I prefer to have things separate). I also use <em>syncthing</em> to keep a backup of my <em>aegis</em> database.</p> @@ -1429,15 +1521,16 @@ func _ready() -> void: <category>Update</category> <description>Actualización en el estado de la página, después de mucho tiempo de ausencia.</description> <content:encoded><![CDATA[<p>Después de mucho tiempo de estar luchando con querer volver a usar este pex (maldita <em>d</em> word y demás), ya me volví a acomodar el setup para agregar nuevas entradas.</p> -<p>Entre las cosas que tuve que hacer fue actualizar el <a href="https://github.com/luevano/pyssg">pyssg</a> porque no lo podía usar de una como estaba; y de pasado le agregue una que otra feature nueva. Luego quiero agregarle más funcionalidad para poder <em>buildear</em> la página completa; por ahora se hace en segmentos: todo lo de <a href="https://luevano.xyz">luevano.xyz</a> está hecho manual, mientras que <a href="https://blog.luevano.xyz">blog</a> y <a href="https://art.luevano.xyz">art</a> usan <a href="https://github.com/luevano/pyssghttps://github.com/luevano/pyssg">pyssg</a>.</p> +<p>Entre las cosas que tuve que hacer fue actualizar el <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> porque no lo podía usar de una como estaba; y de pasado le agregue una que otra feature nueva. Luego quiero agregarle más funcionalidad para poder <em>buildear</em> la página completa; por ahora se hace en segmentos: todo lo de <a href="https://luevano.xyz">luevano.xyz</a> está hecho manual, mientras que <a href="https://blog.luevano.xyz">blog</a> y <a href="https://art.luevano.xyz">art</a> usan <a href="https://github.com/luevano/pyssg">pyssg</a>.</p> <p>Otra cosa es que quizá me devuelva a editar alguans entradas nada más para homogeneizar las entradas específicas a <em>Create a…</em> (tiene más sentido que sean <em>Setup x…</em> o algo similar).</p> -<p>En otras noticias, estoy muy agusto en el jale que tengo actualmente aunque lleve alrededor de 3 semanas de un infierno por problemas debidos a varias razones (del jale). Debo pensar en si debo omitir cosas personales o del trabajo aquí, ya que quién sabe quién se pueda llegar a topar con esto <em>*thinking emoji*</em>.</p>]]></content:encoded> +<p>En otras noticias, estoy muy agusto en el jale que tengo actualmente aunque lleve alrededor de 3 semanas de un infierno en el jale. Debo pensar en si debo omitir cosas personales o del trabajo aquí, ya que quién sabe quién se pueda llegar a topar con esto <em>*thinking emoji*</em>.</p>]]></content:encoded> </item> <item> <title>Create a VPN server with OpenVPN (IPv4)</title> <link>https://blog.luevano.xyz/a/vpn_server_with_openvpn.html</link> <guid isPermaLink="true">https://blog.luevano.xyz/a/vpn_server_with_openvpn.html</guid> <pubDate>Sun, 01 Aug 2021 09:27:02 GMT</pubDate> + <category>Code</category> <category>English</category> <category>Server</category> <category>Tools</category> @@ -1445,14 +1538,27 @@ func _ready() -> void: <description>How to create a VPN server using OpenVPN on a server running Nginx. Only for IPv4.</description> <content:encoded><![CDATA[<p>I’ve been wanting to do this entry, but had no time to do it since I also have to set up the VPN service as well to make sure what I’m writing makes sense, today is the day.</p> <p>Like with any other of my entries I based my setup on the <a href="https://wiki.archlinux.org/title/OpenVPN">Arch Wiki</a>, <a href="https://github.com/Nyr/openvpn-install">this install script</a> and <a href="https://github.com/graysky2/ovpngen">this profile generator script</a>.</p> -<p>This will be installed and working alongside the other stuff I’ve wrote about on other posts (see the <a href="https://blog.luevano.xyz/tag/@server.html">server</a> tag). All commands here are executes as root unless specified otherwise. Also, this is intended only for IPv4 (it’s not that hard to include IPv6, but meh).</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> +<p>This will be installed and working alongside the other stuff I’ve wrote about on other posts (see the <a href="https://blog.luevano.xyz/tag/@server.html">server</a> tag). All commands here are executes as root unless specified otherwise. Also, this is intended only for IPv4 (it’s not that hard to include IPv6, but meh). As always, all commands are executed as root unless stated otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#create-pki-from-scratch">Create PKI from scratch</a></li> +<li><a href="#openvpn">OpenVPN</a><ul> +<li><a href="#enable-forwarding">Enable forwarding</a></li> +<li><a href="#create-client-configurations">Create client configurations</a></li> +</ul> +</li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>Pretty simple:</p> <ul> -<li>Working server with root access, and with Ufw as the firewall.</li> -<li>Depending on what port you want to run the VPN on, the default <code>1194</code>, or as a fallback on <code>443</code> (click <a href="https://openvpn.net/vpn-server-resources/advanced-option-settings-on-the-command-line/">here</a> for more). I will do mine on port <code>1194</code> but it’s just a matter of changing 2 lines of configuration and one Ufw rule.</li> +<li>Working server with root access, and with <code>ufw</code> as the firewall.</li> +<li>Depending on what port you want to run the VPN on, the default <code>1194</code>, or as a fallback on <code>443</code> (click <a href="https://openvpn.net/vpn-server-resources/advanced-option-settings-on-the-command-line/">here</a> for more). I will do mine on port <code>1194</code> but it’s just a matter of changing 2 lines of configuration and one <code>ufw</code> rule.</li> </ul> -<h3 id="create-pki-from-scratch">Create PKI from scratch<a class="headerlink" href="#create-pki-from-scratch" title="Permanent link">¶</a></h3> +<h2 id="create-pki-from-scratch">Create PKI from scratch<a class="headerlink" href="#create-pki-from-scratch" title="Permanent link">¶</a></h2> <p>PKI stands for <em>Public Key Infrastructure</em> and basically it’s required for certificates, private keys and more. This is supposed to work between two servers and one client: a server in charge of creating, signing and verifying the certificates, a server with the OpenVPN service running and the client making the request.</p> <p>This is supposed to work something like: 1) a client wants to use the VPN service, so it creates a requests and sends it to the signing server, 2) this server checks the requests and signs the request, returning the certificates to both the VPN service and the client and 3) the client can now connect to the VPN service using the signed certificate which the OpenVPN server knows about. In a nutshell, I’m no expert.</p> <p>… but, to be honest, all of this is a hassle and (in my case) I want something simple to use and manage. So I’m gonna do all on one server and then just give away the configuration file for the clients, effectively generating files that anyone can run and will work, meaning that you need to be careful who you give this files (it also comes with a revoking mechanism, so no worries).</p> @@ -1496,8 +1602,8 @@ openssl dhparam -out dh.pem 2048 openvpn --genkey secret ta.key </code></pre> <p>That’s it for the PKI stuff and general certificate configuration.</p> -<h3 id="openvpn">OpenVPN<a class="headerlink" href="#openvpn" title="Permanent link">¶</a></h3> -<p><a href="https://wiki.archlinux.org/title/OpenVPN">OpenVPN</a> is a robust and highly flexible VPN daemon, that’s pretty complete feature wise.</p> +<h2 id="openvpn">OpenVPN<a class="headerlink" href="#openvpn" title="Permanent link">¶</a></h2> +<p><a href="https://wiki.archlinux.org/title/OpenVPN">OpenVPN</a> is a robust and highly flexible VPN daemon, that’s pretty complete feature-wise.</p> <p>Install the <code>openvpn</code> package:</p> <pre><code class="language-sh">pacman -S openvpn </code></pre> @@ -1599,6 +1705,7 @@ verb 3 explicit-exit-notify 1 </code></pre> <p><code>#</code> and <code>;</code> are comments. Read each and every line, you might want to change some stuff (like the logging), specially the first line which is your server public IP.</p> +<h4 id="enable-forwarding">Enable forwarding<a class="headerlink" href="#enable-forwarding" title="Permanent link">¶</a></h4> <p>Now, we need to enable <em>packet forwarding</em> (so we can access the web while connected to the VPN), which can be enabled on the interface level or globally (you can check the different options with <code>sysctl -a | grep forward</code>). I’ll do it globally, run:</p> <pre><code class="language-sh">sysctl net.ipv4.ip_forward=1 </code></pre> @@ -1644,7 +1751,7 @@ ufw reload systemctl enable openvpn-server@server.service </code></pre> <p>Where the <code>server</code> after <code>@</code> is the name of your configuration, <code>server.conf</code> without the <code>.conf</code> in my case.</p> -<h4 id="create-client-configurations">Create client configurations<a class="headerlink" href="#create-client-configurations" title="Permanent link">¶</a></h4> +<h3 id="create-client-configurations">Create client configurations<a class="headerlink" href="#create-client-configurations" title="Permanent link">¶</a></h3> <p>You might notice that I didn’t specify how to actually connect to our server. For that we need to do a few more steps. We actually need a configuration file similar to the <code>server.conf</code> file that we created.</p> <p>The real way of doing this would be to run similar steps as the ones with <code>easy-rsa</code> locally, send them to the server, sign them, and retrieve them. Nah, we’ll just create all configuration files on the server as I was mentioning earlier.</p> <p>Also, the client configuration file has to match the server one (to some degree), to make this easier you can create a <code>client-common</code> file in <code>/etc/openvpn/server</code> with the following content:</p> @@ -1717,7 +1824,7 @@ chown nobody:nobody pki/crl.pem chmod o+r pki/crl.pem cd $CPWD </code></pre> -<p>And the way to use is to run <code>vpn_script new/rev client_name</code> as sudo (when revoking, it doesn’t actually deletes the <code>.ovpn</code> file in <code>~/ovpn</code>). Again, this is a little script that I put together, so you should check it out, it may need tweaks (depending on your directory structure for <code>easy-rsa</code>) and it could have errors.</p> +<p>And the way to use is to run <code>vpn_script new/rev client_name</code> as sudo (when revoking, it doesn’t actually delete the <code>.ovpn</code> file in <code>~/ovpn</code>). Again, this is a little script that I put together, so you should check it out, it may need tweaks (depending on your directory structure for <code>easy-rsa</code>).</p> <p>Now, just get the <code>.ovpn</code> file generated, import it to OpenVPN in your client of preference and you should have a working VPN service.</p>]]></content:encoded> </item> <item> @@ -1741,7 +1848,7 @@ cd $CPWD <p>Y pues ya, este pex ya me sirvió para desahogarme, una disculpa por la redacción tan <em>pitera</em>. Sobres.</p>]]></content:encoded> </item> <item> - <title>Tenia este pex algo descuidado</title> + <title>Tenía este pex algo descuidado</title> <link>https://blog.luevano.xyz/a/tenia_esto_descuidado.html</link> <guid isPermaLink="true">https://blog.luevano.xyz/a/tenia_esto_descuidado.html</guid> <pubDate>Sun, 18 Jul 2021 07:51:50 GMT</pubDate> @@ -1750,10 +1857,10 @@ cd $CPWD <category>Update</category> <description>Nada más un update en el estado del blog y lo que he andado haciendo.</description> <content:encoded><![CDATA[<p>Así es, tenía un poco descuidado este pex, siendo la razón principal que andaba ocupado con cosas de <em>la vida profesional</em>, ayay. Pero ya que ando un poco más despejado y menos estresado voy a seguir usando el blog y a ver qué más hago.</p> -<p>Tengo unas entradas pendientes que quiero hacer del estilo de “tutorial” o “how-to”, pero me lo he estado debatiendo, porque Luke ya empezó a hacerlo más de verdad en <a href="https://landchad.net/">landchad.net</a>, lo cual recomiendo bastante pues igual yo empecé a hacer esto por él (y por <a href="https://lmcj.xyz/">lm</a>); aunque la verdad pues es muy específico a como él hace las cosas y quizá sí puede haber diferencias, pero ya veré en estos días. La próxima que quiero hacer es sobre el VPN, porque no lo he <em>setupeado</em> desde que reinicié El Página Web y La Servidor, entonces acomodaré el VPN de nuevo y de pasada tiro entrada de eso.</p> -<p>También dejé un dibujo pendiente, que la neta lo dejé por 2 cosas: está bien cabrón (porque también lo quiero colorear) y porque estaba ocupado; de lo cuál ya sólo queda el <em>está bien cabrón</em> pero no he tenido el valor de retomarlo. Lo triste es que ya pasó el tiempo del hype y ya no tengo mucha motivación para terminarlo más que el hecho de que cuando lo termine empezaré a usar Clip Studio Paint en vez de Krita, porque compré una licencia ahora que estuvo en 50% de descuento (sí, me mamé).</p> +<p>Tengo unas entradas pendientes que quiero hacer del estilo de “tutorial” o “how-to”, pero me lo he estado debatiendo, porque Luke ya empezó a hacerlo más de verdad en <a href="https://landchad.net/">landchad.net</a>, lo cual recomiendo bastante pues igual yo empecé a hacer esto por él (y por <a href="https://lmcj.xyz/"><mark>EL ELE EME</mark></a>); aunque la verdad pues es muy específico a como él hace las cosas y quizá sí puede haber diferencias, pero ya veré en estos días. La próxima que quiero hacer es sobre el VPN, porque no lo he <em>setupeado</em> desde que reinicié El Página Web y La Servidor, entonces acomodaré el VPN de nuevo y de pasada tiro entrada de eso.</p> +<p>También dejé un dibujo pendiente, que la neta lo dejé por 2 cosas: está bien cabrón (porque también lo quiero colorear) y porque estaba ocupado; de lo cuál ya sólo queda el <em>está bien cabrón</em> pero no he tenido el valor de retomarlo. Lo triste es que ya pasó el tiempo del hype y ya no tengo mucha motivación para terminarlo más que el hecho de que cuando lo termine empezaré a usar Clip Studio Paint en vez de Krita, porque compré una licencia ahora que estuvo en 50% de descuento.</p> <p>Algo bueno es que me he estado sintiendo muy bien conmigo mismo últimamente, aunque casi no hable de eso. Sí hay una razón en específico, pero es una razón algo tonta. Espero así siga.</p> -<p>Ah, y también quería acomodarme una sección de comentarios, pero como siempre, todas las opciones están bien <em>bloated</em>, entonces pues me voy a hacer una en corto seguramente en Python para <em>el back</em>, MySQL para la base de datos y Javascript para la conexión acá en <em>el front</em>, algo tranqui.</p> +<p><del>Ah, y también quería acomodarme una sección de comentarios, pero como siempre, todas las opciones están bien <em>bloated</em>, entonces pues me voy a hacer una en corto seguramente en Python para <em>el back</em>, MySQL para la base de datos y Javascript para la conexión acá en <em>el front</em>, algo tranqui.</del> <ins>Nel, siempre no ocupo esto, pa’ qué.</ins></p> <p>Sobres pues.</p>]]></content:encoded> </item> <item> @@ -1761,15 +1868,28 @@ cd $CPWD <link>https://blog.luevano.xyz/a/xmpp_server_with_prosody.html</link> <guid isPermaLink="true">https://blog.luevano.xyz/a/xmpp_server_with_prosody.html</guid> <pubDate>Wed, 09 Jun 2021 05:24:30 GMT</pubDate> + <category>Code</category> <category>English</category> <category>Server</category> <category>Tools</category> <category>Tutorial</category> <description>How to create an XMPP server using Prosody on a server running Nginx. This server will be compatible with at least Conversations and Movim.</description> - <content:encoded><![CDATA[<p>Recently I set up an XMPP server (and a Matrix one, too) for my personal use and for friends if they want one; made one for <mark><a href="https://lmcj.xyz">EL ELE EME</a></mark> for example. So, here are the notes on how I set up the server that is compatible with the <a href="https://conversations.im/">Conversations</a> app and the <a href="https://movim.eu/">Movim</a> social network. You can see my addresses in <a href="https://luevano.xyz/contact.html">contact</a> and the XMPP compliance/score of the server.</p> -<p>One of the best resources I found that helped me a lot was <a href="https://community.hetzner.com/tutorials/prosody-debian9">Installing and Configuring Prosody XMPP Server on Debian 9</a>, and of course the <a href="https://wiki.archlinux.org/title/Prosody">Arch Wiki</a> and the <a href="https://prosody.im/">oficial documentation</a>.</p> -<p>As with my other entries, this is under a server running Arch Linux, with the Nginx web server and Certbot certificates. And all commands here are executed as root (unless specified otherwise)</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> + <content:encoded><![CDATA[<p><strong>Update</strong>: I no longer host this XMPP server as it consumed a lot of resources and I wasn’t using it that much. I’ll probably re-create it in the future, though.</p> +<p>Recently I set up an <a href="https://xmpp.org/">XMPP</a> server (and a Matrix one, too) for my personal use and for friends if they want one; made one for <a href="https://lmcj.xyz"><mark>EL ELE EME</mark></a> for example. So, here are the notes on how I set up the server that is compatible with the <a href="https://conversations.im/">Conversations</a> app and the <a href="https://movim.eu/">Movim</a> social network. You can see my addresses at <a href="https://luevano.xyz/contact.html">contact</a> and the XMPP compliance/score of the server.</p> +<p>One of the best resources I found that helped me a lot was <a href="https://community.hetzner.com/tutorials/prosody-debian9">Installing and Configuring Prosody XMPP Server on Debian 9</a>, the <a href="https://wiki.archlinux.org/title/Prosody">Arch Wiki</a> and the <a href="https://prosody.im/">oficial documentation</a>.</p> +<p>As with my other entries, this is under a server running Arch Linux, with the Nginx web server and Certbot certificates. And all commands here are executed as root, unless specified otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#prosody">Prosody</a></li> +<li><a href="#nginx-configuration-file">Nginx configuration file</a></li> +<li><a href="#coturn">Coturn</a></li> +<li><a href="#wrapping-up">Wrapping up</a></li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>Same as with my other entries (<a href="https://luevano.xyz/a/website_with_nginx.html">website</a>, <a href="https://blog.luevano.xyz/a/mail_server_with_postfix.html">mail</a> and <a href="https://blog.luevano.xyz/a/git_server_with_cgit.html">git</a>) plus:</p> <ul> <li><strong>A</strong> and (optionally) <strong>AAA</strong> DNS records for:<ul> @@ -1781,16 +1901,16 @@ cd $CPWD </ul> </li> <li>(Optionally, but recommended) the following <strong>SRV</strong> DNS records; make sure it is pointing to an <strong>A</strong> or <strong>AAA</strong> record (matching the records from the last point, for example):<ul> -<li><code>_xmpp-client._tcp.**your.domain**.</code> for port <code>5222</code> pointing to <code>xmpp.**your.domain**.</code></li> -<li><code>_xmpp-server._tcp.**your.domain**.</code> for port <code>5269</code> pointing to <code>xmpp.**your.domain**.</code></li> -<li><code>_xmpp-server._tcp.muc.**your.domain**.</code> for port <code>5269</code> pointing to <code>xmpp.**your.domain**.</code></li> +<li><code>_xmpp-client._tcp.{your.domain}.</code> for port <code>5222</code> pointing to <code>xmpp.{your.domain}.</code></li> +<li><code>_xmpp-server._tcp.{your.domain}.</code> for port <code>5269</code> pointing to <code>xmpp.{your.domain}.</code></li> +<li><code>_xmpp-server._tcp.muc.{your.domain}.</code> for port <code>5269</code> pointing to <code>xmpp.{your.domain}.</code></li> </ul> </li> <li>SSL certificates for the previous subdomains; similar that with my other entries just create the appropriate <code>prosody.conf</code> (where <code>server_name</code> will be all the subdomains defined above) file and run <code>certbot --nginx</code>. You can find the example configuration file almost at the end of this entry.</li> <li>Email addresses for <code>admin</code>, <code>abuse</code>, <code>contact</code>, <code>security</code>, etc. Or use your own email for all of them, doesn’t really matter much as long as you define them in the configuration and are valid, I have aliases so those emails are forwarded to me.</li> <li>Allow ports <code>5000</code>, <code>5222</code>, <code>5269</code>, <code>5280</code> and <code>5281</code> for <a href="https://prosody.im/doc/ports">Prosody</a> and, <code>3478</code> and <code>5349</code> for <a href="https://webrtc.org/getting-started/turn-server">Turnserver</a> which are the defaults for <code>coturn</code>.</li> </ul> -<h3 id="prosody">Prosody<a class="headerlink" href="#prosody" title="Permanent link">¶</a></h3> +<h2 id="prosody">Prosody<a class="headerlink" href="#prosody" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Prosody">Prosody</a> is an implementation of the XMPP protocol that is flexible and extensible.</p> <p>Install the <code>prosody</code> package (with optional dependencies) and the <code>mercurial</code> package:</p> <pre><code class="language-sh">pacman -S prosody, mercurial, lua52-sec, lua52-dbi, lua52-zlib @@ -1802,11 +1922,11 @@ mkdir modules-enabled </code></pre> <p>You can see that I follow a similar approach that I used with Nginx and the server configuration, where I have all the modules available in a directory, and make a symlink to another to keep track of what is being used. You can update the repository by running <code>hg pull --update</code> while inside the <code>modules-available</code> directory (similar to Git).</p> <p>Make symbolic links to the following modules:</p> -<pre><code>ln -s /var/lib/prosody/modules-available/MODULE_NAME /var/lib/prosody/modules-enabled/ +<pre><code>ln -s /var/lib/prosody/modules-available/{module_name} /var/lib/prosody/modules-enabled/ ... </code></pre> <ul> -<li>Modules:<ul> +<li>Modules (<code>{module_name}</code>):<ul> <li><code>mod_bookmarks</code></li> <li><code>mod_cache_c2s_caps</code></li> <li><code>mod_checkcerts</code></li> @@ -2134,8 +2254,8 @@ ln -s your.domain.key SUBDOMAIN.your.domain.key ... </code></pre> <p>That’s basically all the configuration that needs Prosody itself, but we still have to configure Nginx and Coturn before starting/enabling the <code>prosody</code> service.</p> -<h3 id="nginx-configuration-file">Nginx configuration file<a class="headerlink" href="#nginx-configuration-file" title="Permanent link">¶</a></h3> -<p>Since this is not an ordinary configuration file I’m going to describe this too. Your <code>prosody.conf</code> file should have the following location blocks under the main server block (the one that listens to HTTPS):</p> +<h2 id="nginx-configuration-file">Nginx configuration file<a class="headerlink" href="#nginx-configuration-file" title="Permanent link">¶</a></h2> +<p>Since this is not an ordinary configuration file I’m going to describe this, too. Your <code>prosody.conf</code> file should have the following location blocks under the main server block (the one that listens to HTTPS):</p> <pre><code class="language-nginx"># HTTPS server block server { root /var/www/prosody/; @@ -2228,11 +2348,11 @@ server { ] } </code></pre> -<p>Remember to have your <code>prosody.conf</code> file symlinked (or discoverable by Nginx) to the <code>sites-enabled</code> directory. You can now restart your <code>nginx</code> service (and test the configuration, optionally):</p> +<p>Remember to have your <code>prosody.conf</code> file symlinked (or discoverable by Nginx) to the <code>sites-enabled</code> directory. You can now test and restart your <code>nginx</code> service (and test the configuration, optionally):</p> <pre><code class="language-sh">nginx -t systemctl restart nginx.service </code></pre> -<h3 id="coturn">Coturn<a class="headerlink" href="#coturn" title="Permanent link">¶</a></h3> +<h2 id="coturn">Coturn<a class="headerlink" href="#coturn" title="Permanent link">¶</a></h2> <p><a href="https://github.com/coturn/coturn">Coturn</a> is the implementation of TURN and STUN server, which in general is for (at least in the XMPP world) voice support and external service discovery.</p> <p>Install the <code>coturn</code> package:</p> <pre><code class="language-sh">pacman -S coturn @@ -2248,7 +2368,7 @@ static-auth-secret=YOUR SUPER SECRET TURN PASSWORD systemctl enable turnserver.service </code></pre> <p>You can test if your TURN server works at <a href="https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/">Trickle ICE</a>. You may need to add a user in the <code>turnserver.conf</code> to test this.</p> -<h3 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h3> +<h2 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h2> <p>At this point you should have a working XMPP server, start/enable the <code>prosody</code> service now:</p> <pre><code class="language-sh">systemctl start prosody.service systemctl enable prosody.service @@ -2261,7 +2381,7 @@ systemctl enable prosody.service <p>Additionally, you can test the security of your server in <a href="https://xmpp.net/index.php">IM Observatory</a>, here you only need to specify your <code>domain.name</code> (not <code>xmpp.domain.name</code>, if you set up the <strong>SRV</strong> DNS records correctly). Again, it should have a similar score to mine:</p> <p><a href='https://xmpp.net/result.php?domain=luevano.xyz&type=client'><img src='https://xmpp.net/badge.php?domain=luevano.xyz' alt='xmpp.net score' /></a></p> <p>You can now log in into your XMPP client of choice, if it asks for the server it should be <code>xmpp.your.domain</code> (or <code>your.domain</code> for some clients) and your login credentials <code>you@your.domain</code> and the password you chose (which you can change in most clients).</p> -<p>That’s it, send me a message <a href="xmpp:david@luevano.xyz">david@luevano.xyz</a> if you were able to set up the server successfully.</p>]]></content:encoded> +<p>That’s it, send me a message at <a href="xmpp:david@luevano.xyz">david@luevano.xyz</a> if you were able to set up the server successfully.</p>]]></content:encoded> </item> <item> <title>Al fin ya me acomodé la página pa' los dibujos</title> @@ -2273,7 +2393,7 @@ systemctl enable prosody.service <category>Update</category> <description>Actualización en el estado de la página, en este caso sobre la existencia de una nueva página para los dibujos y arte en general.</description> <content:encoded><![CDATA[<p>Así es, ya quedó acomodado el sub-dominio <code>art.luevano.xyz</code> pos pal <a href="https://art.luevano.xyz">arte</a> veda. Entonces pues ando feliz por eso.</p> -<p>Este pedo fue gracias a que me reescribí la forma en la que <code>pyssg</code> maneja los templates, ahora uso el sistema de <code>jinja</code> en vez del cochinero que hacía antes.</p> +<p>Este pedo fue gracias a que me reescribí la forma en la que <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> maneja los templates, ahora uso el sistema de <a href="https://jinja.palletsprojects.com/en/3.1.x/"><code>jinja</code></a> en vez del cochinero que hacía antes.</p> <p>Y pues nada más eso, aquí está el <a href="https://art.luevano.xyz/a/elephant_octopus.html">primer post</a> y por supuesto acá está el link del RSS <a href="https://art.luevano.xyz/rss.xml">https://art.luevano.xyz/rss.xml</a>.</p>]]></content:encoded> </item> <item> @@ -2288,8 +2408,9 @@ systemctl enable prosody.service <content:encoded><![CDATA[<p>Estuve acomodando un poco más el <em>sItIo</em>, al fin agregué la “sección” de <a href="https://luevano.xyz/contact.html">contact</a> y de <a href="https://luevano.xyz/donate.html">donate</a> por si hay algún loco que quiere tirar varo.</p> <p>También me puse a acomodar un servidor de <a href="https://xmpp.org/">XMPP</a> el cual, en pocas palabras, es un protocolo de mensajería instantánea (y más) descentralizado, por lo cual cada quien puede hacer una cuenta en el servidor que quiera y conectarse con cuentas creadas en otro servidor… exacto, como con los correos electrónicos. Y esto está perro porque si tú tienes tu propio server, así como con uno de correo electrónico, puedes controlar qué características tiene, quiénes pueden hacer cuenta, si hay <em>end-to-end encryption</em> (o mínimo <em>end-to-server</em>), entre un montón de otras cosas.</p> <p>Ahorita este server es SUMISO (<em>compliant</em> en español, jeje) para jalar con la app <a href="https://conversations.im/">conversations</a> y con la red social <a href="https://movim.eu/">movim</a>, pero realmente funcionaría con casi cualquier cliente de XMPP, amenos que ese cliente implemente algo que no tiene mi server. Y también acomodé un server de <a href="https://matrix.org/">Matrix</a> que es muy similar pero es bajo otro protocolo y se siente más como un discord/slack (al menos en el <a href="https://element.io/">element</a>), muy chingón también.</p> -<p>Si bien aún quedan cosas por hacer sobre estos dos servers que me acomodé (además de hacerles unas entradas para documentar cómo lo hice), quiero moverme a otra cosa que sería acomodar una sección de dibujos, lo cual en teoría es bien sencillo, pero como quiero poder automatizar la publicación de estos, quiero modificar un poco el <a href="https://github.com/luevano/pyssg">pyssg</a> para que jale chido para este pex.</p> -<p>Ya por último también quiero moverle un poco al CSS, porque lo dejé en un estado muy culerón y quiero meterle/ajustar unas cosas para que quede más limpio y medianamente bonito… <em>dentro de lo que cabe porque evidentemente me vale verga si se ve como una página del 2000</em>.</p>]]></content:encoded> +<p>Si bien aún quedan cosas por hacer sobre estos dos servers que me acomodé (además de hacerles unas entradas para documentar cómo lo hice), quiero moverme a otra cosa que sería acomodar una sección de dibujos, lo cual en teoría es bien sencillo, pero como quiero poder automatizar la publicación de estos, quiero modificar un poco el <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> para que jale chido para este pex.</p> +<p>Ya por último también quiero moverle un poco al CSS, porque lo dejé en un estado muy culerón y quiero meterle/ajustar unas cosas para que quede más limpio y medianamente bonito… <em>dentro de lo que cabe porque evidentemente me vale verga si se ve como una página del 2000</em>.</p> +<p><strong>Actualización</strong>: Ya tumbé el servidor de XMPP porque consumía bastantes recursos y no lo usaba tanto, si en un futuro consigo un mejor servidor podría volver a hostearlo.</p>]]></content:encoded> </item> <item> <title>I'm using a new blogging system</title> @@ -2305,28 +2426,42 @@ systemctl enable prosody.service <p>The solution? Write a new program “from scratch” in <em>pYtHoN</em>. Yes it is bloated, yes it is in its early stages, but it works just as I want it to work, and I’m pretty happy so far with the results and have with even more ideas in mind to “optimize” and generally clean my wOrKfLoW to post new blog entries. I even thought of using it for posting into a “feed” like gallery for drawings or pictures in general.</p> <p>I called it <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a>, because it sounds nice and it wasn’t taken in the PyPi. It is just a terminal program that reads either a configuration file or the options passed as flags when calling the program.</p> <p>It still uses Markdown files because I find them very easy to work with. And instead of just having a “header” and a “footer” applied to each parsed entry, you will have templates (generated with the program) for each piece that I thought made sense (idea taken from <code>blogit</code>): the common header and footer, the common header and footer for each entry and, header, footer and list elements for articles and tags. When parsing the Markdown file these templates are applied and stitched together to make a single HTML file. Also generates an RSS feed and the <code>sitemap.xml</code> file, which is nice.</p> -<p>It might sound convoluted, but it works pretty well, with of course room to improve; I’m open to suggestions, issue reporting or direct contributions <a href="https://github.com/luevano/pyssg">here</a>. BTW, it only works on Linux for now (and don’t think on making it work on windows, but feel free to do PR for the compatibility).</p> -<p>That’s it for now, the new RSS feed is available here: <a href="https://blog.luevano.xyz/rss.xml">https://blog.luevano.xyz/rss.xml</a>.</p>]]></content:encoded> +<p>It might sound convoluted, but it works pretty well, with of course room to improve; I’m open to suggestions, issue reporting or direct contributions <a href="https://github.com/luevano/pyssg">here</a>. For now, it is only tested on Linux (and don’t think on making it work on windows, but feel free to do PR for the compatibility).</p> +<p>That’s it for now, the new RSS feed is available here: <a href="https://blog.luevano.xyz/rss.xml">https://blog.luevano.xyz/rss.xml</a>.</p> +<p><strong>Update</strong>: Since writing this entry, <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a> has evolved quite a bit, so not everything described here is still true. For the latest updates check the newest entries or the git repository itself.</p>]]></content:encoded> </item> <item> <title>Create a git server and setup cgit web app (on Nginx)</title> <link>https://blog.luevano.xyz/a/git_server_with_cgit.html</link> <guid isPermaLink="true">https://blog.luevano.xyz/a/git_server_with_cgit.html</guid> <pubDate>Sun, 21 Mar 2021 19:00:29 GMT</pubDate> + <category>Code</category> <category>English</category> <category>Server</category> <category>Tools</category> <category>Tutorial</category> <description>How to create a git server using cgit on a server running Nginx. This is a follow up on post about creating a website with Nginx and Certbot.</description> - <content:encoded><![CDATA[<p>My git server is all I need to setup to actually <em>kill</em> my other server (I’ve been moving from servers on these last 2-3 blog entries), that’s why I’m already doing this entry. I’m basically following <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server">git’s guide on setting up a server</a> plus some specific stuff for (btw i use) Arch Linux (<a href="https://wiki.archlinux.org/index.php/Git_server#Web_interfaces">Arch Linux Wiki: Git server</a> and <a href="https://miracoin.wordpress.com/2014/11/25/step-by-step-guide-on-setting-up-git-server-in-arch-linux-pushable/">Step by step guide on setting up git server in arch linux (pushable)</a>).</p> -<p>Note that this is mostly for personal use, so there’s no user/authentication control other than that of SSH. Also, most if not all commands here are run as root.</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> + <content:encoded><![CDATA[<p>My git server is all I need to setup to actually <em>kill</em> my other server (I’ve been moving from servers on these last 2-3 blog entries), that’s why I’m already doing this entry. I’m basically following <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server">git’s guide on setting up a server</a> plus some specific stuff for <mark>btw i use</mark> Arch Linux (<a href="https://wiki.archlinux.org/index.php/Git_server#Web_interfaces">Arch Linux Wiki: Git server</a> and <a href="https://miracoin.wordpress.com/2014/11/25/step-by-step-guide-on-setting-up-git-server-in-arch-linux-pushable/">Step by step guide on setting up git server in arch linux (pushable)</a>).</p> +<p>Note that this is mostly for personal use, so there’s no user/authentication control other than that of normal <code>ssh</code>. And as with the other entries, most if not all commands here are run as root unless stated otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#git">Git</a></li> +<li><a href="#cgit">Cgit</a><ul> +<li><a href="#cgits-file-rendering">Cgit’s file rendering</a></li> +</ul> +</li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>I might get tired of saying this (it’s just copy paste, basically)… but you will need the same prerequisites as before (check my <a href="https://blog.luevano.xyz/a/website_with_nginx.html">website</a> and <a href="https://blog.luevano.xyz/a/mail_server_with_postfix.html">mail</a> entries), with the extras:</p> <ul> <li>(Optional, if you want a “front-end”) A <strong>CNAME</strong> for “git” and (optionally) “www.git”, or some other name for your sub-domains.</li> <li>An SSL certificate, if you’re following the other entries, add a <code>git.conf</code> and run <code>certbot --nginx</code> to extend the certificate.</li> </ul> -<h3 id="git">Git<a class="headerlink" href="#git" title="Permanent link">¶</a></h3> +<h2 id="git">Git<a class="headerlink" href="#git" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/git">Git</a> is a version control system.</p> <p>If not installed already, install the <code>git</code> package:</p> <pre><code class="language-sh">pacman -S git @@ -2360,11 +2495,11 @@ systemctl enable git-daemon.socket </code></pre> <p>You’re basically done. Now you should be able to push/pull repositories to your server… except, you haven’t created any repository in your server, that’s right, they’re not created automatically when trying to push. To do so, you have to run (while inside <code>/home/git</code>):</p> <pre><code class="language-sh">git init --bare {repo_name}.git -chown -R git:git repo_name.git +chown -R git:git {repo_name}.git </code></pre> -<p>Those two lines above will need to be run each time you want to add a new repository to your server (yeah, kinda lame… although there are options to “automate” this, I like it this way).</p> +<p><mark>Those two lines above will need to be run each time you want to add a new repository to your server</mark>. There are options to “automate” this but I like it this way.</p> <p>After that you can already push/pull to your repository. I have my repositories (locally) set up so I can push to more than one remote at the same time (my server, GitHub, GitLab, etc.); to do so, check <a href="https://gist.github.com/rvl/c3f156e117e22a25f242">this gist</a>.</p> -<h3 id="cgit">Cgit<a class="headerlink" href="#cgit" title="Permanent link">¶</a></h3> +<h2 id="cgit">Cgit<a class="headerlink" href="#cgit" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Cgit">Cgit</a> is a fast web interface for git.</p> <p>This is optionally since it’s only for the web application.</p> <p>Install the <code>cgit</code> and <code>fcgiwrap</code> packages:</p> @@ -2405,10 +2540,9 @@ repo.url={url} repo.path={dir_path} repo.owner={owner} repo.desc={short_description} - ... </code></pre> -<p>Where you can uncomment the <code>robots</code> line to let web crawlers (like Google’s) to index your <code>git</code> web app. And at the end keep all your repositories (the ones you want to make public), for example for my <a href="https://git.luevano.xyz/.dots"><em>dotfiles</em></a> I have:</p> +<p>Where you can uncomment the <code>robots</code> line to not let web crawlers (like Google’s) to index your <code>git</code> web app. And at the end keep all your repositories (the ones you want to make public), for example for my <a href="https://git.luevano.xyz/.dots"><em>dotfiles</em></a> I have:</p> <pre><code class="language-apache">... repo.url=.dots repo.path=/home/git/.dots.git @@ -2417,6 +2551,7 @@ repo.desc=These are my personal dotfiles. ... </code></pre> <p>Otherwise you could let <code>cgit</code> to automatically detect your repositories (you have to be careful if you want to keep “private” repos) using the option <code>scan-path</code> and setup <code>.git/description</code> for each repository. For more, you can check <a href="https://man.archlinux.org/man/cgitrc.5">cgitrc(5)</a>.</p> +<h3 id="cgits-file-rendering">Cgit’s file rendering<a class="headerlink" href="#cgits-file-rendering" title="Permanent link">¶</a></h3> <p>By default you can’t see the files on the site, you need a highlighter to render the files, I use <code>highlight</code>. Install the <code>highlight</code> package:</p> <pre><code class="language-sh">pacman -S highlight </code></pre> @@ -2442,21 +2577,37 @@ exec highlight --force --inline-css -f -I -O xhtml -S "$EXTENSION" 2&g <link>https://blog.luevano.xyz/a/mail_server_with_postfix.html</link> <guid isPermaLink="true">https://blog.luevano.xyz/a/mail_server_with_postfix.html</guid> <pubDate>Sun, 21 Mar 2021 04:05:59 GMT</pubDate> + <category>Code</category> <category>English</category> <category>Server</category> <category>Tools</category> <category>Tutorial</category> <description>How to create mail server using Postfix, Dovecot, SpamAssassin and OpenDKIM. This is a follow up on post about creating a website with Nginx and Certbot.</description> - <content:encoded><![CDATA[<p>The entry is going to be long because it’s a <em>tedious</em> process. This is also based on <a href="https://github.com/LukeSmithxyz/emailwiz">Luke Smith’s script</a>, but adapted to Arch Linux (his script works on debian-based distributions). This entry is mostly so I can record all the notes required while I’m in the process of installing/configuring the mail server on a new VPS of mine; also I’m going to be writing a script that does everything in one go (for Arch Linux), that will be hosted <a href="https://git.luevano.xyz/server_scripts.git">here</a>.</p> -<p>This configuration works for local users (users that appear in <code>/etc/passwd</code>), and does not use any type of SQL Database. And note that most if not all commands executed here are run with root privileges.</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> + <content:encoded><![CDATA[<p>The entry is going to be long because it’s a <em>tedious</em> process. This is also based on <a href="https://github.com/LukeSmithxyz/emailwiz">Luke Smith’s script</a>, but adapted to Arch Linux (his script works on debian-based distributions). This entry is mostly so I can record all the notes required while I’m in the process of installing/configuring the mail server on a new VPS of mine; <del>also I’m going to be writing a script that does everything in one go (for Arch Linux), that will be hosted <a href="https://git.luevano.xyz/server_scripts.git">here</a>.</del> <ins>I haven’t had time to do the script so nevermind this, if I ever do it I’ll make a new entry regarding it.</ins></p> +<p>This configuration works for local users (users that appear in <code>/etc/passwd</code>), and does not use any type of SQL database. And note that most if not all commands executed here are run with root privileges, unless stated otherwise.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#postfix">Postfix</a></li> +<li><a href="#dovecot">Dovecot</a></li> +<li><a href="#opendkim">OpenDKIM</a><ul> +<li><a href="#opendkim-dns-txt-records">OpenDKIM DNS TXT records</a></li> +</ul> +</li> +<li><a href="#spamassassin">SpamAssassin</a></li> +<li><a href="#wrapping-up">Wrapping up</a></li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>Basically the same as with the <a href="https://blog.luevano.xyz/a/website_with_nginx.html">website with Nginx and Certbot</a>, with the extras:</p> <ul> <li>You will need a <strong>CNAME</strong> for “mail” and (optionally) “www.mail”, or whatever you want to call the sub-domains (although the <a href="https://tools.ietf.org/html/rfc2181#section-10.3">RFC 2181</a> states that it NEEDS to be an <strong>A</strong> record, fuck the police).</li> <li>An SSL certificate. You can use the SSL certificate obtained following my last post using <code>certbot</code> (just create a <code>mail.conf</code> and run <code>certbot --nginx</code> again).</li> -<li>Ports 25, 587 (SMTP), 465 (SMTPS), 143 (IMAP) and 993 (IMAPS) open on the firewall.</li> +<li>Ports <code>25</code>, <code>587</code> (SMTP), <code>465</code> (SMTPS), <code>143</code> (IMAP) and <code>993</code> (IMAPS) open on the firewall (I use <code>ufw</code>).</li> </ul> -<h3 id="postfix">Postfix<a class="headerlink" href="#postfix" title="Permanent link">¶</a></h3> +<h2 id="postfix">Postfix<a class="headerlink" href="#postfix" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/postfix">Postfix</a> is a “mail transfer agent” which is the component of the mail server that receives and sends emails via SMTP.</p> <p>Install the <code>postfix</code> package:</p> <pre><code class="language-sh">pacman -S postfix @@ -2493,7 +2644,7 @@ smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous, noplaintext smtpd_sasl_tls_security_options = noanonymous </code></pre> -<p>Specify the mailbox home (this is going to be a directory inside your user’s home containing the actual mail files):</p> +<p>Specify the mailbox home, this is going to be a directory inside your user’s home containing the actual mail files, for example it will end up being<code>/home/david/Mail/Inbox</code>:</p> <pre><code class="language-apache">home_mailbox = Mail/Inbox/ </code></pre> <p>Pre-configuration to work seamlessly with <code>dovecot</code> and <code>opendkim</code>:</p> @@ -2507,8 +2658,7 @@ smtpd_milters = inet:127.0.0.1:8891 non_smtpd_milters = inet:127.0.0.1:8891 mailbox_command = /usr/lib/dovecot/deliver </code></pre> -<p>Where <code>{yourdomainname}</code> is <code>luevano.xyz</code> in my case, or if you have <code>localhost</code> configured to your domain, then use <code>localhost</code> for <code>myhostname</code> (<code>myhostname = localhost</code>).</p> -<p>Lastly, if you don’t want the sender’s IP and user agent (application used to send the mail), add the following line:</p> +<p>Where <code>{yourdomainname}</code> is <code>luevano.xyz</code> in my case. Lastly, if you don’t want the sender’s IP and user agent (application used to send the mail), add the following line:</p> <pre><code class="language-apache">smtp_header_checks = regexp:/etc/postfix/smtp_header_checks </code></pre> <p>And create the <code>/etc/postfix/smtp_header_checks</code> file with the following content:</p> @@ -2545,7 +2695,7 @@ newaliases <pre><code class="language-sh">systemctl start postfix.service systemctl enable postfix.service </code></pre> -<h3 id="dovecot">Dovecot<a class="headerlink" href="#dovecot" title="Permanent link">¶</a></h3> +<h2 id="dovecot">Dovecot<a class="headerlink" href="#dovecot" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Dovecot">Dovecot</a> is an IMAP and POP3 server, which is what lets an email application retrieve the mail.</p> <p>Install the <code>dovecot</code> and <code>pigeonhole</code> (sieve for <code>dovecot</code>) packages:</p> <pre><code class="language-sh">pacman -S dovecot pigeonhole @@ -2660,8 +2810,8 @@ account required pam_unix.so <pre><code class="language-sh">systemctl start dovecot.service systemctl enable dovecot.service </code></pre> -<h3 id="opendkim">OpenDKIM<a class="headerlink" href="#opendkim" title="Permanent link">¶</a></h3> -<p><a href="https://wiki.archlinux.org/title/OpenDKIM">OpenDKIM</a> is needed so services like G**gle (we don’t mention that name here [[[this is a meme]]]) don’t throw the mail to the trash. DKIM stands for “DomainKeys Identified Mail”.</p> +<h2 id="opendkim">OpenDKIM<a class="headerlink" href="#opendkim" title="Permanent link">¶</a></h2> +<p><a href="https://wiki.archlinux.org/title/OpenDKIM">OpenDKIM</a> is needed so services like G**gle don’t throw the mail to the trash. DKIM stands for “DomainKeys Identified Mail”.</p> <p>Install the <code>opendkim</code> package:</p> <pre><code class="language-sh">pacman -S opendkim </code></pre> @@ -2710,7 +2860,8 @@ chmod g+r /etc/postfix/dkim/* <pre><code class="language-sh">systemctl start opendkim.service systemctl enable opendkim.service </code></pre> -<p>And don’t forget to add the following <strong>TXT</strong> records on your domain registrar (these examples are for Epik):</p> +<h3 id="opendkim-dns-txt-records">OpenDKIM DNS TXT records<a class="headerlink" href="#opendkim-dns-txt-records" title="Permanent link">¶</a></h3> +<p>Add the following <strong>TXT</strong> records on your domain registrar (these examples are for Epik):</p> <ol> <li><em>DKIM</em> entry: look up your <code>{yoursubdomain}.txt</code> file, it should look something like:</li> </ol> @@ -2718,7 +2869,7 @@ systemctl enable opendkim.service "p=..." "..." ) ; ----- DKIM key mail for {yourdomain} </code></pre> -<p>In the TXT record you will place <code>{yoursubdomain}._domainkey</code> as the “Host” and <code>"v=DKIM1; k=rsa; s=email; " "p=..." "..."</code> in the “TXT Value” (replace the dots with the actual value you see in your file).</p> +<p>In the <strong>TXT</strong> record you will place <code>{yoursubdomain}._domainkey</code> as the “Host” and <code>"v=DKIM1; k=rsa; s=email; " "p=..." "..."</code> in the “TXT Value” (replace the dots with the actual value you see in your file).</p> <ol start="2"> <li> <p><em>DMARC</em> entry: just <code>_dmarc.{yourdomain}</code> as the “Host” and <code>"v=DMARC1; p=reject; rua=mailto:dmarc@{yourdomain}; fo=1"</code> as the “TXT Value”.</p> @@ -2728,7 +2879,7 @@ systemctl enable opendkim.service </li> </ol> <p>And at this point you could test your mail for spoofing and more.</p> -<h3 id="spamassassin">SpamAssassin<a class="headerlink" href="#spamassassin" title="Permanent link">¶</a></h3> +<h2 id="spamassassin">SpamAssassin<a class="headerlink" href="#spamassassin" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/SpamAssassin">SpamAssassin</a> is just <em>a mail filter to identify spam</em>.</p> <p>Install the <code>spamassassin</code> package (which will install a bunch of ugly <code>perl</code> packages…):</p> <pre><code class="language-sh">pacman -S spamassassin @@ -2781,10 +2932,10 @@ ExecStart=/usr/bin/vendor_perl/spamd -x -u spamd -g spamd --listen=/run/spamd/sp <pre><code class="language-sh">systemctl start spamassassin.service systemctl enable spamassassin.service </code></pre> -<h3 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h3> -<p>We should have a working mail server by now. Before continuing check your journal logs (<code>journalctl -xe --unit={unit}</code>, where <code>{unit}</code> could be <code>spamassassin.service</code> for example) to see if there was any error whatsoever and try to debug it, it should be a typo somewhere (the logs are generally really descriptive) because all the settings and steps detailed here just (literally just finished doing everything on a new server as of the writing of this text) worked <em>(((it just werks on my machine)))</em>.</p> +<h2 id="wrapping-up">Wrapping up<a class="headerlink" href="#wrapping-up" title="Permanent link">¶</a></h2> +<p>We should have a working mail server by now. Before continuing check your journal logs (<code>journalctl -xe --unit={unit}</code>, where <code>{unit}</code> could be <code>spamassassin.service</code> for example) to see if there was any error whatsoever and try to debug it, it should be a typo somewhere because all the settings and steps detailed here just worked; I literally just finished doing everything on a new server as of the writing of this text, <mark>it just werks on my machine</mark>.</p> <p>Now, to actually use the mail service: first of all, you need a <em>normal</em> account (don’t use root) that belongs to the <code>mail</code> group (<code>gpasswd -a user group</code> to add a user <code>user</code> to group <code>group</code>) and that has a password.</p> -<p>Next, to actually login into a mail app/program/whateveryouwanttocallit, you will use the following settings, at least for <code>thunderdbird</code>(I tested in windows default mail app and you don’t need a lot of settings):</p> +<p>Next, to actually login into a mail app/program, you will use the following settings, at least for <code>thunderdbird</code>(I tested in windows default mail app and you don’t need a lot of settings):</p> <ul> <li>* server: subdomain.domain (mail.luevano.xyz in my case)</li> <li><strong>SMTP</strong> port: 587</li> @@ -2798,38 +2949,47 @@ systemctl enable spamassassin.service </ul> <p>All that’s left to do is test your mail server for spoofing, and to see if everything is setup correctly. Go to <a href="https://www.appmaildev.com/en/dkim">DKIM Test</a> and follow the instructions (basically click next, and send an email with whatever content to the email that they provide). After you send the email, you should see something like:</p> <figure id="__yafg-figure-3"> -<img alt="DKIM Test successful" src="images/b/notes/mail/dkim_test_successful.png" title="DKIM Test successful"> +<img alt="DKIM Test successful" src="https://static.luevano.xyz/images/b/notes/mail/dkim_test_successful.png" title="DKIM Test successful"> <figcaption>DKIM Test successful</figcaption> -</figure> -<p>Finally, that’s actually it for this entry, if you have any problem whatsoever you can <a href="https://luevano.xyz/contact.html">contact me</a>.</p>]]></content:encoded> +</figure>]]></content:encoded> </item> <item> <title>Create a website with Nginx and Certbot</title> <link>https://blog.luevano.xyz/a/website_with_nginx.html</link> <guid isPermaLink="true">https://blog.luevano.xyz/a/website_with_nginx.html</guid> <pubDate>Fri, 19 Mar 2021 02:58:15 GMT</pubDate> + <category>Code</category> <category>English</category> <category>Server</category> <category>Tools</category> <category>Tutorial</category> <description>How to create website that runs on Nginx and uses Certbot for SSL certificates. This is a base for future blog posts about similar topics.</description> <content:encoded><![CDATA[<p>These are general notes on how to setup a Nginx web server plus Certbot for SSL certificates, initially learned from <a href="https://www.youtube.com/watch?v=OWAqilIVNgE">Luke’s video</a> and after some use and research I added more stuff to the mix. And, actually at the time of writing this entry, I’m configuring the web server again on a new VPS instance, so this is going to be fresh.</p> -<p>As a side note, (((i use arch btw))) so everything here es aimed at an Arch Linux distro, and I’m doing everything on a VPS. Also note that most if not all commands here are executed with root privileges.</p> -<h3 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h3> +<p>As a side note, <mark>i use arch btw</mark> so everything here es aimed at an Arch Linux distro, and I’m doing everything on a VPS. Also note that most if not all commands here are executed with root privileges.</p> +<h2 id="table-of-contents">Table of contents<a class="headerlink" href="#table-of-contents" title="Permanent link">¶</a></h2> +<div class="toc"> +<ul> +<li><a href="#table-of-contents">Table of contents</a></li> +<li><a href="#prerequisites">Prerequisites</a></li> +<li><a href="#nginx">Nginx</a></li> +<li><a href="#certbot">Certbot</a></li> +</ul> +</div> +<h2 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">¶</a></h2> <p>You will need two things:</p> <ul> <li>A domain name (duh!). I got mine on <a href="https://www.epik.com/?affid=da5ne9ru4">Epik</a> (affiliate link, btw).<ul> -<li>With the corresponding <strong>A</strong> and <strong>AAA</strong> records pointing to the VPS’ IPs (“A” record points to the ipv4 address and “AAA” to the ipv6, basically). I have three records for each type: empty one, “www” and “*” for a wildcard, that way “domain.name”, “www.domain.name”, “anythingelse.domain.name” point to the same VPS (meaning that you can have several VPS for different sub-domains).</li> +<li>With the corresponding <strong>A</strong> and <strong>AAA</strong> records pointing to the VPS’ IPs. I have three records for each type: empty string, “www” and “*” for a wildcard, that way “domain.name”, “www.domain.name”, “anythingelse.domain.name” point to the same VPS (meaning that you can have several VPS for different sub-domains). These depend on the VPS provider.</li> </ul> </li> -<li>A VPS or somewhere else to host it. I’m using <a href="https://www.vultr.com/?ref=8732849">Vultr</a> (also an affiliate link).<ul> +<li>A VPS or somewhere else to host it. I’m using <a href="https://www.vultr.com/?ref=8732849">Vultr</a> (also an affiliate link, btw).<ul> <li>With <code>ssh</code> already configured both on the local machine and on the remote machine.</li> -<li>Firewall already configured to allow ports 80 (HTTP) and 443 (HTTPS). I use <code>ufw</code> so it’s just a matter of doing <code>ufw allow 80,443/tcp</code> as root and you’re golden.</li> -<li><code>cron</code> installed if you follow along (you could use <code>systemd</code> timers, or some other method you prefer to automate running commands every X time).</li> +<li>Firewall already configured to allow ports <code>80</code> (HTTP) and <code>443</code> (HTTPS). I use <code>ufw</code> so it’s just a matter of doing <code>ufw allow 80,443/tcp</code> (for example) as root and you’re golden.</li> +<li><code>cron</code> installed if you follow along (you could use <code>systemd</code> timers, or some other method you prefer to automate running commands every certain time).</li> </ul> </li> </ul> -<h3 id="nginx">Nginx<a class="headerlink" href="#nginx" title="Permanent link">¶</a></h3> +<h2 id="nginx">Nginx<a class="headerlink" href="#nginx" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Nginx">Nginx</a> is a web (HTTP) server and reverse proxy server.</p> <p>You have two options: <code>nginx</code> and <code>nginx-mainline</code>. I prefer <code>nginx-mainline</code> because it’s the “up to date” package even though <code>nginx</code> is labeled to be the “stable” version. Install the package and enable/start the service:</p> <pre><code class="language-sh">pacman -S nginx-mainline @@ -2838,7 +2998,7 @@ systemctl start nginx.service </code></pre> <p>And that’s it, at this point you can already look at the default initial page of Nginx if you enter the IP of your server in a web browser. You should see something like this:</p> <figure id="__yafg-figure-1"> -<img alt="Nginx welcome page" src="images/b/notes/nginx/nginx_welcome_page.png" title="Nginx welcome page"> +<img alt="Nginx welcome page" src="https://static.luevano.xyz/images/b/notes/nginx/nginx_welcome_page.png" title="Nginx welcome page"> <figcaption>Nginx welcome page</figcaption> </figure> <p>As stated in the welcome page, configuration is needed, head to the directory of Nginx:</p> @@ -2905,7 +3065,7 @@ systemctl restart nginx </code></pre> <p>If everything goes correctly, you can now go to your website by typing <code>domain.name</code> on a web browser. But you will see a “404 Not Found” page like the following (maybe with different Nginx version):</p> <figure id="__yafg-figure-2"> -<img alt="Nginx 404 Not Found page" src="images/b/notes/nginx/nginx_404_page.png" title="Nginx 404 Not Found page"> +<img alt="Nginx 404 Not Found page" src="https://static.luevano.xyz/images/b/notes/nginx/nginx_404_page.png" title="Nginx 404 Not Found page"> <figcaption>Nginx 404 Not Found page</figcaption> </figure> <p>That’s no problem, because it means that the web server it’s actually working. Just add an <code>index.html</code> file with something simple to see it in action (in the <code>/var/www/some_folder</code> that you decided upon). If you keep seeing the 404 page make sure your <code>root</code> line is correct and that the directory/index file exists.</p> @@ -2918,7 +3078,7 @@ systemctl restart nginx try_files $uri/index.html $uri.html $uri/ $uri =404; ... </code></pre> -<h3 id="certbot">Certbot<a class="headerlink" href="#certbot" title="Permanent link">¶</a></h3> +<h2 id="certbot">Certbot<a class="headerlink" href="#certbot" title="Permanent link">¶</a></h2> <p><a href="https://wiki.archlinux.org/title/Certbot">Certbot</a> is what provides the SSL certificates via <a href="https://letsencrypt.org/">Let’s Encrypt</a>.</p> <p>The only “bad” (bloated) thing about Certbot, is that it uses <code>python</code>, but for me it doesn’t matter too much. You may want to look up another alternative if you prefer. Install the packages <code>certbot</code> and <code>certbot-nginx</code>:</p> <pre><code class="language-sh">pacman -S certbot certbot-nginx @@ -2930,7 +3090,7 @@ systemctl restart nginx <p>Now, the certificate given by <code>certbot</code> expires every 3 months or something like that, so you want to renew this certificate every once in a while. Using <code>cron</code>, you can do this by running:</p> <pre><code class="language-sh">crontab -e </code></pre> -<p>And a file will be opened where you need to add a new rule for Certbot, just append the line: <code>1 1 1 * * certbot renew</code> (renew on the first day of every month) and you’re good. Alternatively use <code>systemd</code> timers as stated in the <a href="https://wiki.archlinux.org/title/Certbot#Automatic_renewal">Arch Linux Wiki</a>.</p> +<p>And a file will be opened where you need to add a new rule for Certbot, just append the line: <code>1 1 1 * * certbot renew --quiet --agree-tos --deploy-hook "systemctl reload nginx.service"</code> (renew on the first day of every month) and you’re good. Alternatively use <code>systemd</code> timers as stated in the <a href="https://wiki.archlinux.org/title/Certbot#Automatic_renewal">Arch Linux Wiki</a>.</p> <p>That’s it, you now have a website with SSL certificate.</p>]]></content:encoded> </item> <item> @@ -2945,8 +3105,10 @@ systemctl restart nginx <description>Actualización en el estado del blog y el sistema usado para crearlo.</description> <content:encoded><![CDATA[<p>Pues eso, esta entrada es sólo para tirar update sobre mi <a href="https://blog.luevano.xyz/a/first_blog_post.html">primer post</a>. Ya modifiqué el <code>ssg</code> lo suficiente como para que maneje los <em>timestamps</em>, y ya estoy más familiarizado con este script entonces ya lo podré extender más, pero por ahora las entradas ya tienen su fecha de creación (y modificación en dado caso) al final y en el índice ya están organizados por fecha, que por ahora está algo simple pero está sencillo de extender.</p> <p>Ya lo único que queda es cambiar un poco el formato del blog (y de la página en general), porque en un momento de desesperación puse todo el texto en justificado y pues no se ve chido siempre, entonces queda corregir eso. <em>Y aunque me tomó más tiempo del que quisiera, así nomás quedó, diría un cierto personaje.</em></p> -<p>El <code>ssg</code> modificado está en mis <a href="https://git.luevano.xyz/.dots">dotfiles</a> (o directamente <a href="https://git.luevano.xyz/.dots/tree/.local/bin/ssg">aquí</a>).</p> -<p>Por último, también quité las extensiones <code>.html</code> de las URLs, porque se veía bien pitero, pero igual los links con <code>.html</code> al final redirigen a su link sin <code>.html</code>, así que no hay rollo alguno.</p>]]></content:encoded> +<p><del>El <code>ssg</code> modificado está en mis <a href="https://git.luevano.xyz/.dots">dotfiles</a> (o directamente <a href="https://git.luevano.xyz/.dots/tree/.local/bin/ssg">aquí</a>).</del> +<ins>Como al final ya no usé el <code>ssg</code> modificado, este pex ya no existe.</ins></p> +<p>Por último, también quité las extensiones <code>.html</code> de las URLs, porque se ve bien pitero, pero igual los links con <code>.html</code> al final redirigen a su link sin <code>.html</code>, así que no hay rollo alguno.</p> +<p><strong>Actualización</strong>: Ahora estoy usando mi propia solución en vez de <code>ssg</code>, que la llamé <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a>, de la cual empiezo a hablar <a href="https://blog.luevano.xyz/a/new_blogging_system.html">acá</a>.</p>]]></content:encoded> </item> <item> <title>This is the first blog post, just for testing purposes</title> @@ -2958,9 +3120,10 @@ systemctl restart nginx <category>Tools</category> <category>Update</category> <description>Just my first blog post where I state what tools I'm using to build this blog.</description> - <content:encoded><![CDATA[<p>I’m making this post just to figure out how <a href="https://www.romanzolotarev.com/ssg.html"><code>ssg5</code></a> and <a href="https://kristaps.bsd.lv/lowdown/"><code>lowdown</code></a> are supposed to work (and eventually also <a href="https://www.romanzolotarev.com/rssg.html"><code>rssg</code></a>).</p> -<p>At the moment, I’m not satisfied because there’s no automatic date insertion into the 1) html file, 2) the blog post itself and 3) the listing system in the <a href="https://blog.luevano.xyz/">blog homepage</a> (and there’s also the problem with the ordering of the entries…). And all of this just because I didn’t want to use <a href="https://github.com/LukeSmithxyz/lb">Luke’s</a> solution (don’t really like that much how he handles the scripts… <em>but they just work</em>).</p> -<p>Hopefully, for tomorrow all of this will be sorted out and I’ll have a working blog system.</p>]]></content:encoded> + <content:encoded><![CDATA[<p>I’m making this post just to figure out how <a href="https://www.romanzolotarev.com/ssg.html"><code>ssg5</code></a> and <a href="https://kristaps.bsd.lv/lowdown/"><code>lowdown</code></a> are supposed to work, and eventually <a href="https://www.romanzolotarev.com/rssg.html"><code>rssg</code></a>.</p> +<p>At the moment I’m not satisfied because there’s no automatic date insertion into the 1) html file, 2) the blog post itself and 3) the listing system in the <a href="https://blog.luevano.xyz/">blog homepage</a> which also has a problem with the ordering of the entries. And all of this just because I didn’t want to use Luke’s <a href="https://github.com/LukeSmithxyz/lb">lb</a> solution as I don’t really like that much how he handles the scripts (<em>but they just work</em>).</p> +<p>Hopefully, for tomorrow all of this will be sorted out and I’ll have a working blog system.</p> +<p><strong>Update</strong>: I’m now using my own solution which I called <a href="https://github.com/luevano/pyssg"><code>pyssg</code></a>, of which I talk about <a href="https://blog.luevano.xyz/a/new_blogging_system.html">here</a>.</p>]]></content:encoded> </item> </channel> </rss>
\ No newline at end of file diff --git a/live/blog/sitemap.xml b/live/blog/sitemap.xml index 6b40c4b..caceb5e 100644 --- a/live/blog/sitemap.xml +++ b/live/blog/sitemap.xml @@ -47,37 +47,37 @@ <url> <loc>https://blog.luevano.xyz/a/rewrote_pyssg_again.html</loc> - <lastmod>2022-12-20</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/g/gogodot_jam3_devlog_1.html</loc> - <lastmod>2022-06-10</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/g/flappybird_godot_devlog_1.html</loc> - <lastmod>2022-05-29</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/g/godot_project_structure.html</loc> - <lastmod>2022-05-24</lastmod> + <lastmod>2023-05-05</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/g/starting_gamedev_blogging.html</loc> - <lastmod>2022-05-22</lastmod> + <lastmod>2023-05-05</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/password_manager_authenticator_setup.html</loc> - <lastmod>2022-05-22</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> @@ -89,13 +89,13 @@ </url> <url> <loc>https://blog.luevano.xyz/a/volviendo_a_usar_la_pagina.html</loc> - <lastmod>2022-04-28</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/vpn_server_with_openvpn.html</loc> - <lastmod>2021-08-01</lastmod> + <lastmod>2023-05-05</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> @@ -107,66 +107,72 @@ </url> <url> <loc>https://blog.luevano.xyz/a/tenia_esto_descuidado.html</loc> - <lastmod>2021-07-18</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/xmpp_server_with_prosody.html</loc> - <lastmod>2022-12-20</lastmod> + <lastmod>2023-05-05</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/acomodada_la_pagina_de_arte.html</loc> - <lastmod>2021-06-06</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/asi_nomas_esta_quedando.html</loc> - <lastmod>2021-06-04</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/new_blogging_system.html</loc> - <lastmod>2021-05-28</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/git_server_with_cgit.html</loc> - <lastmod>2021-06-08</lastmod> + <lastmod>2023-05-05</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/mail_server_with_postfix.html</loc> - <lastmod>2021-06-08</lastmod> + <lastmod>2023-05-05</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/website_with_nginx.html</loc> - <lastmod>2021-06-08</lastmod> + <lastmod>2023-05-05</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/el_blog_ya_tiene_timestamps.html</loc> - <lastmod>2021-05-17</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> <loc>https://blog.luevano.xyz/a/first_blog_post.html</loc> - <lastmod>2021-05-17</lastmod> + <lastmod>2023-05-04</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url> <url> + <loc>https://blog.luevano.xyz/tag/@code.html</loc> + <lastmod></lastmod> + <changefreq>daily</changefreq> + <priority>0.5</priority> + </url> + <url> <loc>https://blog.luevano.xyz/tag/@english.html</loc> <lastmod></lastmod> <changefreq>daily</changefreq> @@ -185,6 +191,12 @@ <priority>0.5</priority> </url> <url> + <loc>https://blog.luevano.xyz/tag/@gdscript.html</loc> + <lastmod></lastmod> + <changefreq>daily</changefreq> + <priority>0.5</priority> + </url> + <url> <loc>https://blog.luevano.xyz/tag/@godot.html</loc> <lastmod></lastmod> <changefreq>daily</changefreq> diff --git a/live/blog/tag/@code.html b/live/blog/tag/@code.html new file mode 100644 index 0000000..caab191 --- /dev/null +++ b/live/blog/tag/@code.html @@ -0,0 +1,122 @@ +<!DOCTYPE html> +<html class="theme-dark" lang="en +" + prefix="og: https://ogp.me/ns#"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" href="https://static.luevano.xyz/images/icons/favicon.ico"> +<title>Posts filtered by code -- Luevano's Blog</title> +<meta name="description" content="Posts filtered by code"/> +<link rel="alternate" type="application/rss+xml" href="https://blog.luevano.xyz/rss.xml" title="Luevano's Blog RSS"> + <!-- general style --> + <link rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/style.css"> + <link rel="stylesheet" type="text/css" href="https://static.luevano.xyz/fork-awesome/css/fork-awesome.min.css"> + <link rel="stylesheet" type="text/css" href="https://static.luevano.xyz/font-awesome/css/all.min.css"> + <!-- theme related --> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> + <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> + <!-- extra --> + <!-- og meta --> + <meta property="og:title" content="Luevano's Blog"/> + <meta property="og:type" content="article"/> + <meta property="og:url" content="https://blog.luevano.xyz/tag/@code.html"/> + <meta property="og:image" content="https://static.luevano.xyz/images/b/default.png"/> + <meta property="og:description" content="Posts filtered by code"/> + <meta property="og:locale" content="en"/> + <meta property="og:site_name" content="Luevano's Blog"/> + </head> + + <body> + <header> +<nav> + <ul> + <li> + <a href="https://luevano.xyz/"><i class="fas fa-home" alt="Home"></i><span>Home</span></a> + </li> + + <li> + <a href="https://blog.luevano.xyz/"><i class="fas fa-book-open" alt="Blog"></i><span>Blog</span></a> + </li> + + <li> + <a href="https://art.luevano.xyz/"><i class="fas fa-paint-brush" alt="Art"></i><span>Art</span></a> + </li> + + <li><i class="fab fa-git" alt="Git"></i><span>Git</span> + <ul> + <li><a href="https://git.luevano.xyz/" target="_blank"><i class="fab fa-git-alt" alt="Git-alt"></i></a></li> + + <li><a href="https://github.com/luevano" target="_blank"><i class="fab fa-github" alt="Github"></i></a></li> + + <li><a href="https://gitlab.com/dluevano" target="_blank"><i class="fab fa-gitlab" alt="Gitlab"></i></a></li> + </ul> + </li> + + <li><i class="fas fa-box-open" alt="Stuff"></i><span>Stuff</span> + <ul> + <li><a href="https://gb.luevano.xyz/"><i class="fas fa-gamepad" alt="Gameboy"></i><span>Gameboy</span></a></li> + </ul> + </li> + </ul> +</nav> + +<button class="theme-switcher" onclick="toggleTheme()"><i class="fas fa-moon"></i><i class="fas fa-sun"></i></button> + + </header> + + <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> + <h1>Posts filtered by code</h1> + + <h2>Articles</h2> + <ul class="page-list"> + <h3>August 2021</h3> + <li>Aug 01 - <a href="https://blog.luevano.xyz/a/vpn_server_with_openvpn.html">Create a VPN server with OpenVPN (IPv4)</a></li> + <h3>June 2021</h3> + <li>Jun 09 - <a href="https://blog.luevano.xyz/a/xmpp_server_with_prosody.html">Create an XMPP server with Prosody compatible with Conversations and Movim</a></li> + <h3>March 2021</h3> + <li>Mar 21 - <a href="https://blog.luevano.xyz/a/git_server_with_cgit.html">Create a git server and setup cgit web app (on Nginx)</a></li> + <li>Mar 21 - <a href="https://blog.luevano.xyz/a/mail_server_with_postfix.html">Create a mail server with Postfix, Dovecot, SpamAssassin and OpenDKIM</a></li> + <li>Mar 19 - <a href="https://blog.luevano.xyz/a/website_with_nginx.html">Create a website with Nginx and Certbot</a></li> + </ul> + + + </main> + + <footer> +<span> + <i class="fas fa-address-card" alt="Contact"></i> + <a href="https://blog.luevano.xyz/contact.html">Contact</a> +</span> + +<span> + <i class="fas fa-donate" alt="Donate"></i> + <a href="https://blog.luevano.xyz/donate.html">Donate</a> +</span> + +<span> + <i class="fas fa-rss" alt="RSS"></i> + <a target="_blank" href="https://blog.luevano.xyz/rss.xml">RSS</a> +</span> + +<br> +<span class="created-with"> + <i class="fas fa-hammer" alt="Hammer"></i> + Created with <a href="https://github.com/luevano/pyssg">pyssg</a> +</span> + +<br> +<span class="copyright"> + Copyright <i class="far fa-copyright" alt="Copyright"></i> 2023 David Luévano Alvarado +</span> + + </footer> + </body> +</html>
\ No newline at end of file diff --git a/live/blog/tag/@english.html b/live/blog/tag/@english.html index 11b0866..b4cd9c1 100644 --- a/live/blog/tag/@english.html +++ b/live/blog/tag/@english.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by english</h1> <h2>Articles</h2> diff --git a/live/blog/tag/@gamedev.html b/live/blog/tag/@gamedev.html index 84a30b1..ba38db5 100644 --- a/live/blog/tag/@gamedev.html +++ b/live/blog/tag/@gamedev.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by gamedev</h1> <h2>Articles</h2> diff --git a/live/blog/tag/@gamejam.html b/live/blog/tag/@gamejam.html index 2dac914..910b781 100644 --- a/live/blog/tag/@gamejam.html +++ b/live/blog/tag/@gamejam.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by gamejam</h1> <h2>Articles</h2> diff --git a/live/blog/tag/@gdscript.html b/live/blog/tag/@gdscript.html new file mode 100644 index 0000000..dcc53d0 --- /dev/null +++ b/live/blog/tag/@gdscript.html @@ -0,0 +1,118 @@ +<!DOCTYPE html> +<html class="theme-dark" lang="en +" + prefix="og: https://ogp.me/ns#"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" href="https://static.luevano.xyz/images/icons/favicon.ico"> +<title>Posts filtered by gdscript -- Luevano's Blog</title> +<meta name="description" content="Posts filtered by gdscript"/> +<link rel="alternate" type="application/rss+xml" href="https://blog.luevano.xyz/rss.xml" title="Luevano's Blog RSS"> + <!-- general style --> + <link rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/style.css"> + <link rel="stylesheet" type="text/css" href="https://static.luevano.xyz/fork-awesome/css/fork-awesome.min.css"> + <link rel="stylesheet" type="text/css" href="https://static.luevano.xyz/font-awesome/css/all.min.css"> + <!-- theme related --> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> + <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> + <!-- extra --> + <!-- og meta --> + <meta property="og:title" content="Luevano's Blog"/> + <meta property="og:type" content="article"/> + <meta property="og:url" content="https://blog.luevano.xyz/tag/@gdscript.html"/> + <meta property="og:image" content="https://static.luevano.xyz/images/b/default.png"/> + <meta property="og:description" content="Posts filtered by gdscript"/> + <meta property="og:locale" content="en"/> + <meta property="og:site_name" content="Luevano's Blog"/> + </head> + + <body> + <header> +<nav> + <ul> + <li> + <a href="https://luevano.xyz/"><i class="fas fa-home" alt="Home"></i><span>Home</span></a> + </li> + + <li> + <a href="https://blog.luevano.xyz/"><i class="fas fa-book-open" alt="Blog"></i><span>Blog</span></a> + </li> + + <li> + <a href="https://art.luevano.xyz/"><i class="fas fa-paint-brush" alt="Art"></i><span>Art</span></a> + </li> + + <li><i class="fab fa-git" alt="Git"></i><span>Git</span> + <ul> + <li><a href="https://git.luevano.xyz/" target="_blank"><i class="fab fa-git-alt" alt="Git-alt"></i></a></li> + + <li><a href="https://github.com/luevano" target="_blank"><i class="fab fa-github" alt="Github"></i></a></li> + + <li><a href="https://gitlab.com/dluevano" target="_blank"><i class="fab fa-gitlab" alt="Gitlab"></i></a></li> + </ul> + </li> + + <li><i class="fas fa-box-open" alt="Stuff"></i><span>Stuff</span> + <ul> + <li><a href="https://gb.luevano.xyz/"><i class="fas fa-gamepad" alt="Gameboy"></i><span>Gameboy</span></a></li> + </ul> + </li> + </ul> +</nav> + +<button class="theme-switcher" onclick="toggleTheme()"><i class="fas fa-moon"></i><i class="fas fa-sun"></i></button> + + </header> + + <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> + <h1>Posts filtered by gdscript</h1> + + <h2>Articles</h2> + <ul class="page-list"> + <h3>June 2022</h3> + <li>Jun 10 - <a href="https://blog.luevano.xyz/g/gogodot_jam3_devlog_1.html">Creating my Go Godot Jam 3 entry using Godot 3.5 devlog 1</a></li> + <h3>May 2022</h3> + <li>May 29 - <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1.html">Creating a FlappyBird clone in Godot 3.5 devlog 1</a></li> + </ul> + + + </main> + + <footer> +<span> + <i class="fas fa-address-card" alt="Contact"></i> + <a href="https://blog.luevano.xyz/contact.html">Contact</a> +</span> + +<span> + <i class="fas fa-donate" alt="Donate"></i> + <a href="https://blog.luevano.xyz/donate.html">Donate</a> +</span> + +<span> + <i class="fas fa-rss" alt="RSS"></i> + <a target="_blank" href="https://blog.luevano.xyz/rss.xml">RSS</a> +</span> + +<br> +<span class="created-with"> + <i class="fas fa-hammer" alt="Hammer"></i> + Created with <a href="https://github.com/luevano/pyssg">pyssg</a> +</span> + +<br> +<span class="copyright"> + Copyright <i class="far fa-copyright" alt="Copyright"></i> 2023 David Luévano Alvarado +</span> + + </footer> + </body> +</html>
\ No newline at end of file diff --git a/live/blog/tag/@godot.html b/live/blog/tag/@godot.html index 8ebf464..3f7a243 100644 --- a/live/blog/tag/@godot.html +++ b/live/blog/tag/@godot.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by godot</h1> <h2>Articles</h2> @@ -74,6 +81,8 @@ <li>Jun 10 - <a href="https://blog.luevano.xyz/g/gogodot_jam3_devlog_1.html">Creating my Go Godot Jam 3 entry using Godot 3.5 devlog 1</a></li> <h3>May 2022</h3> <li>May 29 - <a href="https://blog.luevano.xyz/g/flappybird_godot_devlog_1.html">Creating a FlappyBird clone in Godot 3.5 devlog 1</a></li> + <li>May 22 - <a href="https://blog.luevano.xyz/g/godot_project_structure.html">General Godot project structure</a></li> + <li>May 17 - <a href="https://blog.luevano.xyz/g/starting_gamedev_blogging.html">Will start blogging about gamedev</a></li> </ul> diff --git a/live/blog/tag/@rant.html b/live/blog/tag/@rant.html index 0d117f3..186d395 100644 --- a/live/blog/tag/@rant.html +++ b/live/blog/tag/@rant.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by rant</h1> <h2>Articles</h2> diff --git a/live/blog/tag/@server.html b/live/blog/tag/@server.html index aaf9f8f..3aa9f4c 100644 --- a/live/blog/tag/@server.html +++ b/live/blog/tag/@server.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by server</h1> <h2>Articles</h2> diff --git a/live/blog/tag/@short.html b/live/blog/tag/@short.html index 888b0cb..2838cc1 100644 --- a/live/blog/tag/@short.html +++ b/live/blog/tag/@short.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by short</h1> <h2>Articles</h2> @@ -79,7 +86,7 @@ <h3>April 2022</h3> <li>Apr 28 - <a href="https://blog.luevano.xyz/a/volviendo_a_usar_la_pagina.html">Volviendo a usar la página</a></li> <h3>July 2021</h3> - <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenia este pex algo descuidado</a></li> + <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenía este pex algo descuidado</a></li> <h3>June 2021</h3> <li>Jun 06 - <a href="https://blog.luevano.xyz/a/acomodada_la_pagina_de_arte.html">Al fin ya me acomodé la página pa' los dibujos</a></li> <li>Jun 04 - <a href="https://blog.luevano.xyz/a/asi_nomas_esta_quedando.html">Así nomás está quedando el página</a></li> diff --git a/live/blog/tag/@spanish.html b/live/blog/tag/@spanish.html index 534dc1f..b77333e 100644 --- a/live/blog/tag/@spanish.html +++ b/live/blog/tag/@spanish.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by spanish</h1> <h2>Articles</h2> @@ -76,7 +83,7 @@ <li>Apr 28 - <a href="https://blog.luevano.xyz/a/volviendo_a_usar_la_pagina.html">Volviendo a usar la página</a></li> <h3>July 2021</h3> <li>Jul 28 - <a href="https://blog.luevano.xyz/a/hoy_toco_desarrollo_personaje.html">Hoy me tocó desarrollo de personaje</a></li> - <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenia este pex algo descuidado</a></li> + <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenía este pex algo descuidado</a></li> <h3>June 2021</h3> <li>Jun 06 - <a href="https://blog.luevano.xyz/a/acomodada_la_pagina_de_arte.html">Al fin ya me acomodé la página pa' los dibujos</a></li> <li>Jun 04 - <a href="https://blog.luevano.xyz/a/asi_nomas_esta_quedando.html">Así nomás está quedando el página</a></li> diff --git a/live/blog/tag/@tools.html b/live/blog/tag/@tools.html index ce1a9e3..ec2e758 100644 --- a/live/blog/tag/@tools.html +++ b/live/blog/tag/@tools.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by tools</h1> <h2>Articles</h2> diff --git a/live/blog/tag/@tutorial.html b/live/blog/tag/@tutorial.html index 0d55bff..8f28716 100644 --- a/live/blog/tag/@tutorial.html +++ b/live/blog/tag/@tutorial.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by tutorial</h1> <h2>Articles</h2> diff --git a/live/blog/tag/@update.html b/live/blog/tag/@update.html index 0cf313c..370cf8d 100644 --- a/live/blog/tag/@update.html +++ b/live/blog/tag/@update.html @@ -16,6 +16,8 @@ <!-- theme related --> <script type="text/javascript" src="https://static.luevano.xyz/scripts/theme.js"></script> <link id="theme-css" rel="stylesheet" type="text/css" href="https://static.luevano.xyz/css/theme.css"> + <!-- misc functions--> + <script type="text/javascript" src="https://static.luevano.xyz/scripts/return_top.js"></script> <!-- extra --> <!-- og meta --> <meta property="og:title" content="Luevano's Blog"/> @@ -66,6 +68,11 @@ </header> <main> + <div class="return-top"> + <button class="return-top" onclick="returnTop()" id="returnTopButton"> + <i class="fas fa-arrow-up" alt="Return to top"></i> + </button> + </div> <h1>Posts filtered by update</h1> <h2>Articles</h2> @@ -78,7 +85,7 @@ <h3>April 2022</h3> <li>Apr 28 - <a href="https://blog.luevano.xyz/a/volviendo_a_usar_la_pagina.html">Volviendo a usar la página</a></li> <h3>July 2021</h3> - <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenia este pex algo descuidado</a></li> + <li>Jul 18 - <a href="https://blog.luevano.xyz/a/tenia_esto_descuidado.html">Tenía este pex algo descuidado</a></li> <h3>June 2021</h3> <li>Jun 06 - <a href="https://blog.luevano.xyz/a/acomodada_la_pagina_de_arte.html">Al fin ya me acomodé la página pa' los dibujos</a></li> <li>Jun 04 - <a href="https://blog.luevano.xyz/a/asi_nomas_esta_quedando.html">Así nomás está quedando el página</a></li> |