Category Archives: Programming

Rugs, doors and better options

A rug and a door in a Free Company Level

It’s the Easter holidays here at the Robotic Shed, a time for doing some gardening & pondering the chocolatey eggs to come. However amidst the shocking indolence some forward progress has been made, which, if you squint a bit you might be able to find some proof of in the screenshot above.

Mainly, I’ve had another pass over the game’s options menu and finally made sure that everything in there can be toggled on and off during the game as well as before it. I also added a couple of new options; 1) to change the texture quality 2) to toggle v-synch on or off and 3) to rebind the game’s control keys. Usually this kind of thing is fiddled about with at the last-minute in a game’s development but I decided to get it out of the way now as their broken-ness had eventually cracked the deep buried QA tester in me.

I’ve also added normal maps to most of the models since the last update and fixed up their shading code. They have to be quite pronounced to be actually visible at the game’s camera distance but I think it improves the look of things like the stone walls and tiled floor quite a lot from some angles. Normal maps were the last significant piece of the game’s graphics ‘tech’ that weren’t working so it’s nice to have them finished and therefore the last steps in the asset creation pipeline nailed down.

Finally, I’ve added a couple of new object types to the level furnishing mix; a new fancy rug at floor level and a door. The door is animated but is still awaiting a bit of man-door interaction code before it’s a finished thing. I suspect doors are probably going to be the main thing other than enemies that the player’s mercenaries will interact with as they complete a level’s objectives. I’m not sure I’ll match Deus Ex’s impressive number of ways to interact with a door but I’ll at least manage opening and closing.


Got myself a crying, talking, sleeping, walking, ragdoll

Thank Cliff for the title.

Since the last update on the game I’ve mostly been busy working on trying to furnish my algorithmically generated level layouts with, well furniture. I’ve bashed together one set of xml files that attempts to roughly outline what kind of rooms a type of location might have in it. Then I conjured up a second set that describes, for each type of room, what kind of furniture might be in it.

Of course to have any furniture to place in the levels meant I had to model and texture some up at last. So Free Company got a whole bunch of exciting new furniture assets recently; like plates and clay pots! The furniture models have to be all tagged up with meta data in a shiny new tool that I think I mentioned I was starting work on last time. It’s forked from the model viewer and is still evolving as I think of more useful ways to describe furniture to the game. Right now it looks like this:

That’s the ghostly Table O’ Doom asset you can see there.

The whole furnishing system is still pretty primitive, and still has some very obvious bugs but it’s coming along. Here is what it thinks a ‘dining room’ might look like right now:

Generated Dining Room

If you peer closely into the gloom you can probably make out the bug where chairs/stools are completely ignored by the placement system.

Other than that I also managed to fit in some time to fiddle about with Bullet Physics, which is something I’m now looking to to replace ODE with to better cater for Free Company’s physics needs. As you might have guessed from the title I was experimenting with ragdolls and after lots of brain teasing work I was able to get something that is just about acceptable or at least doesn’t feature the model warping all over the screen or shrinking into nightmarish ball. Of course it’s impossible to demonstrate physics in a screen shot so I’ve just wrestled with Fraps and Windows Movie Maker and you this delightful film:

It’s probably worth watching just to hear a nice little bit of music from that all round good guy and friend of the Shed; Sam.


Ambient occlusion, new tools and level generation

So, to follow on from my last update eventually I got settled down into London and after a bit of casting around for employment I’ve settled back into a routine of mostly full-time indie game development again. I still have no income but my brilliant co-conspirator in life is supporting me with food rations and bills. As a result rather than mostly mothballing this place I really need to spruce it up instead and put out some more frequent information on my game development activities.

First up, a little spring cleaning of some badly conceived code; my hex grid. When I initially cranked out the hex grid I naively attempted to map it to a two-dimensional array by adding a little off set if the hex was in an odd row. Unfortunately this offset adding code starts to spiral crazily out of control as the algorithms get bigger as you need two paths for every branch; one if you are on an odd hex row and another if you are on an even hex row. Code was becoming unmanageable and hardly any of it could be reused. The solution, it turns out, is to envision the hex grid instead as having three dimensions or axes – one that passes through each set of parallel edges. To index it to a two-dimensional array you just pick two of these three axes and use them as them to provide your 2D indexes. Most of this wisdom and more was unearthed by reading through this treasure trove of hexagonal maths links compiled by Amit.

I still have a few more algorithms to replace as I revisit other parts of the code but so far its working wonders on my code’s comprehensibility and length.

Next up I decided to revisit Screen Space Ambient Occlusion having previously abandoned it as something too tricky to make it look nice. Luckily since my first attempt the scholars at GameDev had put together a good article and a great forum discussion on the topic. SSAO works better on more dynamic scenes than the somewhat static levels of Free Company, the main alternative would be to calculate light maps during load time (my levels are dynamically generated). So far I’m happy enough with my SSAO implementation though and it also has the advantage of being useable across projects and reacting to any more dynamic stuff that I do put into the game. How does it look? Like this:

SSAO example

The darker image being with SSAO and the lighter without. Its main role is to fill in the shadows in corners that my ambient point lighting isn’t managing to. Hopefully it helps make the level feel a bit more substantial and less artificial.

I’ve also spent some time crafting a basic model viewer app I can use to fix problems on assets by looking at them up close. The isometric viewpoint and dark lighting of the game can hide a lot of problems, which is one of the reasons I like it 🙂 however it’s even better if I manage to catch those problems in the model viewer. The model viewer looks a bit like this:

Shot of the Model Viewer App

So far it’s helped me crack a whole range of animation and texture problems in my assets and it is also proving to be a good base from which to branch off into making other useful tools and test projects.

The guiding focus of all these efforts has been in trying to algorithmically generate  levels that both look good and preferably are hardly noticeable as algorithmically generated at all. So far I’ve got as far as generating random dungeon layouts of rectangular rooms and corridors and I’m now moving on to populating those generated rooms with believable layouts of furniture and items. Finally I’ll add room and level appropriate ‘monster’ encounters and then try to tie together all the subsystems around a super system of randomly generated base level types (e.g. ‘Warehouse’, ‘Castle’, ‘Inn’) and randomly generated goals within the level.

All this is building towards a temporary rogue-like game structure where you form a group of mercenaries to tackle a never-ending series of randomly generated missions that get gradually more tricky as your group gets more powerful. I’m going to build toward releasing that before I move on to creating the high level, principally map and economy based strategy layer that forms the other main wedge of the original Free Company design. Hopefully the rogue-like structure will allow me to a) test and improve this area of the game in a rapid way by getting lots of quick battle maps in front of people as fast as possible b) be lots of fun in its own right c) allow me to build up some kind of fan base to help try to support the rest of the game.