FLOSS Game Dev

Enabling Creativity


Leave a comment

“What the Heck’s a ‘Kuwanger’?” New Thoughts for a New Year

Howdy, folks! Happy New Year! πŸ™‚

As we begin our journey into the many possibilities of 2018, I (as I usually do) reflect upon the more important questions of our mind-boggling existence. I’ve learned, after decades of shrugging and brushing it aside, that a “Kuwanger” (as in “Boomer Kuwanger” from Mega Man X) is some kind of beetle. I don’t know why CAPCOM didn’t simply put “Boomerang Beetle” (or something to that effect) for Mega Man X, but hey, it’s their game.

Moving on… >_>

There are a lot of exciting things coming up this year! On my end, I’m working on a sustainable technology platform that should lead to computers that operate at least an order of magnitude faster than what currently exist. On top of that, these machines are sourced from renewable materials, which will allow for a more inclusive hardware infrastructure. I’m also expanding my operating system development chops, and am becoming more familiar with the Rust Programming Language for bare-metal systems programming. So far, things seem promising!

On the Linux front, there are a lot of exciting updates for Blender, Krita, GIMP, and other Free Software tools just around the bend! I’ll be sure to post any news when it arrives.

I hope everyone reading this has a wonderful 2018!

Cheers! πŸ™‚


Leave a comment

The Colors on the Pallette: A Comparison of Linux Distributions

Hello!

Tonight, I’m going to be writing about my recent experience with Red-Hat-based GNU/Linux distributions, and whether or not they apply to what you’re looking for in an operating system.

As I’ve written previously, I believe that Debian GNU/Linux is a must-have for any Linux-For-Desktop environment. The reasons for this are as follows:

-Package stability (package sources go through a rigorous testing process before they are accepted and passed along to various versions of Debian, i.e. “Stretch”/”Jessie”)

-Access to more recent versions of the kernel (through the “testing” environment)

-Ease of source compilation (most CMake configuration files are written with Debian-based distributions in mind)

-Popularity for desktop usage (to the point where Valve has built their SteamOS on top of it)

Debian is also one of the first GNU/Linux distributions to come into being, so it’s had plenty of time to cement itself within the open-source/free software ecosystem.

So, what about these “Red Hat” distributions, then?

I’ve spent the last month becoming familiar with CentOS 7 and Fedora 22. CentOS is the “free” version of Red Hat Enterprise Linux. Usage of RHEL isn’t free, but you’ll receive official, on-the-spot support from the Red Hat community.

If you install CentOS, you’ll also notice that the kernel is a bit old. CentOS 7 currently sports the 3.10 version of the Linux kernel. Red Hat has, of course, added drivers and packages to make the kernel more flexible with regards to different hardware offerings, but, upon immediately loading it up on a new budget machine of mine, the touchpad wouldn’t work. As a result of this, I threw the operating system onto a spare Ivy-Bridge laptop I had laying around, and didn’t see the same issue…

Instead, however, I had to go buy a new wireless USB adapter because it wouldn’t recognize the WIFI capabilities of the chip! 😑

Installing Fedora, on the other hand, was flawless. Everything worked right out of the box! The benefit of Fedora is that it has the latest upstream of the kernel, which, as a result, makes it much more accommodating for different types of hardware. On the software side, though, things are a little rough.

I spent several hours over the weekend trying to get both Blender and LMMS to compile, and both were unsuccessful. I made some comments about this over on the Fedora packages website.

Without the ability to compile from source, you’re left with whatever packages are available by default on the Fedora package manager (which now utilizes the “dnf” command, instead of “yum”, like CentOS). To give you an example, Blender is only at version 2.74 through the Fedora 22 package manager. I was pretty annoyed because Blender version 2.75 is a H-U-G-E upgrade! Given that I’m (at this very moment), writing this article on a laptop with a built-in AMD GPU, having that OpenCL Cycles support is a big advantage.

The other package in question, Linux MultiMedia Studio, however, was the latest version. Unfortunately, though, the package maintainer compiled it without SDL (Simple DirectMedia Layer) support. The problem with this is that sometimes certain audio effects/instruments don’t get along with ALSA (Advanced Linux Sound Architecture). And while ALSA may be less resource-intensive than SDL, SDL is guaranteed to give you the appropriate sound quality you’re expecting. This was a let down, to say the least. 😦

So, my verdict for Red-Hat-based distributions (so far) is that they aren’t appropriate for Linux-For-Desktop computing.

However…

If you want a very stable server environment that utilizes Python 2.7.5 (CentOS 7), MySQL, Apache-anything, etc., then, hey, go nuts! All Red-Hat-based distributions are built with Linux-For-Server in mind. Fedora even has an ARM version for those of you interested in running it on a Raspberry Pi! Even I’m thinking about doing that at some point, albeit in a clustered environment.

As always, my job is to help readers learn how to navigate the world of GNU/Linux. If you’re looking for a desktop OS that will also provide you with the freedom to compile your own software with minimal effort, Debian-based distributions are your best bet. If you’re looking for a stable server environment for distributed computing, or even just a hobby project, anything Red-Hat-related will do just fine. The cool part about working with either family of distributions is that, besides the package manager, pretty much everything is the same. There’s very little you’d need to “re-learn” if you wanted to hop around.

Feel free to post any questions or comments if you think there’s something I missed. πŸ™‚

Cheers!


Leave a comment

To Thread, or Not to Thread… That is the Question

Hello, readers!

Today I’m going to discuss threading, and how it can affect the responsiveness of your application.

This topic was inspired by a comment made by a reader about my previous post. To sum it up, they wondered whether or not my game context was affected by potential latency caused by a “do/while” loop that was included inside of my audio code. Well… because of “threading”, it wasn’t!

So, what is threading… or, more importantly, what is a thread?

A thread is a unit of execution, usually containing a task (a set of instructions loaded into the computer’s memory) to be executed by the CPU. A thread is also a “scheduling” mechanism, which means that it is used to interface with an operating system’s scheduler. Threading guarantees that any task encapsulated by one will be added to the processor’s queue for immediate execution (sometimes simultaneously, which we call “concurrency”).

Tying this back into why it would be necessary for a “do/while” loop… how does threading enable my application to remain responsive? Well, let’s think about it.

Given the imperative nature of programs (A before B, B before C, etc.), if the application became stuck inside of a do/while loop, it would remain there until the loop finally exited. This would normally be true in a single-threaded environment.

If the function encapsulating the do/while loop were threaded, however, the application would be allowed to continue operating as it normally would, without having to worry about the looped task. This is especially useful for when certain actions need to be performed at the same time, like a punch sound firing off when a character’s “punching animation” connected with the bounding box of an enemy unit. Concurrency allows me to have my cake, and eat it too!

So, what is an example of threading? Here’s a POSIX routine that I’m using to test my audio library.

// The below is placed within the scope of my Game class.
pthread_t thread;
const char *audioFile = "test2.wav";
pthread_create(&thread, NULL, play2DAudio, (void*)audioFile);

“play2DAudio()” is a static function which has been passed into the “pthread_create()” method as a parameter for execution. This is the task that I want to be performed asynchronously.

void *play2DAudio(void* param){
    pthread_detach(pthread_self());
    const char *fn = (const char*)param;
    const char *media = MEDIA_DIRECTORY;
    char path[100];
    strcpy(path, media);
    strcat(path, fn);
    twoDAN = new TwoDAudioNode(path);
    twoDAN->play();
    pthread_exit(NULL);
}

As you can see, “play2DAudio()” takes the audioFile character string and uses it to load an audio file inside of a static instance of the “TwoDAudioNode” class. The reason this is threaded is so that loading & playing audio files (which may take a couple of cycles depending upon the size) doesn’t interfere with the Game class’ render/update loop.

Please note that only static methods and variables (unless locally declared) are able to be utilized by POSIX threads; members won’t make the cut! πŸ˜›

I don’t think one post will be suitable for covering this topic in its entirety, so consider this a little introduction to help get you started along the path of performance optimization. πŸ™‚

If you have any questions, don’t hesitate to ask.

Cheers!

P.S. I’m currently learning Blender and how to animate with it. Once I get further along with my knowledge of 3D graphics, I’ll have an update on my C++ game framework.


Leave a comment

Debian 8 “Jessie” Released

Debian 8 has finally been released by the Debian Project. You can grab the release and read about the latest changes here. In accordance with their “Toy Story” naming scheme, the “testing” branch has been renamed to “Stretch”. I don’t know when I’ll make the switch (to the new testing environment), but will probably do so when it becomes feasible.

So, go grab a blank DVD if you’ve got one, because (so far), Debian seems to be the best Linux distro I’ve used. Most of the articles I’ve written are with respect to users who are creating games within the GNU/Linux userspace.

Cheers!


Leave a comment

So You Want to Buy a New Laptop…

Good! Me too! πŸ™‚

Below, I’ve written a detailed step-by-step guide towards purchasing your next laptop.

Step. 1 – GPU Support:

Go to NVIDIA’s website and check out their latest GNU/Linux and FreeBSD drivers here. After specifying the graphics card series your future laptop may have, click on the “search” button and see if it’s supported.

A good rule of thumb is to stick with “GTX” class GPUs, otherwise, you may end up with an “Optimus” laptop like I have (I also happen to own a Lenovo Z710 with a GT 745M inside… >_> /facepalm). My machine can now only access the CPU’s integrated graphics card (which happens to be a lowly Intel HD4600).

Getting the “Optimus” environment to play along in GNU/Linux or FreeBSD has been reported to be a pain on numerous Linux/FreeBSD forums. As I’ve just indicated, I myself have been burned on the Linux front.

Step. 2 – Compare Prices:

Right now there’s a low-cost FreeBSD & GNU/Linux driver-compatible GTX-based laptop for under $1000.00 USD on Newegg. It’s a MSI machine, and I’d recommend giving it a look.

Having lots of access to the BIOS is important, which my Optimus Lenovo laptop doesn’t provide. MSI has a reputation for being very gamer-friendly, so I wouldn’t be surprised if it gave that extra bit of freedom to their consumers. Of course, as of this writing, I do not even own a MSI laptop, but if somebody could validate this statement in the meantime, that would be great.

Step. 3 – Purchase the Laptop:

For those on a budget, you can also buy the aforementioned laptop on Amazon. The reason I mention this is because some of you may not have credit cards, or may have to save up in order to purchase something this expensive. If that’s the case, you can buy Amazon pre-paid gift cards and slowly accumulate the balance. Convenient!

Step. 4 – Enjoy Your New Laptop!

πŸ˜€

Keep in mind that these steps are pretty generic, so you don’t have to buy a MSI laptop. I merely used it to illustrate this process. πŸ™‚

Happy gaming!

ADDENDUM (3-16-2015):

It turns out thatΒ GNU/Linux may actually work on my new DELL after all… so I’ve removed any comments indicating otherwise. Not sure about FreeBSD, though. : /

Also, I don’t have a preference of NVIDIA over AMD, and I’ve written this article based on the cost and availability of hardware. There are also some GPU performance comparisons you may want to check out on Phoronix, for those of you who want to see the numbers.


Leave a comment

And then there was Audio…

Hello!

I’ve made some more progress with my game engine. I’m currently using OpenAL directly (without ALUT, I might add… >_>), and am trying to create a cross-platform threading interface in order to spawn sounds/music off of the Main Thread. This way it can focus on Drawing instead.

As I’ve begun learning about Windows threads and PThreads (POSIX), I’ve noticed that they both have practically identical interfaces. So, it made me wonder… what’s the point of Windows?

And of course, it hit me. Windows is a reaction to UNIX in the same way that GNU/Linux & FreeBSD are a reaction to UNIX & Windows. I realized that the redundancy served a purpose if it made computers more accessible, which it has.

Even if you’ve got a grudge against Microsoft, you cannot deny that they’ve helped make computers more mainstream. Today’s issues, however, stem from an overabundance of control/monetization (how Microsoft/Apple are acting) in the face of even more-accessible/free alternatives.

So, let me tie this back into a discussion about audio; where the redundancy actually made things less accessible (strangely enough).

At first, I tried using several 3rd-party tools, “CAudio” and “OpenAL Soft”, to name a few. One failed to compile, and the other had a complicated interface. At this point, I decided to simply roll my own wrapper around OpenAL (the implementation of which was far less dense & confusing than when compared to OpenGL, thankfully), and I haven’t looked back. This is why I preach the fundamentals to other computer scientists/software engineers I meet. If you become too reliant upon the work of others, you will eventually encounter an obstacle too daunting for shortcuts.

I implore you to at least make and effort to learn native tools so you can always understand what’s being abstracted, instead of immediately relying upon a 3rd-party solution. More often than not, the problem is something that can be easily overcome if you just do a little bit of homework.

With that said, don’t hesitate to reach out if you’re still trying to learn LMMS, Blender, or GIMP (or any other open-source tools)!

Cheers!

(P.S. I’m currently building my engine so that it will be compatible with Windows, GNU/Linux, & FreeBSD. Expect some articles on how to use FreeBSD in the near-to-distant future.)


Leave a comment

Package Delivery Made Simple: In 30 Minutes or Less

Howdy, readers!

Time to write about the Debian packaging system and how to make your Linux experience a lot easier to manage.

For those of you who don’t already know, whenever you use a Linux distribution like Debian/Ubuntu/Red Hat/Fedora/et al., you utilize that version’s package manager to download and install applications. All of the packages stored in their remote repositories are free. I don’t think I’ve ever encountered a “paid package”, and I think the community would deem that an oxymoron.

When you first installed a flavor of Linux onto your computer, there should have been a prompt which asked you to set your sources. These sources concern which remote repository to target for downloading and installing future software packages. Since I’m using a Vanilla version of Debian “Jessie”, I personally use “ftp.debian.org”, and in my experience this has been the most stable. You can browse the list of available sources during installation and choose another if you’d like, or you can perform a quick web search to see what the community recommends.

(Note: You can also perform a system-defined sources optimization with netselect-apt, if you’re using Debian.)

So, how do we actually get these so-called “packages” onto our computer? Well, I’ll tell you:

Open up the Terminal (different window managers have different names for it) and you’ll be presented with a very simple command-line interface. Inside you should see your user name on the upper left followed by a blinking cursor. Type in the words:

“sudo apt-get install <package_name>”

To install the proper package. Substitute the “<package_name>” for the name of the actual package. Since I mentioned installing applications to assist with game development, here are some I’d recommend downloading.

Graphics:

-“blender” (An open-source 3D modeling/animation program. As of version 2.5, has a much-improved user interface.)

-“gimp” (An open-source 2D graphical drawing tool. This is your free version of Photoshop.)

-“inkscape” (An open-source 2D vector-graphic drawing tool. This is your free version of Illustrator.)

Audio:

-“audacity” (An open-source Audio Recording/Editing utility. Useful for careful editing of new/recorded tracks.)

-“hydrogen” (A very comprehensive drum machine. Allows users to create their own beats using a series of different built-in instruments in tandem with different tempos and time signatures.)

-“qtractor” (A full-fledged Digital Audio Workstation. Works with JACK to record and produce different types of audio.)

-“jackd” (A low-latency audio server. Useful for managing multiple audio sources and/or connecting external peripherals to your machine.)

-“qjackctl” (A GUI frontend for the JACK audio toolkit.)

-“fluidsynth” (A SoundFont processor that enables the user to utilize “.SF2” files in order to create music using virtual instruments. I’ll talk about composing with soundfonts in another article.)

-“zynaddsubfx” (A collection of different software synthesizers with built-in audio effects to compose a wide-range of music.)

-“calf-plugins” (A collection of useful plugins for creating music or adding effects to already existing audio.)

-“ecasound” (A hardware disk recorder. Combined with a virtual or physical keyboard, this software will allow you to record directly to your machine.)

-“seq24” (A loop-based MIDI sequencer. Good for people who like to create series of small loops and blend them together into a much larger composition.)

Programming:

-“g++” (The GNU C++ Compiler.)

-“CMake” (The CMake build/configuration tool. This will be necessary for compiling/building software source.)

-“eclipse-cdt” (An open-source C++ Integrated Development Environment that is innately extensible. The version of the JAVA runtime it uses is completely open-source as well.)

-“libsdl-dev” (Version 1.2 of the Simple DirectMedia Layer, an abstraction of lower-level multimedia APIs.)

-“libsdl2-dev” (Version 2.0+ of the Simple DirectMedia Layer, which has a more permissive open-source license.)

-“mesa-utils” (Mesa is the Linux implementation of OpenGL. It should already be installed, but, better safe than sorry.)

I may need to update this list later, but these software packages should give you a solid foundation for creating 2D/3D graphics, producing audio/music, and building a game engine to house all of your components/assets. You may notice that some of these packages may have already been installed by default, either during the operating-system’s installation process, or though the installation of other packages. In any case, if you’re curious about how updated your software is, you can always look at the Debian package-repository website and browse.

Note that, more often than not, the Advanced Packaging Tool (the “apt” in “apt-get”) may install additional packages as dependencies for the software you’re using. This is normal. Don’t hesitate to look up those packages on the Debian package website I linked above to understand what they are and their purpose.

(Note that, since I recommended that you install Debian “Jessie”, you’ll want to browse for packages in the “testing” sub-section of the website. “Jessie” is the name of Debian’s testing environment.)

Okay, here’s another use-case for you:

What if… you have a perfectly good Debian installation running, have some stable packages installed, and, suddenly… the developers release a new, better version of that software?

It may take a while for a member of the Debian community to get that new version inside the Debian repositories. So, what’s an eager developer to do?

This is where compiling your applications from source comes in, which is another benefit of being part of the open-source community!

Chances are, you won’t have a pre-compiled binary available to download and immediately use… but! Most of the time, the developers of that software will release the source for your own personal use.

Let’s take Linux MultiMedia Studio (package name “lmms”) as an example.

Linux MultiMedia Studio is a full-featured Digital Audio Workstation on-par with the likes of Apple’s Logic Pro, but with the simple interface of their Garageband audio software. As of the writing of this article, version 1.0.0 has been released (it was previously in beta-testing). Since I’m using the Jessie environment for my Debian installation, I am unable to download it directly to my machine via the “apt-get” utility. However, I can download the 1.0.0 source code and compile it on my own. So, let’s do it!

First, download the source here. (Look for the link that says “Latest Stable Release”, and then download the “tar.gz” file.)

Next, we need to open our file manager and navigate to the “Downloads” folder where we can open and unzip the tarball archive.

Next, checkout this link and make sure you have the following software packages installed. More often than not, they are dependencies for the application, with only a few being optional.

The link also contains a compilation tutorial which is pretty thorough, however, I would recommend making a change during step 4.

Instead of setting your DC_MAKE_INSTALL_PREFIX to “../target”, I would recommend setting it instead to: “/usr/”.

The reason for this is because making that change will force the installer to follow the standard installation path of the majority of software already installed on your system. The benefit from this is that it will make file-system navigation much more intuitive (in case you ever need to make any edits to folders or files).

Once you have compiled and successfully installed LMMS, you can access it through your desktop’s application menu, or by typing “lmms” inside the terminal.

Whew!

Well, that’s a lot of writing for one post. I hope all of this was helpful. In future articles, I’ll make sure to go over the different parts of the pipeline (graphics, audio, programming) in more detail. As for now, explore the packages you’ve already downloaded and start poking around. Don’t hesitate to drop me a line if you have any questions!

See you next time!


Leave a comment

Why Linux?

Why not?

It’s the manual-transmission of operating systems. Most distributions include a full suite of free software to be creative/productive at no cost, a community willing to share their knowledge to help you get started, and did I mention it was free?

Free = Free to use and modify at your discretion

Free = Zero dollars ($0.00 USD)

Linux means freedom in both cost and spirit, which makes it a much needed entity given the current state of the hardware/software industry, which (more often than not) acts like a cartel.

Eventually, I would like to see open hardware become as equally prominent as Linux has for software, and you can take a look at OpenCores to see what I’m talking about. If you have money to spare, please donate to their OpenRISC project. anything that helps subsidize the cost of computers (and thereby making them more accessible to everybody) is a good thing in my book.

Back to Linux.

I currently use Debian as my base-of-operations, so to speak. If you’re interested in getting your feet wet, this is the distribution I’d recommend checking out. Ubuntu, and the upcoming SteamOS (for the SteamBox) are based upon it.

You can download Debian “Jessie” (which is their testing environment, but contains the latest version of its supported software packages) here. Make sure to download the correct disk image for your computer’s architecture. If you’re using an x86_64 processor, then you’ll want the “amd64” version.

After downloading, you’ll probably want to switch to a different window manager besides GNOME. I am currently using “XFCE” on top of “LightDM” “KDE” on top of “KDM”. I would recommend performing a search for those terms and understanding the difference between them before making the switch. If you’re happy with the way GNOME looks, then you’re good to go.

That’s it for now! Try to get a Debian setup running if you can. If not, don’t hesitate to reach out so I can help you.

Cheers!