Why I FAILED at live-coding!! 🤔💻❌
Tags: discuss, webdev, javascript
Published: 2019-09-07 12:22:38

# Live-coding
Live-coding is still in its infancy but definitely gaining popularity with more and more talented streamers cropping up daily. It'll likely never be as popular as video game streaming but that's just because there isn't quite the demand. That isn't to say it's not a viable channel, there are many full-time programming streamers out there who are pulling in big numbers! 

# My story
It was July 2018, after months and months of watching live-coders almost daily I decided to do it. Decided to grow a pair and try it myself, why not? 

My first stream I had no real plan, I didn't even bother telling friends or family about it I just jumped in and awaited the flurry of £1000 donations🤣.

I was working on a Java backend at the time for a friend so I thought why not just stream this whilst I code, 2 birds with one stone and all that. I wasn't pulling in many viewers but was having a laugh with the few who turned up to say hello.

## Making sh*t move
One stream I decided to do something a little different. I'd heard of this open-source graphical library called [Processing](https://processing.org/) and thought I'd give it a stab on stream with absolutely zero knowledge of it. I did, however, know Java so I picked it up reasonably quickly and ended the stream with a randomised game that integrated everyone watching the stream into the game.  

{% vimeo 358477594 %}

The game was super, super simple but it attracted a reasonable number of views relative to my other streams. I had just discovered, **people like to see sh*t move on the screen**. There are only a certain amount of passing tests a viewer can watch and still be interested.

The following stream I worked on the same game just adding little features to it, such as power-ups, dynamically adding/removing people from the game as they left the stream, etc. It pulled in a few viewers but not as many as last time.

There was a really important lesson to learn here, but I missed it. A lesson I'd only figure out months after stopping.

## Picking up P5.js
I wanted to create a game that I could play with the viewers. I'd now done a little dev with Processing so the logical switch was to p5 which is essentially Processing but in the browser (JavaScript rather than Java).

The game I decided to make was an Asteroids replica but a multiplayer version:
![Gif of asteroids game](https://github.com/LukeGarrigan/spaceheir/raw/master/stream-royale.gif)

I was completely inexperienced with any game dev so in the stream I was learning on the job. Multiplayer game dev introduced me to Node and Socket.io which I also had to figure out as I went. The first two streams working on this game were my favourite and also probably my most successful. I had a AWS Lightsail server set up and every time I committed some new code I'd redeploy, allowing everyone to play and test with me. 

Because I was so inexperienced, unsure which parts of the game the client or server should handle it wasn't long before people were hacking the game and teleporting across the screen, shooting 1000 bullets at once. This is the best thing about live-coding, people that are watching are very likely programmers themselves so they will no doubt pick you up on anything stupid you do (Even when you wish they wouldn't 🤣).

People apparently enjoyed doing this and I eventually changed the title of the stream to "Come hack my multiplayer game".

But eventually, my code got better, I became to understand what the server should be doing and what the client should be doing, so the number of possible hacks dropped dramatically and with that, so did my number of views.


## Clinging on to the game
I was having so much fun developing the game I just kept on adding features to it, it ended up making a bit of a transition from the asteroids game to my own game called Spaceheir!

I don't have a live version of the game running at the moment, but here's my latest gif of it. (It looks a lot different now, with a leveling system and powerups, but you get the idea)

![Spaceheir](https://github.com/LukeGarrigan/spaceheir/raw/master/stream-royale2.gif)

Every stream ended up being pretty similar to the previous, gathering ideas and implementing them into the game, or sometimes fixing bugs people had found playing it. I think, looking back, this became monotonous for viewers and was one of the reasons for the dip in viewership. I was just stuck in the loop and didn't know how to transition.

Looking at big live-coding streamers such as Daniel Shiffman, he is always doing something different, never working on one mammoth program. Daniel's streams are littered with a number of short coding challenges allowing people to watch the creation of something from beginning to end, I think this is so important and is one of the reasons I love his stream (Aswell as his unrivaled teaching ability and character). 

I love to watch streamers tackle problems and compare it with my mental model of the route I'd take to tackle it, if they're working on a large program as I did, it's very rare that I could find a relatable point where an implementation requires no prior knowledge of the existing system. Meaning, if they were to start from scratch I could immediately make a comparison as I don't need to worry about some existing code they've written. Daniel Shiffman has this down perfectly.

## Inconsistency

Another major problem I had was with my consistency, I'd specify the days I would stream, Wednesdays, Fridays, and Sundays. I only managed to stick to my schedule maybe twice at a push. Google any top tips to be a good streamer and all of them will have **"BE CONSISTENT"** somewhere. I just wasn't, I have a long commute to work and some nights I'd get back and I just, uhm, *couldn't be arsed*.

## Organisation

Because I was just working on the same thing pretty much every stream I didn't bother doing any planning, I'd boot it up say hello to anyone watching and then figure out what I'd do for the stream. I know *now* that this is the wrong way to go about things, I should have planned out what I wanted to do on that particular stream, even if the plans did involve the same game at least I'd have a clear vision of what I wanted to get done.

## Conclusion

I had a tonne of fun in the 6 months-ish I did live coding, I met loads of brilliant people and had a laugh on the way. Eventually, though, it became a bit of a chore and I think that showed in the quality of the stream itself. 

I do think I'll get back to it at some point and potentially apply the lessons I've learned. Unfortunately, so much of what I've learned about live-coding was done in retrospect rather than on the job, maybe I'd be bigger than Ninja if I learned whilst doing😂.

## Tell me your stories!
I'd love to hear your experience with live-coding, whether it be you're looking to get into live-coding, or you've been doing it for years, or you're a bit of a newbie at it, I want to hear all your stories and lessons you've learned on the way.

Also if anyone is interested, my twitch is [twitch.tv/codeheir](https://www.twitch.tv/codeheir)!

Follow me on twitter if you don't want to miss out on absolutely brilliant programming insight: 🤣 @luke_garrigan

Thank you, if you like my rambling check out my personal blogging site at https://codeheir.com/


## This blog is sponsored by <a href="https://www.codecanvases.com">Code Canvases</a>

Make your room come alive  with the coolest programming/coding canvases on the market.<a href="https://www.w3schools.com"> codecanvases.com</a> is the number 1 seller for programming prints with 100% exclusively designed canvases. Get them now whilst they're **20% off!!**
![[https://codecanvases.com/](https://codecanvases.com/)](https://cdn.shopify.com/s/files/1/0311/0151/7955/products/jqbr8djyof6ktl8qopmkpvy4_480x480.png?v=1585483987)