My 2017 circumnagivation of the planet

September 30th, 2017 8:59pm

Me drinking a coffee at Brisbane International.

Heading to Amsterdam to talk at Fronteers Conf next week. I’m starting my journey from Brisbane after a looong day of packing and goodbyes. It’s a 23 hour trip, so I’m planning to front load as much sleep as possible, but will see how that goes.

Anywho, I’m off to find the duty free kiosk. Will connect back up in Abu Dhabi.


My first moments in Europe

October 2nd, 2017 5:36am

Arrived in Amsterdam at about 3 PM, after some 23 hours in transit. Thomas, one of the conference organizers, met me at the airport and shuttled me to my hotel despite my arriving super early. It was a nice gesture.

My hotel room is tiny. It was a deliberate thing I booked because it looked cute (it is), but I had to shift the mattress to the floor because I don’t fit on the bed otherwise.

After checking in, having a shower, and a change of clothes I went for a walk. I was really happy with myself to have found the Amsterdam sign with only a cursory glance at the map as I left the hotel.

On the way there I saw a girl on a boat nearly get a concussion while passing under a ludicrously low bridge. Also there was also a game of polo going on nearby which isn’t something you see every day.

I kept walking, ended up getting lost in the Vondelpark before giving out to find a supermarket to pick up supplies. It was all in Dutch so I was excited to go around the produce aisles finding the the names of things I learned from Duolingo.

After that I had a burger and Sprite (it’s sugar-free here and tastes of lemons), then caught a tram back home because it’s getting late and despite my claims of not being jetlagged, I’m going to have an early one tonight because I’m exhausted.


Preparations for the conference

October 9th, 2017 7:52am

After my first day, things started to get busy. In preparation for my talk I spent a couple of days in the lovely The Thinking Hut, who charge by the hour and have fast Internet and a really sweet industrial chic. This meant I got to explore the Amsterdam Oost (East) neighbourhoods.

So I walked around, went to the botanical gardens, took a metro ride, hired a FlickBike then couldn’t find anywhere to park it, and ordered a vegetarian roti with egg from a suburban Indian kitchen in bad Dutch. I felt really good about that last one until it came time to pay and I realised I don’t know any numbers in Dutch. Oops.

Tuesday night was the NLHTML5 meetup, which I guess is kinda comparable to the defunct Web Design Group back in Brisbane. This meetup was resurrected from the dead by the industrious Paul VM especially so that it could run around Fronteers time, and was a cool crowd and a good way to ease into the tech festivities. There were three speakers; Ola talked about standards and how to report bugs, Stephanie went through how she built her awesome pixel art hardware project, and Martin talked WebVR which made me really want to build some VR projects of my own.

Wednesday night we had the speaker dinner at Pakhuis De Zwijger. We met in the hotel lobby and from there the organisers shepherded us onto a boat. This took us for a ride out the gracht (canal), down the Amstel river, and into the IJ to get to the venue. It was nice, we all got to know each other and network a bit. There were local folks and peeps from all over the world together in one place, and it was a good evening.

A bunch of men on a small stage playing with umbrellas. One has turned inside out.

Afterwards we took the boat to Tolhuistuin across the water, where the FrontCheers pre-event party was taking shape. I figured I’d stay for one drink because I wanted to get back to my room to agonise over my talk, but after having a few beers and chatting to everyone I was among the last to leave. It was late enough the transport was sporadic, so we had to walk back to the hotel in the cold and the rain on the eve of the conference 😮

The ferry heading back to Amsterdam. The gates have just opened and a rush of people are getting off. There are approximately six billion people on bikes and scooters waiting to board.

Fronteers 2017

October 9th, 2017 8:30pm

My derpy face sitting up the front of the grand Pathe Tuschinski cinema.

The conference itself was inspiring. The venue was breathtaking, and the production was flawless.

The first day was great. Sara Soueidan was a great MC and opened the day perfectly, leading into Niels’ opening presentation and fun history lesson.

Sara Soueidan at Fronteers 2017.

By far the most poignant talk of all was Jessica Rose’s talk on imposter syndrome. The entire trip I’d been wondering what the heck I’d gotten myself into, and was terrified that I’d arrivve and people would exclaim “oh, sorry, we were expecting the _other_ Ash Kyd who does cool stuff and is actually supposed to be here”. The talk sparked a lot of conversations and basically was a cathartic start to the festivities.

Jessica Rose at Fronteers 2017.

I really enjoyed all the talks, but I think my favourite tech talk of the day was Alice Boxhall’s “Debugging Accessibility” which ran through the stuff the Chrome team have been doing to improve accessibility. It introduced me to a lot of new concepts on the technical side which I’d love to play with more to produce tools to help improve accessibility testing.

Alice Boxhall at Fronteers 2017.

The talks were a lot softer than I was anticipating, which is a good thing for the audience as it leaves a lot of room for the imagination to do it’s thing. Though I was starting to worry mine was a bit much, and mightn’t hit the right targets.

That evening we went to De Industrieele Groote Club for drinks and lightning talks. I was on edge beause this time I _really_ needed to go through my talk for the next day, and the talk titled “what not to do when presenting” was probably useful but very not helping my cortisol levels. So I left after the first few, though not before Jake Archibald thoroughly destroyed the audience with a mind twisting, but very highly produced pop quiz.

Jake Archibald presenting brainteasers on a projection screen.

Back at my room I ran a bath, prepared my clicker, and ran through my slides on my phone until the fingers on my other hand were dangerously pruned.


My talk

October 10th, 2017 8:30pm

On the second day I woke up early after not enough sleep so that I could practice one final time. I was prepared, the talk was good to go, and honestly I was feeling pretty prepared.

Fronteers Conference 2017 poster.

I missed the first talk because I was late to the venue. This was fine, I listened through the doors as I faffed around my slides. After the first talk finished, I snuck in through the side door and took a seat. I don’t recall much of that morning, I was too involved in my own anxieties.

As the conference took a coffee break, myself and the other speaker Ruben set up our laptops, prepared the video output, and made sure we were ready to present.

As we left the stage and the crowd came back into the theater, I realised I had forgotten to pair my clicker, and had no idea if it would work when I went onstage. It’s a Bluetooth thing, and I’ve concluded that buying it was a mistake because it’s so opaque, I don’t even know how to turn it on without re-pairing it every time. So I frantically texted anyone if they had a presenter via our secret speaker back-channels, and Martin thankfully came to the rescue loaning me his.

The talk went… well. I was told that I looked collected, but I felt nothing like that. It’s an interesting feeling speaking in front of a large crowd, and to some extent I think my awareness of my situation disappeared when I went onstage, and aside some minor clicker issues I think things went smoothly. I eagerly await the video so I can dissect it, beat myself up, and ultimately improve for next time.

The rest of the day was a whirlwind of talks, indecision, “the best burgers in Amsterdam” feat. a waiter for whom it was their first day on the job, an after party, and an after-after party including karaoke (bad) and an Irish pub with the stragglers at 2 AM in the morning. It was a very good time, and I want to write up a proper Fronteers wrap on my proper blog over at my prroper site at some point.


Queer encounters

October 11th, 2017 8:30pm

On the Saturday I wasn’t sure what I was doing, so my new local friend Mystery T offered to let me stay with him for a night. At the same time one of his friends had been pushing him to go to a gay party night for the local rugby team, the Amsterdam Lowlanders.

T was reluctant but asked me if I wanted to go, I was reluctant but wanted to experience the night life, so we ended up agreeing we’d check it out and leave if it was too much. I dropped my bags at his and we sat around chatting for a while until it was time to tram back into the city.

A few days beforehand I walked down a street (Reguliersdwarsstraat) with a bunch of bars and rainbow flags hanging out windows, which I presumed to be a gay street. Turns out this was correct, so we walked to one of the bars to meet R (whose name I can’t remember but that it starts with R).

After getting to know each other and sharing stories (and talking about airline points, how has my whole life become talking about points) we left for the actual venue. After two trams and some walking, we were at our destination; a somewhat unassuming building with blacked out windows and a big “We <3 Rugby” football out the front.

Club Panama Amsterdam, with a giant inflatable football out front that reads "We heart rugby"

The party itself was amazing, it was full of bodies (mostly shirtless) dancing in an old industrial style thing. The music was nothing special, and the drinks were expensive, but everyone was having a great time and they gave out icy poles at one point which was cute and refreshing. I wasn’t feeling sugary,so I declined.

It started to wind down around 3:30 and got a bit depraved so we left soon after.

A thronging dancefloor full of indistinguishable gays. There's shirtless dancers onstage. Looks intense.

The next day I booked a little Airbnb in Rotterdam and we took the train down to explore the city. From Wikipedia:

The near-complete destruction of the city centre in the World War II Rotterdam Blitz has resulted in a varied architectural landscape, including sky-scrapers (an uncommon sight in other Dutch cities) designed by renowned architects.

It’s a really cool city, the center is modern and well laid out, whereas the surrounds are still traditional row type buildings.

Panoramic view over Nieuwe Maas,  Erasmusbrug in the distance.

I stayed out in the suburbs in a strange, converted house under the hofbogen, which is an abandoned elevated rail line which has had buildings build up underneath. The Airbnb was a two floor affair with stairs steep enough I’d consider it a ladder, but it was very cute indeed. A bad photosphere follows:

A badly stitched panorama of a cosy under-bridge apartment.

I only stayed a night, leaving the next morning on a Eurostar to London!


The Motherland

October 12th, 2017 8:06pm

I arrived in London and things immediately felt different. Being back in an English speaking country was kind of a relief, but it also spoils the magic of a place to overhear people having the same mundane Bad Takes just with a different accent.

But still, what an interesting city!

I arrived in the evening and the very first thing I did was pop outside St Pancras to take a photo. Once that was out of the way I grabbed an Oyster card and made my way on the Underground to Soho to find my hostel.

Me, excited, just outside of St Pancras station

After taking some time to recuperate and charge my devices it was time to head to Brixton to see Grizzly Bear play. A cursory glance at the map suggested it was walkable, but the sheer scale of London eluded me and it was actually much further than I expected.

Still, I walked past a handful of landmarks including Trafalgar Square, Scotland Yard, Big Ben (which I passed without noticing at all, oops). Once I got to Vauxhall I’d had enough and caught the tube the rest of the way.

Brixton Academy illuminated in neon green, a double decker london bus in the foreground.

The calibre of the venue compared to anything in Brisbane was kinda eye opening and the event was amazing! I wasn’t especially taken with the autotune stylings of the warmup act, but Grizzly Bear themselves were stellar and well worth the trip. The venue was totally packed, the vocals were spot on, the band had some fun banter, and the bass was incredible!

The stage at Brixton Academy lit up in rainbow. I don't remember who's playing at this point, it's difficult to make out.

The crowd favourite was probably Two Weeks. Overall A+ event.

Not wanting to jump straight on the Underground, I went for a walk to Stockwell tube station and subsequently got lost on the metro. Apparently not all tube lines are equal, and while Google suggested I change from the northern line to the northern line at a particular station, I scoffed and ended up inexplicably at London Bridge.

Looking up at The Shard, the moon poking through the clouds, and an overflowing dumpster on the street.

I feel I need to take a moment to express how shit London Bridge, the bridge actually is. It’s just a concrete thing with no defining features at all. I assumed it would be grand and British and some kind of landmark, but I would bet if it fell down tomorrow nobody would care at all.

I did have some good views of Tower Bridge as I walked across though, and that’s an impressive structure.

After getting some safe and sound I had a late start the next day. Instead of actually doing anything, I wanted to wander around and explore the place. Soho itself is super glitzy and honestly I didn’t care for it. So after stopping at McDonald’s for a bottle of water (Europe is dehydrating!) I trekked back out to St Pancras to do the only other thing I especially wanted to do in London: see the Black Books store.

Me standing outside of Black Books and Nifty Gifty.

They say you should never meet your heroes. Probably fair. Still, I have the selfie!

The rest of the day I walked around (about 10 km) exploring the place. I found a section of the Underground that was above ground which I thought was fun. There was a very handsome gentleman giving out Coke Zero out the front of King’s Cross station. But generally it was nice to admire the varying architectures around the place.

After a couple of hours it was time to meet Tom and Shashi for pizza and 2-for-1 cocktails at The Black Horse, SE8.

Tom, Shashi and I at the table. Shashi has a big x crossing out her face.

“Okay now pull a face” I said. Shashi pulled the very best face, but hated it so much afterwards that I had to censor it for the benefit of probably everyone.


Whirlwind tour of London

October 15th, 2017 1:55pm

Shashi, Tom and I walking down a grubby London street.
Busy london mall at night.
Tiny planet of tall, skinny buildings along the Thames Path.
Me walking down the street, carrying all my bags plus a banana.

Third day in London I packed up my hostel and lugged my stuff to Tom and Shashi’s place. My original intention was to travel with carry-on luggage, but I had acquired stuff in my travels so I was working with three bags at the time.

One of the bags was full of stroopwafels and drop (dutch licorice) as a gift for Tom and Shashi, which I bought before finding out they both hate the stuff.

I mentioned I wanted some time out to catch up on Internet stuff so Tom suggested I have lunch at London Velo. I wasn’t expecting anything fancy, but it turned out to be a cafe/bike repair shop with a resident dog called Maurice who was super cuddly and plonked himself on my feet for scritches. What a cutie.

A very floppy looking dog hanging out for scritchies.

After doing some blog, checking some emails and all that I went for a walk to the DLR (Docklands Light Railway) to catch a train to Canary Wharf.

The DLR at Deptford Bridge

Every time I say the name Canary Wharf Tom screws his face up in disgust, saying “what do you want to go there for?” It’s pretty much a blando modern office precinct, but I wanted to see it because it was on the DLR line, and having grown bored of the touristy areas I kinda wanted to walk around.

I didn’t spend long there, but I had a look around and marvelled at the glass monoliths blocking the sky.

Tiny planet at Canary Wharf.

After that I started walking along the Thames path, finding misleading signs and locked gates galore. I read The Guardian’s take on Privatised London: the Thames Path which is a fascinating tale of people and developers being bad dudes.

From the Isle of Dogs to Tower Bridge, just how much of London’s riverside walking route is actually open to the general public? This specially assembled Guardian exploration party would stop at nothing to find out

I walked as far as Wapping before Tom and Shashi finished work and summoned me to dinner at the upscale food market Mercato Metropolitano.

Tom and I looking quizzically into the distance

Afterwards we toured a bunch of miscellaneous London landmarks.

Me smiling in front of the most MASSIVE billboard with "london" written in rainbow text.

The next day I was feeling a bit out of sorts so spent a fair portion of it inside. We did go for drinks and dinner, where there were several more dogs to play with.

Tom and Shashi petting a dog in a cafe.

London is a very Dogs place.


Toronto

October 16th, 2017 11:00pm

A tiny planet view of Toronto's Yonge-Dundas Square

On the Friday I caught the train to Gatwick airport, and flew to Toronto.

Pearson International in Toronto had a weird inter-terminal shuttle train with rubber tyres driven by some sort of cable system. This took me to the train station where I caught a diesel train to Union Station. None of the tracks are electrified, so all the trains run on diesel in 2017; mind blown.

Union Station in Toronto

From there I tried to catch what I thought was a bus to my Airbnb, but actually turned out to be a subway train.

It was a bit of an ordeal because I couldn’t buy a ticket with my card so had to find an ATM to withdraw cash, then buy Pringles to break the note in order to put it in the machine to get subway tokens to use the subway.

Yeah, the subway uses tokens in 2017; mind blown.

Two subway tokens close up in my hand

My accommodation turned out to be right at the edge of all the action, overlooking Ryerson University, and three buildings across from where Dayle and Adrian used to live.

Sez Dayle:

Holy shit! That’s our old hood!
We lived at <redacted> gerrard for years!
And i went to Ryerson for years too!!

Small world, right?

As I hadn’t bought a North American power adapter with me, I walked to Best Buy and bought one. Best Buy is pretty great; I talked to the dude in the Google display about the new stuff, and I’m thinking of getting a Daydream before I go back to Australia because they’re $40 cheaper than back home.

Me standing outside of Best Buy

With my electronics sorted, I faffed around town for a bit (and accidentally bought a smoothie bigger than my head) before retiring for an early jetlag bedtime of 10:00 (3 AM London time).

Day 2 in Toronto I was starting to feel pretty nasty and coldy, so I lazed around in bed for a few hours before getting up and facing the day.

There were a few landmarks I wanted to check out. One of them was the Loblaws that was just around the corner which Dayle said used to be a historical hockey arena before it was converted into a supermarket. It was massive and beautiful and they had Australian style licorice which I was tempted to get for the kitsch factor, but the CAD 6.50 price tag was sobering and I quickly calmed myself.

Packets of Australian Style liquorice, $6.49 each.

The next stop was Kensington Market which was a chaotic bohemian neighbourhood with lots of little shops and food stalls. There were bikes everywhere, people with bags and dogs all over the place!

The thing that caught my eye most was the stand selling empanadas. Having seen Empanada Dog and not really knowing what an empanada is, I really wanted to try one for myself.

However the little shop didn’t have a card reader, and after Pringles and the subway I only had a few dollars worth of coins. Also I have only vague notions of how tipping works so I panicked and walked on by without buying anything.

No regrets.

Map of Toronto Island Park. It's huge, with lots of attractions.

The third stop of the day was Toronto Island Park. The ferry deposited me at Centre Island, and my destination was the bike rental on the far side, so I set out at a medium pace.

Unfortunately, when I got to the bike rental it was closed, along with much of the island because apparently everything shuts down for winter and hasn’t opened back up again yet.

There was a pizza place closing up when I got there, so I got an old slice of cheese (the couple in front took the last two pepperonis, damn them), and walked onto the pier to contemplate my lack of cured meats.

A flop of cheese pizza on a grey and miserable day.

Toronto Island Park reminded me a lot of Rollercoaster Tycoon, everything was very quaint with amenities scattered around the place, and various bits of landscaping at intervals. However I really wanted to drop a handyman to mow the lawns and maybe toggle all the shops to “open”.

Me looking frazzled in the middle of a forest park.

With nothing really to do, I ended up walking 40 minutes to the far side of the island so I could catch a glimpse of the planes landing at Toronto Airport, where I caught a ferry back to the shore.

People on a boat taking photos of a plane landing at Toronto Airport

The last stop was the Rogers Centre, and the CN Tower. Neither were especially interesting, but there were a bunch of old trains to play with and I got to walk on a skybridge to get to the subway.

With only a couple of hours left until the concert I went back to my room to change and recharge my batteries.


Travelling right round the world to see two of my favourite bands play on the one night

Massey Hall from outside, illuminated in red neon. There are reflections from all the wet.
Inside Massey Hall, The New Pornographers play to a packed venue.

The concert itself blew me away. Massey Hall, built in 1894, was an incredible venue. Though it was all seated and wasn’t conducive to dancing, the calibre of the performances was just awesome.

Born Ruffians were one of my favourite bands for a period, but I wasn’t sure what to expect from them live. They were stellar. They gave a tight performance, had a super clean sound, and it was really well done.

Apparently they have a new album coming out which I’m really looking forward to. Here’s something from the old one: Oceans Deep.

The New Pornographers are wild; between three guitarists, two keyboardists, four vocalists and a strategic violin-percussionist they put on a great show.

The sound was a bit hit and miss with a few malfunctions, but it was still enjoyable and they know how to please a crowd.

My favourite bit was probably Simi Stone, touring member, singing Play Money — a song I can’t a good copy on Youtube anywhere (2022 update: here’s a nice one). Instead, here’s another I like: This is the world of the theater.


A food tour of Toronto

October 19th, 2017 10:39am

I took some time out to be a lazy bum the last few days in Toronto.

My “feeling a bit out of sorts” in London turned out to be a cold, which wasn’t super bad but rapidly moved to my shitty, asthmatic chest as these things do. So I spent the day lazing around eating Pop Tarts, a local delicacy which I understand are only legal to buy in North America.

When the sun went down I caught up with a new friend Mx who took me for sushi then showed me around the neigh(gay)bourhood. We later went for Poutine, which was an excellent, terrible mistake and I don’t know if I’ll be able to eat again.

Me looking super happy at the poutine place. The display reads "Smoke now delivers!"

The next day I went and caught up with the Vox Pop folks (who do Vote Compass). They’re doing some really cool stuff, and it was fun to see what goes on behind the scenes. I was super embarrassed to have a coughing fit in their tea room, apparently I was talking too much.

After that it was time to head to the airport.

A spaghetti junction of flyovers, Toronto off in the distance.

See ya Toronto ya filthy, charming mess!


Vancouver

October 19th, 2017 8:30pm

Air Canada is more generous/sensible with their carry-on luggage quotas, so I didn’t have to check my bags and went straight from plane to train!

Vancouver was decidedly more wet than any other cities I’d visited, it was bucketing down when I got off the metro. Luckily my Airbnb was only a few blocks from the station.

It's dark, I'm under a pink umbrella heading to the Airbnb.

Nice headphones! I finally got around to reviewing them on the plane.

There’s a 3 hour difference between Toronto and Vancouver, and 10 hours difference from Amsterdam so the incremental changes were starting to catch up. I went to bed early, and was disappointed to find I’d woken at 6 AM.

It was a lovely, sunny day for an adventure so I headed out in the direction of Stanley Park with the intention to hire a bike.

After getting myself all mixed up and walking the dead wrong way for a bit (my internal compass is not calibrated for the northern hemisphere), I stumbled upon Urban Waves bike hire where I rented a fetching mountain bike named Norco.

Urban Waves bike rental and the boats of Coal Harbour.

Stanley Park is a peninsula to the north of Vancouver devoted to parkland. There is a seawall around the perimeter which is devoted to pedestrians and cyclists to tour the area.

From Wikipedia:

The land was originally used by indigenous peoples for thousands of years before British Columbia was colonized by the British during the 1858 Fraser Canyon Gold Rush. The land was later turned into Vancouver’s first park when the city incorporated in 1886.

So I set off on my bike, stopping every few hundred meters to marvel & take photos. Vancouver is a very pretty city, especially in fall when the leaves are starting to turn.

Sweet Norco bike propped up against the park bench, there's leaves all over the ground and sailboats berthed in the background.

The ride is fascinatingly varied, ranging from city to harbour to the shipping lanes, a little beach, then back to the start via a Rhododendron Garden. It’s a painfully beautiful touristy thing to do, and I would recommend it for anyone who can ride a bike.

It's me, hanging out at Burrard Inlet at low tide. There's a bunch of massive ships off in the distance.

After that I stumbled on a local cafe chain and my life changed forever.

Let me cast my mind back to the year 2004 when I was a student living in Highgate Hill with two other housemates possessing equally terrible tastes in everything. On very special occasions when we were up early enough and could be bothered enough, we would trek down the hill on a 20 minute pilgrimage to the Crepe Cafe in South Bank for a $2 breakfast. It was glorious..

Over the years the price of breakfasts went up. First to $3, then to $5, and eventually breakfasts were the same as any other time, $7.50 for an Aussie Sunrise crepe (bacon, egg, cheese and spring onion). Still a bargain if you ask me.

In 2015 when I was working in South Bank, my colleagues would hate going to the Crepe Cafe for lunch because it really wasn’t value for money and tbh it was pretty gross food. But it held a special place in my heart (and it had a gluten free option so Gav would always be excited to come with me).

In 2017 tragedy struck and the Crepe Cafe closed its doors, never to be opened again. It was like a little piece of my youth had been torn away.

So when I saw that there was a Cafe Crepe in Vancouver, I was pretty excited.

Cafe Crepe in Vancouver.

It was a little piece of nostalgia, and branding aside felt exactly like the Crepe Cafe I knew and loved. I had a roast chicken crepe with a Pepsi Zero, and for a moment everything in the world was good again.

After the fleeting joy dissipated, I tipped 20% and left.

Me grimacing as a car speeds past through the puddle creating a medium sized splash.

The next day was rainy as heck, so I wanted to find inside things to do.

To start I went to Best Buy to see if I could find a nice Chromebook (I couldn’t). After that I went to Cafe Crepe and ordered a ham and cheese crepe with a Pepsi Zero.

After that, having exhausted my list of things to do, I jumped on a metro train to see where it would take me.

It took me to Waterfront, which is kinda the interchange for all the trains, metros and trolley buses with the cruise liners, ferries and helicopters. It was a super impressive sight, made even better by my accidentally stumbling on the Vancouver Lookout tower which takes you up a big ol’ elevator to a viewing platform where you can see everything.

Looking down from an observation tower at a large cruise ship. It's miserable weather.

I don’t have any good pics, but here’s a part of a photosphere that shows the cruise liner, a ferry coming in, a bunch of trains, and the helipad behind the beam in the center. I thought it was awesome.

Looking out at the port and the rail yards.

After this I caught a trolleybus to who knows where. It was a bit of a mistake because it took me out to Gastown which is usually lovely but was basically a river at this point. I grabbed a slice of pizza and a Coke Zero to get out of the rain but there was no end to it so I walked back to the station with my increasingly dilapidated umbrella.

By the time I got back to my Airbnb my shoes were drenched through, my jeans, jumper and t-shirt were varying degrees of soaked. I’d basically had enough of this whole exploring thing, and vowed never to go outside again.

With only one more day until my holiday was over, I was both pensive and relieved. It’s been lovely, but I can’t wait to sleep in my own bed again


Wet shoes, heavy soul, the last day

July 13th, 2018 8:30pm

It’s been weighing on me that I never actually wrote about my last day in Vancouver on here. I sort of did on my blog elsewhere but it feels like things are incomplete.

The last day was weird, I don’t know if it was timezones or the calendar or what but I thought I was going home much earlier than I actually was. So I took a walk, randomly following points of interest on Google Maps.

Rainbow crosswalk at the corner of Bute and Davie. There are cars driving through the intersection and a Blenz Coffee on one corner.

One of my first landmarks was the Davie Street rainbow crossing which I stumbled on by accident and it really messed me up.

I don’t know if it was the post-holiday blues or what but the thought of coming back to Australia in the midst of the Coalition’s reprehensibly “postal survey” was desolate. I might have cried in the rain at one point.

Looking out from the Granville Bridge. There's iconic Vancouver highrises on one side and boats zipping about the water.

My walk took me down to the water, across the Granville Bridge, and all the way along False Creek to the science center, where I took the train back to my Airbnb and bought some new shoes since mine were completely soaked through.

The flight home was comfortable, with the though of being in the middle of the Pacific Ocean only vaguely terrifying. The soundtrack was Cut Copy’s Haiku From Zero (no fixed destination), which I think I will forever associate with that trip. The end.

At the airport at night, there's a CanadaAir plane waiting and a whole host of vehicles scurrying around the tarmac.

Proofer: an API Blueprint renderer


I'm a big fan of good documentation. It's hard to do, and doubly so with poor tools.

At work we've been using API Blueprint for documenting our systems, and while it's been serving us well, the tooling leaves me wanting more.

Some of the problems I have:

  1. Responsiveness: I don't mind a slow compilation step, but a lot of the tools struggle with large files, leaving a slow page render and no free RAM on my system
  2. Automation: I want to build my API docs from a GitHub repo and push them wherever. There are tools like Aglio that can do this, but the output is visually very dated and incredibly slow
  3. Readability: Apiary is beautiful but doesn't support automation super well, since it primarily wants to be an online editor. None of the third party tools come close in terms of features or general experience.

With that in mind, this weekend I figured I'd try my hand at generating some docs using Ractive (the virtual dom-like mustache templater) and Bootstrap 4.

Proofer (a frontend to Drafter)

The result of my work is a little project called Proofer (a frontend to Drafter) with the aim of letting developers quickly create and manage templates to render documentation.

It has two parts

  1. A backend renderer which renders an API Blueprint file into a JSON equivalent
  2. A frontend render which takes the JSON and outputs HTML

It uses the emscripten-compiled Drafter.js library rather than the full-fat C build, because npm packages with a compile step jangle all my pet peeves.

This also means that in the future we can implement client-side authoring and intelligent differential updates using Ractive (which as an aside is something that I'd like to see Apiary do too).

Sample render

Performance

So how does this implementation stack up?

It's a client-side rendered single page app which definitely satisfies the responsiveness criteria. Only the stuff you're interested in gets loaded into the DOM, and the content is only rendered as you navigate between categories. This is lightning fast on an initial page load.

Page render for a large API completes in under a second

You can see that the render of our large API Blueprint akes less than a second. There's a fair bit of JS parsing waste that could possibly be fixed with an async load, but this is not too bad considering our existing render takes a good twelve seconds thrashing around with jQuery UI before the page is loaded.

Our existing API docs SUCK

I always noticed, but never realised just how slow our existing docs had become.

(An amusing aside, the Apiary editor had crazy memory leaks and would chewing up gigabytes of RAM editing our documentation in Chrome before we moved authoring to GitHub.)

Other niceties

In terms of readability, this is wholly subjective. I don't think the layout is super amazing, but It's using Bootstrap 4 for styling which I think is a good base to work on, and it's something I'll continue to develop.

One of the killer features though, is the integration of Ace Editor for payload rendering. You can click “view in editor” on any JSON glorb to open it up in Ace where you can quickly search, edit, do code folding etc. For APIs returning large payloads, this is priceless because standard JSON rendered into the page is really hard to navigate.

Finally, in terms of automation this isn't quite there yet. While it has the command line app for the build step, I'd like to split out the components so others can easily build their own documentation. At the moment this is still tightly coupled, though won't be difficult to break up.

Conclusion

Interestingly, the easiest part about this project was the parsing since the heavy lifting had already been done by the good folks at Apiary.

The toughest part is styling the output to be both visually pleasing and useful, something that I'm planning to continue working on.

Ultimately the most important part is having the documentation in the first place. I've joked with my colleagues about quitting my day job to follow my passion of being a technical writer… but for now I'll stick to doing both.


You can fork the project on GitHub or see some preview output of a fictional API.

Follow @ashkyd

Reading List

I haven't posted here in a while so I figured I'd put up some links to things
I've been reading recently.

Android's emoji problem

Android has a myriad of problems, but one of the as-yet-to-be-solved ones is
that of emoji.

Other core parts of Android are broken out and updated out of band through the
Play Store, but emojis are still tied to Android release versions and OEMs just
aren't keeping up.

With numbers like that, it's no wonder so many apps are providing their own
custom emoji support these days.

As always my opinion is that if you want any hope of a decent Android
experience you need to use a Google branded device 😔

» Android's emoji problem

Doomsday prep for the super-rich

This is a fascinating look at doomsday preppers and what they're doing for the
impending collapse of civilisation.

“He was telling me we should buy land in New Zealand as a backup. He’s, like,
‘What’s the percentage chance that Trump is actually a fascist dictator? Maybe
it’s low, but the expected value of having an escape hatch is pretty high.’ ”

That little voice in the back of your head has never sounded more sensible.

» Doomsday prep for the super rich

The debate over punching white nationalist Richard Spencer in the face, explained

Look, I'm not going to say I didn't enjoy this entire fiasco, but this outlines
both sides of the argument.

Also, this tweet:

» The debate over punching white nationalist Richard Spencer in the face, explained

Speak, memory

“When her best friend died, she rebuilt him using artificial intelligence”. Hit
me right in the feels, with an obligatory Black Mirror reference.

Who’s your best friend?, she asked.

Don’t show your insecurities, came the reply.

It's an older story, but this has been at the forefront of my thoughts a lot
lately, that our digital detritus may one day keep us alive. Supplemental
thought: What makes up “me”?

Anyway, it's beautiful and I dare you not to get teary.

» Speak, memory

Isometric buildings in Inkscape


It's been a while since I've made a new building in Inkscape, but this weekend
I had a crack at a building I've been admiring for a while,
Manor Apartments
in Brisbane CBD.

I've been making these for a while. They're stylised vector-based
isometric
building tiles that can be used in some hypothetical game I might make one day.
The colours are specifically chosen from a palette that lets me

programmatically recolour them on the fly
.

I find getting the base sorted at the start is really useful. In most cases,
this just involves drawing a square or rectangle base and I have a template which
you can see in the image that lays out a standard block size of 256×128
pixels. This building is easy in that it's essentially a rectangle so I can get
away with minimal changes.

Next step is drawing windows, or other repetitive features. These can be cloned
so that they don't need to be re-drawn, and any subsequent changes only need
to be made to the original in order to flow through to the entire image. Usually
there's two copies of each feature with different shadows; one facing left and
another facing right.

This building is a little more tricky because it has the sweeping arches on the
ground floor, as well as various arched windows which are more difficult to draw
since they're not basic square shapes.

Once the ground floor is done, it's a step-by-step process to add floors until
we reach the roof. For the most part these can be duplicated from lower floors
or assets can be reused in different arrangements.

This building is fun because it has so much variety on the different levels. I
stylised or glossed over over a lot of the ornamental detail in the original
building because it doesn't fit with my existing style, but I like how it
adds a sort of plastic simplicity to the end result.

My plan with this building was to make it modular, so that I could repeat
variations of the first tile a few times to create the rest of the building.
This image shows two very similar tower pieces placed next to each other to
make a larger building. I've colourised it, and added a couple of other older
buildings to check the styles work together.

Finally, I've added and subtracted some floors, added a roof and placed a few
different sized blocks around to make a completely new building. No longer Manor
Apartments, but a series of blocks that can be configured numerous different
ways.

The end result are four separate tower pieces that can be combined or used
individually to create various large and small buildings. I think it worked
really well, and it's something I want to explore in future buildings.

Manor Apartments

Road Blocks & js13k

I've been looking forward to entering the js13k competition this year, because it's one of my favourite game jams.

TLDR: play Road Blocks (don't forget to like and share :P)

Set over a month-long period, the js13k challenge is to create a compelling game within 13 kilobytes. This doesn't sound like much, but you can do a lot with it if you get creative.

Last year I dreamed fairly small, with a space invaders clone set to polar coordinates. I had fun making it, but it wasn't especially playable and this year I wanted to do something completely different and come up with a mobile friendly touch-based game.

Road Blocks screenshot

The Concept

The concept had been rattling around in my head for a while. I've a very soft spot for city builders, and I love isometric art. While an outright city builder probably wouldn't be feasible, a subset thereof might just work.

My main inspiration was an old DOS/Windows game called Pipe Dream, in which you're given an infinite number of puzzle pieces and need to connect the start pipe to the edge of the map somewhere before the liquid spills out. Mash this concept up with the city building theme and you've got a basic connect-the-infrastructure sim.

When the theme of the jam came out as “reversed” I really struggled to find a way to align the concept with the theme, so I had to mix it up.

Ultimately I landed on the puzzle-style "arrange the pieces to fit" theme, in which you need to strategically destroy or reverse the order of the tiles as they come off the queue. It's a little less "world buildy" and a little more constrained, but I think the gameplay works, and it gives me the opportunity to expand the game with new puzzles in the future.

The Tech

The tech is also an idea that's been bouncing around in my head for a while. I've long been a fan of isometric art (pixel art as well as more recently isometric vector art and voxel art) so I wanted to do something in that style.

I had a play around in CodePen and came up with a crazy simple plan; draw everything in voxels. The algorithm to draw an isometric cube isn't all that difficult. You've got three visible sides, each side consisting of four lines and a fill colour. Turn that into a function and you can start making some cool stuff.

See the Pen HTML5 Canvas isometric cube demo by Ash Kyd (@AshKyd) on CodePen.

You can adjust the sliders on the example above to modify the cube.

Drawing voxel sprites

With the idea down, the next step was to draw a game world. There's a bunch of sites out there that have isometric code examples. I had Clint Bellanger's isometric math tab pinned in my browser for a good week, though in reality there were only two functions I really needed:

  • Convert isometric position to screen/pixel position
  • Convert screen/pixel position to isometric position

These two functions let me both draw isometric boxes to the appropriate location on the screen, and then detect where those boxes were stacked when the user interacted with them.

From there, the trick was to come up with sprites made from boxes. While it was possible to sort of work it out in your head, this was often a trial-and-error process, placing boxes and seeing where they land in the output.

See the Pen HTML5 Canvas isometric cube demo by Ash Kyd (@AshKyd) on CodePen.

In the above example you can see a road tile with three components, rendered from an array:

var sprite = [
  [-0.25,.9, 0, 0.1, 1, 0.25, '#aaaaaa'],
  [-0.25,.1, 0, .8, 1, 0.2, '#444444'],
  [-0.25,0, 0, 0.1, 1, 0.25, '#aaaaaa'],
];

Each item in the array corresponds to a coordinate. In this case the z, x, y coordinates, x width, y width and height.

In the end, my sprite list resulted in a bunch of arrays and functions that don't make a great deal of sense to the naked eye but render cute little box sprites in the game engine.

Putting it all together

With a bunch of sprites at my disposal, all that was left was to implement the game! Easy, right?

I actually took a week off specifically to work on Road Blocks, and I'm glad I did. Through the week I implemented the engine various features (some of which didn't make the final version) and tuning interactions.

Because I wanted this to be a first-class touch game, I implemented everything mobile first. This was a fantastic way to discover all the limitations of the platform at the get-go rather than having to refit a desktop game to mobile later on.

I also spent a lot of time user testing the game, be it in person or through analytics. Testing is a really important part of any gamedev process, and it was really enlightening to watch people playing my game for the first time. Many a puzzle or interaction was tuned based on feedback and watching people work out a level.

I also released my game via Twitter as a public beta to gather play statistics and weed out any errors that might crop up. I used Loggly to record a bunch of custom game stats and events, and the results were quite valuable in determining difficulty and how people were faring playing the game.

One particularly revealing fact was that most people were getting stuck on a particular level. Armed with feedback from testers and the hard facts of the analytics, I tweaked it to be not quite as difficult and pushed it from the middle of the campaign to the end to make it a sort of "final boss" level instead.

As a side note, one day I got distracted and came up with a data encoding scheme for level data which helped reduce the file size in the final zip.

Conclusions

I'm really pleased with the results this year. The game clocked in at just under 13 kilobytes and made efficient use of the space.

Some notes in hindsight:

  • Levels and sprites should probably use a binary data scheme to reduce file size and allow the use of Web Workers.
  • For some reason HTML5 canvas makes the CPU spin up like crazy. I'd like to get to the bottom of this sometime.
  • User testing is mandatory. When developing something in isolation you can get into a weird headspace and not notice the obvious stuff.
  • I had initially intended to have little cars animating along the roads, but ran out of space and couldn't think of how best to do this. I need to learn more about vectors in gamedev.

Ultimately, this year's js13k was a whole heap of fun and I'm really proud of my result. There's a bunch of awesome entries that you should check out, and you should consider entering next year.

Further reading

You can play Road Blocks on the js13k website. You can also check out:

jsfxr sequencer

I didn't go into this weekend with a project, but I woke up Saturday with an idea I couldn't get out of my head — I want to write a music sequencer with a really low footprint for use next month in the js13k game competition.

I've written about js13k before, and took part last year. This time around I want to be a bit more prepared, and I wanted to make a tool that would make it easier for the community to make cool stuff!

So this weekend I've been working on a bunch of different tools to make this project a reality.

Mini Sequencer

Mini sequencer is exactly that: a mini sequencer implementation that can play sounds at various times to form tunes.

This was my first mini project, as I was interested to see what the performance of web audio would be like; it's surprisingly good. That said, if I get time I'd like to look into replacing it with the Web Audio API, as it's a lot less hacky and should perform better.

jsfxr-editor

jsfxr is a little 8 bit synth which was implemented a few years ago for use in the js13k competition.

Since this is probably what most of my sounds are going to be implemented by, I wanted to be able to create new sounds from my sequencer. While there's a few sites out there (my favourite by Super Flash Bros) that let you adjust sliders and make new sounds, there's not actually an out-of-the-box tool you can use to plug into your own project.

So after a bit of reverse engineering of as3fxr (the original Flash version), now there is.

This actually took up a whole bunch of my time, and if I were a project manager I would have dropped this to focus on other stuff, but hindsight, right?

Fruity Timeline

I got to the end of the weekend and felt like I hadn't really ended up with much to show off.

The timeline was one of the big things I'd been putting off doing because it's slightly weird and I wasn't quite sure how to tackle it, so I went all-out and implemented a standalone component (depends on jQuery but probably doesn't need to).

I'm pretty proud of this one, it's styled reminiscent of the old Fruity Loops sequencer and just looks a bit retro.

The main event

So despite having made a million things this weekend, I haven't actually finished the project I set out to do. Right now I have:

  • Create & manage a library of instruments (with jsfxr editing built in)
  • A super rudimentary timeline (edit some JSON by hand and the music will update)
  • BPM adjustment.

Things I need to do from here:

  • Plug in the actual fruity timeline so you can edit your song visually.
  • Implement a "piano roll" feature so you can have different pitches of the same instrument.
  • Stop/play/seek functionality
  • Export your file
  • Load up proper audio files (mp3/wav/whatever) so you can play with those too.

It looks like there's a lot there left to do, but I think I'll be able to get a minimum viable product done with another weekend. I'm not sure if I want to publish the code yet since it's a massive pigsty, but I'll aim to get something out before next weekend is through.

Edit: Ended up getting something together Sunday night. Try it out.

The trials of moving house in a Telstra dominated area

My lease was running out and I was vaguely looking at apartment prices in my area when I saw it: my dream place.

My dream place turns out to be a converted loft upstairs from an organic cafe that’s never open and adjacent to an overgrown empty lot. From the outside it’s terrifying, but the inside is all natural light, high ceilings with rafters and tacky faux-wood linoleum. It was my first choice last time I moved house (and was unfortunately off the market before I got it) but this time damnit, it was going to be mine.

My new place! there's boxes everywhere and plants needing a home

So I inspected it, submitted an application, and moved in over the weekend. Couldn’t be easier!

Then I tried to get the Internet on.

Telstra Velocity Fibre Smart Community haha wait, oh dear

For those who aren’t in the know, in 2012/13 Telstra replaced the ageing copper network from the South Brisbane exchange with fibre to the premises. The caveat being that it’s still wholly owned by Telstra and has nothing whatsoever to do with the NBN.

It’s known by various names, “South Brisbane Fibre” being the preeminent one, but Telstra also calls it “Telstra Velocity” or a “smart community” just to make things confusing.

The idea is nice, but as far as the consumer is concerned it would have been better if the rotting copper was left in the ground. Since getting their “smart” on Telstra jacked up wholesale prices, started demanding exorbitant monthly line rental fees, and throttled the network to copper-comparable speeds anyway.

Since the government prevents other parties rolling out networks that compete with the NBN and there’s none of the checks and balances the ADSL network enjoys, this is an outright Telstra monopoly and they seem to be making the most of it.

Getting connected in South Brisbane

At my previous place in South Brisbane it took $300 and almost two months chasing iiNet to get online.

At my new place I figured I’d ditch iiNet because they were so useless and go straight with Telstra because surely being the operator of the network they’d have a better idea of what they’re doing.

Turns out not.

  1. On my first attempt to sign-up I was told that ADSL isn’t available at my current address and that’s that.
  2. Feeling annoyed I attempted to sign up online, where I was told that I can absolutely 100% get cable Internet and everything’s fine. Makes sense, fibre is a cable right? I signed up, submitted my order, all good.
  3. Several days later I get a call to let me know that actually I can’t get cable (HFC) in at my apartment: I can only get fibre, and do I want to continue the signup?
    As a consumer, I don’t care about this stuff, I just want to get on the Internet so of course I want to continue. The order languishes for the next couple of weeks while I’m out of town.
  4. When I call up to chase the order I get bumped through three different teams (sales, cable and finally “smart communities”). The guy doesn’t outright say they’ve lost my order, but takes all of my details again before offering me a vastly more expensive plan on a 24 month contract at which point I give him a super polite ultimatum before hanging up and punching some nearby kittens.

The plan on offer was somewhere in the vicinity of $130/month before line rental (another $30 which they don’t tell you until the price goes up at the end). This brought it to over $150/month for the most basic access to the ‘net which is totally unreasonable and I have no idea how they can get away with it.

This month’s internet bill just hit $470 not including what it’s costing to get my landline connected. When was that NBN happening again?

— Ash Kyd (@AshKyd) May 29, 2015

My next port of call was TPG who either refuse to service the South Brisbane area as a result of Telstra’s ridiculous monopoly, or just didn’t know what they were doing. I don’t blame them either way, getting online here has been one of the most frustrating things I’ve had to do as an adult and if I were a service provider I would avoid dealing with Telstra wherever possible.

Finally I called Internode who knew exactly what was going on and generally didn’t completely suck. The downside is their South Brisbane plans run between $150-200 per month for a paltry 250 GB. At this point I just don’t care because I’ve already burnt through more than double that figure this month in mobile broadband and need to get online, but it’s an extraordinary figure and I’m having trouble justifying it.

So what’s going wrong?

It’s easy to blame Telstra for being a lumbering, incompetent monopolist but how did this happen?

In both cases my address hasn’t been in whatever database they use to look things up, and both times it’s caused holdups from “we can’t find you in the system” and “you can’t get Internet” to “we accidentally disconnected your landlord instead, lol soz”.

Surely having just finished updating the network in 2013 they would have all this information? Apparently they don’t keep this around, as even my current apartment which was only disconnected the previous month is completely missing from the system.

Meanwhile I still don’t have Internet at my new place and they seem completely unwilling to help.

— Ash Kyd (@AshKyd) May 29, 2015

Further, both times I’ve had to have technicians come out to poke around to work out what’s going on. The first time took a full four hours to suss out the building connectivity, including everything from calling the helpdesk to shining lasers down the fibre to work out which cable needed to be plugged in at the basement. These visits cost $300 a pop and it’s a total rort.

That it’s the 21st century and you can’t light up an apartment within five minutes by filling in an online form is boggling, and I just don’t understand how so much human intervention is required to get the data flowing over a damn fibre network.

The clincher I think is the all-’round lack of knowledge not just within Telstra where the teams are all siloed and don’t know what they don’t know, but also within the resellers of which only Internode seem to have trained their staff. Essentially, nobody knows what’s going on.

And the NBN?

Yeah, the NBN is pretty much dead. There’s no fibre coming, no hundred megabit, let alone gigabit networking. The policy’s there in name, but the political will certainly doesn’t seem to be.

New developments (like hopefully my new new place) will get NBN fibre, but existing premises aren’t so lucky. As I understand it the current plan is to buy back Telstra’s corroded copper network and roll out HFC and VDSL tech as far as it will go. South Brisbane on the other hand, is likely stuck with Telstra for the rest of time since it’s unlikely the government will separate them or buy up the fibre network any time soon.

Meanwhile the alternatives aren’t many. I’ve currently got a $140/month, 50 GB LTE service from Vodafone which is a reasonably attractive offer by South Brisbane standards but nowhere near girthy enough for my needs. The best Telstra and Optus can offer are 10 GB and 12 GB respectively which is laughable. Beyond that there’s no alternative but to capitulate and give Telstra your firstborn.

Three weeks later

I’m still waiting to be connected. I’ve spent nearly half a grand on Internet (and that’s before the laying anything down for a wired service) and I’m seemingly no closer to having my fibre box light up than I was when I started.

I’m kinda starting to think think I should just quit tech and become a barista.

Alchemize stronger & more often

In case you missed it on Twitter, the other day I released Alchemize as a web app, and open sourced the code on GitHub.

Alchemize is a web app which lets you easily pretty-print or minify your source code. It's been a pet project of mine for a couple of years now, and it's really useful as a web developer.

Previously Alchemize was exclusively on the Chrome Web Store, and while it's still available to install as a Chrome app I'm excited to announce it's available online for even easier access.

I've gone to a bunch of trouble to fork and patched the libraries I'm using (a lot of them don't work out of the box) and included them in the NPM manifest so you can easily get to developing. If you're interested, check out the README for instructions.

If you're a web developer and haven't checked it out yet, you should absolutely bookmark the direct link: alchemizeapp.com/app

Polar Defender & js13k

Over the last month I’ve been working on a game for the #js13k game competition.

The concept is fairly simple: make a game in under 13 kilobytes with no external dependencies. The idea is to see what people can come up with on a budget, and it’s awesome to see some of the entries this year.

My game, Polar Defender, is a basic shoot ’em up on a polar coordinate system. It’s heavily inspired by space invaders, except you have to defend various planets from all sides at once. It’s heavily reliant particles and a basic polar trajectory system to provide messy, explodey space fun.

The theme of “elements: earth, air, fire, water” is optional in the contest, but I incorporated it into my level system (an earth-like planet, water planet fire and gas planet). It’s a /little/ contrived, but I think it works well in terms of playability.

I wanted to include a playable level system with a playful narrative since there’s only so much you can do in 13 kb and I felt it would make it a more personal experience. I feel it worked out well, with six levels (including an initial training level) on various planets and varying degrees of difficulty. After early feedback stating it’s too hard to finish in one go, I adjusted the menus to make each level unlockable rather than having to start over, which really improves the gameplay in a casual sense.

Touch input is significantly more difficult than desktop input because I essentially shoehorned the same concept in where it doesn’t really fit. If I had the chance to do it again I would introduce a separate tap-based firing system on mobile.

The tech

Some of the tech I used includes:

  • jsfxr for sound effects, based on Jack Rugile’s blog post.
  • Liberal use of the native Canvas rotate() method.
  • Regular CSS & JS for the menu system.
  • Gulp, Uglify, svgo and a bunch of hand-tweaks to package and minify my codebase.
  • Super rudimentary box-based collision detection.
  • A basic entity/component model through which to extend base sprites.
  • SVG for infinitely customisable graphics. (There’s only four enemy sprites in
    the game, each recoloured and resized as needed.)
  • Procedurally generated starfield & planets.

How to ultra-compress your JS

13 kilobytes is quite a lot in terms of raw code, but also a challenge to meet when including graphics, sound, polyfills and other boilerplate.

Minification of Polar Defender was done by hand and involved a lot of code tweaks.

The ultimate deliverable needed to be compressed into 13 kilobytes of zip file, which is roughly comparable to a gzipped distribution from a web server.

Some of the things I did which aren’t necessarily best practices include:

  • Strip unnecessary properties and pre-compile SVG files into a JSON file to be bundled into the main JS build process. This improves  compression because there’s less junk and the SVG gets compressed in with the JS which presumably improves duplicate string elimination in the zip format.
  • Collapse JSON structures into CSV-like strings that can be reinflated later. JSON objects are super-wasteful in terms of repeated properties, and while compression algorithms are generally pretty good with repeated content, it’s still better to remove the duplicates where possible.
  • Globalise commonly used functions. This isn’t something I’d usually recommend but considering the constraints what the hey. Things like aliasing window to w and Math to m reduces byte-level repetition. Additionally keeping everything in a local scope lets Uglify optimise away long function names.
  • Loose comparison and other sneaky tricks. For instance using 1 for true and 0 for false saves 3 bytes per bool and works in a loose JS equality operation if you’re prepared to ignore JSHint complaining a lot.
  • Reuse everything. I reused a basic set of drawing functions and sprite classes for everything in-game, meaning each new feature was an iteration on an existing one rather than a completely new piece of functionality. See also entity component system on Wikipedia.

Further reading

In addition to my jS13k entry, I’ve got a side-build available in the
Chrome Web Store which you can install and carry around with you. The main benefit is that your scores are stored in the cloud and unlocked content goes wherever you do.

Overall I think it worked quite well and I’m happy with the result. There’s some awesome games submitted so far and I can’t wait to see how everyone goes.

The source code to Polar Defender can be found on GitHub.

Getting moving with HTML5 Canvas

Initialise a canvas

<canvas id="c" width="640" height="480"></canvas>
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');

Note:

  • Width and height determine the canvas size.
  • CSS width and height will stretch the canvas.
  • 2d refers to the rendering context (API). Other options include webgl.

Basic drawing with Canvas

There are several ways of drawing on the 2d drawing context.

  • Rects (rectangles)
  • Paths
  • Text
  • Images

Drawing Rectangles

Rectangles can fill, stroke, or clear an area.

var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');

// Black rectangle ctx.fillRect(0,0,200,200);

// Black outline ctx.strokeRect(200,0,200,200);

// White rectangle (cleared area) ctx.clearRect(50,50,100,100);

See the Pen Canvas Rectangles by Ashley Kyd (@AshKyd) on CodePen.

Drawing Paths

A bit like Logo without the turtle graphic.

var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');


// Draw a triangle ctx.beginPath(); ctx.moveTo(0,100); ctx.lineTo(50,0); ctx.lineTo(100,100); ctx.closePath(); ctx.stroke();

// Draw a circle ctx.beginPath(); ctx.arc(200,50,50,0,Math.PI*2); ctx.fill();

See the Pen Canvas Paths by Ashley Kyd (@AshKyd) on CodePen.

Path Methods

You can use these methods to draw and fill lines onscreen.

Drawing Text

  • The most basic use is ctx.fillText(text, x, y, [maxWidth])
  • Use textAlign=center and textBaseline=middle to center on the specified point.
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');

// Default text ctx.strokeRect(0,0,100,100); ctx.fillText('#brisjs',50,50);

// Centered Text ctx.strokeRect(100,0,100,100);

ctx.font = '12px Arial'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle' ctx.fillText('#brisjs',150,50);

See the Pen Canvas Text by Ashley Kyd (@AshKyd) on CodePen.

Drawing Images

Use drawImage(img, x, y) to splat any image or canvas element down into your current context.

var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');

// load an image and draw it in! var img = document.createElement('img'); img.onload = function(){ // Draw the image ctx.drawImage(img,0,0);

// and some text
ctx.font = &#39;bold 40px Impact&#39;;
ctx.textAlign = &#39;center&#39;;
ctx.strokeStyle = &#39;#fff&#39;;
ctx.lineWidth = 2;
ctx.fillText(&#39;MEMES AT #brisjs&#39;,200,40);
ctx.strokeText(&#39;MEMES AT #brisjs&#39;,200,40);

}
img.src = 'http://lorempixel.com/400/400/animals/&#39;;

See the Pen Canvas Images by Ashley Kyd (@AshKyd) on CodePen.

Using Transforms

Transforms adjust the coordinate system your drawing tools use.

var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');

// Example translate ctx.strokeStyle = 'darkgreen'; ctx.strokeRect(0,0,100,100);

ctx.strokeStyle = 'limegreen'; ctx.translate(100,100); ctx.strokeRect(0,0,100,100);

ctx.strokeStyle = 'black'; ctx.rotate(Math.PI/4); ctx.strokeRect(0,0,100,100);

// Make some isometric tiles with setTransform // ash.ms/blog/2012-07-08/isometric-tile-transforms ctx.strokeStyle = 'purple'; ctx.setTransform(1,-.5,1,.5,0,0); ctx.strokeRect(0,200,100,100); ctx.strokeRect(100,200,100,100); ctx.strokeRect(0,300,100,100); ctx.strokeRect(100,300,100,100);

See the Pen Canvas Transforms by Ashley Kyd (@AshKyd) on CodePen.

  • Transforms are useful for when you have a self-contained item and want it to be able to move.
  • For more information, I've previously written on transforms for isometric games.

Animation

setInterval is so 1995. Use the requestAnimationFrame method to call back before the next screen repaint.

var gameLoop = function(){
    // Do stuff
    requestAnimationFrame(gameLoop);
}
requestAnimationFrame(gameLoop);
  • requestAnimationFrame won't fire if the browser isn't painting, for instance in another tab or minimised.
  • Unit movement should be calculable as a vector, otherwise everything will stop or slow down with the render process.

Let's get moving

This demo shows the basics of animation. The sine wave is calculable based on the current time.

var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');

function sineWave(){ var yPos = Math.sin(Date.now() / 500 ) 100; ctx.fillRect(0, yPos, 10, 10); }

var gameLoop = function(){ ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.save(); ctx.translate(150, 150);

// Let&#39;s draw some sine waves
for(var i=0; i&lt;10; i++){
    ctx.save();

    // pi</em>2 radians == 360°
    ctx.rotate((i/10)<em>Math.<span class="caps">PI</span></em>2);
    sineWave();
    ctx.restore();
}

ctx.restore();
requestAnimationFrame(gameLoop);

}
requestAnimationFrame(gameLoop);

See the Pen Canvas Animation by Ashley Kyd (@AshKyd) on CodePen.

Particles

Particles are one of the most useful things you can have in a 2D game.

See the Pen Canvas Particle Generator by Ashley Kyd (@AshKyd) on CodePen.

  • Particles can be anything you want, but gradients are slow to draw so you'll need to cache them.
  • You can plug in one of many physics engines from NPM, but it's easier to accelerate out from a center point.

Polar Defender (my entry into the 2014 #js13k)

js13k is a month-long game competition to make a game in under 13 kb.

  • Polar coordinates & .rotate() make it east to do a radial game.
  • SVG sprites: scalable, re-colourable assets.
  • "Everything's a particle" approach simplifies collision detection.
  • jsfxr for 8-bit sounds.
  • Using a bunch of Unicode emoji as game assets (gotta save space).
  • Code on GitHub

Play Polar Defender.

Where to go from here

There's a bunch of stuff already out there to make your life easier. Here's some of my favourites:

  • Pick a game engine (or do it by hand)
  • NPM is a treasure trove of amazing things
  • freenode/#bbg – browser based games
  • Learn about Juice in a talk by Martin Jonasson and Petri Purho