Tag Archives: Programming

Warhammer, Mafia and endless winter

 

Somehow it’s mid-April already and this blog has been growing a little neglected. The past month has been filled up with a pile of things other than working on Free Company, so that I can barely recall what I was doing on it last time I worked on it. Such is the chaos of life, we’ve had Ofsted inspections, blocked exterior drains, a mini Warhammer tournament and most recently I’ve been distracted by working on a helper utility for people who want to run variants of the party/forum trust game Mafia.

Last time I was talking about building a notification system for Free Company which is something I went ahead and did, you now get popup messages when you’ve finished researching lores and that kind of thing which helps keep you informed about what’s going on in the strategy layer. Some of the notifications are pretty elaborate; like the one you get after fighting a tactical battle  but most of them are fairly simple affairs and it’s easy to add more of them should the need arise.

Then I worked on the path-finding code again so that it could properly take account of the ‘zones of control’ around players and not try to navigate through them midway along a path as was happening before. Zones of control also became a much more interesting part of the combat system in that, now, if you try to leave one the owning player will get a free out of sequence attack against you. In practice this gives players a strong incentive to leave their mercenaries that are in close combat, in the fight and not run them out of it.

The lore system became ‘structurally’ complete in that you can now properly research every one of the planned technologies and they properly unlock when you obtain the correct prerequisite technologies and items. None of the technologies actually have any other game mechanical effects yet but we’re halfway there.

So that’s Free Company. I then spent an inordinate amount of time assembling, gluing & painting miniatures for a planned Warhammer mini-tournament against my brother. Warhammer is a game of fantasy table-top battles, there are hundreds of miniatures per side and they fight in large ranked units through a mixture of dice rolling luck and strategic calls made during the game over unit positioning and so on. I had a goal to try and make two completely painted armies this year after our tournament last year with two ‘fresh from the box’ unpainted sets that come with the Warhammer starter set. Unfortunately I didn’t quite manage to make it because damn, there are a lot of Skaven in a functional army, but I was definitely over halfway there with almost every unit having some painted stuff.

I won’t reveal the results of the tournament here because that will be the subject of a couple of lengthy battle reports with maps when I get the chance to make them.

Then we get to Mafia Helper. This is a utility I started tinkering with back in February after participating in particularly elaborate version of the game and getting a sense of how hard it is to balance games of this type due in part to the large quantity of variables but also due to the psychological variables of a trust game. So I decided to build a simulator that could attempt to run thousands of test games of Mafia with a given setup of players, teams and special powers and produce some odds on how likely each team in the game was to win. The idea is then to expose the ‘psychology’ variables so that each game runner can adjust them in line with his or her feelings about how players interact and gain or lose each other’s trust. So far I’m about halfway through the initial planned feature set from working on it here and there in between everything else.

The tool is also serving as a way to make a series of improvements to the cross program UI Library I created for Free Company. Mafia Helper is entirely UI so it serves as a great test bed for the kind of more complicated UI elements I use in Free Company without the chaos of Free Company’s other code getting in the way of debugging. I’ve already managed to make a couple of big improvements to the UI system that finally squashed an annoying bug with flickering  in UI elements that’s been in the code for possibly years, and there has been a host of smaller improvements to the functionality of the generic elements like buttons, text boxes, tool-tips and scrollable lists that help make the UI feel a lot more solid.

Finally, a word on the endless UK winter which has finally broken this week. Good riddance.


Base camp

Base Camp screen

click to enlarge

 

One of the things Free Company had been missing from the classic X-Com design locker (that I have been so gleefully looting) is some kind of base building mechanic in the campaign layer. Well no longer, despite the lengthy pauses in keeping this blog up to date I have been steadily trundling away on new stuff for the game here and there in between some minor computer troubles and a new gym regime (designed to keep me alive long enough to finish this game).

Screenshots of menus are never that gripping but this particular one happens to capture almost everything I’ve been doing recently. First up was a code refactor of the campaign UI to support multiple potential screens worth of menus ( rather than having everything stupidly dumped in one rapidly filling up place). This was to support a couple of new screen ideas, the first of which is the base building one you see above in it’s first incarnation. To sell the base screen I decided to make a whole bunch of fancy images in a consistent style to represent the ideas I had for buildings. I think it came off reasonably and it is a lot more satisfying to gain that little icon of a tavern than it would be just building a bunch of text descriptions.  Though I also spent a bit of time revamping the text description displays by making the tool-tips used throughout the campaign (and in some areas of the tactical battles) more aesthetically pleasing. They now have slightly rounded corners, a carefully adjusted amount of alpha and the use of new text rendering options. The engine can now, with a little bit of text markup, render a bold version of a font (as long as you remembered to load one) and assign text colours with a much more dynamic system of css like id tags loaded from an xml so it is easy to add new colours and easy to adjust the colour of all the text that uses the same tag.

And finally you can actually use that menu now to start construction of the available buildings and as long as you have the cash and wait a few turns your company will be the proud owner of a new tavern/stockade or whatever. Of course at the moment all of the buildings are somewhat ceremonial as the other systems they are going to unlock , contribute to or  buff have either yet to be built or are yet to be decided upon. I have a few ideas of what they are going to do but nothing is set in stone yet.

I’m quite enjoying working on the campaign layer at the moment as I feel that every time it improves it’s helping to add the purpose and context that I feel has been a bit lacking in the tactical battles. However, there is still a chunk of necessary work that needs to go into the current tactical battles around mercenary special skills, path finding and play speed improvements and better enemy AI. At some point soon I want to muster the drive to finish off those areas to an ‘alpha-ready’ standard so I can start to think about some kind of release that will garner much needed player feedback.

In not-Free Company-news there is a new remake of X-Com due next month by Civilization developing titans Firaxis.  I have of course preordered it out of my ‘research’ budget mainly so that I can swipe all of its good ideas and twist them to my own dark ends.

 

As always any comments or encouragements are welcome in the handy box below, or you can follow me on twitter and bark commands to me via that instead.

 

 


If I had a hammer…

Free Company with highlight lights

Click to enlarge

The development of Free Company continues this week with the addition of  lighting themes to the procedural tactical battle generator. In the shot above you can see my first stab at the ubiquitous ‘orange & teal’ theme that has become so popular in Hollywood. The basic principle is to help increase the variation that players see between levels in a simple, asset cheap, way. As the generator progresses I’m intending to tie the lighting colour theme to other aspects of the contract to help enhance whatever mood suits that particular contract. Right now though it’s just a completely random pick.

I grabbed a couple more shots of it in action so you can better see to what I am referring:

More light theme examples

I call them "Sandy" and "Red-ish"

I also spent some time since the last update finishing the first pass on the ‘overgame’ campaign code and UI. A player can now successfully navigate between the overgame layer and a series of tactical battles while retaining the same set of mercenaries. Right now the main tie between the two layers is whether the mercenaries died, whether they completed the contract and what weapons they bought from the campaign shop. As development progresses I’m going to try and increase the amount of interdependency between the two game states to help keep them feeling like a cohesive whole. Exactly how is going to depend on playtesting.

Finally I added a really big hammer.

Hammer time

Thor would be proud


Look! An early, art free, screenshot

I’ve decided that it was high time to post a screen shot of what I’ve been working on for the past month, if only so I can look back on it months later and say – look how far we’ve come. It’s very much mostly programmer art (and indeed placeholders from directX) so far as I haven’t seriously put my artist had on since my first proof of concept tinkerings with GIMP and blender a few weeks back. It does show some of the features I’ve managed to hammer together so far such as the text rendering, basic UI and the general lighting/camera angle setup. Boom:

Love those D3D standard assets

I’m starting to push things in a dark fantasy direction with the hud image there, and the general blackness of everything but I think there is a long way to go before I really nail that aesthetic. Though, with nothing really going on, check out that frame rate!

General code optimisation on an indie budget is actually kind of tough. I haven’t yet found a good, free or nearly free, tool that’ll quickly do function timings yet. What I want is some of the functionality of a VTune like program for a sub fifty pound price.


Useful usable code for indie developers

Creating a game as one man army is a difficult task and its even harder if you aren’t going to use a complete off the shelf engine. I decided that I wasn’t going to purchase or license a complete game engine to build my mercenary strategy game. I’ve found in the past that the free, or affordably licensable engines, suffer from either being hard to bend to a purpose they were not designed for (and few engines are built with a tactical strategy game in mind) or so packed full of features that they become overly difficult to learn for what I feel are simple requirements. However, I also didn’t want to hand build everything from scratch as my time is not infinite.

I’ve settled on a strategy of pulling together a game engine from an amalgamation of open source freeware code, cheaply licensable libraries and, of course, my own frenzied key bashing. I thought that other people thinking of doing something similar might appreciate a list of the free bits and pieces of code I’ve been using and why. All code in this list is written in C or C++ :

DirectX 9

This is the current gold standard in the games industry and likely will be until the next generation of consoles. While the more modern iterations of DirectX have many high end features they just won’t work across the range of OS’s and graphics cards that I would like to target. DirectX is hugely well documented in purchasable tomes and across the internet I’m also very familiar with it personally from my industry game development work.You can get the directX 9 SDK direct from Microsoft, the latest one is here but to get any of the decent documentation and tutorials for version 9 you’ll need to dig backward and find an SDK before XNA or directx 10 existed.

Open Dynamics Engine

This is an open source physics library that’ll help you make a pile of boxes that you can knock about realistically. I’m currently not testing it in anger in my game but it certainly seem to work out ok for 2D Boy in World of Goo. The documentation is… not great and discussions about it online tend to become –very physicist– very quickly, nevertheless it wasn’t too tricky to set up the aforementioned pile of boxes and it can do double or single precision and will handle ray casting for you as well. The main page for it is here but I’d recommend also evaluating bullet which was used in the recent Trials HD if you are focusing on physics.

FreeType 2
This is the text rendering library – accept no substitutes. Its used widely in the professional game industry and in many distributions of linux and its handily simple to setup. You’ll be rendering font glyphs to grey scale bitmaps in no time. While researching FreeType I discovered that there are a whole mass of very specific patents covering font rendering techniques owned by Apple and Microsoft – the results of which you’ll be able to see if you grab a screenshot of this browser window and zoom in on it in paint. FreeType is available here. I recommend the tutorials under ‘Documentation’ on the website.

StackWalker

Some times you just need to spit out the callstack on a particularly troublesome bit of code but you can’t get a break point in. This little bit of code will help you do that – its helped me nail a tricky bug a couple of times. You can read a full explanation of it and download it here.

tinyxml

It’s an xml reader, one of many available but I like the simple, easy to integrate, ethos behind tiny xml. It’ll read from, and write to xml files for you – with minimal hassle. You can grab it here.

sigslot

Allows you to simply use an observer pattern like relationship between classes in C++. It’s invaluable for input handling and user interface messaging beating the windows message loop into a cocked hat. The broadcasting class has signals which can be sent out at any time and they are then received by the listeners through their ‘slot’ methods. The explanatory page is here.

irrKlang

An audio library thats easy to use? After negative experiences with DirectSound and Open Audio I was very pleasantly surprised by the simple interface on irrKlang. It costs a bit of money to license for commercial use but they have a special rate (£60) for indie games made by individuals sold cheaper than £18 (which I will be). It was used successfully in 2DBoy’s World of Goo as well. You can find irrKlang here.

Thats all I’m up to so far but I’d love to hear about positive experiences with any other C++ libraries/open source code in a game development environment.

Add your thoughts in the comments & you should follow me on twitter here.