Ship, Captain, and Crew: Cross Platform Differences?

Hopefully, the above pictures came through for you, or this wont make much sense. I’ve been working on my dice game, and it is nearly completed. However, as I test it out on different platforms, I notice that it doesn’t look the same. In the above screen shots, the left is from my Linux desktop, and the right is from my Android phone.

What hopefully is obvious is that the Android phone has an abnormal pixelation/black dots on it. Also notice that the table and dice are brighter on the Linux machine. Both screens are using a 1920×1080 resolution, so it isn’t a stretch/scale problem. The darkness of the Android screen is not a display brightness problem, as these are screen shots and not pictures of the screen. So what is causing this?

Well, after a bit of web searching, I came up with nothing. Thus, I must be using the wrong key words. But, after some trail and error, I found that the culprit was the texture normals for the table. Interesting. As far as I can tell, the normals are used to calculate light beams reflecting/refracting off of the surface of the object. For some odd reason, the normals texture overlay work great on the computer, but fail miserably on the phone. But both phone and computer support openGL 2 and 3, and this game is only openGL 2.

So, I don’t know why it happens. If you happen to know, please feel free to let me know in the comments. What I did to fix it was remove the normals texture overlay, and just use the textured wood overlay for the table. Now both the phone and the computer look the same. As always, you can check out the full project on my GitLab.

Linux – keep it simple.

New Course! Beginning Qt 5 C++ GUI Development : The Fundamentals

I’ve just completed the first of 10 sections in a new course I am taking on Udemy. The course is called Beginning Qt 5 C++ GUI Development : The Fundamentals. As you know, if you’ve been following along, I started learning C++ using a course on Udemy that particularly focuses on graphics through SFML. It was a lot of fun learning to program in C++ while making a few games.

While making those games was really neat, I realized that I now need a way to make applications that aren’t games. I suppose you could use SFML for that, but it seems a bit overkill to make your own buttons for everything, when they have great programs for that already. Programs like Qt and Qt-Creator.

Licensed under the GPL-2 and GPL-3, Qt is open source, which is a big plus for me. Qt is also written in C++, which I am currently learning, so that is the primary reason that I want to use it. And did I mention that it’s cross platform? The IDE is Qt-Creator, which is licensed under the LGPL, a copyleft license, which makes it free for me to use and open sourced for those who wish to contribute, which is great!

qt_2

I’ve only just started working with it, but I really like the user interface of Qt-Creator thus far. The course itself has a huge plus for me, in that the author/instructor also supports Linux users, even providing a video tutorial for installing the application and how to deal with a few possible errors that may pop up if the right dependencies are not installed. That is really rare these days!

If you want to follow along, be sure to check out my first Qt commit!

Linux – keep it simple.

Custom script to build my C++ games

So, I’ve completed section one of my Udemy course. There are eleven sections total. It’s a bit odd, in that the course instructor is using Microsoft Visual Studio, and I am not. Actually, I’m not even using Windows. So there are a few differences that I think are worth noting.

One of the biggest differences, is when he is done adding something, or doing something, he simply presses a debug/play button at the top, and his newfangled app launches. Now, there are several options for good Linux IDE’s to do this sort of thing, but I’m a bit of a minimalist myself, and I feel it helps me learn more as well, so I’ve been using Geany to type out and build the programs.

sfml_timber_1

Geany works great, is lightweight, has a compile and run button, and text color coding specific to whichever language you are working in. To be honest, I couldn’t be happier with the experience. At present, however, I need to link the SFML files to my compiled code to run the game. There are ways to do this in Geany, but I wrote a simple script that does everything for me instead:

#!/bin/bash

# You need libsfml installed on your system!

g++ -c Timber.cpp
g++ Timber.o -o timber-app -lsfml-graphics -lsfml-window -lsfml-system

./timber-app

echo “type ./timber-app to launch”
exit

I call it build.sh. After I’m done coding, and I’m ready to try my game, I just double click on the build.sh script, and it compiles, links, and launches my game. Pretty easy! So far, I’m working through a tree cutting game called “Timber”. You can check it out on my GitLab if you’d like. Just remember, if you download the files, you must install libsfml before running the build.sh script.

Linux – keep it simple.

Fool’s Mate Friday?

Fool’s Mate Friday is going to take a little detour, as I work on learning a new programming language.

If you have followed my blog at all, you will notice that I’ve made a bit of a shift away from Android. When I was working with Android, I was heavily invested in Java programming, both for games and app, as well as making custom ROM’s. I’ve come to realize though, that while Java is cross platform, it is a bit of a niche these days.

Java is used by Android, but rarely used by other computer operating systems. True, it CAN be run on just about any OS, but usually ISN’T. Most browsers have dropped Java applet support, and most OS’s don’t include Java support without installing some form of JRE (Java Runtime Environment).

As I’ve switched (at least temporarily) from Android to Ubuntu Touch (UBPorts), I’ve seen a real need for more robust apps for that platform. Unfortunately, UT doesn’t support Java natively, and that left me out in the dark.

But, God gave us brains, and I’m always trying to use mine to learn new things, or master things I already know. So, I’ve decided to take up a new programming language. Obviously, if you read the title, you already know that I picked C++.

It can be hard to just “learn” something new by reading a book, or looking at code. One of the things that helped me a lot when learning how to make Android games was to sign up for a class on Udemy by Rob Percival. He made the course fun and dynamic by making little creative games or applications to teach the student new concepts or ideas. With that in mind, I jumped back on Udemy and snagged a course (during the $10 site-wide sale) called “Beginning C++ Game Programming“. It focuses on teaching a complete noob how to program in C++ by creating 3 simple games.

One of the perks to this programming style is getting to see something get created from start to finish, and have a graphically playable product when I’m done. It uses the SFML library (which sounds like a dirty acronym, but really is an open source library – Simple and Fast Media Library) for handling the graphics, and it seems to be really intuitive and straightforward. It also seems to be very similar to using libGDX that I was using with Android, so that make working with it easy for me to learn.

Since Java and C++ are both object oriented languages, the concepts of each are the same, which is helping me in the learning process. Although I still try to type things the Java way, so that may take a while to get used to. Either way, I’m having fun with the course, and while I’ve only completed about 15% of the course, it has been interesting and fun.

sfml_timber_1

The course does use Microsoft Visual Studio, however, I’m just using Geany to type and compile my programs. Other than one or two little snags about include files being different from Windows and Linux, I haven’t had any trouble doing things my way. Hopefully you’ll enjoy hearing about the journey!

Linux – keep it simple.

Video to Gif Command Line Conversion

This is really just a side note for myself. I tend to do something only once in a blue moon, and then consequently forget how to do that again later. So, I’m writing this one down for my own future reference. Hopefully you will find it useful too.

Of course, I am using WordPress for this technical blog. And, because I am “resourceful” (a fancy term for frugal or cheap) I can’t upload videos to my free blog. Maybe someone else has this problem also, and has wondered how to get around it.

Most often, I don’t need a video for the things I post, but occasionally, I can’t show something with just a picture. Thus, I’ve found a good “cheat” is to convert the video into an animated gif file instead.

Previously, I was using online tools, such as ezgif.com, or others. But that takes up an excessive amount of internet, as you upload a video, burning my limited internet allotment (yes, there are still places on the planet where internet is not unlimited). Then you have to download the gif, only to find an issue with the settings, or a tweak you want to do, which starts the process over again.

So, I decided to do some research, and while this is nothing new, here is how I’ve found is a good way to make the conversion on your Linux computer:

~/Downloads$ ffmpeg -i autostart.mp4 -vf scale=320:-1 -r 10 -f image2pipe -vcodec ppm – | convert -delay 8 -loop 0 – output.gif

Where:

  • ffmpeg is the program
  • -i autostart.mp4 is the input file video name
  • -vf scale=320:-1 scales the video to a 320 by whatever video to preserve aspect ratio. Note that you can use 640, or whatever scaled size you desire.
  • -r 10 is the frame rate. Most cell phone video is recorded at 30 fps, so choosing 15 would be every other frame, or in this case 10, every third frame.
  • -f format and pipes, redirecting to the convert tool.
  • -delay 8 is the number of milliseconds between frames. This sets the flow and speed of the gif.
  • -loop 0 is the setting for continuous loop, however, most modern browsers use a continuous loop anyways, unless you specify something else.
  • – output.gif is the name of the output file.

The output at the console will look something like this:

~/Downloads$ ffmpeg -i autostart.mp4 -vf scale=320:-1 -r 10 -f image2pipe -vcodec ppm – | convert -delay 8 -loop 0 – output.gif
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: –prefix=/usr –extra-version=0ubuntu0.16.04.1 –build-suffix=-ffmpeg –toolchain=hardened –libdir=/usr/lib/x86_64-linux-gnu –incdir=/usr/include/x86_64-linux-gnu –cc=cc –cxx=g++ –enable-gpl –enable-shared –disable-stripping –disable-decoder=libopenjpeg –disable-decoder=libschroedinger –enable-avresample –enable-avisynth –enable-gnutls –enable-ladspa –enable-libass –enable-libbluray –enable-libbs2b –enable-libcaca –enable-libcdio –enable-libflite –enable-libfontconfig –enable-libfreetype –enable-libfribidi –enable-libgme –enable-libgsm –enable-libmodplug –enable-libmp3lame –enable-libopenjpeg –enable-libopus –enable-libpulse –enable-librtmp –enable-libschroedinger –enable-libshine –enable-libsnappy –enable-libsoxr –enable-libspeex –enable-libssh –enable-libtheora –enable-libtwolame –enable-libvorbis –enable-libvpx –enable-libwavpack –enable-libwebp –enable-libx265 –enable-libxvid –enable-libzvbi –enable-openal –enable-opengl –enable-x11grab –enable-libdc1394 –enable-libiec61883 –enable-libzmq –enable-frei0r –enable-libx264 –enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘autostart.mp4’:
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-04-20 14:05:43
Duration: 00:00:25.96, start: 0.000000, bitrate: 6103 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1280×720, 6448 kb/s, SAR 1:1 DAR 16:9, 29.88 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2018-04-20 14:05:43
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 48 kb/s (default)
Metadata:
creation_time : 2018-04-20 14:05:43
handler_name : SoundHandle
Output #0, image2pipe, to ‘pipe:’:

Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf56.40.101
Stream #0:0(eng): Video: ppm, rgb24, 320×569 [SAR 5121:5120 DAR 9:16], q=2-31, 200 kb/s, 10 fps, 10 tbn, 10 tbc (default)
Metadata:
handler_name : VideoHandle
creation_time : 2018-04-20 14:05:43
encoder : Lavc56.60.100 ppm
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> ppm (native))
Press [q] to stop, [?] for help
frame= 39 fps=0.0 q=-0.0 size= 20805kB time=00:00:03.90 bitrate=43700.4kbitsframe= 80 fps= 80 q=-0.0 size= 42676kB time=00:00:08.00 bitrate=43700.4kbitsframe= 121 fps= 80 q=-0.0 size= 64548kB time=00:00:12.10 bitrate=43700.4kbitsframe= 159 fps= 79 q=-0.0 size= 84819kB time=00:00:15.90 bitrate=43700.4kbitsframe= 200 fps= 80 q=-0.0 size= 106690kB time=00:00:20.00 bitrate=43700.4kbitsframe= 241 fps= 80 q=-0.0 size= 128562kB time=00:00:24.10 bitrate=43700.4kbitsframe= 245 fps= 80 q=-0.0 Lsize= 130696kB time=00:00:24.50 bitrate=43700.4kbits/s dup=0 drop=483
video:130696kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
~/Downloads$

Hopefully that is a tidy explanation. Keep in mind, the higher the -vf, the bigger the gif appears, but also the larger the file. The -r value will make the gif smoother as it goes up, but will also increase the gif size in MB!

Linux – keep it simple.

More “Stack-able” Certificates from CompTIA!

Some changes at my work are driving me to renew and gain new CompTIA certificates. What is a bit odd about the system, however, is the “stack-able” feature. Now you can not only get certificates for completing various exams, you can now “stack” some of the certificates to get special combined certificates.

Overall it is nice to have extra fluff for the resume, but I can’t help but feeling like I’m playing Gunstar Heroes and that I’ve just combined the laser beam with the flame thrower.

In any event, by taking one test, I have not only gained a certification, but I also gained two more stack-able specialties. Added to the one I already received, I now have effectively “doubled” the amount of certificates I have, without actually doing anything extra. If this sounds odd, let me explain:

At my work, I was required to get the Linux+ and the Network+ certificates, which I did. When I renewed them a couple of months ago, I was given the new stack-able certification of “CompTIA Linux Network Professional”. I’m now a registered CLNP. However, I’m a CLNP because I have a Linux+ and a Network+. Both of which are required for my job. You cannot be a CLNP without them. But I didn’t do anything extra to be a CLNP, there is no exam to become one.

Conversely, it was “strongly recommended” that I also go back and get the A+ certification, which I did, and received the A+ certificated. At the same time, however, having an A+ with a Network+ made me a “CompTIA IT Operations Specialist” (CIOS), and having an A+ with a Linux+ makes me a “CompTIA Systems Support Specialist” (CSSS). Since I didn’t do anything extra to gain these titles, I am just wondering if they hold any weight or have any real meaning.

Don’t get me wrong, I’m not objecting to these new stack-able certs, I’m just not sure I understand the purpose of them. To maintain them, you have to maintain the two or more certifications that were combined to get them. On my certifications for A+, Net+, Linux+, there is a verification number, but there isn’t one for these combined certs. I suppose you would have to look them up by requesting if the applicant is certified in the underlying certifications.

It is pretty impressive, though, that in less than six months I have taken two tests (one renewal, one new) and effectively doubled the number of certifications that I hold. Can’t complain about that!

Linux – keep it simple.

CompTIA Mobility+ certificate to be retired on December 15th.

One of the many things that my work requires is various IT certificates. In particular, they require Network+ for the job I am currently filling, and A+, Security+, and Linux+, for various other simulators at my work. So, I make an effort to keep my certifications current, and to have as many as possible, in the event that a position opens up to which I want to apply.

Now, there are a lot of certificates out there, and while I’m not intending to talk about them all here, I would mention that there are other great programs out there, other than CompTIA. For instance, I do hold an LPIC certification, as well as a SLES, and a LFCS. Two of the great things about CompTIA, however, is the fact that they are an industry standard, and that they have a pyramid hierarchy, which allows you to make current and hold numerous “lower” tier certifications by only taking the top level test.

It was a surprise to me to learn that they are retiring the Mobility+ certificate before the close of this year. Here is their take on why they should retire this certificate:

CompTIA Mobility+ certification will officially retire on December 15, 2017. The main reason for this retirement is that the job role for Mobility+ continues to merge into the Network Administrator role, and much of the Mobility+ content is covered in CompTIA A+, Network+ and Security+.

What surprised me, though, was that this is the only certification from CompTIA, and one of the few certifications in general, that covered cellular data and infrastructure.

Sure, A+ does cover a lot of hardware, but it doesn’t seem to cover cellular towers, WiMAX, or even Satellite components, which are a part of Mobility+. Here in Alaska, with many wild and untamed areas of the state, various forms of wireless communications are utilized to get internet connectivity into remote locations.

Granted, Network+ does cover the majority of TCP/IP protocol stack, but cellular devices typically use odd protocols to control the transmission and reception of the TCP/IP data. The radio portions of Mobility+ helped differentiate between the various types of frequency shifting, hopping, and cells that are an integral part of the mobile world.

Of course, Security+ covers most aspects of authentication, authorization, and accounting, but in a more general sense. While it does cover wireless access, it only focuses on the typical 2.4 and 5 MHz bands and associated equipment, not covering the special needs of cellular devices. When it comes to MDM (Mobile Device Management), Security+ treats it as a footnote in section 4, in which all of section 4 is covered by less than 15% of the test. In Mobility+, however, Mobile Device Management alone is 28% of the exam!

It would seem to me that any cellular or satellite internet provider would make Mobility+ a mandatory requirement. Places like Verizon, T-Mobile, or AT&T would all be encouraging their technical employees to certify in this field in order to maintain their network.

What does that mean? I certainly think that the Mobility+ certificate is one worth keeping, but apparently CompTIA believes otherwise. Since it does not make logical sense to me, I can only believe that either too few people are taking the test to make it worthy of updating, or CompTIA is not earning enough revenue from Mobility+ sales to warrant it’s continued operation.

It could be that cellular technologies will be rolled into A+, Net+ and Sec+, negating the need for Mobility+, but I just renewed my Network+ and Linux+ certifications, and didn’t see any cellular references on the exam. They say that CompTIA certifications are led by the industry, and not the other way around. In a world that is becoming increasingly more mobile, I just can’t see getting rid of Mobility+.

Linux – keep it simple.

How to check your governor and I/O scheduler from the command line

The other day, when working through some issues with kernel governors and I/O schedulers, I realized that I was a bit rusty on where to find them from the command line. After some searching and tinkering, I thought I might save some internet searcher the long and winding road to find this out.

From the command line:

[CODE]
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative ondemand userspace powersave performance

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand

$ cat /sys/block/sda/queue/scheduler
noop [deadline] cfq
[/CODE]

It’s a pretty simple trick to just read what is written in the /sys directory. As you can see here, my laptop system is running the ondemand kernel governor with the deadline I/O scheduler. If you are using this for yourself, you can check any of the cpu’s and drives by inputing them instead of the cpu0 and sda which I used here. This works on just about anything running a Linux kernel, from computers to cell phones like Android.

Linux – keep it simple.