Godot and hobby project


Game engine

Previously I found a game engine LOVE (Lua language). Then I planned to learn about it. But then I read about Godot, which uses GDScript with similar syntax like Python. So, I choose Godot over LOVE because I have better experience in Python.

I planned to work on edutainment project since long time ago. Since I have extra time recently, so I invested little time on my hobby project. Using Godot, I revived my old project.

Godot provides a fantastic IDE. It allows to edit the UI, adjust any UI components easily. It provides almost everything I wanted: scene graph, everything is node, audio, video, texture, input, etc. The below is the screencasting of the auto play (with manual input) of the Tetris game.

(The new project is not open source.)

 

I am outdated

I like to play games (I believe everyone likes to play games). But most modern games are beyond my capability. There are several reasons:

  1. I am primarily using Linux.
  2. Not enough time to play game.
  3. I don’t have gaming computer.
  4. Though I like play story focused games like JRPG, I don’t like to invest time to collect items, level-up, etc, so I get used to use cheat engine (that’s why I created [memory editor](https://github.com/allencch/med)).
  5. Mobile games are mostly money-draining AND time-draining.

Because of the above reasons, I feel that it would be better for me to create my own game that fits my taste. Gaming of the 私, by the 私, for the 私.

The games that I love most are Dai Koukai Jidai 2 (大航海时代2) and Taikou Risshiden 5 (太阁立志传5). The reasons I love these two games:

  1. Not resource hungry like modern 3D games.
  2. Good story with the realistic history and background.
  3. Combination of JRPG, simulation (business), sandbox.
  4. Player can choose a protagonist from several characters. Each has its own story line, and they are in the same world.
  5. Realistic game play. E.g., earn interest from bank (Koukai2), monthly meeting and send gift to make friends (Taikou5), etc

I can’t find any other game that can fulfil the above conditions.

 

Advertisements

Vivo Y17 and Wunderlist


Recently changed to new phone Vivo Y17. Installed all the apps needed. Then I discovered an issue with Wunderlist.

Wunderlist widget keep showing “loading”, and I cannot change the list to be viewed.

The reminder doesn’t show notification in time.

Then I tried to migrate Wunderlist to Microsoft To-Do, and it has same issue as well.

Searching the solution and I finally get this page.

To summarise the solution, go to Settings > Permission Management > Autostart, then enable Wunderlist or Microsoft To-Do.

Chinese (and CJK) fonts


I am using Arch Linux, and recently I found that my fonts are little different after upgrade.

In DBeaver, the monospace font shows this:

This causes the monospace doesn’t follow the same width. And I found that, the default “Monospace” doesn’t use DejaVu Sans Mono anymore after the recent upgrade.

After looking some solutions, I tried edit ~/.conf/fontconfig/fonts.conf according to this this one.

<match target="pattern">
  <test qual="any" name="family"><string>monospace</string></test>
  <edit name="family" mode="assign" binding="same"><string>DejaVu Sans Mono</string></edit>
</match>

The above solution solves the monospace in most applications like Mousepad and DBeaver.

But then, I found CJK issue in Mousepad when using monospace font, like this,

The Simplified Chinese font and Traditional Chinese font are different.

If open with “charmap” and choose Monospace font, we can check what are the fonts being rendered, like this

I right-clicked the character, found that two fonts are being used in Monospace for these Chinese characters: Meiryo and KaiTi. Meiryo was installed with “ttf-vista-fonts” package, and KaiTi I installed directly to ~/.local/share/fonts.

After some study, I found that the above fontconfig is not good enough. Lastly, I changed my setting to

<alias>
  <family>sans</family>
  <prefer>
    <family>DejaVu Sans</family>
    <family>WenQuanYi Zen Hei</family>
  </prefer>
</alias>
<alias>
  <family>monospace</family>
  <prefer>
    <family>DejaVu Sans Mono</family>
    <family>WenQuanYi Zen Hei</family>
  </prefer>
</alias>

After saving the changes, the application must be restarted in order to see the effect.

And this finally solved the font issues.

Script to notify myself


Sharing a simple script I recently used. Because recent development, I need to run a build command which needs about 2-3 minutes. I run it in the background so that I can continue my other work.

But switching the window in order to check whether the build is completed, it is frustrating. To make it easy, I wrote the following script,

#!/bin/bash

notify-send -t 1500 -i applications-utilities "$@"
aplay /usr/share/orage/sounds/Knock.wav &> /dev/null

notify-send comes from the libnotify package. By running this command, you will see a popup notification on your desktop.

/usr/share/orage/sounds/Knock.wav comes from orage package. I just simply searched for a wave file that sounds good to me.

So, once I run the command such as,

build_my_project && /path/to/script/notify_me.sh

Once the project is built, my desktop will notify me with popup notification and play a sound.

MacBook Air 11-inch (Late 2010) revive


Recently, I revived my old laptop HP Pavilion dv3, due to the need of second computer to do my research study.

Since it is revived, and works smoothly, I then revived a tablet which was not used, Samsung Galaxy Tab 10.1 (P7500). I flashed the AOSP 7.1.2 Nougat. And it is revived also. However, the hardware specification is too antique, it can neither install Google Chrome nor Firefox. Most of the apps failed to run. 😩

Then lastly, there is a MacBook Air 11-inch (Late 2010), which I have installed Arch Linux onto it before. However, because it has been long time didn’t update all the packages, there are a lot of troubles.

For instance, after partial upgrade, when I ran pacman or pacman-key --init, it complained about

error while loading shared libraries: libreadline.so.6

Even after I boot with Arch Linux LiveUSB, this issue was hardly to be solved. This is because existing packages fulfil the dependencies, but the linked shared libraries’ versions were different.

Another issue was that it complained about

error: failed to commit transaction (invalid or corrupted package (PGP signature))
Errors occurred, no packages were upgraded.

This is even worst. The final solution was to install the latest gnupg, gnutls, and libassuan (as described here). Once pacman can work, then all the upgrades should work fine.

 

MacBook hot (heat) issue

After finished upgrading Arch Linux, there was an issue that I noticed when I first time installed Arch Linux on Mac. The machine was very hot, and the fan was spinning loudly. I firstly thought it was because of the WiFi device driver issue, because this happened even I run Arch Linux with TTY only.

I tried to install macfanctld (according to this), thermald, and cpupower (according to this). But none them solved the over heating issue.

Then after some readings from the forum (such as this post), the possible root cause was the graphic card driver issue, which Nouveau is not compatible with Mac. In order to solve this, I found the solution here (related post here) which allows me to use NVidia graphic card driver. This is a fantastic solution. I tested, and it works.

One thing to note. In the description of the solution, it says

cat << EOF
setpci -s "00:17.0" 3e.b=8
setpci -s "04:00.0" 04.b=7
EOF

Where the “00:17.0” and “04:00.0” may differ for each machine. However, “3e.b” and “04.b”, are just magic number that I just follow them. Though I don’t know what they mean actually.

Now MacBook Air is revived without overheating issue.

Bash history for each project


Previously, I tried to use zsh when I am working, so that my default bash history will not be filled with project related commands, especially git commands. Because some of my bash history are useful like ffmpeg related commands. So, I tried to distinct project work and non-project work with zsh and bash, so that they have different shell histories.

However, there are two problems when I use zsh,

  1. All my projects use the same zsh history. The old history may be lost if I have too many commands (depends on HISTSIZE variable).
  2. zsh is slow with git auto-completion.

However, zsh has one thing better than bash, that is, auto-completion navigation. Let’s say your directory has various sub-directories, double tab will bring to directory navigation that can be controlled with arrow keys. This is useful for me to navigate to non-alphabetic directories, like the directory with CJK characters.

Due to the slowness of git auto-completion as mentioned above, I decided to find an alternative solution, so that I can use bash instead of zsh, and separate the shell history from non-project work. At the end, I come out with this,

#!/bin/bash

# source any shell script, like rvm or nvm

touch "$PWD/.bash_history"
history -a
export HISTFILE="$PWD/.bash_history"
history -r
export PS1='\[\033[1m\]\u@\h \[\033[0m\]\w$(__git_ps1 " (%s)")\$ ' # custom prompt to differentiate from default prompt

So, add the above content to a file like init.sh in the project directory. Whenever starting with the project, run

source ./init.sh

Hence, the .bash_history will be saved and used in the project directory.

Rename files according to date


I recently wrote a Perl script, that renames the files in a directory according to the date, in the format “YYYYMMDD ##” where “##” is the running number.

Rationale

Because I used to download the photos using the mobile apps like Weibo or Twitter, however the file names are almost random. This made me hard to organize these photos on my computer.

The artists (or celebrities) usually share a set of their photos, so when I download these photos, the files should have mtime (modified time) in the correct order.

Yet, I don’t need to rename the file to the time precision like “HH:MM:SS”. I just need the date and followed by the running number, because it looks shorter.

Though we can just use the file browsers to sort the files according to the time, it is still inconvenient to browse the images by changing the sorting condition. Furthermore, mtime can be changed, and this will void the purpose of the sorting.

Lastly, the randomized filename is just meaningless to me. Rename them according to the date is much more useful, in my opinion.

 

Script

 

Why Perl?

In my opinion, Perl is less famous like Python in the present day. But I prefer to use Perl, due to the popularity in most Linux distribution. For example Perl is the base package of Arch Linux. Once I installed Arch Linux, I can run Perl script immediately.

Though Python is great, backward incompatibility sometimes causes issue, which I may need to maintain the script. If I write with Perl, I can pay less effort to maintain the script.

 

WARNING! And usage

As the script mentioned,

Rename is irreversible. Recommend to make a backup.

The usage is,

./rename_files_to_date.pl ./target_dir

Where target_dir is the directory that contains the files you want to rename. It will not rename the files recursively.

PLEASE USE THE SCRIPT AT YOUR OWN RISK!!!

After renaming the files, a log file will be created. It is used just in case you want to revert the file name. (But you have to do this manually.)