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

Normal mapping question (it’s my day OFF)

EDIT: I’ve fixed it. It’s my own dumbassness. I was setting the sprite_angle variable in the shader AFTER the shader had started, and it was presumably never being set, and populated with garbage (or the ship beforehand) it works a charm now :D

Right so, despite being good at AI coding and optimisation, i suck at this clever stuff you people call ‘3D math’. I was in the pub that day of school. So I enlist you, the all-knowing internet to explain to me like a child what I am doing wrong. Here are 3 images:

normalmapstuff

The left is just the ship, the middle is a normal map thingy (thanks to charles!) and the right is what it looks like on screen given a single light source. The end result is exactly what I wanted, and there is much rejoicing… BUT. It’s screwed up, the position of the light source is wrong, and seemingly random, and sometimes jumps and cycles all over the place. I reckon I have everything sorted except the shader, which is an fx file as follows:

sampler2D g_samSrcColor : register( s0);
sampler2D g_samNormalMapColor: register( s1);
float sprite_angle : register(C0); 

float4 NormalMap( float2 texCoord : TEXCOORD0 ) : COLOR0
{  
    //get the value of the normal at this texturecoord
     float3 normalcolor = tex2D(g_samNormalMapColor, texCoord);

     //convert it to +/- 1.0 range
     normalcolor *= 2.0f;
     normalcolor -= 1.0f;

     float3 LightDirection;
     LightDirection.x = sin(sprite_angle);
     LightDirection.y = cos(sprite_angle);
     LightDirection.z = 0;

     float dot_prod = dot(LightDirection, normalcolor);

     //apply as a tint to the final pixel
       float4 original = tex2D(g_samSrcColor, texCoord); 
       float4 final = original;
       final.r *= dot_prod;
       final.b *= dot_prod;
       final.g *= dot_prod;

       return final;
}

As an idiot, I’m not really sure what I am doing here. What I *think* I’m doing is this: I am drawing a sprite which has a separate normal map (g_samNormalMapColor) I also pass in the current angle of the sprite. I sample the color of the normal map, and convert it into the required range. I then convert the sprites angle into a light direction vector (probably wrongly) and I then do some magic which kids call ‘dot’ which I’m guessing gives me the brightness of the pixel given the angle and the default light direction. I then multiply the original texture color by this brightness to tint my final rendered sprite. Yay.

it’s something clever to do with angles and vectors and stuff isn’t it? explain it to me like I’m an idiot :D

 

And yeah…I’m playing about with Gratuitous Space Battles. It’s a Sunday morning, don’t read too much into it :D

Crunch Crunch

I have a day-off booekd for the 24th August. I’ll probably do some programming anyway, but according to my schedule, there is nothing specific booked on that day. Every other day in between has a pile of stuff to do. Why so busy?

Well REDSHIRT will be shipping very soon, insofar as we will start taking pre-orders and make the beta available to people who order it. When I say beta, I really mean beta, not some experimental kickstarter-early-access style tech demo, I mean beta. The game is perfectly playable. Bugs to find, balance to tweak, typos to fix, but everything feature and design wise is looking pretty cool.

rs

Shortly after redshirt going into beta, DEMOCRACY 3 will go into beta as well. This is in the same state, ie: finished, apart from any last minute bugs or balance tweaks. Officially, I’ve balanced the UK, France and half of Germany.  USA,Canada and Australia will be done over the next few days, then I’ve set aside some time to bug hunt in redshirt. Democracy 3 will be on sale from my suite hopefully by the end of the month, with pre-order customers getting to play it straight away, and a steam and final release about a month later.

d3

After both games officially ship, there will be a bit of admin involved in terms of Linux & Mac builds of both games, and an ipad port for Redshirt. Then….who knows what comes next! I have grand plans for Gratuitous Space Battles 2, and also vague other plans, and may actually consider whether it makes sense to carry on like this as the sole designer/coder.

Anyway between now and then is a lot of crunch crunch crunch. Also, in unrelated news, I recommend this book on advertising and neuroscience. half way through it so far, kinda cool.

 

 

Gratuitous Business Expenses

I did some analyzing of the last 10 months of positechs expenses and I get this graph:

chart

‘Training’ might seem weird, but it’s because positech is not just me. There is another person doing some writing and proofreading, and yeah, I’m actually investing in training for that person, which is a very long term investmenty thing.

Infrastructure is stuff like web hosting, accountancy and other ongoing expense stuff. Shows is a new one for me, and basically that’s attending GDC in the US as a visitor (including flights and hotels) and exhibiting 2 games at rezzed (including hotel).

PR includes fees to PR people, plus similar expenses on game trailers and website design and coding, including this blog.

Actual expenses are about 22% of revenue. Note that salaries and dividends as the owner of the company aren’t included in all this. Game production costs are basically contractor payments.Obviously if I included a calculation for my own time, the game production cost would be dramatically higher.

Current projections put this years profits lower than last years, although that may turn around once Redshirt and Democracy 3 go into beta.

Yeah, I’m a chartaholic.

Just one pesky stat

The trouble with designing games like mine, is you often find that the game ends up focusing on just one stat. This is a problem, in my view, because it makes the game a bit too single-minded, and decisions a little too easy, or frustrating.  let me explain what i mean…

In a game like Prison Architect, theoretically it’s a very interesting and fun balancing act. You need to balance your budget the ratio of staff to prisoners, the happiness of the prisoners, the safety level of the prison, the  cleanliness, the number of prisoners you can feed that day, etc etc. It is a great game with a lot of appeal, and theoretically you are spinning all of those plates at once, trading X against Y and Y against Z. This is what makes for exciting, fun and unpredictable gameplay.

prison

HOWEVER. Like all games of this sort, including my own such as Democracy and Kudos, and no doubt Democracy 3 and Redshirt, they often (at least during development and beta) bump into a problem where for long periods, gameplay becomes all about just one pesky stat. In Democracy 3 it is often GDP or the deficit. In Redshirt, it is often happiness. In Prison Architect, for me at least it is always budget.

This is a problem that it’s worth keeping an eye on. Some games deliberately ‘cheat’ it. If your budget has been a ‘limiting factor’ for X turns, why not alleviate it a bit with a grant from the government? If happiness is ‘stuck’, then why not have the player invited to a happiness-inducing random event? The very interesting question is…. Is that good game design?

Personally, I think it is, at least in a single player game (obviously). In the real world, we can become ‘stuck’ and frustrated with one part of our lives, one single problem, but when we are game designers with total control of the universe there is no rule saying we must make the player suffer in this way. racing games often cheat with ‘catch-up’ physics. Is it ok for simulation and single-player strategy games to do so too? I would say yes, but I’m interested to know what people think. When you are stuck with 4,000 fuel and 9,000 munitions and zero manpower in Company Of heroes 2, and this is your tenth go at that mission, would you be offended if the manpower stat artificially sped up a bit?

The land grab for gamers eyeballs

I enjoy reading about the early days of the internet. I have a strong feeling that only one guy really understood it. Only one guy really got what was going on, and what to do. I don’t mean Bill gates, or The google guys, or Steve Jobs. I don’t mean Woz, I don’t mean Tim Berners lee. I mean Jeff Bezos.

Jeff Bezos understood that the internet was like a big new country being discovered, where all the land was free. And soon, everyone would be emigrating there. Whoever owned all that land would be very very wealthy and powerful. He Realized he had to ‘get big fast’ and more importantly he realized that it was a long term win, where if you didn’t make money for a decade, in fact if you absolutely threw money down the drain for the first decade, it didn’t matter, as long as you won.

bezos

Gaming is pretty big, and it’s getting bigger. For a long time, gamers were just kids. Nobody over 30 played games. It was a niche thing. You wouldn’t make a living doing it. Then it became something that made decent money. then game developers started driving ferraris. Then Call of Duty started appearing on the news. The Minecraft happened. And so on…

Gaming is like a great big country waiting to be conquered, and right now, we do not know who has won. Some might say apple have won, because of the app store. others say maybe Microsoft win by default, due to the X-Box and Windows. or maybe Valve have won? or Zynga? The important thing right now is *we have no clear winner*. And long may that continue.

Thankfully, there is still a slight element of the free market in gaming. There is Kickstarter, Humble Bundle, Gamersgate, D2D,Steam and GoG, and that’s just third party PC game stores. We have some clear frontrunners but nobody has actually ‘won’ yet. I do have a great fear that the main word there is *yet*. As consumers, we will do absolutely NOTHING to maintain the free-market and level playing field. It’s just not in our nature. We worry that the supermarket will out-compete the local butchers, but we drive to the supermarket anyway because they have convenient parking. We are not the best guardians of free markets and competition. We are also, on the whole, oblivious of the fierce war being fought for our loyalty, our eyeballs, and our attention. Attention is everything. I *REALLY* want you to visit my site www.positech.co.uk and buy my games from there, or at least hear about me as an independent entity. If I could guarantee that you would buy my next few games from my website, it easily makes sense for em to offer you my current games for free, or even at a loss.

Indies don’t generally think like this. Especially with their first game. You normally have bills to pay, and getting into debt is scary. If you earn $1,000 in a month, the thought of spending that $1,00 on adverts to get people to come buy your current game at a loss…. that’s madness right?

That’s what Jeff Bezos did.

Me…I don’t quite have the balls for that, but I’m pointing out that the big boys out there who want your eyeballs do. There is a war going on for the attention of gamers. To the winners go huge spoils. It’s fascinating, exciting and frightening to see. I just hope there’s still room for little old me.