I’m from the UK, and if you are following the news, you may know that following a vote (referendum) to stay or leave the EU, we are soon about to Leave, unless there is a new vote, or its overturned in some other way.

I spent years really disliking the EU as an institution, although I have nothing against Europe or Europeans. It boggled my mind that the EU was run so badly, with a legislature and an executive in different cities, and a parliament that actually MOVED regularly to maximise its own inefficiency. The accountability of MEPs for expenses was laughable, their pay was tax-free (wtf?) and there were numerous examples of corruption, stupidity, and unfairness. I found the whole institution to be an embarrassment.

When the Brexit campaign started up, I found myself persuaded by the economic arguments for remaining. I was a ‘reluctant remain voter’, and voted to stay in. I thought it best to stay, and fight for a reformed EU.

Since then, there has been widespread coverage of the issues, and a lot of news about it, and I’ve read extensively. I am now a fairly passionate remainer, almost entirely for Economic reasons. I understand (and could argue convincingly) the argument for leaving, but firmly believe it would be a bad idea. I could talk for quite a while on the topic.

But here is where it all goes badly wrong…

To be totally honest, I am not informed, educated, or impartial enough to make this decision. I have my own prejudices to be aware of, as someone who is economically not concerned by either skilled or unskilled immigration. I do not fear for my job. Where I live, immigration is practically zero, and unemployment is incredibly low. This part of the UK is barely affected either way. Also if brexit resulted in higher food prices, I could afford it. If the £/$ tanked, I’d actually be BETTER off, as I’m paid in dollars. I have a skewed POV.

Add to this my incredible ignorance on the topic:

I could not (from memory) tell you if immigration went up or down last year, or what that level was. I have no idea if there is more (or less) skilled vs unskilled immigration, or what the unemployment rate is in those industries that attracted those immigrants. I cannot immediately tell you the rate of net tax/welfare contribution from immigrants vs residents, or vs EU/non-EU immigrants. I cannot state with any accuracy the rate of crime in areas more or less affected by immigration.

I did a degree in economics, but I cannot state for sure whether the UK needs more, or less immigration right now, or what effect this will have on interest rates, unemployment, wages or house prices. I cannot make any informed predictions about how any of those values will change over the next decade or two, or how they compare with the equivalent rates in any other comparable economies.

Additionally, I have no real grasp of how leaving the EU will affect UK law, whether it be corporate law, health and safety legislation, monopoly and competition law, tax rates, libel, criminal law or the rights of minorities. I do not know for sure what laws in the UK are dependent on, or bypass / overrule or are overruled by EU legislation, or how than can/will change in either the remain or brexit situation.

From a business POV I have a fairly strong understanding of how brexit would affect the UK games industry at my level, or the UK car industry (through my research for my latest game). I have zero idea the effect on fisheries (which could be hugely beneficial), medical (or other) research, education (esp universities), the financial sector or manufacturing.

In other words.. I have no fucking clue whatsoever about what the impact will be of Brexit or the impact of remain. Unless you can speak with experience, accuracy, and from memory on all of the above topics (and many more), to be honest, you have absolutely no fucking clue either. None of us do. I’m a game developer, full time (more than full time…) I don’t have time to research all of this stuff in the detail required to truly make an informed decision.

I am going with my gut feeling when I GUESS that remain is best, and so are you, regardless if you are pro or anti brexit. Unless you are a full time researcher, academic or civil servant working in a multi-discipline committee that looks into this stuff, you are as clueless about the real details as me.

And yet we vote.

How can this work?

By all means give me a vote on broad priorities, based on gut feeling and general emotion. I am a liberal kind of guy, who favours LGBT rights, personal freedom, equal pay, right-to-choose and so on. I am also an economic freedom guy, who is pro-business, generally small(ish) state, progressive but reasonable taxation, etc. I am an environmentalist.

But ask me to make finer-grained decisions on the technical policy making? ha! no! I have no idea. Like many of you, I *think* i know how to do it, and have great fun making and playing award-winning video games about this very topic! But i’m increasingly worried that I cannot be relied upon to make informed, sensible decisions about intensely complicated political or economic issues like Brexit.

If playing Democracy teaches you anything other than ‘compromise is often good’, it should teach you that ‘holy crap this stuff is complex, and very hard to predict’. Why are we trusting mere voters to make this sort of decision? I am arrogant enough to consider myself educated, informed, interested, analytical, and a good person. I don’t trust ME to have opinions on this, let alone someone whom none of those words apply to.

And it will get worse. Climate change, and our response to it, is not a ‘gut feeling’ issue. Its hugely complex. Should we allow GM food and support nuclear power? How should we legislate to protect our privacy in an internet-of-things age? what can we do to prevent automation creating vast inequality? how do we legislate 3D-printed guns? how do we defend society from malicious use of drones? how do we balance security vs freedom in air travel? and the big insane ones like ‘what do we do when true AI is created’? and ‘what if nanotech makes the current economic system collapse’ or ‘should we ban human cloning’? What do we do if antibiotics stop working (possible) or quantum computing renders cryptography obsolete overnight? These issues are HUGE.

Imagine the shitstorm if we actually make contact with alien life? How the fuck will we handle decisions in a situation like that?

They say Democracy is the worst form of government, apart from all of the others. I reckon we need to make sure that when we talk about democracy we don’t get lured into thinking direct democracy and referendums are as good as representative democracy. I don’t think direct democracy works now, and I think its only going to get way way worse…

The really scary thing to me is that everybody THINKS they are informed enough. None of us are. This is dangerous.

So with all the current stuff in the news about Unity/Improbable and the counter offers from unreal, and the big epic vs steam thing going on… I think there are probably a few developers out there who think to themselves… ‘I wish I *did* have my own engine, then I wouldn’t have to worry about ANYBODY else’s code. The problem is… if you are used to unity or similar systems, you might have no idea where to start right?

The windows basics:

To have an app that runs under windows you basically need just two functions, WinMain and a Windows ‘procedure’ function that handles windows message. A stripped down winmain looks like this:

int APIENTRY WinMain(
                     HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR pszCmdLine,
                     int nCmdShow)
MSG msg;

gInstance = hInstance;
GetGame()->InitApp();

//main program message pump loop//////////////////////////////////
while(1)
{
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )//any for us?
    {
    if( !GetMessage( &msg, NULL, 0, 0 ) )//if so get em
        {
          return msg.wParam;
        }
    else
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
else
    {
        if(BActive)
        {
            GetGame()->GameProc();
        }
        else
        {
            Sleep(1);
        }
    }
}
return msg.wParam;
}

The only two exiting parts are InitApp() where I create all the Directx3D stuff, and load in any data I need, and GameProc() which is basically the games main loop. The window proc looks like this:

LRESULT CALLBACK WindowProc(HWND hWnd,
                                 UINT uMsgId,
                                 WPARAM wParam,
                                 LPARAM lParam
                                 )
 {
 switch (uMsgId)
     {
     //main switch statement for handling messages
     case WM_DESTROY:    //end the application
         PostQuitMessage(0);
         GetGame()->ReleaseResources();
         return 0;
         break;
default://default behaviour
        return DefWindowProc(hWnd,uMsgId,wParam,lParam);    
      }
}

Again the only exciting thing there is ReleaseResources() which basically closes down all that directx stuff and releases all the textures and any memory I allocated.

meanwhile inside that InitApp() thing I need to do this:

int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);

Which gets the desktop res for me to create a window, and show it to the world:

gWnd = CreateMainWindow("Production Line", gInstance, IDI_ICON1, IDI_ICON1, WindowProc, width, height, bwindowed, bborderless, 0, 0);
UpdateWindow(gWnd);
ShowWindow(gWnd,1); 

After that I initialise all the directx stuff, which I have written about a decade ago, its pretty easy to grab all that from the directxSDK. BTW that CreateMainWindow function is mine too, and looks like this:

HWND CreateMainWindow(char* appname,HINSTANCE hInstance,int IDI_SMALL_ICON,int IDI_TINY_ICON,
                       WNDPROC proc,int width,int height,bool bwindowed,bool borderless,int left,int top)
 {
     WNDCLASSEX wcex;
HICON icon = NULL;
HICON iconsmall = NULL;
if(IDI_SMALL_ICON == NULL)
{
    icon = (HICON)LoadImage(NULL,"data/icon.ico",IMAGE_ICON,0,0,LR_LOADFROMFILE);
}
else
{
    icon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SMALL_ICON), IMAGE_ICON, 64, 64, 0);
    iconsmall = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_TINY_ICON), IMAGE_ICON, 32, 32, 0);
}

wcex.cbSize           =    sizeof(WNDCLASSEX);
wcex.hInstance        =    hInstance;
wcex.lpszClassName    =    appname;
wcex.lpfnWndProc      =    proc;
wcex.style            =    CS_CLASSDC | CS_DBLCLKS;
wcex.hIcon            =    icon;
wcex.hIconSm          =    iconsmall;
wcex.hCursor          =    NULL;
wcex.lpszMenuName     =    NULL;
wcex.cbClsExtra       =    0 ;
wcex.cbWndExtra       =    0 ;
wcex.hbrBackground    =    (HBRUSH) GetStockObject (BLACK_BRUSH);

RegisterClassEx(&wcex); 

int flags = 0;
if(bwindowed)
{
    if(borderless)
    {
        flags  = WS_POPUP;
    }
    else
    {
        flags = WS_OVERLAPPED |  WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_BORDER;
    }
}
else
{
    flags  = WS_POPUP;
}

HWND gWnd = CreateWindow(appname,appname,flags,
    left,top, width, height,
    NULL,//GetDesktopWindow(),
    NULL, hInstance, NULL);

return gWnd;
}

TBH the only fiddly bit is finding a program to actually create a decent windows ico .ico file in all of its myriad different sizes. Plenty of them exist, but its something you probably did not realise you need. I also have to use a batch file and a little command line thing to stuff the finished icon into the exe, so that it shows up in windows explorer as well as when the window is launched (weirdly these are different things…).

Thats pretty much all of the ‘initialisation’ code you need to create a windows app. Obviously you then need an actual graphics engine, but thats not *too bad* to write yourself if you are not coding something that is huge and requires amazing performance or tons of shaders.

In 2D, everything is pretty simple. You just need a sprite class (I have a Base Sprite, which is just 4 vertexes and a way to manipulate them by scaling, changing UV values, positioning them etc), maybe a textured sprite (the same but with a directx/opengl texture pointer), and if you want to optimise stuff you need a system that handles vertex buffers.

In general I just have one (big) vertex buffer that I stuff with sprites during the main game render loop, and then call draw() on it every time I need to change the texture or one of the render states.

Input stuff is pretty simple. You should just hook into the windows WM_LBUTTONDOWN messages and others like WM_CHAR, and do some processing on them. Way simpler than using middleware for all that. If you need to know the current state of a key you can use this:

bool CBaseInputManager::KeyDown(int key)
{
bool down = (bool)(GetAsyncKeyState(key)& 0xFF00);
return down;
}

I *do* use middleware for sound, but you can get pretty affordable, pretty simple sound middleware from lots of places these days. I have not updated my sound middleware for a LONG time. I don’t do any fancy sound processing so why would I? Playing an ogg file or streaming one…is not complex.

Now obviously if you have never coded outside unity, then there is a LOT of stuff you take for granted that you would have to now write some code for, but you only need to learn these things once. Loading in a file, or browsing a folder for files, is just a few lines of code. Even writing an absolutely bullet proof ini file loader that operates efficiently and correctly and without bugs is only 913 lines of code by my count, and thats a LOT of whitespace, helper functions and wrappers around it.

If you start writing an engine early, when you are still doing hobby games, preferably simple ones, you will find it quite easy to scale it up as you make more complex games. The code samples in this blog post have been stripped of their error checking, and some game-specific checks and extra processing to make them clear on first reading.

Basically every game I make involves me adding some new functionality to my engine. Production Line was the first game where I had to create an isometric object class, and isometric renderer (basically just a system to sort by Z and then render…), an animation compression system and some metric reporting and user-survey stuff, but that was probably just adding an extra 3-4% to the size of the total engine.

I wrote the multi-threading stuff ages ago (Democracy 3 if I recall), although I seriously improved it this time. The original windowed GUI system was coded for Starship Tycoon (OMG). Most of the directx stuff comes from Gratuitous Space Battles 2. The current text renderer dates back to Democracy 2 for its initial version. The vertex buffer code started in GSB 1.

Don’t get me wrong, there is a LOT of code in an engine, and it DOES take a fair bit of time, but its a big, long term investment that definitely pays dividends. I don’t have to worry if unity supports X or Y, or if it conflicts with Z, or if they are going to remove it without warning next week (or break it). All the code works in a style I like, and with absolutely zero bloat.

The source folder for my engine is 100 files and 620k total. Its not *that* big. Obviously it compiles pretty quickly and easily.

…and don’t forget you can still code using an IDE (Like Visual Studio) with built in code syntax highlighting and intellisense (I recommend visual assist!). Do not fall into the trap of thinking its unity OR just typing in a command line window without any help!

I have been selling games a LONG time now (twenty years!). My first game to ever sell a copy was called ‘asteroid miner’ (later renamed star miner). Because in 1998 selling games online was all very ‘new’ I just used the root directory of positech.co.uk to store the shareware .zip file for my game demo, together with images not even in a folder, called ‘image1.jpg’ and other such unscalable stupidity. There was a ‘hit counter’ to show how many people had visited the website. A single screenshot, I think even a banner ad for someone else?

Anyway… the site has had a bunch of redesigns over those twenty years. it now supports https and even has a mobile version of the main page! it scales how much data it displays based on your screen resolution. (omgz). It now looks way better than it ever has, and currently looks like this:

Which is fine, and I like it, but there is a definite lack of consistency from an aesthetic POV the minute you leave the front page. Each game got a website designed ‘at the time’ with whatever cool ideas I had, or whoever I had hired to do the design. They all link back to the main page, and some of them even have ‘other games by positech’ hacked manually into the bottom of the page like this:

That approach never scales, because its just showing fixed games to people regardless how many years later it is, or the genre, or anything like that. Frankly I don’t shift many copies of Planetary Defence these days, so why even mention it. The approach is static HMTL, and its dated. Theoretically what I need is some sort of database driven website that shows my games, and cross links them properly.

Its not like I’ve never done it before, showmethegames.com was a vague attempt at that (although it never gained any real traffic). I could in theory code such a system myself, but I don’t want to spend the time (I am 100% busy developing Production Line & producing Democracy 4). The only motivation I would have for doing it myself would be that I HATE working with CSS/HTML code written by others, which is normally some over-templated bloated mess with at least 50x the code required to do the job.

So the question is…should I even be considering it? No doubt there are some great off-the-shelf products to build an online web store that would make it possible without a lot of hassle, but would I be losing the ‘feel’ of each individual games web page? Some of them have cool backgrounds, or videos surrounded by excellent artwork. Do I really want to reduce them all to the bland consistency of a steam store page style layout just for the sake of my own OCD and obsession with order?

Normally I would say no, but then i can’t help but think that steam, GoG etc all have standardised store pages, and nobody cares? Is the obsession with creating some sort of tailored ‘experience’ for visitors to your gaming website something that died out in the 1990s and we just are not accepting it yet. Its not like videos and lets plays and trailers are not a thing, do people really need a ‘shadowhand’ font on one page and the ‘democracy 3 CSS’ to give a different tone on a different game page?

I think there is an argument that the ‘big AAA studios’ who do this still are only doing it because its effectively 0.1% of their PR budget anyway, and they may as well cover all bases. In the end, isn’t a game really selling based on a screenshot, a short video, a review score, and the name?

The other way of looking at it, is what would be the upside? How many people buy big pharma direct from my website who don’t know we make production line, and would otherwise buy it right then (who would not have bought it at another point). Even if the number is 1% of total big pharma customers (and vice versa of course), is that really enough money to justify the cost and time to totally revamp the website?

I suspect, sadly it is not, and this may be relegated to a ‘wishlist’ thing. My own OCD and the fact that I think the current mishmash looks ‘amateurish’ are what is really driving me here, not any sort of business case. Its not like I’m looking for outside investors who may be put off by the aesthetics of my web page, and I really don’t care what people who are not customers think anyway.

Maybe I’ll reconsider it again sometime in 2029?

The change made by steam from a simple store front to a dynamic one based on who is logged in was a huge improvement. I was extremely pleased to see them do that. I find that for me, their algorithm actually works pretty well, and other stores are definitely not as good (yet). But lets stop congratulating things that already exist and remember three really important facts here.

Its 2018 and computers are fast as fuck

Most online web stores have a LOT of money

Most online web stores have a lot of clever coders working with them.

And now lets imagine all the factors we REALLY should be able to plug into some clever neural net that decides what games to show somebody. Starting with the trivially stupidly simple ones;

SIMPLE FACTORS

The genre of the game as defined by the developer vs the players preferred genre from playtime of other games or stated preferences

The weighted-values of all the tags associated with that game against the similar weighted values of tags that apply to the games the player has played (weighted by time and tag relevance).

The current price of the game compared to the usual purchasing p[rice at which the player either buys or wishlists / follows the game. (don’t show $59.99 games from a publisher who rarely discounts to someone who never buys a game over $5).

Really dumb stuff, like if the game is a sequel (determined by a scan of the name) to a game the player liked (or opposite if sequel to ignored), or made by the same developer.

Super-super-dumb stuff, like the platform must match the platform the player usually plays, and skew towards multiplayer if they only play multiplayer stuff, language option should include those the player usually has for the store interface.

NOW LETS GET CLEVER

We need to build up a major hidden customer profile that contains as much information about the player as possible. Stuff they enter into their profile page is a cute start, but its the absolute tip of the iceberg. Does the player have a lot of friends who are playing game X, and can we weight that by how *close* those friends are (by statistical analysis of the chart frequency and posting in similar discussions). Do those players have large average play times, or better still, have thy left multiple comments, or positive reviews. If so, factor that in when showing the game to them.

Is the player a bargain hunter? what percentage of their games were bought at each price point and each discount percentage. skew the game presented to them that match this purchasing pattern.

Do we know the players birthday? if so, send discount coupons to their close friends for games that are on their wishlist, to encourage them to buy those games for them in the week before their birthday. Skew those coupons to match the calculated likely purchase level that we can get from each friend.

NOW LETS GET EXPERIMENTAL

We only know about a game what the developer tells us, and use that as the final information on that game. Asking players to tag games is great, but surely we can go further. Internally we can know if a game is viral from the amount of instances where someone buys a game, and then a close friend of theirs buys that same game within a certain window. The virality of a game should act as a positive that results in us showing it to more people.

We can also re-evaluate all of the reviews left for a game to get a more accurate picture. If a player leaves 95% negative reviews, then they are basically just a bit grumpy, and we should skew the relevance of their reviews to the score. A player leaving overwhelmingly positive reviews, probably needs analysis to see what percentage of games they review, and if they were dissatisfied with other games but never leave negatives. If analysis of their playtime/refund rate, forum-participation and chat mentions suggests that this is not the case, and they are unusually positive, maybe skew down the relevance of their reviews too?

Reviews cores for a game being the same for everyone is a joke. Maybe everyone hated the game except for the 30 players who we estimate to be young Chinese players who tend to like funny games with certain tag combinations. If I match those reviews profiles really closely, I should see a review score FOR ME, showing how much people like ME, like the game.

Computers can analyse video pretty well now. Get an algorithm to watch 100 hours of youtube videos (or uploaded player videos) of every game, and try to draw some statistical analysis from it. Is the game clearly a fast moving, high contrast particle-fest bright explodey sort of game? Make a note. Is the game a slow paced, relaxing game with subtle color scheme? make a note. Is it clearly a brown man-shooter? etc…

Its 2018. I shouldn’t have to explain to people that production line has a similar aesthetic or feel to factorio and big pharma. an algorithm can do that for me.

Maybe some of this is impossible, or even undesirable. Its certainly a challenge. But the online store market wars are heating up. If you run a games store and do NOT have a bunch of coders attempting this sort of thing…well maybe you should look into that?

For the last few years Positech has done this thing where we basically take all of the money we earn from steam sales of Democracy 3 or any of its DLC during the War Child Armistice, and give all of that money to them. We just got our royalty reports and crunched the numbers, and this year that sum is £9,416.88, which I think is pretty good.

Basically if you bought democracy 3 or its DLC from the 6th-13th November this year, we gave all the money (well, our cut of it) to charity. This is the third time we have done this. The first time (which was the original armistice event), it was £15k, last year it was £10.1k, so its going down a bit, but on the other hand, we have contributed about £35k now, which isn’t at all shabby. To put all this into perspective,.. Positech is basically one full time employee (me!) and some contractors, although Jeff (D3:Africa,D4) is pretty much full time now). Imagine how awesome it would be if we could persuade some really big profitable games companies to do the same thing?

If you are wondering what on earth war child is, you can read all about what they do on their website here.

And if you are somehow here not knowing what Democracy 3 is, its a game we made about politics and elections and running the government, and we have a website about it here.

There are no comments yet