Game Design, Programming and running a one-man games business…

School #2 construction finished!

They need to clear away building materials by the looks of it, and do some painting and other bits, but the structure of our second school is now complete. Image quality not great because rainy season in Cameroon is not ideal for high end HD photos :D.

More details on the school here:

Here are the photos!

A reminder that the charity we use is called ‘Building Schools For Africa’. Link below:

http://www.schoolsforafrica.co.uk/

Making the Production Line supercar expansion

So unless you have not heard, i’m making an expansion pack for my car factory game ‘Production Line‘ which adds a new car type (supercar) and also some new door options as features for various car models, and those door types are Scissor-wing doors, Gull-wing doors and butterfly doors. I’ve done a video that shows these off (below) and also we have a web page for the dlc that you can find here.

I thought I’d put down in writing how this came about and why this was the DLC I decided to do. Personally I’m a fan of DLC, but only if its actually ‘adding’ to the game, or giving the player options, rather than just tweaking some numbers and selling a few text files for $5.99. That seems a bit exploitative, so I always focus on doing DLC where we have new art content at the very least. There is a LOT of art that goes into a single car body design in Production Line, because every car is completely different in terms of where the wheels are, what the headlights look like, even what the axles and drive shaft looks like and where they go. Nothing currently gets simply re-used between body styles.

Adding a super-high end car to the game makes sense from a design and balance point of view, because it means we can leave the balance of the existing game in place, and effectively just add a new style option for the luxury cars, and add a tiny section of the public who only want to buy a super-car shaped vehicle. In the real world, most sales at that price point already are accounted for by people buying sedan and sports style bodies, but there are some people who would want to spend the same budget on a car with a crazy shape.

Plus crazy designed cars are cool right?

Once I knew we wanted a supercar, having crazy doors is pretty much a no-brainer. people love cars with mad doors, and some research showed that butterfly, gull and scissor were the most common options on modern real world supercars. In theory putting all this in the game was going to be mostly artwork, and then some balancing by me. pretty easy huh?

It turns out..NO! This was extremely tricky because of the way the design of those doors overlaps other parts of the car when they are open (which involved a lot of re-ordering of existing components), and the nightmarish fact that gull wing doors actually require a different ‘roof’, to allow for the cutouts n the side for the door hinges. This means I had to redefine these door ‘styles’ as roof types, which also ensures you cant have gull-wing doors and a panoramic sunroof…

As a result, door styles have to be like drive-trains: set in stone when the car chassis is first created and unchanged for the lifetime of that existing chunk of metal. In game-terms, this means that switching your luxury sedan to use gull wing doors will not have any visible effect for a while, as the cars right at the start of the line are then set to be gull-wing, but they have to get all the way to the door panel slot for you to notice.

This also involved a huge amount of special case code-spaghetti, because if you have gull wing doors, then certain other things change. You cannot stick normal windows or wing mirrors on a gull-wing door, and so-on. There was quite a bit of complexity involved in swapping some components for others to accommodate the new system.

I like to give my artists total freedom to create cool stuff and tell them I will worry about making it work. I get better art that way, but more work for me… It turns out that yes…its very cool that the supercar’s engine is behind the driver, but that caused me some hassle to ensure that when the engine gets fitted, its the back part of the car (trunk) that opens up to have it fitted, and not the front… (99% of players wont notice, but I like to surprise the 1% who do). As we were doing this anyway, it made sense to support the same capability for the sports cars, which also look like they have the engine in the back.

So all of that stuff is now DONE and tested and working in the game. The installer is done, and I’m working on the steam build, and mod-panel integration. All I need to do before release is keep testing the balance of this stuff to ensure that the doors are expensive and awkward to fit (but not unprofitable or too annoying) and that demand for these features and for the supercar makes sense.

Right now, the game is being tested with supercar sales only taking place in the luxury price band (well yeah…) and with a market size of 4.76%. I think thats maybe a bit high, and obviously in the real world its <1% but this is a game and needs to be fun :D

In terms of balancing the doors, they are currently just ordinary door panels..BUT the slot-upgrades are pretty expensive ($195,000 for a slot upgrade for scissor doors compared with just $3,480 for central locking) and they require sensors and servos, which lead to a bit of a bottleneck (intentionally). Plus the actual fitting time to add those doors is considerable, more than doubling the max-optimized time to fit ordinary door panels.

The final piece in the puzzle is the design cost. All door types need to be researched separately and also you need to research the new supercar body style. These are quite lengthy research items, but there is nothing stopping you skipping all the other car bodies and making supercars or gull wing doors your early game priority!

If you like the sound of all this stuff you can wishlist the DLC using the widget below.

If you are a youtuber looking to cover the game and want to make a key request you can get in touch through keymailer (below) or email me your steam curator name.

Fixing the latest Production Line Code Bottleneck

Its always worth occasionally grabbing a full run-time-profile of your game to see whats taking up all that processor power. Today I dug into it a bit with aqtime and wanted to see what was chewing up the PC the most on a (fairly) big map.

If I ignore child threads (that take a lot of the load-off in terms of route-finding and other things) and just concentrate on the main thread, I can see that 73% of a frame is in the drawing code, and 22% is processing. I suspect on crazy big maps that processing chunk goes higher, as the drawing code scales to some extent with the screen size, and a big map on a small laptop is still my target for improvement.

If I break open that 22% I get this:

SlotManager::Process is obviously the biggest problem here. Its also something that scales quite badly because on really jam-packed maps, there is a lot of slots, and for my sins, EVERY item placed down is a slot, even if its just a conveyor with one entrance and one exit… so whats going on in there…? 95% of the time happens in ProductionSlots (the rest is facilities or supply stockpiles…

…so quite a mixture here, which is a good sign really, as it shows no real obvious glaring screw ups! Because I’m really worried about maps with just a lot of conveyors on them I guess the thing I really need to look at is Processvehicle(), as the other top offenders don’t seem to be related to those theoretically simple slots…

Hmmm. so CheckExitSlotFree() is taking up a lot of time, and some digging around shows that in my short sample run I called that on average of 1,248 times per frame. Ouch. Thats a lot, but to be expected with so many slots, and them all wanting to know their immediate status. The sad thing is, this is likely to be 99.5% of the time, a lot of slots going *is the slot in front of me empty* and the answer coming back *no, just like it was the last 100 times you asked*.

There is a fundamental algorithmic screw-up here, in that polling a value, rather than being notified when it changes, is hugely inefficient. Its also incredibly reliable and fault tolerant, which is why its such a popular method… What exactly takes so long anyway in that function?

Aha… so it looks like a big chunk of the time is actually spent just notifying the popup GUI above a vehicle or a slot, what message to display which is almost *all* cases is none. This seems crazy, and clearly a target for optimization. On its own, this function is taking up a tiny part of total run-time, but a larger part of the main (blocking) thread, and certainly seems to be inefficient. What takes up most of the code? actually its the code that works out the width and height of any of the strings based on the UI font, and thus resizes that notice. Yikes, am I *really* calling that every frame?

Out of 1,992,097 calls to SetType() only 55,280 update it, so only 2.7%, but its still a lot. Inside that function we set the size and the text without even checking if its onscreen, or if we are zoomed in far enough to see it anyway. I can simply set that to be something thats done ‘lazily’ once I know we are onscreen and zoomed in…

Ok done that and…. Hahaha. That function now averages 0.0001ms vs 0.0007ms before the change. Thats a decent hours work :D

That reduces the overall time for a slot processing a vehicle from 0.0012ms to 0.0009ms. For big factories, thats a welcome change.

Creating a real working environment for game development

It drives me mad when I talk to some younger indie devs how little actual *work* they do. They are hardcore serious game devs, into game jams, and going to games conferences, and maintaining twitter, instagram and facebook pages about their game, and they often talk at shows, or attend talks, or tweet about talks, and watch tons of past talks, and play fellow indies games, and meet up at game dev meetups and try out the hot games and compare them to other games and…

…very rarely they sit in front of a keyboard and code a game.

This is a big problem if you actually want to make a living from games rather than just enjoy the ‘indie lifestyle’. FWIW, the indie lifestyle is easy. Dye your hair (or for extra points just part of your hair) bright blue, get an apple laptop, and cover it in stickers from games shows. Buy a GDC T-shirt (or for extra points, one from a smaller show), and spend at least three hours a day on social media. Bonus points for every 100 posts on gamedev subreddits talking about tech and marketing and design issues. Super bonus points for getting into heated twitter arguments about whether or not games are art or inclusive.

Oh obviously, you need to have a name and genre (maybe even a game jam concept?) for your game, so you have something to talk about.

This is all fine, and reminds me a LOT of the guy who persuaded me to take up learning the guitar when I was at college. He had been playing the guitar for about 3 years and was very cool. He showed me guitar tab one day and I bought a guitar the next month. Within 2 months I was a better guitarist than him. I ended up playing in 2 bands, and working briefly as a session guitarist, as well as teaching probably 100 people to play. AFAIK he never played a gig.

The difference between us was that I wanted to play the guitar and learn how to play well, whereas he wanted to be a guitar player. This was probably related to a desire to be cool, or get women to sleep with him, or both.

My advice is to know which you are. Are you an indie developer because you love the indie scene, and the people? Or are you an indie developer because you want to make games, ideally full-time? I also suggest that if its the latter, you need to lock down and optimize WHERE you do it.

Briefly, when I quit my job to go indie the first time, and my wife was at work full-time, I experimented with coding in coffee shops, because thats what they show people doing on TV and in magazines. It was crap. They are full of mothers with screaming kids, expensive (but average) coffee, no stability, no room, no peace, an environment 100% NOT conducive to C++.

this is not work

You MAY be one of the 1% of people who can program and design games and do real serious *deep work* while in a noisy environment you do not 100% control and surrounded by other people who often interrupt you. You really may be… but you probably are not. Almost everyone can concentrate better when things are quiet. Programming especially requires *deep* concentration, that is easily shattered and hard to rebuild.

In short, unless your environment is quiet, free from clutter, dedicated to one thing (work) and set up to convey that this is a WORK location, not a chill-out zone, then you are not going to get much done.

My tips?

Get a dedicated room in the house/flat if you can. If you cannot, then set dedicated work times, when you are not to be disturbed for any reason except a literal burning building…

Get an office chair, I recommend an aeron but cheaper alternatives are available. Set it up to be perfect for typing and reading, not slouching. You are *not* going to work all day on a beanbag or a sofa. You just are not.

Only people insecure about creativity think beanbags will save them

If its not quiet enough, get noise cancelling headphones and wear them.

Do not fill your desk and office with lots of fun toys and other distractions. Yes, you are making a fun game, but 95% of your time is work and implementation. Don’t confuse your subconscious. Are all those desk toys REALLY making you more creative or just distracting you from actual work.

Most of us are pretty shallow. We really care about what other people think of us, and when we are young, especially if we are single, we obsess about seeming cool. Work is not cool, work is for serious grown-ups who are boring. Thus we spend a lot of time trying to look cool, rather than be effective. If you saw me sat here right now, unless you noticed the framed prints of past games on my office walls, you would assume I’m working in fintech or IT. Its a very un-gamey environment, and it keeps me focused.

When you have shipped game #10 and sold game copy 1,000,000, feel free to fuck around. I *do* indeed have a child-size Tesla model S propped up in my office, and a toy car with toy robots on my desk, and am happy to be interrupted by cats and visitors all during the day. I can afford to be slack, but it was not always the case.

Set your environment up to be worklike, and you *will* get more done. We are simple animals and highly influenced by our surroundings. Stop trying to be cool.