I recently got sent a HUGE factory in a savegame for Production Line. It has over 600 production slots and 24 resource importers, and its MASSIVE. Here are some screenshots:

Despite its awesomeness it was MASSIVELY slow. Not only did loading it take forever, but whenever you changed any of the resource conveyors the game would hang for about 20 seconds. hardly ideal, especially given that I have an 8core i7 PC. So I set to work trying to optimize the code. I did some fairly small optimisations first, which boosted processing by 12% but I needed more fundamental re-design.  After chatting to a fellow indie coder, I agreed that my currents system of always calculating the optimum route to everywhere, for everyone, when something changed, was clearly not viable. I switched over to a new system of ‘lazy’ computation. Basically when I change a route somewhere, it now sets a flag on every production slot saying ‘you should recalculate your nearest slot soon’. That flag gets checked every frame, and sometime in the next 120 frames 92 seconds) each slot will calculate the route from its location to all the importers, and store the nearest two. It needs this so slots seem to import from a sensible location, as opposed to an importer that is miles away.

This was good, and sped things up a LOT. Now instead of hanging, the game would stutter for about 10 seconds. better but nowhere near good enough. I then realised I was doing something seriously dumb. I was going through all those routes I calculated, and picking the nearest, THEN doing it again, to pick the second nearest. doh! This sped things up, but in retrospect, it was trivial, it just alerted me (alongside my profiler) to the fact that when I tried to get (for example0 15,000 routes, I actually calculated 30,000. How come?

It turns out that the code that multithreaded all of the ‘calc the routes’ code, was not storing any of the results, so the code that came after it which then went through the (not saved) routes to pick the nearest ones was having to recalculate them anyway. I was essentially doing everything twice.l Worse…this second bit of code was single threaded, meaning all my multithreaded time was wasted and all the work happened in a single thread. What a dork.

A nice simple change to the code to make sure those multithreaded route calcs are actually stored *doh* means that not only did the processing time half, it now gets split over potentially 8 cores instead of 1, so on my PC its now running 16x faster. Combine that with the earlier speed-ups and its likely 18x faster, and because of the frame-spanning over 120 frames, it *feels* fluid as hell, even on insane maps.

Here is the concurrency visualiser showing the loading of the insanely big map.

And here it is zoomed in showing the multithreaded bits.

Those gaps are because each slot makes a single-threaded call to evaluate all of the import bays (each colored block is the code to get a route from one import bay to one production slot), and that call (in the main thread), then spreads it over the worker threads. Ideally I’d find time to eliminate that single thread blocking. Also I have some gaps in there because the end of each threads Calc() has to use a critical section lock to deposit its new routes safely in the main thread. Ideally I’d bunch them up inside a thread structure and dump them at the end.

Anyway, enough tech bollocks, the upshot is that massive factories will now be uber-fast :D.

There are no comments yet

Legacy Business

March 08, 2017 | Filed under: business

Having a long established business brings benefits (FWIW Positech was formed in 1998, as I recall). You get tons of experiences, and contacts yada yada. It also has a negative side.

British Airways used to be a really major force in UK aviation, but got hammered badly by ‘low-cost’ airlines and is struggling to compete. One of the many reasons it finds it hard is that BA has been around long enough that it has a bunch of retired pilots 0n decent pensions. Thats a considerable cost that its new upstart challengers do not have, and its just one example of the negative side of legacy business.

Having been around for so long and shipped so many games, I have a lot of legacy crap to deal with too. I get emails (often) from people who have lost their Kudos or Kudos 2 download link. Its a 1 or 2 minute distraction at best, but it involves mental context switching that is expensive for a coder. I even get the odd request from someone to buy/re-register their shareware demo of Asteroid Miner/Star Miner (my first commercial game). FWIW, don’t email me, the serial code for every copy is the same (what a n00b huh?) its the serial number of the trash compactor in star wars, if that helps…

Emails about long dead games are one thing, but it also means you have communications about long dead publisher deals and other biz stuff. I am owed tiny amounts of money by at least 4 different publishers and payment providers which are below the threshold for paying out, yet spam me each month with an automatic royalty report. (RealGames, I can guess I’m not selling any copies next month, so lets give it a rest shall we?). This sort of stuff is long redundant and could probably be spam filtered out, but actually its not the ‘really’ old stuff that is the biggest legacy distraction.

Believe it or not, Democracy 3, a game which still generates comfortably enough for me to live on, and for which we will soon release a Unicode update with exciting new language support… is now considered legacy in my mind. This is partly because Jeff now deals with it, but mostly because I have moved on to do other stuff. We did D3:Africa, then Political Animals, and Shadowhand is coming, and of course I code Production Line. Frankly, in my mind, Democracy 3 is history, at least in terms of day to day concerns.

Yet to loads of people, it absolutely is not history, but a current, new game. I get emails from publishers wanting to discount it in sales, I get more requests to do academic stuff around it than you would ever guess, I get a bunch of interesting emails about modding it, I get requests to bundle it, requests to list it on new stores, obviously I get some tech support (not much now, happily), and so-on and so-on.

I know this sounds a little ‘first world problems’ but actually, you don’t realize how much this stuff builds up. If you are working on your first indie game, or have just released it, you have 100% focus. When you get an email about ‘your game’ you KNOW which one. You never get confused as to whether its Democracy 3 or Production Line that has a fix for certain sound card bugs. You never forget which game you are running an ad campaign on, or confuse which one is in a sale this week. (FWIW several of my games are likely in this weeks GoG sale. Off the top of my head…no idea which ones).

I am beginning to think there is a very good argument for restricting the game output for a single-dev studio to below my current level. Make a few games, make them long-form hits. There is definitely a diseconomy of scale when it comes to multiple projects over time.

 

 

Should you go to GDC 2018?

March 02, 2017 | Filed under: business

You definitely get a skewed view of GDC from general media and social media. If you are a penniless indie dev, or just someone who hasn’t been to GDC, you might think it is an exciting wonderland full of product releases, wild parties, great deals being done, and venture capitalists throwing bags of cash at grateful developers. The truth is, its much more variable.

GDC Tweetage is generally “Just had an awesome meeting, so excited” and “So amazing to meet up with so many talented people again #GDC17” and so on. The non-tweeted thoughts are more like…

“Sat alone in hotel room eating crisps again.” “Can’t afford the pass to go to the cool talks :(”

The reality is a mix of the two. I’ve had some great times, met with nice people, and some kinda dull, boring, miserable times. All my real ‘biz’ stuff is done now, so its just the nice socializing with buddies stuff ahead of me, then the inevitable long flight home. At this point, I think I have enough data to provide some pseudocode to determine if you should attend 2018:

bool ShouldIAttendGDC()
{
float ValueOfGDC = 0
float relative_cost = CostOfAttending / IncomeFromGameDev;
if(relative_cost > 0.5f)  return FUCK_NO;
if(relative_cost < 0.01f) return HELL_YEAH;
ValueOfGDC += (0.02f * NumFriendsAttending);
if(CanAffordBusinessClassSeats) ValueOfGDC *= 2.0f;
if(NeedFunding || LookingForFirstIndustryJob)
{
 if(IsExtravert) ValueOfGDC += 0.2f;
 else return FUCK_NO; 
} 
if(HasNeverAttendedGDC) ValueOfGDC += 0.20f; 
if(AboutToReleaseGame) ValueOfGDC += 0.05f; 
ValueOfGDC += (0.075f * NumConfirmedPartyInvites);
if(WorksForMiddlewareCompany) return WHO_CARES_BOSS_PAYS; 
if(YouGetAFreePass) return LOL_YEAH; 
if(ValueOfGDC >= 0.5f) return MIGHT_AS_WELL;
else return NAH_FUCK_IT;
}

I hope this is helpful.

 

There are no comments yet

Decision markets for indie games

March 02, 2017 | Filed under: business

Should you make a game about X? is it worth pricing your game at $Y or $Z. Should you do a mobile port? Should you develop in unity? How many people will buy the game if we spend an extra $35k on art?

Most of the answers to these questions are useless, partly because the correct answers are truly unknowable, partly because most people you ask will lack the experience to have any real insight into the topic (for example asking me if your mobile game will sell is pointless. I have ZERO insight), and also partly because people generally tell you what you want to hear.

The first 2 problems can be solved by taking *all* answers with a pinch of salt along with only asking people who actually know about the topic. For example if you want to know what makes a political strategy game, you could ask 100 random developers, or you could just ask me & brad wardell. The latter would be a much better idea.

The last problem, has an actual technical solution, but it wont work with everyone. its worth discussion though. The solution is called a decision market, or a prediction market (same thing).

Basically with a prediction market, instead of saying ‘cliff, do you think my game will make sales of $50,000 dollars’, you say ‘cliff, if I was prepared to sell all the income from my game to you, what would you pay?’. Obviously that assumes I have $50k I’m willing to risk, so a more nuanced version would be ‘What would you pay me for 1% of my sales revenue?’ to which you presumably want me to say ‘$500’ or maybe more.

Because such markets include an actual financial incentive, it skirts immediately around the ‘not wanting to hurt your feelings’ problem. I’m happy to tell you that your game is a sure fire hit, to make you feel good, and not be mr doom-and-gloom. I’m less happy for that politeness to cost me $100.

I definitely think that the whole idea of markets, predictions, shared equity, and kickstarter / down-payments is something under-utilized by creative industries. Kickstarter gets close with the whole ‘would you buy this thing now? before I make it?’ idea. Greenlight surprisingly uses no incentives whatsoever. I would LOVE to see the discrepancy between current greenlight votes versus a system where voting on greenlight costs you $1, recoup-able against the cost of the actual game. I’d also like to see that at $0.10. (I suspect the difference between them would be negligible.)

To some extent, I am doing this with production line. It’s in alpha now. Will the finished game be worth more than $11? About 8,000 people so far have said yes, and not with mouseclicks, but with actual proper money. That information is not just good, its a whole order of magnitude better that any opinion poll or greenlight style system.

The problem with all this, is that kickstarter (the best public decision market) has become perceived (helped in no small part by its name) as a way for ‘people without money to get a project off the ground’. Ideally it would be perceived as ‘A way for anyone to test the market value of a proposal.’  For example, say I went to kickstarter for ‘Democracy 4’, I’m sure I’d get grief along the lines of ‘he doesn’t need the money that way…kickstarter isn’t for people in his position’. And that’s nuts, because we already have decision markets for REALLY wealthy companies, and we call them futures markets, options and to an extent shares themselves. All a share price really represents is the public consensus on the market success of a companies projects in future. This is REALLY helpful information.

Positech shares will not dip (or jump) if I tease Democracy 4 tomorrow. Nobody is able to short-sell (or buy options in) my stock. Somehow, there is an opportunity to ‘fix’ this with clever tools. In practice, legal hassle involved with gambling makes actually doing it probably nonviable.

Probably the nearest we can get is something like this site.

 

Five dollars twenty in silicon valley

February 28, 2017 | Filed under: business

Five dollars twenty cents. Thats the price of the medium size latte in the hotel lobby. The hotel room has a coffee machine, but I don’t like the coffee. I sell lots of games, I can treat myself. I buy the coffee. I forget to pick up the cardboard surround for the heat. I could go back and ask for one, but I’m done with interaction today. I’ll get hot, I’ll burn my hand.

Day one of GDC is over, at least for me, at just 9.20PM. I was awake at 5PM but thats no excuse. My real excuse is I’m like crocodile dundee here. Most people in the village back home seem to know me. Cars are rare, we walk in the road. Trees are everywhere.

I am on floor twenty seven and I see no trees, just skyscrapers, glass and concrete. The aura of business, of finance, of money, of work, of technology. This should be my world, I’m in silicon valley, I’m actually HERE.

Breakfast is with fellow coders. I miss a lunch with friends because collectively me and google suck at calendars.  I miss another meeting for the same reason, but meet up with old friends and grab food and a coffee, then later there is more food, then drinks. I’ve met new people, an alarming percentage of whom know who I am and read my blog. This always feels weird, flattering but weird. I’ve met people whose games I admire. I don’t mention this. Do they think I’m being shy? or arrogant?

Most people are here to get press, or learn about new technology, or hear the tales of success (and increasingly…failure) from fellow developers. People come here to network, to make contact with people known only as disembodied twitter and facebook avatars. If you ask me why I am here, I have no answer. Is it to get press? maybe a bit, but that won’t happen. Will I learn much from the 5% of talks I am allowed into for $300? not really. Am I here just to go to parties? me in bed at 9.30PM?

GDC is weird, and I am weird when I am here. I sport a brilliant white (practically glowing) jacket festooned with Production Line logos. I am a walking billboard, happy to say hello, but terrified of not knowing what to say after that. Everyone seems confident, but most of us are shy introvert geeks. Fully alive when discussing multi-threading, never happier when swapping stories about memory management, awkward to the point of terror when meeting new people. I still notice the accents. Not clique but ‘click’ not ‘mobile’ but ‘mow-bill’.

So far its been really nice, great to see old friends, interesting to chat about the industry, yet still tiring and in some ways scary. So different to a life of quiet coding and the occasional meow.  GDC is great (nowhere near as good as steam dev days…but great), but I’m glad its only an annual event. My inner introvert couldn’t take anything more.

Every day I think about giving some money to some homeless people, whose continue presence in the land of billionaires never ceases to shock. I spent five dollars twenty on a coffee. Should I have given it away? Maybe I should but even that social interaction is overwhelming when I’m thousands of miles from home and surrounded by people, so many people, confidently talking about monetization strategies as they stride down the street.

I’m not in kansas any more.