7 things I've learnt in 3 years coding my first indie game
Sol Trader is at the end of Alpha and is now on Kickstarter to raise funds for completion. Here are the seven biggest lessons I’ve learnt in the three years of coding my first indie title.
1. Pick the right platform
When I started back in late 2011, I thought I’d try and make the game in Ruby. Unfortunately, despite it being my language of choice for development up until then, I discovered that’s one of the worst platforms to build a game in.
My main reason wasn’t lack of support for games libraries, or the lack of a community: it’s that the garbage collector in Ruby can sometimes take an entire frame’s worth of time to run. This leads to horribly stuttery framerates. I feel like garbage collection in general doesn’t belong in games at all.
In Jan 2012, I decided to take control. I moved back to working in C/C++, which is where I started my career in 2000. I wrote a post about it that caused rather a stir. I have never regretted the decision.
2. Pick the right architecture
As a former AAA games developer, I thought I knew how to write and structure C++ games. I ploughed in with a big entity inheritance hierarchy and lots of classes. In doing so, I immediately and unknowingly gave up control of my memory layout and the frequency I accessed it. Memory is much slower than you might realised, so this made inner loops much harder to optimise and causes ‘general slowness’ in the engine which is hard to get rid of.
Unfortunately my ideas for how to do game development were a decade out of date - I should have paid clearer attention to current trends and things like data-oriented design. I should have either stuck to using someone else’s engine such as Unity, where a lot of the optimisations and porting comes for free, or thought and read a lot more carefully about architecture up front.
Having a well organised memory layout also leads to another advantage: serialisation comes pretty much for free. All you do is save a chunk of memory to disk, rather than writing thousands of lines of code walking through your entire object hierarchy and saving them all carefully, which is what I’m doing now.
If I was to do it again, I think I’d still write my own engine but stick to C almost entirely, coding in a very functional way where possible, without much C++ at all. In short, I’d take the approach exemplified by Casey from Handmade Hero. If you haven’t seen his video series, I’d strongly recommend you check it out - he’s writing an entire professional quality game from scratch in C without libraries and with full explanations. Very impressive and highly worth a watch.
3. Don’t go overboard on libraries
When you write your own game in C/C++, you want to be in control. I ended up using lots of libraries (around 15 or so) to get all the various things like GUI, physics, sound, network access, TrueType fonts, serialisation, ZIP compression and PNG support… oh, and Boost for signals, pathfinding… The list goes on.
Libraries do often save you time, but every library you use is something else that you have to learn how to use, compile on all your platforms and deal with all the platform specific bugs that come up. There’s quite a lot of overhead in keeping them all working.
Libraries also slow down your compilation, especially highly clever templating/C++ style libraries such as Boost. I think Boost is a monumental achievement, but I won’t be using it on my next game project. I’ve learnt that compilation speed is everything.
There are some libraries you want to use. I’m pleased I went with SDL and OpenGL, although in hindsight I’d have done the architecture differently to make porting easier. I’d use well supported libraries like FreeType and Curl again, but I’d avoid libraries that aren’t kept up to date or don’t have a strong userbase.
In short, I should have written a lot more of the code myself. The amount of time I’ve had to work around annoying bugs in libraries, or the weird way they choose to use memory, I’d have been better writing the small amount of functionality I needed myself.
4. Port late, not early
I used Mac as my primary development environment for most of Sol Trader’s development, but I ported Sol Trader to Windows really early - around 2.5 years ago. Most people who bought Alpha access downloaded and played the game on Windows, but the Windows version was always inferior to the Mac version and still requires a lot of work to get all the libraries compiled and the platform-specific bugs out.
Porting to multiple platforms is like Internationalisation. You plan for it, but do it as late as possible. As soon as you introduce another platform, the maintenance requirements for your app jump - depending on how you’ve architected it, they can jump by a huge amount.
In hindsight, I should have coded the game exclusively on one platform first, architecting it in such a way as to keep all the platform specific code together as much as possible, and aggressively reducing my dependence on lots of little libraries. Again, engines like Unity make a lot of this legwork go away - either use one, or aggressively code to make this part of your project as painless as possible.
5. Use a simple build system, with live code editing
My build system is impressive. I’m pleased with myself for still being able to understand it. This is a bad sign. It is also hilariously complex (hilarious for you, not for me.) There are a huge number of asset generation steps and scripts to mangle names and handle dependencies. It’s tricky to worth with, to say the least.
If approaching it again, I’d become a lot more careful with build steps and cut out any need for dependency management. It’s not that hard to build a unity build system using a simple script file that can compile the game code and relink it using DyLibs or DLLs, whilst the rest of your code is running. This does away for the need for a scripting library for fast code editing: if building and reloading your C code takes less than a second, and the only person needing to write script code is you, why bother?
6. Make it fun to play, not fun to code!
It sounds obvious, but when you’re coding on your own the design decisions you make can be unduly influenced by how fun your game is to make, rather than to play. It doesn’t matter if your game doesn’t have the latest features or that they aren’t completely real-world accurate. What matter is that it’s fun to play and experience.
I learnt this the hard way on Sol Trader. I coded a lot of systems that were ‘accurate simulations’, but simply not fun. I was effectively simulating the environment, but not honing great player experiences.
The big example in Sol Trader was the market code. I spend a good long time at the beginning of the project making a fully simulated market, with buy and sell orders, and realistically fluctuating prices. When I released it, all pleased with myself, I got lots of complaints from early players about how difficult it was to trade at planets. I kept tweaking it, but the results were the same.
In the end, I realised that this was because I was writing something that was fun to code, not fun to play. The code looked impressive but it was a chore to interact with. In the end I ripped it out, replacing 5,000 lines of carefully crafted boring experience with a couple of evenings worth of code that plays fluidly and isn’t a frustrating chore.
A game is meant to be played, not admired. There’s a big difference.
7. Keep going
I took six months off Sol Trader in 2013, telling almost no-one. I took the time to build a web prototype to test some ideas, but really it was because I was burnt out working on it after 18 months. Games are hard, and finishing them feels almost impossible.
I picked it up again in November after some encouragement from friends, and am so glad that I did and got it this far. The code looks awful to me now, especially the early code, but if you don’t look at your old code with disdain you’ve stopped learning and growing as a developer. I’m resisting the urge to rewrite everything and focusing on doing what I need to do to get it out the door and into your hands!
Summary
There’s a common theme here:
Write the game so others will enjoy playing it, not so you’ll enjoy making it. This is harder, but ultimately the satisfaction payoff is much, much bigger.
Share
More articles
The Job Is Not To Build
Startup CTOs or founding developers are the first technical people in the business. It is natural to think your job is to write code and build software. This is backwards.
Your first job is not to build software. Your role is to use your technical expertise to help the startup figure out fast if you have a valid solution to a compelling problem, and then a valid product for a big enough market.
You might do this through building software, but you might not need to.
Here is a story of how I did this wrong, and how you can do it right.
Read moreEaldorlight: A Kickstarter retrospective
It’s now been over three months since the end of the Ealdorlight Kickstarter campaign. I’ve deliberately been taking some time to think and learn from the fact that it didn’t reach the target, and to work out what to do next. Frankly, I was pretty upset that the campaign didn’t make it, and it’s taken a while to get over it.
It’s also taken a while to think through the campaign properly. Some things are obvious in hindsight, and others less so. A lot of post-Kickstarter analysis feels like a stab in the dark. Nevertheless I’ve given it a lot of thought, and these are my best guesses for why I think Ealdorlight’s Kickstarter failed:
Read moreEaldorlight's Kickstarter is live at 4pm today
The sixth of June is a significant day for me personally. In 2004, I spent the entire of the day in hospital. I remember the 60th anniversary commemorations of D-day on the TV in the background, as I sat beside my wife, in labour with our first child. I became a father an hour after midnight on the 7th June; my son becomes a teenager tomorrow.
Twelve years later, in 2016, I spent the entire of 6th June glued to Steam watching and waiting whilst my first game Sol Trader was released to the world. This was a career dream come true: since I started programming at six years old I’d always wanted to create and ship my own games. Sol Trader’s release was ultimately a painfully formative experience for me, which I wrote about at the time and was interviewed about recently in GamesIndustry.biz.
Over the last year, I’ve been keeping busy doing two things. One is to support Sol Trader as much as I can with countless updates and patches. I’ve also been very busy working on a new game, Ealdorlight, a medieval RPG-style take on Sol Trader’s mechanics, with turn-based combat, realistic damage and great graphics. I announced Ealdorlight in March and demonstrated it at Rezzed, strengthening my hope that the idea was a good one.
I decided fairly early on that I wanted to take Ealdorlight to Kickstarter. Sol Trader’s successful Kickstarter was a brilliant experience. The Kickstarter community is one of the kindest, most positive on the Internet. I also needed funding for this game: Sol Trader was self-funded through many long evenings and contracting work, and for Ealdorlight I need a bigger team to realise the vision. It’s built in Unreal Engine 4, which simultaneously saves me loads of development time and means I need a bigger team to pull off the realistic art style I’ve gone for.
As time came near to launch, the first anniversary of Sol Trader’s released seemed an appropriate day to launch the campaign. So today, 6th June 2017, I will spend the entire day glued to Kickstarter as my campaign goes live at 4pm today.
Visit Ealdorlight’s Kickstarter Campaign
There’s plenty more about Ealdorlight on the campaign - head over there and read all about it! A huge amount of work has gone into it, and I’m very grateful for all the support and help I’ve received from the team I’ve put together, and for friends and family who have given me endless encouragements and feedback.
This post is a little earlier than 4pm so that you can watch it go live if you want. Earlier backers get lower edition numberings on some of the rewards, so you might want to be there from the start!
Read moreHow Ealdorlight's story stands out
As we head towards the Kickstarter campaign launch on June 6th, I want to talk a little about the story behind Ealdorlight works.
The basic story stays the same for each game: you are discovered wandering through a remote village at a young age, and realise your destiny is to overthrow the King. However, like in Sol Trader, every person you meet is randomly generated. This means that your real identity will be different every time, and you’ll have to discover it all over again every time you generate a new game.
Handcrafted story in a random world
The trick is layering a great story on top of a generated world with random characters. Building empathy with the main character and his family when all characters are generated is hard, and hinges around being able to hook the story in at the right moments.
My plan is to write plenty of tightly connected story arcs that are triggered on events that happen during history generation. These will in turn trigger future quests the player can undertake. Not all story-arcs will appear in every game: it will depend on how the history generation goes. I will constrain things such that there is always a route through the game, and that players always have a way to overthrow the King, even if that might be easier or harder depending on the starting setup. These story-arcs then should interact with each other, hopefully producing a unique path through the game.
Identity
Ealdorlight is set within a low fantasy world, and there’s no traditional magic. The player gets more powerful through discovering key pieces of knowledge about their past. These insights into of your real past feed directly into your character’s stats, skills and abilities.
I’ve long been fascinated with identity: knowledge of who we truly are affects many areas of our lives for the better. In Ealdorlight I wanted to tell a story which takes this to an almost supernatural level. By removing the player from their birth family, they start as an entirely normal person within the world. It’s only after their early game encounter with the Ealdorlight and the discovery of their past that things begin to change.
Much more on this to come, but in the meantime, here’s a glimpse of our story’s beginning.
Ealdorlight: backstory teaser (updated)
Read more
Ealdorlight Kickstarter on 6th June, Sol Trader 1.3 released
I am now back from some extended time away after Rezzed, both on holiday with the family and training some clients away from home. I’ve released Sol Trader 1.3 today, and set the Kickstarter for Ealdorlight to 6th June.
Rezzed was fantastic: it was great to see lots and lots of people wearing our Ealdorlight crowns. We ran out of crowns on both days, with some creative head displays on offer:
View post on imgur.com
Ealdorlight Kickstarter launch date: 6th June
Yes, I know I said May :) I’ve decided to go for a 31-day campaign, starting on the 6th June, for a few reasons:
- It doesn’t clash with any major US holidays, like Memorial Day. The 48-hour reminder email should go out on the day after 4th July.
- I want to give myself the best chance of success by polishing the combat demo hard. It was great to get such good feedback at Rezzed and I think it’ll be a great hook. I need more time to do that well.
- 6th June is the first anniversary of Sol Trader’s launch, so it ties in nicely with the ongoing Revelation Games story.
I’m excited and nervous about this Kickstarter campaign: my third one to date. After succeeding last time I’m really trying to take my time and get it right.
Sol Trader 1.3 released!
Now that I’m back, I’m able to support a new release of Sol Trader: 1.3 is now finally released after a length beta period.
Here are the highlights:
- You can now chat to characters directly on the right if they’re in the same location as you
- Pirate Chief and criminals are now more likely to try to destroy you
- Fix a bug where you’re not paid enough for a mission
- Dignitaries now fly around a little less than before to make it easier to pin them down
- Inter-faction missions now pay slightly less
- Business trips now pay slightly less
- Taxi missions now pay slightly more
- Talking to your criminal parents will no longer cause them to forget who you are
- Fix crash where a character develops an opinion of the player mid-conversation
- Fix crash when showing GUI for a ship the AI is driving
- Fix crash where a character would attempt to sell a good on a ship they’ve lent to the player
- Can now initiate conversations when paused - will restart the game but at realtime speed
- Fixed the Tiger II achievement
Your steam copy should automatically update. I’ll be releasing an updated downloadable version to SendOwl in the next few days.
Read more