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

Stock Market Analysis ‘fun’

EDIT: lol. I had some serious bugs in my code, so ignore those numbers. The real ones are less extreme :D

To try and crack down on my almost comical tendency to overwork and be working 100% of the time, I decide to do some ‘fun’ coding today instead of work, to help me ‘relax’, which is something people keep telling me to do. Obviously I’m still me, so it involves programming..

I dabble on the stock market (I used to work up there many lifetimes ago) and something I have long found infuriating is the absolute awfulness of UK retail stock-market reporting. Its almost like they don’t WANT you to know if you are making money or not.

My broker (Hargreaves lansdowne) is great at telling you your current profit or loss as a percentage and in financial terms, on each trade, but this doesn’t take into account how long you held the stock, rendering it effectively useless. If stock A has been held 4 years and is up 4%, thats way less attractive than stock B, which I bought last Wednesday and is already up 1%. They make it IMPOSSIBLE to get the real ‘;annualized’ figure.

What I wanted was ‘the rate of return, if I held this stock for a year, and the stock growth was linear over that year, given its growth during the time I held it’.

It turns out, to do this, I had to copy and paste a bunch of PDF files into .txt files, then write my own code to parse it all and rearrange it into a CSV so I could visualize it using excel. This also meant grabbing a copy/paste of today’s prices for stocks I still hold and have not sold, and then doing the SUPER TEDIOUS work of copying and pasting dozens of names, because it turns out HL use ‘different text’ to describe a stock in their PDF reports than they do in their live prices (grrr). Its also annoying that they changed their formatting about 2 years ago to include the exchange code, so I had to detect those and strip those out of some lines of text. Plus there are other errors, and missed text here and there, meaning my results are (so far) probably not 100% accurate.

I suspect all the data I *do* have is correct, but in some cases there are some missing buys and sells, so I’ve effectively ignored those stocks.

Still…it amused me for over half a day, and means I can bask in my glory on these stocks:

And cry into my sleep about these…

None of it is as good/bad as it looks, because the results are annualized. For example I think I held my bitcoin for about 48 hours, and some of the others I held for very short periods as well. Its probably worth doing some sort of clever smoothing code to work out which are the ‘long term good picks’ versus me just getting lucky over a week or a month.

My TSLA stock is a good example. I’ve made a series of buys (and one sell) over a great many years, and although its been very volatile lately, the ROI on an annualized basis is looking pretty sweet. The Biotech Growth Trust is also looking pretty cool, and I’m also happy with Materialize and Teradyne.

I should probably do that pointless legalese bullshit here that says ‘this is not advice’, but frankly if you take stock picking advice from a British Chocaholic game developer who likes to drink a lot, then you probably aren’t going to listen :D.

Democracy 4 – Multi Party Support

So I had a sudden mad rush of adrenaline this past weekend and decided I should code multi-party support into Democracy 4. This is something people have asked me for over a very long period, but I’ve always resisted it. I thought it would change the game into some horrible three-way negotiation and back-room dealing simulation rather than be focused on actual policies and theories which is what I am more interested in…

Actually I’ve always found it weird people WANT the game to be basically more like the corrupt, undemocratic bullshit that a lot of western multi-party politics has become. Surely in our heads what we want is a trial of ideas and philosophies where the best policies for the people win? nobody fantasizes about having to implement policies you hate because you need to haggle with some other party leader?

The sheer optimistic joy of coalition government

Anyway…eventually me and Jeff got chatting and decided that there WAS a way to include some elements of multi-party politics, without totally breaking the way the game works, and which could work within the existing framework of political capital and policy decisions. But first, I had to sort out the UI.

Democracy 3 has always had 2 parties, and because I never intended to change this, there were actual hard coded ‘pointers’ to the player and opposition parties everywhere in code. Essentially this just meant a lot of donkey-work going through code and changing this to an open ended list everywhere, and checking everything would save and load ok, and that we didn’t have any legacy stuff referring to ‘the opposition party’ in the code.

Then I needed to re-jig a lot of GUI code. There were basically three places where parties get referenced, the party screen (showing members/activists over time), the fundraising screen (this was part of the D3 electioneering DLC but now integrated into the game) and the election results screen.

As I write this, I’m done changing all the GUI apart from the post-election breakdown of each voter group and how they voted (it needs different colors for each opposition group too). So right now, the post-election screen in a 3-party game looks like this: (work in progress BTW)

shiny new user interface (work in progress)

I’m thinking (for now) that a 3 party limit makes most sense. To explain that, I need to delve into the two areas that are needed to make this work within the simulation: Joining parties, and coalitions.

In the current game (Democracy 3) party joining is simple. Players build up over time a sympathy to a party if they are super happy (player) or super unhappy (opposition) eventually joining that party. A weakening of sympathy for a party over time results in the player leaving. I decided to keep this system, but to position the new 2nd opposition party as a ‘centrist’ party between the player and the opposition. In other words, if a value of 100% happiness means joining the players party, and 0% means joining the opposition, 37.5% means joining the new centrist opposition. Why 37.5%? because we still see 50% happiness as being the point where you will vote for the player (if you vote…)

Let me explain the term centrist. I’m not referring to politically centrist at all. In fact the game makes no explicit assumption about the political position of either opposition party. Basically the ‘opposition’ are the party who absolutely oppose your party position on everything, and the ‘centrist’ party (the new 3rd party) are midway between you and the opposition. In theory, your party could be centrist, the opposition right wing, and the new opposition mildly left wing. The key point here is that the new opposition is *closer* to your position than the old opposition is.

random image of yang for no reason

So…I’ve done all the code for this and modeled correctly voters joining and leaving all 3 parties over time. So thats in the game and working (hurrah!). The next thing I need to do is to code in the effects of a coalition.

If your party gets >50% of the votes in an election (ignoring absent voters) then you win just as before. If you do NOT get that, but you ARE the largest party…then you go into a coalition in government with you sharing power with one of the other parties. At first sight, this makes no difference to how the game is played…

…but actually it reduces your political capital each turn dramatically. In other words…you really cant get much done. HOWEVER, you will be regularly offered deals by your coalition partner, where they basically say ‘implement/cancel/change THIS policy, and we will give you X political capital’. Obviously we will engineer code that will always make that an *interesting* decision for you to make. In other words, to reference my own countries recent coalition government, this is ‘give us a referendum on political reform and we will stop blocking your economic policy’. Obviously in real politics this happens all the time (in >2 party systems).

yet another group of happy politicians in a coalition! compromise feel so great!

Hopefully this strikes an interesting and acceptable compromise between having all the machinations of multi-party government, while still keeping the game playable and understandable to people who enjoy Democracy 3. I do intend to make this totally optional as a parameter when you start a new game, so you could (for example) play the USA as a true 3 party system, or Germany as a 2 party system, whatever appeals to you.

This is the first big ‘gameplay’ change that makes Democracy 4 different to democracy 3. So far its been tech changes (multi-language text rendering and vector graphics) and UI changes (OMG it looks so much nicer). We also have a lot of content changes planned (policies,events etc). More on that over time…

Democracy 4 GUI update

We are still working away on Democracy 4…although I have not blogged about it much. This is partly because Jeff is doing a lot of ‘under-the-hood’ debugging and GUI support stuff, so there has not been that much to show for it yet. Unlike many sequels we are doing this GUI first and Mechanics / Content second, so for a while, it will look like a beautifully re-skinned democracy 3, until we start adding all the new events and policies etc.

Anyway… I sometimes forget how much slicker and cleaner the new UI is because I stare at it a lot, but here is a side by side comparison of the electioneering ‘perceptions screen’ for both games:

(BTW we likely will not use those same Democracy 3 icons for those 3 things, they are placeholder).

Re-sized screenshots do not do the GUI justice really, because its vector based and super-super-crisp. I do think that having a proper UI style guide, and vector graphics is going to make the new version feel SO much nicer to use. The previous game is from 2013 and starting to look like it…

There will be a lot more updates to come once we start putting in the new events. We just ordered all of the event graphics (and there are 95 of them this time, for even more actual events) and I’m looking forward to blogging about the new stuff we are adding.

Oh and in case you didn’t realize from the above screenshot, ALL of the content from Social Engineering, Extremism, Clones & Drones and Electioneering will ship in Democracy 4 as standard.

Reboot red (Banff)

So recently I went to Canada for reboot banff, although tbh half my reasoning was to go to the games conference, and half was to go on holiday with my wife as we had been there a long while ago and loved it, so we knew it would be a great place to go visit. This was a pretty small games conference (500ish people), when you compare it to the likes of GDC, but it was worthwhile, the talks were mostly good, and the atmosphere (in every way) was just so much better.

One of the things I really dislike about GDC is its price tiers. You are literally barcode scanned when entering a talk to check you are sufficiently wealthy enough to hear what is being said. The top tiers are stupidly pricey. I’m a bloody successful developer, but I’m not paying thousands of dollars just to sit in a few room and hear people tell me about the way they used shaders in their AAA game, or to give us a post-mortem that is 50% advertising and pitching for a better job at another company…

Everything in reboot is the same price, plus you get FREE coffee and buns/cakes/yummy things in the morning and afternoon and a FREE buffet lunch. Everyone mingles, everyone is chill. There are no torturous queues to be able to spend $5 on a crap cup of coffee… its ace.

Plus for fucks sake…banff. I’m sure we all know about the insane homeless problem and literally shit problems in San Francisco. and here is a picture I took at banff from my hotel window:

I was celebrating something while I was there, so we did something truly insane and went on a helicopter trip to the nearby mountains, and I cannot convey the awesomeness of this with a mere photo like this:

But trust me it was amazeballs.

The hotel that the conference was at is very nice, although you need deep pockets to eat there each night, but luckily the town is way cheaper and a very pleasant walk 15 minutes along a clear glacier-water stream. Hardly a chore. We saw a fair few deer on our walks there, although TBH living in the UK we have deer in our garden now and then but still…its pretty cool.

The talks were a nice variety, a fair few businessy ones which I found interesting. Some slightly avante-garde ones too, but I chose mostly business and industry ones. I went to probably 4x as many talks at this as I do at GDC, which is amazing really, given GDC has about 50,000 talks (about 5 of which you can go to as an indie…).

Anyway, the real value in these things is the over-dinner and after-party chats with fellow devs. I met some new people, re-connected with old friends etc, and it was cool. I definitely learned some things, and its good to take the pulse of other indies in person. Would I go next year? Maybe… I don’t know what to do about GDC. I’m thinking NO, mostly because of flying, but it will be Democracy 4 launch year so maybe I should? Still undecided.

But I give reboot 5/5. You should go.

Positech’s Cameroon School #2 photo update

As you might know from previous blog posts, in partnership with the charity ‘Building schools for Africa‘. we have funded the construction of two schools in Cameroon. The first one was completed ages ago, and the new one should be opened real soon. Here are some new pictures:

To recap earlier posts: ” The project is just the three classrooms, an office, a latrine with hand washing facilities, 27 benches to seat 54-81 children (depending on their age and size!) and 3 tables and chairs for the teachers, tools and seeds for the school garden, project management and monitoring costs. ” Cost to us: about £24,000.