Five years ago, we started blogging about building Powargrid. Obviously, we did so here, on powargrid.com, since back then we didn't even have a studio name yet. Now that Powargrid has been officially released and we've started prototyping other games, it's time to move the blog to our studio website: www.weefreestudio.com/blog. All old posts will remain available here.

​Where do ideas come from? How do you generate good ideas (for games)? How do you make the ideas stop? I won't pretend to know the real answer to any of those questions, but today I'd like to ramble a bit about things like inspiration. This will probably be a short blog post, but I've been known to write a bit more than I originally intended .

So, I'm one of those people who have lots and lots of ideas. They (seem to) just pop into my head. Perhaps this makes me a creative person. Perhaps a different diagnosis applies :). Most often, these ideas are about games, with stories being a good second. In my experience, these ideas come in two types: unconscious and (semi-)conscious.

The unconscious ideas are by far the strangest. What seems to happen is that a fully formed idea, usually a concept for a game, just springs into my head out of nothing. It feels like being hit by one of the inspiration particles Terry Pratchett wrote about:

For good measure: the last part of this quote doesn't apply to me. I don't feel unfortunate for receiving a lot of inspiration particles and I certainly don't get them all. Else I'd be Leonard of Quirm :).

I've read a thing or two about (the little we know about) how our minds work and what causes inspiration, and I know that how it feels does not equal how it works. You could say that your unconscious mind is always working on things without you knowing about it. But I always have this nagging feeling that what we call the unconscious mind is actually just the conscious mind forgetting what it was thinking about an hour ago. Or perhaps not forgetting, but filing really condensed versions of these thoughts away in cabinets that can't be consciously reached. What ever way that actually works, the gist is that the feeling of being hit by an inspiration particle is probably a result of a lot of unconscious thinking.

​Much more about this subject (and lots of examples) can be found in Steven Johnson's book Where Good Ideas Come From and in his TED talk by the same name:

This wisdom and knowledge notwithstanding, Terry Pratchett's inspiration particles are still a wonderful shorthand to describe the way this feels. So that is the way Michiel and I refer to new ideas.

What happens after I've been hit by an inspiration particle is that I take a mental look at it (consciously, in case you're wondering). The base idea usually isn't all that big; more of a general concept than something completely worked out. But when I poke at it, for instance by identifying problems and asking how they are mitigated, answers often just seem to be there. As if the idea really did arrive fully formed, and you're just skipping to the page of the mental design document that has the information you were looking for. Again, I realise that's not how it works. But I do wonder whether my mind is actually making these things up on the fly or whether these are indeed already part of the idea that has unconsciously formed.

One -admittedly first world- problem with being hit by an inspiration particle is that it will start buzzing around in my conscious mind. And this is great. The idea expands, changes, is refined and sometimes parts are cut away from it (and sometimes the entire idea is discarded on closer examination, which is also useful). But it does drown out what I'm working on at the moment. Not a problem if I'm cleaning up the house, but it is a problem when I have to do work for which I need to think (deeply).

What helps is the age-old trick of writing things down. At first this may be just a few notes on a piece of paper, but to really free up my mind I (have to) type the entire thing into a document I call 'my ideas file'. Since doing this is another way of poking at the idea, the idea keeps expanding during writing. But eventually I catch up and have all of it in my file. I can then go on with what I'm supposed to be doing. Until the next inspiration particle strikes, that is :).

Hm, I just looked back and saw that I've already failed to write a short blog post even though I'm only halfway done.

Yes, I chose to go for a facepalm instead of changing the start of the post.

​So I guess I'll write down what I want to say about (semi-)conscious ideas in the next blog post. I'll leave you with what got me to write this post in the first place.

My kids were watching the Muppet Show the other day when Kermit decided to do some more reporting from the planet Koozebane (although I've always thought of it as Koesbeen; owing to Dutch being my first language). This is the scene they watched:

​I love the punchline there. And while I laughed, this also was a big WTF moment for me. I remembered having seen this before, but I also had forgotten about it for years. In those years, Michiel and I built Powargrid an I made up a lot of stuff for the storyline. For most of it, I have no idea where my inspiration came from, but for a few ideas this Koozebane visit by Kermit must have been a big influence. It's really, really weird to suddenly be confronted with something my unconscious mind used as inspiration / reference without telling me about it.

And it's cool to catch a glimpse of how my mind works, even though it's also kind of scary to realise how much goes on in my brain without it telling me about it :P.

May you never lack inspiration!

- Willem -

PS; Posting this text on our blog was postponed a few hours in order to write down in my ideas file:1) an idea for series of easy to read stories for my son and2) the basis for a board game design, for which the main inspiration was the question whether it's possible to create a physical board game with simultaneous turns.I hope this isn't too much of a surprise :).

Today, a short blog post about something we didn't do instead of a long one about something we did :). As mentioned in the last blog post, we haven't included support to add one or more AIs to games with 3+ players. Here, I'll dive into the two issues that make this difficult enough to justify (in our eyes) not adding this in the multimultiplayer update.

First off, ​playing with more than two players (or teams) adds a formidable amount of complexity to Powargrid. Determining the game state and choosing which opponent to attack becomes much more difficult, since you don't just have to evaluate which target can most easily be reached, but also which opponent is the most dangerous to you. Attacking a weaker opponent can be bad for you if that gives a more dangerous opponent time to build up superior defenses or (worse) pull ahead on the number of power plants.So sometimes you want to refrain from attacking. Or perhaps you want to put weapons down that threaten a player's base without actually charging them, awaiting the opportune moment or forcing them into a (temporary) alliance with you.Which brings me to the social aspect, which is an even harder problem to tackle than the one above. While entering into formal(ish) alliances is rare in games like these, informal, spontaneous unspoken ones are quite usual. I usually see those as a small version of 'live and let live' arrangements that sometimes emerged during WWI, including all the fragility and vulnerability to (perceived) missteps those had. Luckily Powargrid is a lot less lethal.Both the tactical and the social aspects are needed in an AI, at least to a certain degree, to prevent the AI from being too stupid, too frustrating or both. An AI that consistently attacks the weakest player and then gets overrun itself is no fun.As an example, take a look at the gameplay GIF I included in the last blog post:

If you look closely at the gameplay, you'll see that yellow keeps attacking green, even though blue is clearly (to the human eye) the largest threat. Once green has only one power plant left, blue moves in to destroy yellow in a swift attack while ignoring green. Yellow didn't see this coming and didn't have the resources or defenses to repel the attack. After this, green's single power plant was easy to pick off for blue.Perhaps not surprisingly, I recorded this GIF by playing (with blue) against three Skrimish AIs. And since my aim was to create a nice-looking GIF, I didn't even fully exploit the tendency of the AIs to go after each other. I hope this gives you a feel for why creating a Powargrid AI fit for multimultiplayer games is difficult :).

The second issue in creating a multiplayer AI crops up when you play in teams. The problem I described above goes away if the players are divided into two teams. But then the AI(s) will need to cooperate. And while I think anything beyond 'kill the other team' is a bonus, this doesn't hold up when it comes to blocking, which we found out when building the seventh campaign mission: A Piece of Paradise.

It turned out that the AIs often blocked each other, since they can't use each other's network, can't shoot through their team mates' buildings and can't sacrifice buildings to make room. The consequence of this was that the blocked AI started to build lots of power plants, eventually making the mission unwinnable. This was before the cost of power plants went up the more you had, but even now, the AI would just spam out lots of substations. Which looks stupid (imho), impairs its ability to build weapons to defend itself and creates a frustrating grind the player has to go through to get to the enemy power plants.In this mission, we solved this by defining sections of the grid that are forbidden in the pathfinder. Michiel expanded our A* algorithm for this purpose (for more about that, see this blog post). In the picture above, the path yellow has used to get to blue's base is forbidden for green. The forbidden tiles for yellow lie on the outside of the grid.While this is a good solution for A Piece of Paradise, it would be a hell of a job to implement this in a general sense. Hardcoding this into each AI for every map, every starting position and every possible distribution of players in teams is obviously way too much work. But writing something general is difficult, espectially if you want the AIs to be able to communicate about this. Also, sometimes it can be a very good move to block your team mates, since that may save them from an incoming attack.So this is also a difficult nut to crack. And even then we're only looking at the first step of cooperation.

So that's why we haven't included adding AIs to 3+ player games in the multimultiplayer update. And to be honest, I don't think this is something we'll add in the next update. We' But we will keep this in mind.

I guess that the short blog post turned out to be a bit longer than I'd thought, but I hope you liked it :).

-Willem-

PS; don't hesitate to let us know if there are Powargrid features you'd really like to see or if there is a subject you'd like us to address in a blog post.

Yesterday we released the first Powargrid update on Steam. We put a post about that on the community hub which highlights the changes we made. We'll repeat some of that here, but we'll also dive a bit deeper into the changes.

​Eight person multiplayer

​The AI in Powargrid has been called intelligent and even devilish. But since humans are much better than the AI at taunting, throwing insults, gloating and being sore losers, the real fun for many players is to play against - and try to defeat - a human opponent.To multiply this fun, we've added multiplayer matches with more than two players. Hence the multimultiplayer update - we couldn't find a real word to use :). You can now host multiplayer games for up to eight people. You can choose whether to fight in teams or go for free for all mayhem.

Adding the possibility to play matches with more than two people sounds rather trivial. And while we knew there were some issues to be expected, getting the multimultiplayer to work was harder than we thought, even though the basic code was already there.One thing worth of mention is that we wanted to support any number of players up to eight. But since Powargrid is played on a square grid, there is no obvious balanced placing for other numbers of players than 2, 4 or 8. Just take a look at the examples above.In order to get balance into the starting positions, we've had to juggle with the distance between power plants, the distance to tiles from where other players' power plants can be shot, how far away the starting positions are from corners and which building each player starts with. On top of that, the starting positions shouldn't just be as fair as possible, they should look fair as well. On the other hand, what looks fair at first may not be as balanced when you look closer. Take a look at these two eight player starts:

The starts on the left looks fine. The building placement has a nice symmetry going on (yay) and we're used to starting positions like these from the two player game. But actually, the four players in the corners have an advantage over the others. so we had to reshuffle the positions to what you see on the right.And even then, the lakes in the middle of this map create an asymmetry we can't solve here. But that's a problem you'll have to live with. Just like you'll have to live with the fact that the main challenge in winning an eight player free for all lies in navigating the social interactions, not in an (un)favourable starting position ;).In the end, we hand-picked all starting locations for each of the maps for each number of players. Do let us know if you have an opinion on whether we did a good job.

In a future blog post we'll probably write about the other problems we encountered in adding multimultiplayer. From the best way to create the menu to handling disconnects to (the lack of) starting perks to why we haven't added the option to add one or more AI players to these games.

​New skirmish map

The blue-hued nighttime map you see in the screenshots above is our new map, Marsh to War, which we announced in our previous post. It can be used for both skirmish and (multi)multiplayer matches with up to eight players. The gameplay is quite different from the other maps and we hope you'll enjoy it.​

​Powargrid demo

Along with the update, we've also made a demo version available, with the first five missions of the campaign. While we (of course) hope to reach new players with the demo, we also had existing players in mind. With the demo, you can join (but not host) multiplayer games. So if you own the full version of Powargrid, you can always play a (multi)multiplayer game with your friends, even if they only have the demo.

We haven't included skirmish mode in the demo. We think that would go beyond trying out the game, what the demo is for, since a lot of the replayability for Powargrid lies in playing the skirmish mode. But we did make sure that achievements, which add to the replayability of campaign missions, are carried over when you get the full version.

​Visual changes

Something that has bugged us for a while is that the visuals for the sixth mission (Seeing Red) do not compare favourably to those for the rest of the game. What's more, the idea that you're on a small mesa / hilltop in the same jungle you fought the previous mission doesn't show. Fortunately, Michiel had a brainwave that solves both these issues. He tweaked the terrain, removed a lot of the trees and added a background that shows the previous battlefield in the distance. What we especially like is that at first glance it simply looks better without immediately recognising what the background is until you focus on it. Or that's what our first tests showed at least. Have a look for yourself:

We've also changed the menu scene, which now uses the terrain of the second campaign mission. This is a more alien and varied landscape than the background we used to have. The original layout allowed for more balanced games between the two AIs (and yes, what you see in the background in the menu scene is an actual battle between two AIs that plays out differently every time; hit F10 to hide the menu and see the battle in full), but the new layout is visually more attractive. And the AI battle is still fun to watch. Or so we think. We may be weird. We know.​

We hope you'll enjoy this Powargrid update. If you do, please don't hesitate to share it with your friends. And don't forget to invite them for a game of multiplayer :).

It's been a long time since we wrote a blog post, way too long actually. So here's a long overdue update on what's happening. We haven't been idle in the last months, but it's mainly been behind the scenes work; sketching out and prototyping ideas for new games. We're happy with the progress and I expect we'll be able to give you a first look somewhere this summer.Personally, I've also been practising my programming skills. Specifically, I've been learning to use C# in Unity3D, since that's the language we'll most probably use for our next big project (and the language Quill18 uses in his great programming tutorials). I've had a lot of fun coding and it resulted in a small side project that will get its own blog post in a while.

But the main news I have for you today is that there is a Powargrid update in the works. It will add a couple of features to the game, two of which I'd like to share here.

First off, we've decided to add support for games with more than two players to Powargrid. Multiple people have requested this, so we hope this will be a welcome addition to the game. How many players are supported will differ from map to map, but the maximum is eight. It will be possible to play in teams or to initiate a free for all (imagine that with 8 players ;). Both of these modes should bring new strategic considerations to Powargrid compared to one versus one games.

​Another thing in the update we can already show you is a new skirmish / multiplayer map called March to War:

Gameplay-wise, this map took quite some tweaking to get right. The basic premise is simple: have multiple viable paths to reach your enemy, in this case two impassable areas that can be shot over with cannons. But as always, the devil is in the details. It turns out that having a path through the middle leaves too little relevance for the sides of the map, which means that the map is not much different from one that is simply narrower in the middle. Eventually we figured out that we could create a more interesting map by making the path through the middle longer. This created the dynamic we were looking for and we're very happy with the end result, both for the gameplay and the looks.

We'll release this update at the end of May. When we know the exact date, we'll post it here. Also, if you've bought Powargrid on Steam, you should receive a notification in Steam somewhere in the first week after the update. There is one more thing we're adding in this update, but we'll tell you about that in the next blog post (which we'll write soon, I promise :).

Last Wednesday, we were invited to demo Powargrid at the monthly Dutch Game Garden networking lunch. It's a fun event where you can showcase your game and chat with fellow game developers!

We've been there a couple times before, and it's always fun to showcase our game! This time, we mostly had a chat with a few fellow devs, visited Game Drive (who helped us market our game) at their new office and left with plenty of food for thought about how to present our game, for example on our Steam store page.

That's us talking to Bram from Game Drive, and Bas from Abbey Games who gave us some good advice. Once again I am reminded we are not big dudes :p

Thanks again to DGG for inviting us, and to those present for the fun atmosphere, pleasant conversation and new insights!

Quick! How much is 3 times 28? Or in Powargrid terms: do you have enough juice to double charge this tower?

We realized, again as we were watching people play our game, that we make you do a lot of mental math. Now, Powargrid is not supposed to be easy, but it's definitely not meant to be a chore! Last time I heard, computers were pretty good at math, so let us help you out by having them do some for you :)

Yep, the tool tip now tells you how much a double charge will cost, and it'll light up in red if you don't have enough. You're welcome, and sorry it took this long!

Hi, Michiel here! After watching a few videos of people playing Powargrid, I noticed that they were often looking for a place they could place a certain building, moving the mouse around until they found a good spot where they could afford to build it. I've been working on this game so long, I mostly just know without even thinking about it -- so that was a good wakeup call that something could be improved there.

I'm now trying out a little visual aid, by highlighting the tiles you can build on and "lowlighting" (is that a word? de-emphasizing!) invalid tiles.

For me, it's REALLY weird to change anything to the core visuals after staring at them for years -- but I think this is going to be an improvement!

I've just set the new build live on Steam, so everyone should be receiving the new version shortly. Tell us what you think!

This time, I'd like to talk about some of the implementation details of our AI scripting framework. If you just want to write your own AI, you don't need to know about any of this! Still, I'm sure some folks will find it interesting :)

MoonSharp

Our game is made in Unity, which gave us several options to embed a scripting language. We went with MoonSharp, for a few reasons:

it's entirely written in C# and designed to be used with Unity, which means it's a matter of dropping a single, cross platform DLL into your project and you're ready to go

you can have multiple interpreters in a program, so each user AI gets its own environment

Sandboxing

Playing against someone else's AI means running their code on your computer. We have to ensure that it's safe to do so: we don't want an AI to give someone else access to your computer, to delete your files, or in fact even look at them. That's why the AI scripts run in a secure environment, called a sandbox.

The sandbox strictly limits the files an AI script can access: you can use the "require" function to load additional modules, but you can only load Lua files, and only from two places: the AI's own directory, and the Shared directory that contains utility modules you may want to share between different AIs, like our ailib module.

We also limit the built-in Lua modules you can use. For example, you can have math, string and table, but not os, the interface to the operating system.

Threading and command queue

We had several requirements for the AI framework:

API calls should be blocking: if you say "build me a power line", that power line should be built when the function returns. This makes for a much nicer interface than, for example, something based on callbacks.

an AI script must not be allowed to freeze the game while running, even if it goes into an infinite loop.

AI scripts must not be allowed to interfere with each other.

To make that happen, each AI script gets its own Lua interpreter and runs in a separate thread.

Multithreading is hard, especially when you're trying to share data between threads - so we don't, or at least, we share the absolute minimum.

When it's the AI's turn, the framework takes a snapshot of the current game state: how much power does each player have, what buildings are on the board, how many charges does each weapon have, etc.

If the AI calls a function that just returns information about the game state, this is answered based on the snapshot. Since Powargrid is a turn based game, nothing can change until the current player makes a move.

When an AI calls a function to change the game — for example, placing a building — the AI thread enqueues this command and on the next frame, the AI framework, running on the main thread, picks up the command, tries to execute the action, puts the result (whether it was built or not) on the response queue, and takes a new snapshot. The AI thread that was blocking on the response queue picks up the response and returns that to the Lua script as the result of the "build" command, and the AI can continue.

That's it, in a nutshell! Again, don't worry about any of this when writing your AI. Just take a look at the API docs and the example AI, and start hacking!

Tomorrow, October 5th, we're launching Powargrid after more than 5 years of working on it. We've talked about that process before here on the blog, but today I found myself just mulling over the idea of making things.

Because, strange as it may sound, I'm really excited by the fact that we've made something that wouldn't have existed if we hadn't made it. Obvious? Yes. But that doesn't make it any less true for me :). If all goes well, starting tomorrow, people will buy, play and enjoy our game. And that's just amazing.

Powargrid, the thing we made that wouldn't exist if we hadn't made it!

Anyway, we're really looking forward to the launch tomorrow. We're also very curious (and a little terrified) to hear what people think about it. We'll share any reviews, let's plays and other coverage through our Twitter account (@weefreestudio).

- Willem -

PS: just in case you haven't seen our Steam store page yet, here's a link :)