A: It will make more sense after you read the code.
Q: I skipped ahead and read the code. So… you’re making some kind of overly obscure and hamfisted Steppenwolf reference?
A: Yeah… okay look it’s the end of the year and I have a lot of doings happening and the things, you know!? Like, what’s wrong with a Steppenwolf gag?
Q: Sure okay whatever, but then why not like, call it like… “Born To Be Wild”?
A: That’s silly! Bots are built not born. 😛
Plus that’s a bit of an obvious choice isn’t it?
Also, I’m all about trying not to get sued and Looking For Adventure seems less “infringy” while also being imbued with a positive child like imaginative sense of future.
Q: Fair enough, but… why isn’t Mr. Good Bot wearing a helmet? You realize that under California Vehicle Code 27803, Mr. Good Bot is required to wear a helmet and is clearly guilty of an infraction under the law?
A: Under most circumstances you are correct but you see, that law was clearly written to apply to endoskeletal citizens and Mr. Good Bot is an exoskeletal being so technically his head is a helmet and with “Jury nullification” being what it is… I’m sure no conviction would be forthright!
In any case, this interview is now over and all further inquiry should be directed towards Mr. Good Bot’s attorney!
A Bugged Bot
My little QA tester Xavier managed to find a couple of bugs in our prototype.
He found a way to get the bot into a state where it wouldn’t talk even if it had something to say and wasn’t speaking.
Mr. Good Bot is mostly assembled and we’re not looking at any code today (okay maybe just a little) but we’re really just going to talk about how Mr. Good Bot works and all the recent commits I made to Mr Good Bot over on GitHub.
Also, here’s the featured image from today’s post as a wallpaper. It depicts Mr. Good Bot being mostly assembled… I liked the look of hanging wires instead of legs, hence the name. 😛
If you need a refresher on this series, here are the other Mr. Good Bot posts:
Today were going to look at assembling Frankenstein… I mean Mr. Good Bot.
By the end you will have the code needed to run Mr. Good Bot in his most basic capacity.
Before we proceed though, I caution all braves souls who dare venture further, this post will be frightfully technical and you need to be prepared for the coding horrors that lay ahead!
If your stomach turns at the sight of raw code (i.e. most sane folks) then I would suggest you keep right at the fork and head towards A Spooky Real Neat Blog Award for a more engaging and seasonally festive experience.
Though before you go, if you just want the featured image for this post, here’s the wallpaper
Otherwise, here are the other posts in this series if you need to catch up:
Many years ago, in what seems like another life… I had the advantageous opportunity to work for the Walt Disney Corporation, not a sponsor but as I said I did used to work for them as a contracted Computer Technician for a few years.
I was young and had my A+ back when it still meant something and stood as a confirmation of basic competency!
I’m just kidding, an A+ was never meaningful (allegedly and IMHO)!
Anyway, mostly my job amounted to “burning/cloning” hard drive images, light software and OS configuration as well as installing the equipment for the end user.
Occasionally I’d fix a broken printer, upgrade some RAM on a laptop, spend a little time in the LAN closet correcting the patch panel port list because the dedicated local department sys admin liked paper records.
On top of that there were the near constant departmental moves… oh the lost weekends! 😛
Nothing complicated though and along the way I met a lot of really smart and wonderful people!
Welcome back for another episode of let’s build a bot! This week we’re building the front-end of Mr. Good Bot!
So look out the window and pick up every stitch because beatniks are out to make it rich!
Come, let the Bene Gesserit Reverend Mother Joy Muad’Dib guide you in the Weirding Way!
And… in case you missed it, those last couple sentence are an obscurish (but stupidly clever) way of joking that I’m a witch.
Like Donovan sang (paraphrasing)… “It must be the season of the October crone!”.
Yeah I know… its less funny if I explain it like that but I’d hate for the censorship bots to think I’m starting a cult.. okay, okay… another cult!
Look, I still contest it was valuable research alright!
Nonetheless, I don’t want to end up on the blacklist again, so… let’s just build the dang bot!
Mr. Good Bot’s Front-end
Sam (my research bot) and I went down into my bot dungeon… er… I mean “subterranean research facility” where we set about designing and constructing Mr. Good Bot for the amusement and bewilderment of all!
Any and all code should be short, simple and sweet… like me (that’s not true).
Everything should be easy for ANYONE, even illiterate people, to use and modify… wait, no… excuse me, that’s insensitive! What I meant to say is, people who can’t read and write code. 😛
Ideally Mr. Good Bot would be “skinable” to have more than one look and maybe even have the option to wear “accessories” because even though you never have the time, sometimes… accessories are fun!
Extra credit for cross-platform operation.
I’m juggling many irons in the fire ATM, so I should try to get the most effect for the least amount of effort on this project. Sort of a “Pareto’s principle of strategic half-assery”.
While discussing our options for rapid prototyping Mr. Good Bot, Sam and I made this list of methods we might use to animate the new bot:
Potential Animation Methods:
Dynamic Layered SVG.
A 3rd Party Animation Library.
Sacrificing a virgin… uh.. martini to summon an ancient automaton.
After careful consideration of all the factors Sam was frightfully dead-set on that last method because it involved his Bender Rodriguez impression!
Sam mentioned something about the possibility of meeting the great ToBoR “groking well” but the simulations he ran indicated the probability of success was inconclusive at best and likely low if positive.
This violates the need to be simple and modifiable by everyone.
It’s kind of a pain in the ass for rapid prototyping! 😛
3rd Party Animation Library
Look, I’m not going to say it’s not doable, but… it’s going to be a lot like that time Napoleon marched across the alps… extravagant and full of propaganda and in the end you’re left asking “Why?” and declaring “Never again!”!
I won’t subject my audience to that level of abuse!
After considering all options available, Sam and I decided to go with still frame animation because it would be the easiest for non-coders to play with and it is the only option left standing after reviewing all the other options!
Simply put, everybody can draw a picture.
You can use these raster image editors if you don’t already have one:
I use GIMP for manual raster image work by choice (it indiscriminately works on Win, Mac & Linux, but the fact it’s free ain’t half bad either!) and Photoshop is a good choice also.
Although, I would add that having to run Photoshop on a virtual machine to be able to use it on Linux after having paid for it is BS!
GIMP is a lot like VISA (not a sponsor!) it’s everywhere you want to be, though unlike VISA there are no late payments!
Oh, and uh… in case it’s not abundantly clear, #its_never_a_sponsor!
“WHAT?! You mean… we have to draw every face permutation?”
No! Of course not! That would be wasteful & magically delicious… I mean… silly & redundant!
We just need to draw each isolated component but we’ll probably get into all that next week or the week after assuming I don’t take the opportunity to write about Project Orion for Columbus Day because that just totally makes sense to me. 😛
Front-End Code – MrGoodBot.php
Below is the code for this week, it creates a web page and uses CSS to add a little style!
There is a select dropdown element used for changing the skin, the “value” property is the name of the subfolder the skin is in, note it will be case sensitive on Linux.
After that there is an image tag with the element id of “face” and as you might guess this is the DOM object we use to draw Mr. Good Bot’s face.
Note the random numbers appended to the source link image name to prevent browsers from caching the image and not updating after it is loaded the first time: