Friday, February 22, 2013

Clayworks: a background.

An alternative history of 3D modelling programs

(some of the software you probably haven't heard of).

This blog is largely going to be about the continued development of Clayworks, a 3D modelling program I've been developing in various guises as a personal project for most of my professional career. First off, a brief history:

I started writing Clayworks to fill a simple need: I needed to create 3D models but didn't have access to any software that did what I wanted.
  Back in the early 90s, I was a student studying programming at the local college. My friends and I had started writing simple 3D engines. This was the most positive educational experience I've ever had - we were largely left to our own devices but were spurred on by continual, intense but friendly competition. Every day, we'd have some new trick to show; it was great fun. Most of our 3D data was hand entered vertex and polygon data or else procedurally generated. I wanted something that looked a bit better and as my first love is art, I wanted a tool to help me create it. I couldn't afford 3D studio (not Max, that came later) so I did the only sensible thing and wrote my own. My plan, all those years ago, was to use the editor to put together the graphics for this great space game I'd be thinking about.

1992, First version in DOS

This was some time ago and you didn't get a lot for free back then. I had to program my own rasterizer (the code the draws triangles, lines and images), a task that took quite a while in itself. I was lucky enough to find a copy of Richard Ferraro's 'Programmers Guide to the EGA and VGA cards' which sounds pretty dry but, for me, it was life changing. I learned to code in assembly for one thing, a kind programming zen that had quasi-mythological status amongst my geeky teenage peer group. Before home internet, books like this were gold dust. Staples do not sell this sort of tome these days. 

AC3D © Inivis
Aside from writing the basic code to make images appear, I also needed a user interface.
  Windows was at version 3 at this point and wasn't really up to the performance required for a 3D modelling program - DirectX was a while away yet (does anybody remember winG?)

  So I wrote a system I called TWIN, standing for Tim's WINdows. Hell, if Linus could get away with nominative ego-insertion, so could I. To rather less spectacular success but still, there it is.
  With that foundation, I wrote the first version of Clayworks.  I left for University that year and continued writing Clayworks whilst there. In retrospect, I should perhaps have paid a bit more attention to what I was supposed to be studying but having access to the nascent world wide web was exhilarating; you could see how this was going to change the world.
  I also spent more time in the research lab than in the undergraduate labs; they had SGI machines - hardware acceleration cost you tens of thousands back then and even with my total immersion in the world of 3D graphics, I wouldn't have predicted the rise of affordable graphics cards at the time. If I had, I might have spent less time writing my software rasterizer, which was where I was concentrating most of my programming effort.
  It was at this time that I met Andy Colebourne of (more nominative ego-insertion!) AC3D fame.  Andy wanted me to re-write Clayworks in C++ and OpenGL (back then it was Pascal/ASM and software rendering) so that it'd run on SGI machines. Not having access to such a machine on a daily basis, I wasn't able to do that, so Andy wrote AC3D. Andy's program was much better poised for future hardware than mine and he's converted AC3D to dozens of platforms.

  During this time, I put the DOS version of Clayworks up for download on the Hensa archive and it was the most downloaded program on there for several months, racking up hundreds of thousands of downloads.

  Now, at this point, what I should perhaps have done was get a loan, start a company and make a proper go of things. However, I was young and knew a bit about how to code, draw pictures and make models but knew nothing of business. So, instead I landed my first programming job with a small team working on V.R. and 3D modelling software, Themekit.

 At this point, I had to stop working on Clayworks. In a theme that's been repeated again and again through my career: there was too much conflict of interest.
  Martin Robinson, my boss at Themekit, had written a great set of tools for 3D modelling. I have very fond memories of working on and with this software. It was quirky, did things unapologetically its own way but it became one of those programs for which I fully developed muscle memory - like DPaint, I didn't have to think about using it, the short cut keys were fully mapped out in a special area of my brain.

MindFormer © Themekit
 Again, a product of the time, these tools were software rendered and written in DOS. It was around this time (1997-8) that hardware acceleration really started to take off and one of my tasks was to rewrite the engine for OpenGL. I worked at Themekit for around 2 years and learned a great deal. 

  Leaving that company was one of the hardest decisions I've ever made. 
  It wasn't over a better offer at a rival company but rather the chance to work in Japan, where my girlfriend of the time (whom I'd met at University) lived.

    The new job was categorically not what I wanted to do in life - it actually involved making webpages at a travel agency but the chance to live and work in Japan was too good an opportunity to ignore. Besides, even with that newfangled Instant Messenging thing, long distance relationships suck. 

 The story of how I got that job is largely down to Clayworks and not a small amount of luck. So much so that it looked for all the world like fate taking a back handed slap at my face and demanding that I pay attention.  My girlfriend had just finished her masters degree and was, like just about every other Japanese graduate, traipsing around Tokyo looking for a job. It was around this time that I was in Japan for a visit. Tokyo looked at my hard saved British money, made a polite little nervous laugh and asked where the rest was.  

  Around half way through my stay, she had a job interview. With little else to do, I stated in the foyer where they had a little 'cyber-cafe' thing going on, all beige boxes, bulky CRTs and noisy modems. After checking my email, I downloaded a copy of Clayworks and started passing the time making models of this and that. At that point, a manager appeared behind me and I thought I was about to be removed for doing non email related tasks.

  Instead, he asked me what the software was. When I mentioned that it was a little personal project that I'd written myself, he became rather excited and, in charmingly broken English that was none the less better than my Japanese would ever become, offered me a job on the spot. My girlfriend arrived in the cafe with a big smile on her face and announced that she'd got the job. I surprised her a great deal by mentioning that I had, too.

Clayworks 2. A rewrite, still in DOS but prettier now.
Six months later, I was working in Japan. At first, I didn't have a place to live and wasn't entirely sure how to go about getting one. Worse, I didn't have a computer. Being a man of sometimes outwardly dubious priority management, I rushed off to Akihabara to buy a bunch of computer bits with the money that should have gone towards the key money (key money? I know, I had no idea what it was either) on an apartment. Again, in retrospect, I should have bought that dinky little 486 palm top that was around 10 years ahead of its time but instead got a familiar big ugly beige box, got the parts back to my hotel room, built the machine and coded up a few graphics demos. I was suffering programming withdrawal symptoms. My girlfriend was not exactly amused at this purchase but one of her wonderfully diplomatic friends pointed out that I wasn't in Kansas any more and probably needed something to anchor myself in reality. I've always found that virtual reality does the trick.

  The job at the travel agency had its ups and downs but I did manage to do a lot of rather nice pixel art and learned to code Java. However, as I said, this wasn't the job I wanted to do.  Fortunately, through a friend of a friend, I heard about a vacancy at a company called A.I. Cube over in Shintomicho. The interview was strange in that, 6000 miles away from home, I'd already met everybody in the room. It turns out that A.I. Cube had risen from the ashes of the Japanese software development arm of the now sadly defunct British V.R. headset manufacturer, Virtuality. I'd met them all on a business trip a few years previously. They said that they thought it was me on the interview form and subsequently offered me a job.
  Now, this part of living in Japan was great. I loved my job, I was working on the new Playstation 2 a year before it came out as well as working on the GSCube (a prototype PS3, noisy bugger, looked like Borg cube. It warmed my feet under my desk during winter). My Japanese was improving and life was generally rather good.  At A.I.Cube we developed 'middleware' engine software that other companies used to build their games. We worked with, amongst others, Koei, developing the engine that was used in Gitaroo man (a great little game)

Gitaroo Man! © Koei

 Of course, that didn't last. The Japanese immigration people didn't like the fact that I'd changed jobs - and that, although lacking a higher degree, I was doing a well paid software engineering job whilst being reprehensibly foreign. After numerous appeals and several months of anguish of the sort that only the officious can inflict, I was back in the UK.

  At this point, I dived back in to academia as a way of attaining that qualification and getting back to Japan. I wrote a thesis on generative modelling and got the degree but, unfortunately for me at the time, the relationship that was my reason for returning didn't last another bout of long distance. I settled down to live in the UK again, working for a couple of years as a researcher at the University of Wales in Swansea where I met the lovely lady who is now my wife.
  I rewrote Clayworks for the third time and this forms the code base that I now work from.
When the research project came to an end, I attempted to start a company to develop Clayworks further. Unfortunately, I failed to get any local traction on that and, with a young child to care for, I took the conventional route again and got a job.

  This took me to the Creative Assembly, a games company in Sussex famous for the Total War series of games. I met a lot of good people at C.A., worked on the graphics engine for the series, worked on four separate titles, did a spot of voice over work (I'm the Welsh soldiers in Napoleon, mind you)  and developed TED, the total war editor. TED's UI takes its skin and design all the way back to the very early versions of Clayworks, although the program itself is not a modeller - rather, it's a scene builder 

TED © The Creative Assembly. The Total War Editor.
specifically designed for creating total war levels.
TED was released last year, a little after I left C.A.  It's the first time anybody has made you tube videos showing how to use something that I've had a large hand in writing. Thanks, RobinHood2109, you made my day.

After five years at C.A., I felt it was time for a new challenge. I trained up my replacement and headed back to Wales to start my own company, Totga Games

Chinese New Year app © Totga Games
  After releasing a few android titles, (which were more tech demos than anything else, as I developed my android engine), I had another chance encounter, via a convoluted series of events involving my wife's rock band cousin suffering a heart attack. From his hospital bed and hearing what I was attempting to set up in Swansea, he got me in touch with his good friend Darren, who for the last four years has been running Swansea's sole dedicated games development company (that I know of).  I've been working with that company, Chaos Trend, for almost a year now and I'm now on board as a director. The bulk of my work has been adding a full 3D engine to their already well developed code base and working on a new game, working title of 'Solar Escape'.  Finally, I'm actually working on that space game! And, as always, developing the tools to help do it.

  I've been developing 3D software for around 20 years now.  It's taken me all over the world but during all that time but, due to various obligations, I've only released one real version of Clayworks - the old 16 colour DOS app that I started it all in 1992.

  Now that I'm again captain of my destiny to some degree, I hope to finally release an up to date version of the project that's been a continuous thread throughout my rather circuitous career in 3D graphics and games development .
  In this blog, I'll be keeping a more regular diary of that development and of the space game I'm finally working on.

Clayworks in 2013. It's getting there.