RSS Feed

Gaming on Linux

Posted on

Recently, I admit that Chromium is faster and smoother than Firefox. And now, for me, Firefox is my primary bookmark manager, reference manger with Zotero, and best ever download manager; yet Chromium is my primary web browser.

This is just like Windows is no more an Operating System for me, but a game console. I have no choice to admit this because playing games on Linux, is still far behind from Windows. The main reason is the developers usually target on Windows instead of Linux. However, it is truly worth for me to optimise the functionality of a computer by running Linux and sacrificing the gaming potentiality of Windows.

Native, Emulators, and Steam

There are several methods to play games on Linux. Steam is one of the methods, but it is not my favourite. Other than that, there are native games in Linux, one of my favourite is Cave Story. Another solution is using emulators, such as DOXBox, VBA-M, MAME, etc. However, not all emulators work perfectly, especially PS2 emulators.

WINE

WINE (WINE Is Not Emulator) is my another favourite. It allows to run Windows applications including some games. Yet, it does not work perfectly, not all games work. I have successfully used it to play KOEI Sangokushi (Romance of the Three Kingdoms) 12 and The Sims 4. WINE works fine with these games. However, some 3D games such as Assassin’s Creed II and Dead or Alive 5 Last Round do not work for me. Moreover, latest version of WINE does not guarantee better compatibility of all games. Some games work better with a certain version of WINE; some games requires certain patched version of WINE.

Virtualisation

So, the native Windows is still an attractive solution for playing games. Therefore, virtualisation is the possible solution. (LXC and Docker do not work, because they are containers.)

VirtualBox

VirtualBox is my favourite hypervisor because it is very easy to use. VirtualBox allows Direct3D yet it is under experimental. It has to be installed through the Guest Addition ISO image. However, I found that the Direct3D driver installed is wined3d.dll. As a result, the 3D rendering produces the same problem as in using WINE for certain games. As a conclusion, using VirtualBox to play 3D games does not work as expected.

QEMU/KVM

Since VirtualBox does not work with 3D games, I recently tried QEMU with KVM. Because I read some articles (this and this) regarding QEMU/KVM, it can virtualise the 3D graphics card. However, this requires 2 graphics cards: one for the host machine, another for guest machine. And this method uses VFIO, which is very troublesome.

Furthermore, there is a Virgil 3D project which targets to produce virtual 3D GPU. I studied a little, yet I didn’t try to compile it, because it seems like very troublesome. As a conclusion, QEMU/KVM does not work either.

VMware Player

So, the final solution I tried recently was VMware Player, which is free for non-commercial use. Installation of the VMware Player version 7 requires GCC 5.1.0 in Arch Linux. In this case, I have to install GCC 5.1.0 and compile the modules, then downgrade to GCC 4.9.2 again.

VMware Player is very similar to VirtualBox, but the VM management less useful than VirtualBox. Besides that, some VM configurations have to be done manually using text editor.

After some configurations and testing, I found that it works as the best among the virtualisation software. It is better than VirtualBox.

VMware Player 3D configuration

To enable VMware 3D graphics for Direct3D, firstly we have to make sure our host machine (Linux) allows “direct rendering” by entering the following command,

glxinfo | grep direct

Then, to make sure it works,

glxgears

Next, install WMware Player, then download and install VMware Tools for the guest OS. This can be done when running the Windows in the VM, by clicking “Virtual Machine” > “Install VMware Tools…”. Alternatively, we can download all VMware Tools for all the supported OSes from Player Preferences menu item. After finish downloading, we can run the setup in the Windows just like VirtualBox. The installation of VMware Tools allows seamless integration of the host and the guest like VirtualBox: such as resizing the window will resize the Windows resolution directly, and also the seamless mouse integration.

After installation, make sure 3D acceleration is enabled. This can be done from VMX file or from the Virtual Machine Settings,

mks.enable3d = "TRUE"
svga.graphicsMemoryKB = "1000000"

If 3D acceleration still does not work, then in the ~/.vmware/preferences, add

mks.gl.allowBlacklistedDrivers = "TRUE"

Next, in the ~/.vmware/preferences, add followings

pref.motionUngrab = "FALSE"
pref.motionGrab = "FALSE"

This disable auto grabbing or ungrabbing our mouse pointer when it moves into the VM window.

However, in my case, my 3D game is very sensitive to the mouse movement. Thus, I have to disable the drivers installed by the VMware Tools. This can be done through Device Manager in Windows. After disabling the drivers, my mouse cannot click anything in VM. I have to use keyboard to restart the Windows.

 

Finally, I think I can enjoy more games in Linux now, though playing the games virtually in Windows.

Desktop Environment and Window Manager


As using Arch Linux, the advantage is I can choose any Desktop Environment or any Window Manager. Recently, I have tried several Desktop Environments and Window Managers which are officially supported in Arch Linux. After trying, I learnt the differences and similarities among these Desktop Environments and Window Managers.

Desktop Environment

My primary Desktop Environment is Xfce4. Previously was GNOME 2. Since the release of GNOME 3, I chose Xfce4 as it is more conventional and there a lot of useful goodies (plugins). It is also lighter than GNOME.

LXDE is similar to Xfce4 in the sense of lightness, and it is even lighter. It uses OpenBox (a window manager). The drawback of LXDE is it has less plugins and lack of GUI configuration tool for modifying shortcut key. However, this can be solved by installing obkey.

In my opinion, GNOME3 is just an eye candy. It is nice to demonstrate the visual effects to the users. Because of the window and workspace are quite different, old conventional user like me feels uneasy to use it. Furthermore, there is no way to move the GNOME Dash (left panel). Yet, there are some ways to modify it. Extra configuration of GNOME requires GNOME Tweak Tool.

MATE and Cinnamon are just similar to GNOME2. LXQt is just similar to LXDE.

I tried KDE4 instead of KDE5. In Arch Linux, they are conflicting each other. Thus, I chose the older and smaller version. KDE is quite different from MATE, Cinnamon, and GNOME3. Because KDE uses Qt; latter uses GTK+. As a result, the designs are different. One of the most prominent characteristics I found is the file browser. Nautilus (GNOME), Nemo (Cinnamon), Caja (MATE), Thunar (Xfce4), PCManFM (LXDE), and PCManFM-Qt (LXQt) shares the bookmarks, yet Dolphin does not share with them. (But PCManFM-Qt uses Qt also.)

Enlightenment is another DE. It is quite different from others. It does not use Qt or GTK+, but uses EFL (Enlightenment Foundation Libraries). It has good visual effects. However, a critical problem I faced is the system tray. The system tray uses systray module in Enlightenment. However, the systray does not work properly and seems very buggy. Even worse, the systray is not going to be maintained by the developers. Therefore, alternative such as trayer can be used.

Window Manager

There are a lot of Window Managers as well. There are three categories: stacking, tiling, and dynamic. Stacking window manager is just like Windows, Mac OS X, or any other common Linux distro. The window can cover or on top of another window. Tiling window manager is not common. The windows are all in the same level, that means they are arranged as tile. Dynamic window manager allows user to switch between tiling or stacking or mixed. All the DEs mentioned above are consider stacking. Though we can arrange our windows as tiling in stacking window manager, the design of the window manager itself is still based on stacking.

I tried several window managers. There are some I do not like, especially tiling window managers, because they are almost similar. I tried Window Maker and IceWM, they are impressive, but not my favour.

As LXDE uses OpenBox, we can login with OpenBox without LXDE as a pure window manager. It is interesting to learn that a window manager does not necessary provide any panel (taskbar). The advantage of OpenBox is that you can choose your own panels, such as tint2 or Cairo-Dock. You can just use whatever you like, even Xfce4 panel or LXDE panel.

I tried fluxbox awhile only. It is also a stacking window. But it provides a panel. As a result, we need not to choose our own panel. A very simple ready to use window manager. OpenBox requires customization before truly using it.

The last one I would like to mention is i3. It is a dynamic window manager. A Linux lover should try it. It requires a little time to learn the tiling concept and the hotkeys. Once you know how does it work, you will like it. i3 can be switched to tab mode or tile mode. Furthermore, the windows can be changed to floating windows. Floating window is similar to stacking window, but it is always on top of the tiling window. So, the software such as Pidgin can be set to floating window. Besides that, Pidgin can hide to tray. Sorry, i3 does not have any minimize or maximize. Hide to tray icon is the only solution.

If using i3, you can switch between the window using keyboard, but not using conventional Alt+Tab. You can arrange the order of the windows using keyboard. You can also resize the tile using keyboard. One serious problem I faced is drag and drop between the window. But I believe that this problem can be solved by changing my behaviour of using the window manager. (Strongly influenced by stacking window manager.)

Components

After trying these DEs and WMs, whatever I choose, I will prefer several features. Firstly, hotkeys are important. It should allow me to customize the hotkeys. Panel is important to show the running applications, and system tray is very important to avoid using too much space for the running applications. Showing date, battery status, network connection, and volume control is very important. These show and control the computer status. Workspace (or virtual desktop or pager) is very important. Launcher is important, such as gmrun or GNOME Do. Using a launcher, we can run any application by typing the command. It is different from running a program from terminal emulator. When running a program from terminal emulator, the program is a child process of the terminal emulator. Exiting terminal emulator will also terminate the child processes.

Less important components are application menu, startup applications, terminal emulator, file browser, task manager, screensaver or screen lock, notification, and screenshot. Similar to launcher, we can launch the application from the menu. Sometimes I just cannot remember an application name, searching from the menu does help. Startup applications can always be configured, either using DE’s configuration tool, or using .xprofile. There are a lot of terminal emulators. Just install one and bind it with a hotkey, it will be very useful to open a terminal emulator anytime. Similarly, file browser is useful to manage the files: drag and drop, copy-paste, delete, open, rename, etc. Task manager, just like “ps aux” and “top”, allows us to see the CPU usage and kill any process. Screensaver or screen lock allows to protect the current screen from others to view, especially when we are away. A popup notification helps a lot to notify the users for a certain matter, e.g. low battery, reminder, email, etc. Screenshot is just useful for some sharing or project.

In my opinion, with the components and features stated above, any DE or WM will be satisfying.

RIME 中州韵输入法引擎之“五笔朙月流”


又一篇用中文写的。因为这篇反正就是关于中文输入法引擎——RIME中州韵输入法引擎——而写的。这中州韵输入法引擎是从Arch Linux的维基那里看到的。它是一种非常奇特的输入引擎。因为它可以让使用者简单地自制理想的输入法。

在Linux,有好几种中文输入法,谷歌拼音、搜狗拼音、SunPinyin等。其它非拼音输入法也有,如五笔输入法、仓颉输入法。本人虽曾经想学仓颉输入法,但因为太难记难用,最后放弃。因为有些生字不晓得如何读,拼音是没用的,所以最后就学了五笔输入法。

五笔输入法,只要懂得字形就可以输入了。因此用五笔输入比拼音来得准确。比如输入名字,用一般的拼音会出现很多选择,而这些“候选字”要一一看过,是相当的累。而若用五笔输入法,就可以把“候选字”减少到一两个罢了。但本人因为不熟悉五笔输入法,尤其在跟朋友在线对话时,拼音会是基本的思考方式,所以本人用拼音会比五笔来得快。因此,五笔和拼音两种输入法一起使用的话,对我来说就会出现因切换输入法而迟缓和多余动作的问题。因此,最理想的方式就是将两种输入法融合,不需要切换,以五笔为优先,因为五笔输入后,候选字词会比拼音来得少。能够达到这种理想输入法的,就是这个中州韵输入法引擎。

这中州韵输入法引擎,在我用的时候发现有一个字,因为台湾繁体和大陆简体有一些差别,所以中州韵输入法引擎本身的有些字用了不太一样的代码,就是“々”和“𠚤”。但中州韵输入法引擎可以用简单的方法让我解决这个问题。不仅如此,我还借此机会加入“绘文字”。因此,我就先制作了自用的五笔输入法。用这个的话,就可以轻松的输入我要的表情绘文字了😁。

但融合两种输入法,说容易也不是很容易,因为没有完善的说明书。因此本人就在百度贴吧里询问了。经过高人指点,后来就尝试融合。起初有几个问题无法解决,但勉强还是可以使用。后来根据苍颉检字法的制作,终于完成“五笔朙月流”输入法了。用这个输入法,就可以拼音加上五笔,输入人名和跟朋友对话都不成问题了。而且还可以反查五笔代码,即在不知五笔的代码是什么的情况下,还可以反查,这样的话就可以同时学习五笔输入法了。强!

这“五笔朙月”和“五笔拼音”是不同的。五笔拼音无法用拼音输入句子,而这“五笔朙月”就可以做到这点。

源码可在此处下载。

Folders and file naming habits that are useful


I would like to share some of my computer management habits regarding the folder name. Unlike my friends or colleagues, I seldom put the files in the Desktop folder. Because I prefer that my computer desktop is always clean (yet physically, my desktop is messy).

Therefore, there are several folders appeared in my computer, and these folders can be appeared in any other folders.

Firstly, “temp” is my most favourite folder. Any temporary documents or files, that are not very important, they are saved here. The “temp” folder is also appeared in my Download folder. Furthermore, when necessary, “temp2″, “temp3″, and so on will be created. These folders, if they are deleted, normally will not cause any catastrophic effect.

Secondly, “backup” folder. When doing the development, some of the files, I need to backup, I will renamed them suffix with date, then move to the “backup” folder. I do not use version control software, since most of my developments are individual project.

Thirdly, “unsorted” folder. I adopt this concept from Firefox bookmark. In Firefox, all the bookmarks that are not put inside any folder, they are automatically put in Unsorted Bookmarks. I use this folder when, some of the files or documents especially articles that are quite important, but I not yet decided where to put, then I will put them all in the “unsorted” folder. It is not a “misc” (miscellaneous) folder, but just a not yet organized folder. I may (or may not) organize the files in future.

Fourthly, “archive” folder. I adopt this concept from email management recently. There are some files or documents, can be deleted, but they are still worthy to be kept in the computer. And, they are not organized, then I will put them into the “archive” folder.

Finally, “1”, “2”, “3”, …, folders. These folders, I use them to put my favourite files such as photos, movies, songs, etc. The worst movies or songs that I do not like, but still want to keep in my computer, I will use “9” folder. Then the best one is the “1”, followed by “2”. So that, it is easy for me to know which files are important. Moreover, the best of the best files will reside in “0” folder.

As a conclusion, ordering these folders according to the importance: 0, 1, 2, … > backup > unsorted > archived > temp.

Previously, I used the some folders such as “new”. This actually doesn’t many any sense, because there is no way to let me know how new is the “new” folder.

Besides that, there are some file naming habits I am using. Adding date at the end of the file name, such as myfile20150419.docx. This is useful if the file is frequently updated and older content has to be preserved. So that, the file edited yesterday is myfile20150418.docx. By reading the filename, I can know how latest the file is. (Though the word processing software such as LibreOffice Writer allows to save the older version in the file, but this will also increase the file size, and also has the difficulty to compare two files, thus I am using this file naming style.)

Recently, because of reading journal articles, I renamed the PDF files with a keyword at the end. I adopt this style based on the “tagging” (or “labelling”). Normally, we organize our files into the relevant folders already. Yet, the folder itself is not sufficient to give the “brief description” of the file. As a result, I add a keyword to the file name.

Organize the files properly, will reduce the time to search the file. Some users may install the desktop search software such as Google Desktop Search. However, because I used EncFS to encrypt my files, search indexing is troublesome.

Framework or not?


Long time ago, I was learning CakePHP, then followed by CodeIgniter. Due to the restrictions using the framework such as naming convention, strict function calling based on MVC model, I decided to write my own personally framework from the scratch. The experience was very nice. Because I learnt about the caching, MVC architecture, function arguments in PHP, etc. But the development became gradually inactive.

After several years, recently I am trying back CodeIgniter, and now I conclude that, framework, though it is not required, it is strongly recommended. Why?

Faster

Writing PHP web application from the scratch, meaning that you have to write my own libraries, classes, functions, or search for the suitable libraries. If using a framework, what you need to do is just learning, and writing some libraries, classes, or functions that suit to the problem. Assuming you are doing a big project, doing it alone is impractical. That is why you need a group of people to do the project. And, those open source web application frameworks are already build by a group of people. That is why, this reduces a loner’s workload. Hence, this allows the development faster.

Larger

When the development is faster, meaning that the development can target on the higher level development, that is, developing applications instead of modules. Moreover, the project can be even more larger.

(I personally prefer low level studies, yet in the real world market, end user products are more attractive.)

More secure and stable

Like what I have mentioned, doing a project as a loner is totally impractical. Because one cannot do a thorough test to a project. One cannot ensure that most bugs are fixed. One cannot write the libraries for validation, encryption, caching, template engine, etc. Using an existing framework, they are tested. Furthermore, with the community support, the bugs are reported.

Production

If you are targeting on the production instead of research and studies, then framework is a need. From the raw materials to the products, it a long way. Unless it is low level product such as a small library.

 

Just like one would like to learn more about Linux, then he/she may learn to install Linux from the scratch. However, for a company or an organization, installing Linux from the scratch for each computer is unfeasible. Creating our own distro is interesting as we can learn a lot. Yet this will only benefits to ourselves directly, and may benefits to others in the long term. Using an existing distro will benefit to a company or organisation directly, because the distro can be used for work immediately.

So, how to choose a web application framework? Before choosing a framework, the best way is to get the reviews from other users. Then we can try some of them, and “feel” which framework is suitable. Experiencing multiple frameworks allows us to know the similarities and differences between the frameworks. Similarities are usually the common features, differences are the uniqueness. So, let us enjoy the web application frameworks: Ruby on Rails, Django, Express.js, etc.

WINE and CDemu


Previously I posted about installing software/game with different CD/DVD ISO images in WINE. But this method does not work in some installation ISO images. Because these installation will detect for the CD/DVD. The method above does not solve the problem because the installation does not detect the CD/DVD.

Recently, I found a better solution. It is CDemu. It is similar to DAEMON Tools in Windows. It will emulate the optical disc drive in Linux. As a result, it will produce /dev/sr0, /dev/sr1, and so on. Because it is a virtual CD/DVD, thus we have to load the image. It can be easily loaded by using gcdemu.

Once the image file is loaded, we have to mount the image as root. I mount the image to /mnt/cdrom. Then, in WINE, run the winecfg, then it will automatically appear the CD-ROM in Drives tab. In my case, it is E: drive.

Now, I run the installation from WINE, I can detect the image as CD/DVD.

JDownloader 2 BETA Japanese font


Previously I was reluctant to use JDownloader 2 BETA version. The main reason is that I will see boxes when the files contain Japanese characters. But this problem solved now.

As I am using Arch Linux, the JDownloader 2 is installed at /opt/JDownloader. We have to create two files:

  1. /opt/JDownloader/translations/org/jdownloader/gui/translate/GuiTranslation.en_custom.lng
  2. /opt/JDownloader/translations/org/appwork/swing/synthetica/LanguageFileSetup.en_custom.lng

The GuiTranslation.en_custom.lng is a copy of GuiTranslation.en.lng. So that the interface is still using English language. Then LanguageFileSetup.en_custom.lng is a copy of LanguageFileSetup.ja.lng. So that the font is using Japanese language font instead.

Open the JDownloader, change the User Interface language to “English (CUSTOM)”. Restart. Now, I can read the filenames properly.

Follow

Get every new post delivered to your Inbox.

Join 163 other followers