90 Days Later

After several weeks doing paper-work, accounting, making a corporate logo and a web site, I eventually got to the fun stuff … writing the game !  Most of my recent experience has been with writing server and low level code (ie. not UI), and so I figured I’d start with the tasks I knew very little about … rendering.

I started with Direct 3D tutorials on the internet (there are thankfully many of these).  After a couple of days of typing, I was able to render a triangle with a simple texture.

I then, of course, tried to draw a lot of triangles.  My first lesson (among many) was that the order of the vertices (corners of the triangle) is important, and if you provide them in the wrong direction, the texture is drawn on the side facing away from the camera.  I also struggled with linear transforms at first and spent at least a day staring at a black screen because my triangles were not in the frustum.

Luckily the internet exists these days, and questions like “dude, where are my triangles” are quickly and easily answered.  I can’t imagine how much harder this would have been in the ’90s.  One fantastically enjoyable thing about working on rendering is that most of the changes you make have a nice quick satisfying visual reward that you can show off !

After a short foray into rendering, I spent some time contemplating whether I should use an existing off-the-shelf graphics engine, and which it should be.  Literally everyone I know advised me to use Unity.  Most of those people had not used Unity personally, but knew someone else who had success using Unity.  I eventually decided not to use a traditional engine, which by popular opinion makes me insane.  I may grow to regret this, but here are some of my thoughts on the trade-offs:

  1. Drawing Triangles.  In the early ’90s, fancy 3d graphics chips didn’t exist, and programmers literally had to draw their own triangles.  It was really tough to do all that math efficiently.  Really smart people wrote really efficient engines to get that done.  Today, literally every modern computer (and phone) has a built-in 3d graphics chip.  Most of the work of drawing the triangles is no longer done in the “engine”, it’s done in API layers and on the 3d graphics chips.  Another way to look at it is that the OS layers have taken over the toughest part of the work that traditional engines did.
  2. Layers.  With a traditional engine, there are extra layers.  Extra layers often reduce performance, and limit flexibility.  I’m hoping that writing directly to DirectX / OpenGL will give me greater performance and flexibility.
  3. Shaders.  Many engine packages offer a variety of shaders.  There is a strong likelihood being able to use those shaders would save me a lot of time.  On the other hand, some of the shaders I need to write are not going to exist already.
  4. Portability.  This is probably the best part of using an existing package.  By writing my own, I’ll have to make my own abstractions for DirectX / OpenGL / Metal, Windows / MacOS / iOS / Android, etc.  One good thing about writing directly to the OS API layer is that performance trade-offs will be painfully obvious; they would be less obvious and more difficult to fix if they were hidden below layers that were difficult to modify.
  5. Core competency.  Joel on Software had an interesting perspective on the topic of when to reuse.  He argues that if a component is core to what you’re building, it may be better to not reuse.  With the game-play I’m trying to achieve, having greater control and performance are going to be important.

This is obviously something I can revisit, but so far I haven’t hit any horrible snags that have made me wish I’d made a different choice.

I’ve spent quite a bit of time drawing things !  I don’t know why I didn’t expect that — it seems obvious in hind-sight.  I have no art training (or talent), and so my plan is to make art that is good enough for decent game-play feedback, and eventually when I’m close to Alpha, I’ll get an intern or an art studio to re-do all my art to make it look amazing.  I watched a series of great video tutorials on Blender, which is the 3D modelling program I’ve been using.  The learning curve is enormous.  I’ve drawn several models now, the first one took me a long time, and I’m slowly getting faster.  I often will draw a model, then do some programming that uses that model, then draw another model.  This week has been mostly an art week.  I keep forgetting all the magic check-boxes and keyboard shortcuts for things.  Again, thank goodness for internet help sites !  I will probably be actually good at modelling by the end of the year — but still with very little talent.

Overall, my game is coming along slowly but surely (many years to go — I have very ambitious plans!).  Fortunately, entertainment is special, it’s more important that the game is amazing and less important how long it takes.