Neuromancer was published in 1984. This was 2 years after the introduction of the Intel 80286 — so PCs were still in their infancy and so-called “home computers” were all the rage in homes everywhere. I think I got my first MSX computer then. The internet existed, but it was all text and all run on mainframes. Getting on the internet meant sitting in front of a terminal (or a PC that ran terminal software) and typing up commands. These mainframes ran VMS or a Unix variant, so you had to use arcane commands like “ls” instead of “dir”. Most terminals were monochrome and had a green phosphorous coating on the cathode tube — so all text was bright green. Applications that you interact with through this type of terminal are called “greenscreen” — sometimes lovingly, sometimes derisive.
The first time I connected to the internet, which was much later, in 1991 — it was on an Adm3/a connecting to the server at 9600 baud.
Actual computer work was done on the same mainframes. Four years later, in 1988, IBM released the AS/400 “midrange computer” — still a computer that required it’s own room, but less bulky than the mainframes that were used for really large calculations. The AS/400 became the workhorse of mid-sized companies for their administrative duties. It still is: we have lots of customers that are running insurance or policy systems on these machines. (I’ve also heard a rumour about Colombian drug lords kidnapping AS/400 systems programmers to force them to build applications to keep track of their illegal empire.) And here, too, greenscreen rules supreme — often as terminal emulators run on PCs, but even there the text is green. There are some systems to “convert” greenscreen applications to web applications, but that’s more like coating it with a little web sauce instead of actually converting.

So in the 80’s and 90’s, greenscreen ruled supreme — in the office, and on the internet. And this is the hacking that is portrayed in Gibson’s Sprawl trilogy (though I don’t think there’s ever mention of a greenscreen anywhere). It really meshes well with the idea of giant, faceless systems that control everything and everybody. I think this is why (classic) cyberpunk has a greenscreen esthetic: that was what that looked like at the time of cyberpunk’s inception. (Though I wonder if Gibson really knew about these things. There’s a legend that when he and Sterling were co-writing The Difference Engine, it was suggested they use e-mail to exchange the written text. The both of them found it too hard to understand, so they used hardcopy and used Fedex to send the manuscripts to and fro.)
And this esthetic has stayed with cyberpunk. Look at the opening scene of The Matrix: even the WB and Village Roadshow logo are greenscreen.

I’m participating in an online campaign of The Sprawl, called “Ashes to Ashes, Chrome to Rust” (which is streamed live through Twitch.tv — you can read my session reports and watch the videos linked from here). During the initial discussions we had about the ‘feel’ for the game we were going for, we decided to do ‘classic Gibsonian’ cyberpunk, reaching back to the rules and types of things that happen in Neuromancer.
We use Roll20 for our character sheets, and the sheets that are available for The Sprawl are fantastic. They’re even animated, and really well suited for streaming: you can ‘present’ things on your character sheet as items in the chatbox. We ‘project’ that chatbox into the stream, so the viewers can keep track of which is what. And… they’re greenscreen, which personally I think is fantastic. Here’s the top of my character’s sheet:

And one of the players, who is well-versed in design, created a really cool greenscreen-inspired layout, even with scanlines over our video feed. He also created a greenscreen GIF to promote the game on Twitter, and I really liked that.

So I set to programming and created a Python script that uses the curses library to recreate the greenscreen, 9600 baud experience to emulate a system in our game. Setting up a terminal in Ubuntu to look like greenscreen is easy, and byzanz can record (part of) the screen and create a GIF out of it. The text is actually read from a command file, so that it’s now possible to create GIFs like this without coding.

Mobile app: Success!

I’ve managed to build the HTML5 app I needed/wanted, and I’ve also succeeded in packaging it in a ‘native’ Android app through Phonegap/Cordova. I’ve just sent out an e-mail to the Pathfinder players that I know — I’d rather do a ‘soft release’ first.

New project

I’ve started a new project in my free time — as if I needed more things to do! Last time we played Pathfinder, there was a lot of stuff to keep track of during combat. We were level 8, which means there were a lot of circumstantial modifiers possible. During a few rounds, I got a +2 to hit and for damage because of the bard singing a Bardic Song of Inspire Competence, I was Hasted for 8 rounds, which gives me my first attack in full and gives me a +1 to hit, I had expended two charges of my Nine-fold Spirit Sword to gain Banish Undead (which adds 2D6 of extra damage against such a creature), I had used my Scabbard of Vigor to gain a +3 to hit and +3 to damage for 3 rounds, and I had Challenged my opponent, which gives me another +2 damage bonus.

Calculating all that three times per round (once for every attack, with the to-hit scores differing) is a lot of work, and you tend to miss one or two things.

So I thought I’d make a Pathfinder Combat Tracker: input your regular attacks, the circumstantial bonuses you could get, and let a machine do all the work! And because you’d want this in a handy form factor, it would have to be a smartphone app. And because I don’t fancy coding for both iPhone and Android but would love for the app to work on both, I decided to make a HTML5 application for it.
It’s been slow going — mostly because my Javascript is quite rusty, because I haven’t been building sites in earnest for seven years now. Coincidentally, I spotted a book in the ‘library’ at work that someone had gotten at a conference: Mobile Javascript Application Development. Just what I needed, so I loaned it.
I’ve decided on JQuery Mobile as my platform (a good excuse to learn about JQuery itself too), and so far, things have been going quite well. However, I didn’t really think things through, so I have had to re-write lots of code when I got new insights.

It’ll get done eventually.

I’ve succeeded in syndicating the entries for kliktikfix onto Facebook, where I created a Page for the site. However, the process is a lot more complicated than it is with Twitter, mostly because of the way Facebook uses access authorisation. Also, there is a lot of outdated info to be found when searching for a solution, so I’ve decided to post the solution I’m using, in hopes it is of use to others.
Please note that this code works at this moment. Future API changes might invalidate it, which it did with so many other posts about the subject.
I’m assuming you know your way around PHP and that you have access to a site that runs PHP scripts.

My use case

I’m guessing if you want this, you’re already on Facebook. Next step is to create a Page that you will syndicate to. If you don’t know how to do that, this page will tell you how to go about it.

So far, so good. Now we have to register a new ‘App’, so that we can get the keys to the proverbial kingdom!

Registering a Facebook App

Next, we’ll be creating a PHP script to get a so-called Page Access Token. The whole Access Token thing is explained in the documentation, but in short, here’s what we’ll be doing:

Our flow

Follow these steps to create the script to get the Page Access Token:

Getting the Page Access Token

Now we have our Page Access Token. Remove the PHP script from your server, so that it can’t be called by someone else — we don’t need it anymore, and we don’t want anybody to stumble upon it.

The next step is to create a PHP script that posts to our Page.

Testing posting to the Page

When I had it working, I saw the entries appear. There was only one problem: only I saw the entries! Other users or viewers who were not logged in, didn’t see them! This gave me a few headaches, but in the end the solution was simple.

How to publish your App

It took me quite a bit of time (and some frustrating moments!) to get this working. I hope this posts helps others achieve the same — with less time wasted and less frustration!

It seems like I have to retract my previous post — now I’m using something else to post to Twitter from the kliktikfix website.

After the posting to Twitter was done, I proposed to include a thumbnail of the photo in both the RSS feed and the Twitter post. Resizing images with PHP is not much of a problem, and including an -tag in the RSS feed is trivial. But uploading media to Twitter seems to be impossible with the Twitter library I was using.
Searching around, I came across this entry on StackOverflow, which pointed me to the Codebird library. (This is the PHP version, there’s also a Javascript version.)
Codebird does allow uploading media along with a status, so I changed the feed-mechanism once again to make use of it.

Today’s entry is online: it has both a photo and a haiku, and I’ve activated the new feed mechanism in time for the 21:00 cron job. It ran without a hitch — so there’s now thumbnails on Twitter and in the RSS-feed, which is syndicated here on LJ as kliktikfix!

Service resumed

I’ve just repaired/rebuilt the RSS feed for kliktikfix, which had been broken since the server migration last April. That also means that the LJ feed (which syndicates the RSS feed) will now be resumed as well.

I have also used this example to get the posting to Twitter on the @kliktikfix account working again. (Tip: Don’t download his zip-file with the files that are needed — download them from the source at the github page, because they work with the v1.1 of the API.)

PCGen

Allow me to sing the praises of a program I have been using for a few years now: PCGen, a d20-based character management program.

You see, I find the character creation and advancement rules of the d20-system (also known as D&D 3), confusing. Sometimes you gain a feat, sometimes you can add 1 to a stat… but it’s not clear to me when what happens.(*) And it’s not like I’ve made an extensive study of the d20 ruleset, so it takes me a lot of time to chase down all the available options for the character.
Now, with PCGen, you choose a class and press a button to add a level. And then you simply get a list of things to do to level up! No more forgetting that you could get a bonus feat, no more forgetting to add skills.

We’re currently playing through the Jade Regent campaign by Paizo, which uses the Pathfinder ruleset — which I’ve heard described as “D&D 3.75” — which is also supported by PCGen. Even the special traits that you can select when creating the starting character are present!
Last session, we had to start out by levelling up. Luckily, we were playing at our place, so I just booted up PCGen, pressed a few buttons and made a few selections, and I was done!
During the course of the session, I acquired a special weapon with some magical abilities. PCGen allows you to create your own equipment by taking the base item (in this case, a Longsword) and adding any modifiers you need. Then you can rename that item and simply add it to your character’s inventory to equip it. And presto: all the numbers on the character sheet reflect your new awesomeness.

I also really like the fact that it’s free and runs on Linux…

*: I’ve heard people complain about the so-called complexity of Rolemaster, but at least in RM levelling up always uses the same process. No matter if you go from level 1 to level 2, or from level 20 to level 21: you always do the exact same things.

Much fun can be had by running both the King James bible and “Structure and Interpretation of Computer Programs” though an analyser and then creating texts through Markov chains, as evidenced by this Tumblr.

Of course, it spews lots of text, and the maker is left to interpret these — acting as a high priest for the masses of programmers who ask things like “is it OK to use global variables”? It seems like it’s OK.

WordPress hacking

So, I wanted to set up a blog for my Streamdales campaign — nathreee will be doing session write-ups and I’ll be posting background information and stuff like maps. Of course I wanted to use WordPress.
(As an aside, that’s how I found out that my current webhoster was running a PHP version from 2007 on the server that has one of my sites. I sent them a mail asking after it, and they failed to answer within a week — they fail. So I did some research and found a hoster who even advertises their phpinfo()-page. Last Thursday morning I registered a new domain with them, paid through e-banking and was up and running in five minutes!)

I spent quite a bit of time looking for a WordPress theme that suited the style I envisioned. It’s a fantasy campaign after all, so a hyper-modern theme just wouldn’t fit. After a lot of searching I found a theme that was sort-of what I was looking for, so I downloaded it and installed it on my local machine. (Running Ubuntu on your desktop means never having to search of a LAMP-stack, ever.)
And then I customised the crap out of it. New header image, removing one side-bar, making the content area wider and creating new background images for those, using the Google Font APIs to create an attractive entry header, etcetera. If you see the themes together, you can see the similarity, but they’re quite distinct.

And then I saw why the theme was free. It included links in the footer of the page, which linked to various Facebook pages for slimming products and shady financial firms. With an euphemism, this is called a ‘sponsored theme’. Basically, it’s SEO gaming at it’s worst: you use unsuspecting bloggers to promote your clients’ pages.
It’s not only spammy, it’s also a security risk. There was a chunk of obfuscated code in the functions.php file that was executed — and you just don’t know what your site is doing. For all you know, it’ll become part of a spam-bot network. And removing the function call that produces the links resulted in a red bar at the bottom of the page informing the viewer that this site had violated the terms of use.

I don’t mind people getting paid for their work. In fact, I try to pay for what I use — the only reason I have food and a roof over my head is because other people pay me for the work I do.
But if you get paid by introducing a security risk in my site and link-spamming, you’re at the bare-rock bottom of the ecosystem and you will not get any sympathy from me. And if you try to be ‘clever’ by obfuscating your code? Of course, that means war!

The fun thing about PHP obfuscation is that you get a giant string that’s Base64-encoded, gzipped, rot13’d — and then it’s ‘eval’ed. The solution is simple: change the ‘eval’ into ‘echo’ and you get the code that would be executed. That’s what I did, and I got another eval-statement. By iteration 9, I built a tool to do this automatically. It took some time, but it was a fun puzzle. I was actually a bit dissapointed that it stopped at iteration 23.
All the variables had been obfuscated too: instead of ‘$text’, you’d get something like ‘$am____p’. And some of these variables had values that were only one character long, and they’d get concatted elsewhere to form function names.
By then, I was unstoppable. I analysed the code, found the functions that did productive things (like producing the actual footer or providing the ‘read more…’-code for entries), and stripped the rest.

The rest of the code was very interesting too, to say the least. I found code that actually opened a socket to a website with a nonsensical name (a twelve-character random string, it seemed) to do some sort of AJAX-like call to retrieve the links that should be spammed. It also contained identifying information for the wordpress installation itself. The site would return the links and those would be spammed in the footer.
So: not only does every page hit on your site also result in a request to another site (slowing things down and costing you bandwidth), you also allow someone who you don’t know to have control over (part of) the content of the pages you serve.
As I stated before: I want people to get paid for their work, but I gleefully deleted this code. Then I packaged it all up as a new theme, and that’s what I installed.

I’m pretty pleased with the result — though I might change the headings and other text around, depending on whether we’ll be blogging in English or Dutch.

Campaign started

This past Wednesday was the first session of my RPG campaign, set in the Streamdales. It took a bit of time to explain how things ‘worked’ in the daily lives of the characters, but soon they received a mission to find out why a trading house feels the need to build a fortification to house their distribution activities. (Not much was accomplished right then, but the stage is set for the characters to start their investigation.)

During the preparations and the session itself, I found that I wanted to present maps of the setting to the players, but I hadn’t had time to properly map out their surroundings. I’ve used Autorealm for the map in the setting booklet, which resulted in a barely readable map.
Not satisfied with that, I looked around for mapping software again, and again came to Campaign Cartographer, which is a re-tooling of a CAD program to produce maps. I watched the video tutorials, and I was very impressed with the result one could get with just a few clicks of the mouse. klik reminded me that I hadn’t gotted any Sinterklaas or Christmas presents last year, so there was budget…

And so I bought their ‘Fantasy Mapper’ bundle, which also includes extensions to map cities and dungeons. I’m currently working my way through re-making the Streamdales map in CC, to learn the program. I’m looking forward to mapping out the rest of the setting.