Multithreading concurrency bug?

October 18, 2014 | Filed under: programming

I have a theory, help me out if you know about this stuff. take the following image from the visual studio concurrency profiler for GSB2 pre-draw code…

8156,6792 and 8404 are my additional worker threads I spawn to help me process stuff. Click to enlarge…

threadsWhat I do is basically build up a queue of tasks. The threads are always running and checking for whats next available to process for them. Meanwhile the main worker thread also does the same thing, ensuring it is not idle while the other threads are busy. Critical sections surround access tro the queue stuff to ensure there are no nasty bugs.

I think my problem is illustrated by the red section with the black line connecting above it. This is a thread sat there doing nothing. Here is what I think happens…

  • The main thread builds up the queue of stuff to do.
  • 6792 jumps in and grabs a task to do
  • 8404 jumps in and grabs a task to do
  • The main thread then thinks ‘right then, I’ll do this next task’
  • 8156 wants to jump in now and also grab a task, but the main thread is busy doing actual work. In fact, it seems to ‘miss’ its opportunity to grab a task for ages, even though the other threads do ok getting task after task.

Is this just a problem of my code design because the allocation of tasks is done by a thread that is not otherwise idling? It seems horribly wasteful to have a whole thread work just as a 99% idle ‘task allocator’. I thought cpus were clever enough to allow interruption of one cpu by another in these instances?

I know I could queue up the tasks ahead of time, but each task takes a variable amount of time, and also varies each frame. I *could* work off the last known task timings and write a clever allocator that tried to assign things in the best order, but that seems possibly like overkill, and something the cpu surely handles anyway? Or am I totally misreading this data. IO checked a few frames, they all seem to have the same pattern.

So here are some harsh figures that will make you cancel your ad spending for your indie game.

In the last 8 days my figures show me this…

For every 100 visits to my index page for D3, 48 people will proceed to the register page. Of those, 11 will hit the buy button, of those roughly 1 will buy the game. That earns me about $22.

so the maximum cost per click that makes sense is $0.22, or £0.13, which is practically unachievable.

So how can ads make sense?

The beauty of ads is that the person who comes and buys the click is just one factor in the equation. There are many other factors, and the problem is they are hard to quantify.  Here are the ones I think matter and the rough guesses.

  • The life time value (LTV) of the customer has to include every other game they buy, including DLC. Assume D3’s DLC adds 10% to total income, and assume a 20% chance of buying another positech game eventually  so LTV factor is 0.3.
  • The virality of the customer has to include friends that he persuades to buy the game. This is hard to tell, but lets say it’s pitched at roughly 20%. So one in five people will eventually lead to another sale, either directly or indirectly through a forum post or tweet about the game, so this includes people they have never met. So this is 0.2
  • The untracked sale. This includes people who visit the buy page at work/school, then buy at home, or view it on mobile but buy on desktop. I suspect that is around 10% so another 0.1.
  • The delayed / wishlist/ bargain hunter. I crunched the numbers once for Democracy 2 and found roughly 33% of revenue was from sales, so thats 33% of income not being tracked here, or earned here, but stored for later, so lets say 0.33.
  •  The impression that wasn’t a sale. This is a big thing. Some people used to say you needed to see an ad 5 times before it worked. Other research claims even 1 impression has an impact, and >5 can still help. Because click-through rates are pretty low, we are totally disregarding the impact on brand awareness. Essentially you visually prime a customer with your logo to ensure subconscious recollection when viewing a review, portal listing or whatever else. Personally I think this is a big factor, lets say at least 25% to be cautious.

So if we add that up, we get 0.3 + 0.2 + 0.1 + 0.33 + 0.25 = 1.18, so an extra 118% of income generated by that sale. In other words our 0.22 is really 0.48. That *is achievable, although still not easy. What should be immediately obvious is that we have a LOT of fuzzy numbers and guesses in here that really cannot be tracked. Putting hard numbers to some of them would help a lot.

Looking at it the other way, we have to take into account the fact that a big chunk of site visitors are not ad related but coming from reviews, portal links, tweets etc. Ideally I need to deduct that traffic to get a better picture (which would make my figures much worse).

So for now, lets assumed that we break even at $0.48 per click, what are the possibilities for making an ad-based strategy work?

  • Target traffic more cleverly so the people who arrive are more suited to purchasing. That would push up that 48% who go to the register page.
  • Increase the lifetime value of the customer. More games. Cross-promotion. Maybe more DLC, or sequels, there are various strategies here, but I’m already doing most of them
  • Reduce leakage points. Find out why people don’t hit the buy button, or then hit the actual order form buy button. A/B testing to improve both stages.
  • An ad that more clearly prevents non-buyers from clicking, and thus targets better. I don’t want people who expect a free game, or a mobile game. Luckily adwords lets you analyze each ads performance. I should do this…

Fun fun fun…

 

 

 

Positech Energy. STAGE ONE. BWAHAHAHAHAHA

October 15, 2014 | Filed under: solar

My day dreams involve mostly chocolate and spaceships, but now and then I dream about running a big renewable energy business. I’m a big believer in such things. If You are someone who thinks climate change is made up by Al Gore as a plot to take away your guns, stop reading now.

Unfortunately, despite being very into green energy, I know sod all about engineering. I can wire a plug, and even solder a bit now and then, but my understanding of planning applications and energy management and construction processes is absolutely zero, so Positech has to be, for now, a passive investor in such things. Long term readers of my blog may know that I have a hybrid car and a little row of 10 solar panels in my driveway, and maybe also know that I’ve bought some shares in a solar farm here and there. I consider them to be good investments. I don’t know many investments that pretty much guarantee an inflation-beating return over 25 years, but energy infrastructure does. I’m willing to bet that energy prices will only go UP during that time frame.

Anyway, today marks a milestone because rather than making these investments as an individual, Positech has invested in a chunk of renewable energy as a long term (25 years) investment. I see this as a pretty good hedge against the games industry. Don’t keep all your eggs in one basket and all that.

So Positech has bought roughly 6% of this:

14711216160_b16ec05afe_z

It’s a crowd-funded Vestas V39 Wind Turbine, in Dorset, SW England. It’s also BIG. Wind turbine efficiency is very directly correlated with scale. Small ones suck. TBH, this one is too small really. It’s a 500Kw one, whereas the big ones are 6MW or even 8MW for experimental offshore ones. However, it kicks my 2.1kwp solar array into dust. Plus wind turbines run all night and all year. yay! It might be small by wind turbine standards, but its’ big enough to be efficient. 39 meter diameter blades. pic below shows scale better…

IMG_3021

I’m a big fan of long term investments, and spreading risk, and trying to do something about climate change. Positech could leave its money in the bank, where it could be lent out to arms companies like BAE or Oil Companies or god knows what else, or I could take control of it directly and invest it in something I consider positive, so thats what we have done.

Who knows maybe in the long term we will invest directly, and get a turbine built as a company (positech energy?) rather than this sort of investment, but that takes BIG money. I think you really need about a million pounds to do that, and ideally about five to ten million to build any of the proper sized ones. I better get back to work… :D

Fun with stats: Buy Pages

October 12, 2014 | Filed under: business

So welcome to another exciting episode of ‘fun  with stats’ with your host cliff harris.

Lets examine some stats for changes that are under analysis (using random sampling) with the buy page of a fictional pc political strategy game. Lets assume it sells for $20 to make things simple, and to take into account occasional discounts.

Lets also imagine (theoretically) that the game sells on portals which take a 30% cut and that it has a direct sell option which (theoretically) takes a 10% cut. So a portal sale earns $14 and a direct one earns $18.

The raw before and after the change stats are heavily skewed due to traffic variations, but basically we have this:

3rd October onwards (old buy page)

Direct buy button clicks 427
Buy page hits 3203.
Portal buy button clicks 152
direct sales share = 13.3%

8th October onwards (changed buy page)

Direct buy button clicks 194
Buy page hits 451.
Portal buy button clicks 23
direct sales share = 43%

So far, all this does is say that the percentage of buyers who choose the direct option has gone up. Because we get email details + a higher percentage of the sale, then we can assume this is a boost for us, but it’s not ‘free money’ We are not getting new sales, just converting portal sales to direct ones. So the difference is really only to be found in that 20% difference. To work out the actual difference we need to guess total portal and direct theoretical (assuming all clicks are sales, they really aren’t…) income, and compensate for traffic variation…

3rd October onwards (old buy page)

Portal income $2,128
Direct Income $7,686
Income per visitor from portals: $0.66
Income per visitor from direct: $2.39
Income per visitor overall: $3.06

8th October onwards (changed buy page)

Portal income $308
Direct Income $3,492
Income per visitor from portals: $0.68
Income per visitor from direct: $7.74
Income per visitor overall: $8.42

Holy crap. Have I done this right? And this is with A/B testing so actually only HALF the visitors are getting the new buy page, so the effect is actually double this. Assuming my maths is correct, the percentage of people who visit my site and THEN buy on a portal is actually fairly low, meaning that encouraging them to buy direct (but still having multiple portal options displayed) seems to have very little downside. The income from portals actually even rose very slightly $0.66 to $0.68, which is a statistical irrelevance. That change from $3.06 to $8 is not though. It’s real.

So obviously I need a lot MORE data to prove I’m right, so I’m going to leave my experiment running a few more days. I have some D3 ads running now which will drive in a bit more traffic which will help. You can’t really extrapolate anything from under 1,000 clicks on anything. But it looks promising.

BUT THE FUNNEL…

What this means is that getting someone to my buy page now earns $8 not $3. Now as it happens, the actual; abandonment rate is fairly high, because many people see the price (only on the buy page..) and then don’t buy, but there is value there in the stored intent and later discount-purchases, or second-thoughts and return buyers. Lets assume an abandonment rate of 80%. That makes a visitor now worth $1.68 rather than $0.61. The problem is not everyone gets to the buy page, home page to buy page hits happen at  35% so real values are old system-> $0.21 per visitor, new system -> $0.59.

The difference between the viability of an ad campaign or PR campaign targeting $0.21 and $0.59 per visitor is huge. It’s hard getting $0.20 CPC. It’s easy to get $0.50 CPC.

This is why I care about this stuff. Plus I’m a stats head and I enjoy it :D

 

Various things going through my head today…

Firstly, the UK government gets to build a nuclear power station near me. That doesn’t scare me *as such*, although I’d definitely prefer it was a few hundred miles further away thanks. What pisses me off is that people are not prepared to discuss the facts, and risks. Even just RIGHT NOW on the BBC web site, there is news of new cracks in an existing reactor, and a ship carrying radioactive waste is drifting out of control. I mean…FFS, can we not even sensibly discuss the risks without being daubed as ‘anti-science’ and ignorant. I get that all the time because I’m very sceptically of nuclear power and it pisses me off. It’s possible to be informed, educated, sensible and still very wary of risks of these things thanks to the precautionary principle.

Anyway, I’m SURE that now we have guaranteed the french-owned nuclear station 30 years of a £92.50 strike price for nuclear energy we will get the same for solar generated by UK citizens right? The Feed-in-tariff is currently 6.38p/kwh for standalone solar PV. thats £63.80 guaranteed for 25 years, with no government implied insurance backing (nuclear plants are never insured), waste disposal or safety/security concerns. So….. err no.   I’m aware that solar has downsides due to indeterminacy and land-use, but rooftop solar has no land-use downside and the distributed nature of the energy source makes it more efficient due to lower power-line losses. Nukes have to be by the sea. Solar can be anywhere. Solar can be community owned, closer to the people and more democratized.

This is all in my mind as I’m looking for very-long-term investments for Positech Games. I’d ideally like to diversify a bit from games, and my dream project is a solar-farm or wind-farm. Ideally wind, but this is VERY expensive (there are huge economies of scale with turbine size, you really want 6MW turbines, which cost millions each), so more likely solar, which means buying land, which is hard to find. In both cases, planning is a nightmare because people somehow think solar panels in a field they can’t even see are somehow a problem. The thought of arguing with such people drives me nuts.

What I *could* do, what *everyone* in the UK does, is buy some cheap flats and rent them out to people who can’t afford to buy them. This is the default pension plan for middle and high income brits. I kinda hate it. I don’t want to leverage my financial position to squeeze ‘dead-money’ in rent from people on a lower income. That kinda sucks. I’d like to set up a business that generated renewable energy instead, but our politics in the uk is moving against the environment, and can I really trust a government feed-in-tariff promise anyway?

In unrelated news, getting new games to feature on showmethegames.com is like pulling teeth. A lot of indies sell only through steam. Not just only through 3rd party portals, but exclusively through one. This amazes me. I LOVE steam, but my attitude to any business is like Han Solo and Lando.

“Can you trust him?”

“No…but he is my friend…”

I don’t know who might buy valve next year, or in ten years time. Nobody does, not even Valve. Hedging your bets is good. You don’t stick your entire stock portfolio in one share, it’s too risky, however safe a bet it looks. BigFishGames started off paying devs 70% royalty as I recall. They ended up with  around 20%. Businesses can change. It seems I’m the only one who realizes this.

So these ‘indie’ devs (I can’t really call them independent), can’t be listed on SMTG because it only lists devs with a direct purchase option, and increasingly this isn’t the case. Add to that people who take the hilariously catch-22 attitude of not wanting to be on SMTG because it has relatively low-traffic.

Again..I’m trying to do the right thing…use my own money to run a site that promotes other indie devs FOR FREE. But nobody is that interested.

So maybe it’s time to close SMTG, spend the money (and any solar-investment money) on buying up a bunch of buy-to-let properties so I can squeeze young people off the property ladder in the UK even more. Apparently that is what sensible people do.

Bah.