Welcome to part 3 in the series on our AI scripting framework! See part 1 for the introduction and part 2 for a short description of the debugging tools.
This time, we'll look into the functions you can use to interact with the game. The technical term for this is the "API": the Application Programming Interface. Or in this case, maybe it's an AI Programming Interface!
The API defines the functions your code can call do to get information about the current game, and to perform game actions like building things and charging weapons.
Your AI script has access to two global objects with useful functions: Game and Debug. Debug just lets you write stuff to the console. The Game object is what lets you see and manipulate the game grid. It has functions to look at the current game state, like GetMyPower(), GetPiece(x, y), GetHitPoints(x, y), and functions to take actions: Build(piece, x, y, direction) and Charge(x, y).
Of course, those are very low level functions, and to make your life easier, we include several modules with useful functions, including an A* pathfinding implementation for navigating the grid. These are written in Lua, so you can look at the source code and copy/modify/reuse whatever you like! In ailib.lua, you'll find higher level function like ailib.findPieces(pieceType, player),ailib.canHitFrom(tile, withTower, withCannon, cannonDirection) and ailib.getBuildCost(pieceType, tile).
There are many ways to figure out where to go on the grid and how to get there, but you'll probably want some sort of pathfinding algorithm, and A* is great! It's my favourite algorithm. My wife thinks it's strange that I even HAVE a favourite algorithm, but hey, that's what she gets for marrying a nerd :)
If you want to know more about pathfinding in general and how we used it to create the built-in skirmish AI, check out this blog post: http://www.powargrid.com/blog/powargrid-ai-part-1-intro-and-pathfinding.
Documentation and example AI
You can find the descriptions for the Game and Debug modules, as well as the Lua utility modules, in the API documentation. If you're not sure how to use a particular function, see how the Daft Wullie example AI uses them. Still stuck? Ask us on the forum or our Steam community hub, we're happy to help!
In the next installment we'll take a look under the hood of the AI framework.
The previous post introduced the Lua scripting framework that lets you program your own Powargrid AI. Now, I'd like to show you the debugging tools we're providing you with. Nobody said this was going to be easy, but we're not sending you in without a little help!
You can edit your AI in whatever text editor you like. I like Sublime Text, but the choice is yours! Just get yourself something that has a bit more features than plain ol' Notepad :)
It's the most basic method of debugging, but it's never let me down: print stuff to the screen. Your AI can write messages to the AI debug console, which is visible if you've checked the "Enable dev tools" box in the Add-ons menu. Simple "print" statements will go there. If you want to get fancy, you can use the Debug.info, Debug.warning and Debug.error functions to write text in different colors according to how urgent a message is.
Another important feature is the reload button: you can edit and reload your AI scripts whenever you want, and the changes will take effect on the next turn.
We use the MoonSharp Lua interpreter to run user AI scripts. It comes with a pretty decent debugger, which runs in your browser. To open the debugger, hit the "Open debugger" button in the AI console. Your browser should open automatically - if not, just browse to http://127.0.0.1:2705/. The debugger will pause your script at the start of the turn() function, and you can step through the code, set breakpoints and watch variables.
Now how do you actually interact with the game? Build stuff and blow things up? We'll cover that in the next post!
We recently added a feature to Powargrid we are very excited about: a framework/interface that allows you to program your own AI to pit against yourself, your friends, and other AIs!
User AIs are written in the Lua programming language, a very popular programming language for scripting and modding games. Famous examples include Civilization V and World of Warcraft.
Add-ons (just user AIs for now, but maybe we'll add custom maps later!) are loaded from the Addons directory, but you have to enable this first. To enable add-ons, go to the Settings menu, select Add-ons, and check the "Enable add-ons" box. This lets you run AIs you've put in the add-ons directory. If you want to write your own AI, also check the "Enable dev tools" box. This enables the debugging console in skirmish games with user AIs.
There's a button to open the directory in a file browser; it's located at .../path/to/Powargrid/Add-ons/AI. Inside you'll find a directory containing "Daft Wullie", our example AI. It's named after a Discworld character, because we are both huge Terry Pratchett fans :)
The next posts will discuss the debugging tools we've included to help you write your own AI, the functions you have available to do so, and a bit about the technology behind the user AI framework, for those that like to take a look under the hood. Stay tuned!
Do you like The Daily Blobbie? Now you can make your own!
Yes, Mr. Swap, they can! Just go to The Blobbie Meme Maker, pick your blobbie picture, and enter your text! Comes with buttons for easy sharing! We're looking forward to seeing what you can come up with. We'll feature our favourites on our Twitter feed :)
It's no secret that we've been building this game for a long time. For over five years in fact. And during that time, we've had to learn loads of new things. One of those things was learn how to draw characters that were acceptable for Powargrid. Since I was well aware of my artistic limitations, I decided that the main characters would be blobbies. Blobbies with one eye to be exact, so drawing them (without taking forever) would lie within the realm of the possible for me. The first iterations of Commander Grak looked like this:
I was thinking along the lines of amoeba, and I also figured that I'd need variability in form to be able to convey emotions. But this didn't work well enough, so eventually we settled for a more defined (though not more solid) shape. Turns out that you can convey a lot of information about how a blobbie feels with just an eye, a mouth and an eyebrow.
Once we got to that shape, I thought it was just a matter of drawing a picture for every dialogue node. How naive of me! Over time, as I drew hundreds of blobbie pictures, I actually got better at it. Or, to be more precise, I learned a couple of things. First off, we humans are really, really good at detecting where someone is looking. We notice the tiniest fractions when it comes to how the iris and pupil are placed compared to the white of an eye.
I also found that dialogue pictures work best if the blobbie is looking straight at you, except when there is a good reason to look some place else. Down if they're ashamed or up if they're exasperated for instance. In the earlier pictures I made, I wasn't very precise in these placements, so it felt like the blobbies were telling you things without really being interested in you. And even though this would probably be in character for most of the blobbies you'll encounter in Powargrid, it works counter to drawing the player into the story. So this had to change.
Second, what I realised early on for the body shapes is something I didn't realise for the mouths and especially the eyes until a lot later. I purposely started out with eyes that weren't perfect spheres. That just didn't feel right for the blobbies. And that is still true. Using perfect spheres makes them lose a bit of their organic-ness. But making the shapes much smoother than I did looks much better. So the mouths and especially in the later drawings are better than in he earlier ones.
In all, the differences are subtle, until you look closely. Once you see it, the difference is glaringly obvious. Or perhaps I'm developing a rudimentary artist's eye ;). Some examples:
This was especially true for the first mission of the campaign; eventually it stood out to me like a sore thumb. And that mission is the first thing people see of the blobbies, and often of Powargrid (there are also people who dive straight into skirmish battles, but most play at least part of the campaign first). So this had to change. And today, finally, I got around to remaking those pictures. And I'm happy with the result! Here's the first thing you see when you start the first mission of the campaign:
I mean, I know I'm still no Michaelangelo, but that's part of the limitations I have to work with :). But the new Commander Grak image offers much more connection when you're reading the dialogues, and that's what I'm aiming for.
And there is one more thing I'd like to share. We decided quite some time ago to separate the blobbies from the backgrounds. The reason for that was so that we could change the backgrounds without redoing all the pictures. And the backgrounds have become much better over time. In hindsight, we probably should have made the blobbies themselves modular as well. That way, we could have built up each blobbie from a base body shape, paraphernalia such as hats and decorations, an eye and a mouth. In which case I would have just had to improve the base ingredients and every blobbie picture would have become better. But as I said at the start of this post, we've had to learn a lot. Apparently this was one of the things on my list.
Happy gaming :)
Is it an impact crater from a rare metal meteorite or an old spy satellite? Is it an abandoned archeological dig of the Red Blobbies? A bomb crater from a forgotten conflict, a volcanic caldera, or an old surface mining operation? Nobody knows, but it must be worth fighting over! Introducing our new skirmish map: the Pit of Grit!
For a long time, we've had only two (finished) skirmish maps in Powargrid. We always planned to add more, but didn't get around to it until this week. Originally, we wanted to just vary the size and dimensions of the skirmish maps. But the problem was that the difference in gameplay between slightly larger or slightly smaller square maps just wasn't big enough. And while skirmish maps certainly have to look good, we would like them to also be distinct in gameplay.We tried some elongated rectangular maps, but they didn't lead to interesting gameplay.
Instead of using the skirmish map concepts we had, we looked at other ways to make them interesting. Skirmish maps in Powargrid have to be symmetrical to be fair (although asymmetrical design can work very well elsewhere; we both still love the old Alterac Valley PvP map in World of Warcraft), so that limits the ways you can design them. We realized we don't need mirror symmetry: a point symmetrical map is just as fair. For this map, we added a central obstacle that blocks cannon fire, so you'll have to circle around to get a shot at your opponent.
That means Powargrid will ship with three maps for skirmish, hotseat and online multiplayer modes. I've also finally named them!
The Isle of Trial
Who knows what might still be found on these old testing grounds? A clever player may be able to exploit the slightly narrower center section of the 11x11 board to establish their defenses.
All Must Fall
Because it's autumn! Fall, geddit? Geddit? ... Sorry. Bad puns and particle effects, that's me. Also, a nod to One Must Fall: 2097, which was my favourite fighting game when I was a teenager!
This map is a wide open 13x13 square, which you could consider the "regulation size" board - small enough for fast action, but large enough for complex tactical moves.
We've got plans for a few more map concepts, so stay tuned!
It's official now. We're releasing Powargrid on the 5th of October! The Powargrid store page looks even better now there's an actual date there :D
And yes, wow, it's really real now. We're actually releasing our game! I've been thinking that the great thing about building Powargrid is that we've created something that wouldn't exist if we hadn't created it. Something original. Something new. And that feels great! Especially after working on it for over five years.
Of course, having an actual release date is also scary. There's quite a lot of work still to be done; from finalising the last features to handling beta feedback to all kinds of marketing things. Luckily, we have the awesome Bram and Stephanie from Game Drive to help us with that.
So, be sure to mark October 5th on your calendar. Your commander needs you!
It's been a while since we've posted here, so it's high time for an overview of what is happening with Powargrid. so here goes:
We have a store page on Steam now. It's both really strange and really cool to see the game we've been working on for so long appear on an actual Steam page. Somehow that makes the whole thing feel more real. Also, Powargrid is set to 'coming soon' and has an 'Add to your wishlist' button. We should know a definitive launch date somewhere next week, which will replace the coming soon. Getting everything up and running for Steam was a lot of work. Your game obviously needs to work through Steam, but on top of that you need banners, badges, trading cards, profile backgrounds and achievement icons. Michiel has done a terrific job on that (as shown in the previous posts).
The beta is progressing steadily. We've received a lot of valuable feedback and we've made a ton of small improvements. What's more, we haven't had many reports of technical malfunctions and, as far as I know, no one has had their computer crash (and burn) on account of Powargrid. So that's good :D. We do expect to see some technical issues after launch, since there are so very many different systems and configurations out there, but the small number of problems in the beta gives us confidence that this will be manageable.
The improvements I mentioned include showing the ranges of weapons when you mouse over them, toning down the difficulty in the third campaign mission (Dam It), adding a window that shows the objectives for every mission and fixing a bug where the fifth mission (Welcome to the Jungle) wouldn't end even if your path to victory had been cut off (literally). On top of that, we've added difficulty levels (easy - normal - hard), finished the multiplayer and made power plants more expensive after the third one. Unfortunately, I Don't have the space here to dive into these improvements; most of them warrant an entire blog post of their own (and I expect most of those will get written in the future).
With the Steam store page also comes a Steam community hub for Powargrid. The discussions tab was empty, since most of the beta testers have contacted us through email and such. But with the release not too far away, I thought it was time to start the first threads with a bit of an introduction and an invitation to share feedback with us. So feel free to join us there :).
Lastly, we'll re-start The Daily Blobbie. We really like it, and the plan was to keep making new ones for every weekday, but the drain on the time we could devote to actually getting Powargrid ready for release was too great. But now that things are a-rolling again, the blobbies are ready to share more wisdom with the internet!
That's all for now. I think the next post will be a bit more in-depth, possibly about one of the things we touched on today. Until then (and after), don't hesitate to give us a shout on Twitter or on Steam :).
Steam achievements need icons! 39 achievements in total so far. Really looking forward to seeing which ones people manage to unlock :)
As we're getting ready to start beta testing Powargrid, we're also working on marketing and sales: Powargrid will be released on Steam, so that involves quite a bit of preparation to set up the store. I've been busy whipping up some artwork for our store page:
In addition, I've set up some forums for our future players at forum.powargrid.com. See you there!
We're Michiel and Willem. Hi!