Trial and Epic Fail

Ventures of an indie game developer

Radio 2.0

It seems at least one more developer than me got tired of the current state of affairs in the music player business: finite, static playlists which you have to maintain. So Albertz deviced Music Player. It seems to contain everything I need, except a Grooveshark plugin. I'll build one of those and two frontends: one headless (keyboard only) and one similar but for mobile web. The mobile version doesn't even have to show songs, just an input field so we, or our guests can flip over to some song of their choice.

I'll hard-code F1-F4 or so for radio channels, grunge, rock, etc., and for hardware I'll use a Raspberry Pi for 50 bucks.

One other thing that I personally think would be awesome is to install a mic and let it double as a long-distance walkie-talkie. I could shout at the kids to stop fighting when I'm at work, or I could scream my last words if I get fatally injured by a moose in the forest... It's going to be awesome!

py

Python comes out on top in the universities as well. To-the-point language with a fantastic standard library.

Green Ubuntu server

I have a tiny 3W Intel Atom-based Ubuntu server, and I hadn't upgraded it for many years. Well, now I wanted Arduino support and thought it would be a good time to deal with the hassle of upgrading 7 major versions. Something went haywire and I had to reinstall. I'm still using an old SATA disk, so in order to save some watts and add some life expectancy to the hardware (which normally isn't used more than once a week on average), I want the disk to spin down.

To find the culprits spinning up my disk I ran:
ls -talc
in the root (/) folder and some other places. Then I added the entries I found to /etc/fstab:
tmpfs /var/log                                            tmpfs   defaults        0       0
tmpfs /var/lib/dhcp                                       tmpfs   defaults        0       0
tmpfs /var/lib/sudo                                       tmpfs   mode=700        0       0
tmpfs /var/lib/update-notifier                            tmpfs   defaults        0       0
And also added ",noatime" to my HDD partitions (not swap however). Then I added
hdparm -B -S 243 /dev/disk/by-id/ata-XXXXXX_YYYYYY
to my /etc/rc.local. Apart from that I installed a couple of packages I wanted and set an hourly cron job running dynamic DNS so I can connect from anywhere. DuckDNS is free and simple to use:
curl -k "https://www.duckdns.org/update?domains=pixeldoctrine&token=xxxxxx-yyyyyy-zzzzzz&ip="
Right, I also started the rsync service because I wanted a better way to backup my pictures. That's all I had to do to get the server exactly as I wanted it. If somebody could make a nice GUI to go with the desktop installations, I'm betting Linux will take over in a few years. Oh, and here's my powertop output:
Summary: 4.4 wakeups/second,  0.0 GPU ops/seconds, 0.0 VFS ops/sec and 0.3% CPU use
In the last 7 major version steps they've managed to more than half the wakeups on my machine when idling. I'm pretty sure Microsoft is not up to the challenge any time soon. "Which solution is best" is slowly overpowering "how much money is in this new solution" in some of areas where there is a BDFL. Linux desktop GUI needs an outstanding BDFL; with that I'd be hooked.

Programatically sending SMS

The SMS alert for the alarm wasn't as bad as I thought. I found Twilio, bought an account for the minimum $20 (they deduct $1 per month). They seem to charge about $0.18 per SMS. The code is a piece of pie:

Oh, and don't forget to escape your non-ASCII's (Swedish below):
char_xlat = list(zip('åäöÅÄÖ', [s+';' for s in 'åäöÅÄÖ'.split(';')]))
for ch,xlat in char_xlat:
 msg = msg.replace(ch, xlat)

ALARM!

It's fun to solder and build stuff with your hands! I'd forgotten how fun it is since I last built stuff 20 years ago.


The controller is an Arduino Leonardo, which I connect to a server via micro USB. It acts like a normal serial port with the USB chip built in to the micro controller.

The 230VAC-to-12VAC transformer for the horn is switched on and off by a solid state relay, the PIR (Passive Infra-Red sensor) is plain 5V. The current state is shown on the LED and I'll simply keep an on/off switch hidden away somewhere. (Didn't want to bother with controlling a pin pad.)

I use the Arduino pretty much as a control device, and keep the main program flow in a Python program on the server. The software on the Arduino is written in a C-like syntax which pretty much boils down to

where the "handleCrash" turns off the siren if nothing is heard from the computer in 15 seconds to avoid leaving the alarm on during vacation. I'm going to mount the horn on the outside of the house; neighbors tend to get annoyed if they haven't slept for a week or two.

The bulk of the code was very small, but I had to inject a bunch of failsafes, timeouts, sound indicators, e-mail alerting, logging and so forth to cram all the features I wanted in there. The current Python+Arduino code is 421 lines, and I also have an additional 100 lines of unit testing. I wanted to send SMS's as well, but it looks like a jungle so perhaps I'll just skip that. This is the bulk of the main loop in the computer code (stripped of sleeping, logging, etc.):

Remains to do proper soldering and installing. I'll do that when I'm done with our 104 m2 decking. Peuh!

Usability and expressiveness

Apple proved the importance of responsive animation with iOS in 2007, but I'm still surprised from time to other when I try UI out. Take these jelly info boxes for instance.

See the Pen Expanding info boxes with jelly by Jonas Byström (@highfestiva) on CodePen.


There's no doubting which box you clicked as they expand. No game dev lately however. Composed a Python fuzzy file finder by accident tho.

Also made a surveillance tool for my dayjob during night (gasp! He's being altruistic about his time, giving it away to the needing... billion dollar company H&M). It's amazing what you can do with a standard installation of python. Listen to this. I wrote a background "status crawl" of sorts (ten parallel processes), read an .ini file, setup a web server, made some html templating support, parsed some hard-to-find files on disk and then some in 344 lines. What other language can do that with a standard installation without any extra libraries? I doubt there is one, and I'm still, after years of developing in Python, mightily impressed by the sheer awesomeness of Python's standard lib and its compact syntax.

Neither JS nor Python is the future, they are merely simple tools for simple jobs. Either the quantum leap in programming will come in the next few years, or we've reached event horizon for us as a species. The fact that programming theory is pretty much on the same level now as forty years ago doesn't bode well. But at least we can take the best of what we have today and compose into compact, modular and standardized languages. Even though it's far from what I feel can be accomplished, it's better than today's state of affairs.

BTW: Have you ever run IBM WebSphere Application Server? It is to Java developers what SAP is to IT staff in general: a gigantic pile of unpolished turds that the personnel have been appointed to eat. As a Java developer there's not much else to do; the problem, I feel, is that everybody's happily munching away.

free(time)

I've been busy excavating at the back of the house, preparing a big fucking patio. I rented a mini excavator and dug a couple of days by hand as well. Planted concrete forming tubes and prepped for the carpenters, who'll help me rig some planks; I'll do the floor myself. It's wonderful to not work with programming all day+all night. Hmm. Can't let this become a habit.

I'm currently reading some book of Elisabeth George. It's so boring I can't even remember what it's called. But somehow, and for some reason I can't justify to myself (let alone for anyone else), I'm going to read through the whole damn thing. I've always been one of those "finishers". I watch the whole movie, even though it sucks ass and I'd like to strangle the script writer. I've only put aside very few books which were too dull. I don't even throw away books, not even the bad ones. I think it has something to do with saving, or rather being cheap; but usually I'm able to rationalize it using feelings (don't we all, oh the embarrassment).

When I'm done with that I'll study. Things I should have studied a long time ago, and things I'd wanted to study for a long time. Sure, programming like Lisp and Haskell and other science fields are probably going to be part of it, but also geography, religion (Christianity sounds dull, but I've promised a couple of christian friends I'd do that as well), history, politics, art, architecture, and most of all literature. I'm looking forward to reading the classics. Damn it's fun to have time to do what you've yearned for a long time.

So maybe after all I shouldn't do that Tekken/Int. Karate+ clone now after all. It would be really nice to make a tiny game so I'd get more time for other stuff. Mm. What's in my idea drawer. Let's see.
  • Tekken/Int. Karate+ clone
  • Bacteria eater
  • 3D ball shooter
  • Knobbelen (Dutch die)
  • Cowboy bank shooter (idea stolen from some C64 I once saw, I think)
  • Ignition-style
  • Crazy hoArse
  • Pick up toys using a "Carneval crane".
  • Cyber Sled re-make
  • Hold off the attacking robots
  • Clone of Bloons, but in 3D
  • Mimic that swipe-pattern
  • Swipe away from your stalkers
  • Your UFO strike
  • WW2 tank vs. tank (done very well a couple of times already on iOS)
  • Shape-shifting, fleeing animal made up by particles
  • Sniper
  • Impossible Mission clone
  • Dinosaur - YEAH!
  • Bards Tail clone
  • Physics sandbox: place things in the world, make them go
  • Fantastic Contraption clone with a twist
  • Game creator (this one sounds like fun, but don't know what it is)
  • Flocking (mhm, a bit vague for an idea, isn't it?)
  • Ragdoll goalkeeper
  • Save Earth from the aliens
  • Maaad using genitals as obstacles (I'd have to use some type of auto-update to get this through the AppStore review team)
  • Forklift puzzle
  • Programming
  • 3D Helicopter
  • Matrix-style octopus (oh mah gaaawd impossible to make!)
  • Something speech controlled something something
Either I invest my time in that, or my money in this. Which is it going to be? And why?

About the author

Min bilder
Gothenburg, Sweden