Starting an open source project

The free and open source software ecosystem is a rough, harsh place. Lots of initial work has to be put in to ensure your project is successful, the conditions need to be just right to get third-party contributions, and often you still need a thick skin to handle the conflicts that inevitably arise.

But as both those who contribute and those who maintain projects themselves know, it’s a labor of love. As a long-time supporter of many projects, I myself am willing to accept the risks and launch a new project of my own. I have been working on building a data-oriented game engine in C++11 for a few months now, and it has just recently seen a fully-fledged port to Rust. I thought I would share it with the world and have it be developed in the open.

Enter Amethyst. This is a work-in-progress game engine written in Rust that aims to be both data-oriented and data-driven, taking heavy inspiration from the industrial-strength Bitsquid engine (now called Autodesk Stingray). There are plans for an entity-component-system (ECS) architecture and a strong emphasis on modularity (e.g. multiple graphics API backends for the renderer, easy to bind to Lua/mruby/Python for scripting). Amethyst is in its early days yet, so don’t expect to be wowed. The most it can do now is transition between game states in a pushdown automaton design, and there is preliminary work being done on the renderer.

I have a few design documents up on the wiki, an unfinished online book, generated API documentation, a CONTRIBUTING file for people interested in helping out, and also a simple command-line client that can generate full-fledged game projects like this:

$ cargo install amethyst_tools
$ amethyst new mygame
$ cd mygame
$ amethyst run

I am also starting another blog called This Week in Amethyst on January 18th, 2016 that will detail the weekly changes and updates from the project as it evolves.

So what do you all think? Are you interested in helping out? Have you started an open source project and have some wisdom to share? Leave me a reply in the comments below.

Top 5 favorite modern C++ features

I must say, when I first started dabbling in computer programming, C++ was not at all my first choice of language. The general perception of C++ that I got from my friends and from forums were like…

C++ is a language for really, really smart people.
Each line of code is about 30-40 characters long on average, if not longer.
Everything is needlessly difficult and fraught with pitfalls.
There are so many *, #, &, <>, (), {}, /, [ ], <<, ::, and ! symbols everywhere that it looks like comic book characters swearing.
Before you even think of attempting C++, you should first know C well.
It is impossible to know the whole language. Even people who have been learning it for 15 years have barely even scratched the surface of what is possible.
Template metaprogramming is the devil.

Looking back on these statements today, as someone who now programs mostly in C++ for fun, I see a grain of truth in each of them. C++ is certainly not perfect. Far from it; it is a flawed, verbose, error-prone, needlessly complicated, sometimes rage-inducing language.

But why do I write in it, then, if it’s so terrible? And why for fun? Well, I probably would have never picked up C++ in the first place if the ISO C++11 standard hadn’t come out.

At the time, I was playing around with straight C for a while since I moved to Linux, though with time I found it to be a little too spartan for my taste. I was interested in learning C++ to make games since many well-known game frameworks use the language natively, and I wanted to carry over my C knowledge.

Originally dubbed “C++0x” before delayed to 2011, the C++11 standard added a ton of new and attractive features which attracted people like me, who were previously used to C#, Java, Go, Ruby, Python, etc. Due to extremely positive reception in the C++ community, the ISO committee has been hard at work creating the C++14 standard, and the up-and-coming C++17 standard. These last few iterations have been made such radical changes to the core language that they are colloquially referred to as “modern C++.”

C++11 feels like a new language. I write code differently now than I did in C++98. The C++11 code is shorter, simpler, and usually more efficient than what I used to write.

— Bjarne Stroustrup, creator of C++, https://isocpp.org/tour

These features made me comfortable enough to dive into C++, though they are not necessarily the reasons why I decided to stay. I stayed because I could now work almost as efficiently as I could in C# or Java, but at the same time I had the gory insides of the machine exposed to me. That’s right, I actually found it refreshing to see why the computer behaved the way it did, and not only that, I loved the fact that I could drop the fancy object-oriented stuff and fall back to glorious old C if I ever needed to. C++ also blew my mind several times over in regards to what I thought was possible to get computer programs to do (I’m looking at you, template metaprogramming).

So grab a beverage and some popcorn, because here come my top 5 favorite “modern C++” features.

Read more

Make a Linux LiveUSB without Unetbootin

Unetbootin has been giving me issues lately. After starting up my newly-burned Antergos LiveUSB on a testbed, the system halted with a weird error as it was mounting the drive:

[    8.755116] FAT-fs (sdb1): IO charset iso8859-1 not found
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so
ERROR; Failed to mount '/dev/disk/by-label/ANTERGOS'
   Falling back to interactive prompt
   You can try to fix the problem manually, log out when you are finished
sh: can't access tty: job control turned off
[rootfs /]#

Very, very weird. There was little else I could do that wouldn’t result in an instant kernel panic. Since I was testing an unstable pre-release image, I decided to boot into Windows, deep format the drive as FAT32, and use Unetbootin to burn an older stable copy of Antergos that I knew worked.

Unetbootin and formatting process

I booted it up, and to my surprise, I came up with the same error again! I tried using LiLi instead, but it still didn’t work. I even tested my images with VirtualBox to check if they were clean, and sure enough, they were. Frustrated, I wrote down the error and Googled it. It seems to be a particularly nasty bug with Unetbootin that has apparently affected others.

I decided to write the ISO directly to the flash drive without using Unetbootin nor LiLi as my middle-man. Let’s get our hands dirty in the terminal.

Read more

Manually upgrading Debian & friends to a newer kernel

CrunchBang 11 Kernel Upgrade Offline

After nearly a year and a half of using Arch Linux as my primary desktop distribution for my desktop and its more user-friendly cousin, Manjaro, for my laptop, I ran into problems when installing a copy of VMware Workstation 9.

The .bundle installer would run for a while and mysteriously fail, leaving me with a broken VMware daemon. After some digging around, I learned that VMware Workstation depends on a Debian-like environment (a System V-style init, for starters) and getting it to work on Arch would require quite a bit of elbow grease before using it.

Being short on time, I decided to get a lightweight Debian installed on my desktop for the purposes of installing and using VMware. For me, CrunchBang 11 “Waldorf” (aka #!) was a fast, configurable, and attractive choice (I am a sucker for Flux/OpenBox distros).

Unfortunately, #! is based on the x86-64 Debian stable (Wheezy, at this time of writing) and my motherboard uses the new Haswell Z87 chipset and UEFI. Ugh. I had issues right off the bat. My Logitech M705 and K320 crash-banged (see what I did there?) while it booted and spat out the error:

logitech-djreceiver: probe of 0003:046D:C52B.0009 failed with error -32

Not good, but plugging in a wired mouse and keyboard worked around this problem. The rest of my system wasn’t so lucky. #! could not recognize the new Haswell microcode changes and gave me more errors. Audio under ALSA was glitchy. Worst of all, neither of my dual Gigabit Ethernet NICs on my motherboard worked (didn’t show up on ifconfig), so I couldn’t go online to update my kernel image and firmware. I decided to download the necessary packages on my laptop, bring ’em on over to my desktop the old-fashioned way and do the upgrade manually.

Read more

Writing a virtual desktop system in C# with WinAPI

The virtual desktop system is an interesting feature that attempts to bring the massive benefits of multi-monitor computers to single-monitor people. With a simple key combo or button click, the screen is split into a tiled grid of several desktops in an Exposé (now called Mission Control)-type fashion with the ability to select one and switch to it (see fig. 1).

Virtual desktops on Windows (Sysinternals Desktops 2.0)
(Fig. 1) Here is a an example desktop switching “pager” called “Desktops” by Sysinternals running on my Windows 7 machine.

For all intents and purposes, a virtual desktop is treated like another physical monitor, giving you a tremendous amount of “screen space” to work with. This is excellent for developers or graphic artists whose careers require many programs to be up and running simultaneously but cannot use a multi-monitor system, whether it be due to high costs or space constraints of some kind.

When people think of virtual desktops, thoughts of Linux, Mac, and BSD come to mind, but never Windows! Believe it or not, the WinAPI does have full virtual desktop support (as shown by the screen that appears when you press CTRL+ALT+DEL), but Microsoft does not implement it in a user-accessible way. This tutorial will detail how to get access to it and embed it in your own application. So let’s get cracking!

Read more

Kali Linux: A better BackTrack?

Kali Linux 1.0 in action

BackTrack Linux was and still is reputedly one of the best security-oriented Live Linux distributions out there, for both offensive and defensive purposes. Packed with tools and affirmed by near-universal acclaim, the veteran BackTrack has seen a whopping 7+ years of active development and explosive community growth.

Originally based on a merger of two earlier established distros, the Slax-based WHAX (formerly Whoppix) and a Knoppix-based LiveCD named Auditor Security Collection, BackTrack saw a switch to an Ubuntu-based system during its later life, mostly to benefit from its Aptitude package management system and wide driver compatibility. But now, faced with an aging tool management architecture for its penetration testing tools, parent company Offensive Security wants to try something new.

Enter Kali Linux. First announced and finalized just a month ago in March 2013, Kali aims to be a complete restructuring and replacing of BackTrack from the software perspective while keeping the philosophy, community, penetration testing options, and even much of the branding intact.

Read more