People often tell me that they have no idea how I can do standup. The idea of trying to make a large group of strangers laugh is, for many, absolutely petrifying – and it is – but there are ways of gradually developing the material that can ease the fear. For me, it has never been a case of sitting down in front of a computer. I tend to develop my rambling anecdotes by actually getting up and performing them. That's the joy/horror of stand up – if you have the germ of an idea that you think might be funny, there is a way of finding out if it's funny very quickly. In standup, the feedback is instantaneous, and if it fails you know you'll be off-stage and hiding in a short time.

I assumed writing for television would be pretty straightforward. I was wrong. Having total freedom, it turns out, is horrendous. One has to make the most basic decisions before a single word is written. Some decisions are easier than others. I knew I wanted it to be, in essence, a traditional sitcom. I grew up watching people tell stories using this format. Carla Lane's Butterflies seemed to be on in our house at all times when I was a kid, as did The Good Life. But it was Fawlty Towers that made me really sit up for the first time. Basil's incandescent rage made me howl. Then suddenly, some people went a step further - when The Young Ones arrived, my friends and I thought something had been truly written for us. My mum hated it, which was delightful, and the slapstick elements and sight gags in Man Down owe a great deal to it. It took me years to realise that the dysfunctional family set-up is as present in The Young Ones as it is in the sitcoms that delighted my parents. Most mirror what is going on in every house, every family – chaos and hidden affection. Much been written about the arrival of The Office and the death of the traditional sitcom, but it is not a massive leap to see that show as another example of a messed-up family stuck in a house together.

There were, therefore, some decisions that were easy to make. My middle-aged lead character Dan had to be trapped with his parents and in a job he hated. He is, like so many sitcom characters, fairly unsympathetic on the surface. He is a selfish idiot, but I hope that people will find themselves rooting for him ultimately. He tries to make things better but doesn't have the skills to do it. I was loathe to make him a teacher because of the inevitable lazy comparisons with The Inbetweeners, in which I played a headmaster, but I spent 13 years as a teacher, so making him anything else felt wrong.

What I learned fairly quickly is that trying to create a reasonably credible world and the characters that inhabit it on your own is a recipe for madness. Every decision you make has knock-on effects and trying to tell a simple story is in fact like putting together a jigsaw designed by Satan. This resulted in, to list but a few incidents, me pouring a kettle of water on the floor of my flat deliberately, destroying a perfectly good chest of drawers and one early morning calling an urban fox "a prick".

But creating Man Down did eventually become a joy. If you have cast the right people for the roles – Rik Mayall was my ideal dad from the start – and if those actors are nice, actually filming a sitcom is wonderful. It was a blast from start to finish. How I kept a straight face during scenes in which Rik Mayall, one of my comedy heroes, was humping a wall, attacking me in a bear suit, cocking an eyebrow as he sat defecating on my toilet is a mystery to me. (Some shameful indications of my love of the puerile there). It also made me question why it is I feel the need to publicly humiliate myself. When a handler was setting a genuine attack dog on me, she informed me that just last week it had horribly bitten an intruder. You have to take a moment to wonder what you are punishing yourself for.

My family and ex-collegues in the teaching profession will be delighted when I put on the record that very few of the incidents that happen in Man Down actually happened in real life, but there is a more general truth to it. I wrote about a time when I was totally lost at sea, and I just took the humiliation of my character, Dan, to a more extreme place. My mum said, "Anyone watching this will think you grew up in a mad house." I did. We all did.

Man Down begins on Friday at 9.30pm on Channel 4