One of the most important and fun systems we want to test in the Tower-Defense mini-game is City Walls. In Sandbox you will be able to construct wooden palisades to protect your tier 1 village, and as the game progresses and you gain in power and wealth, stone walls. For the mini-game we're going to focus on stone walls, and throw wave after wave of goblin forces at you.
Having built your walls, defensive weapons and traps, the goblins will fling everything that they have at you in waves of progressive difficulty. Eventually you will be overrun, so the challenge is very much to survive for as long as possible.
As you can see in the screenshots below, your walls are going to take a pounding from the Goblin Trebuchet. Your gatehouse will be tested by Goblin Battering Rams, so be sure to mount those turrets with Ballista and Repeating Crossbows. Building a few of your own Trebuchet behind your walls should help take out the Goblins own Trebuchets and Ogres, and putting City Guard/Militia up on the battlements will help take out the goblin infantry who'll be scaling your walls ( covered in dev blog 9 ).
|City Walls: Damaged|
|City Walls: Damaged|
Further enhancements within the Location Editor include the addition of a randomization feature to provide a starting point to design your locations. Prop Painting with variable brush size is working in a limited form for trees which we'll include in a future video, and Aron has integrated the tile-based navmesh pathfinding system which is very cool, but very technical. Everything is starting to come together.
Adding variety to the appearance of characters was a big request from the RPG fans in the Community. Having previously covered why it's not possible to add the full visual customization found in RPG games ( see the Sandbox Vision Presentation, it's mostly a memory issue ), we've continued our R&D work into what we can do to inject a little more variety.
There were a number of factors to consider when designing our character customization system.
a) Memory efficiency - we need to reuse as many textures and pieces of geometry as possible, and keep textures as small as possible. The fewer assets required to do the job, the better.
b) GPU Draw Calls - A draw call is made to your graphics card each time a material and/or geometry needs to be drawn on screen. If a character has one material ( which comprises of one or more textures and a shader ) that will result in one draw call. Shadow casting adds another draw call, as do any point lights in a scene. It's important to keep draw calls as low as possible.
Being able to swap hair, face, body and props at runtime presents a number of challenges. Each hair style is a piece of geometry, each head shape is a piece of geometry, and each body style is two pieces of geometry ( one for clothing, and one for any exposed skin ). Without optimization, that results in quite a few draw calls ( ignoring point lights for now ):
hair ( 1 geom draw call + 1 for shadows )
+ head ( 1 geom draw call + 1 for shadows )
+ body clothing ( 1 geom draw call + 1 for shadows )
+ body skin ( 1 geom draw call + 1 for shadows )
= 8 draw calls.
Now multiply that by say 100 characters = 800 draw calls just for characters.
Normally RPG games solve this by packing all of the textures for the character into a unique texture atlas for that character, merge all the geometry into one at runtime, and render it with a single material. That reduces 8 draw calls to 2 ( geom + shadows ), but comes with the cost that each character requiring it's own unique texture. A 2048x2048 DXT5 RGBA texture without mipmaps consumes 4MB of memory. Multiplied by say 10 characters on screen at any one time = 40MB in character textures. That sounds reasonable, until you realize that Folk Tale has maybe 100+ characters on screen at any one time, rocketing that total up to 400MB+. Taking the RPG approach simply isn't an option. MMO's solve this problem by instancing public areas to cap the maximum number of potential players on screen at any one time. Again, that isn't an issue for a single player citybuilder game.
For Folk Tale, we're forced to sacrifice a few draw calls to achieve some improvements in memory efficiency. We made the decision that character classes will wear the same outfits to help players quickly identify a character's role ( e.g. Hunter, City Guard ) just by looking at them. That immediately saves us a lot of texture memory. Next, we atlased hair and skin into one texture so that we can combine the hair, head, and body skin geometry into one. Skin, eyes and teeth are left as color RGB, while hair is grayscale. This is because within skin, there are important hue variations that tinting alone cannot capture. Hair doesn't have that hue variation. This however presents a problem because tinting a flesh color limits the color range available. For this reason we added the ability to desaturate the original skin tone in the shader, allowing us to achieve all possible skin colors, from Hulk green to dark elf purple/gray. Packed into the alpha channel of the skin/hair atlas is a mask that determines how much influence tinting will have. Eyes and teeth are masked as black as they never change color, skin is masked as white, hair is masked as white but with ribbons masked as black, and lips are masked as medium gray, because we want them to be only partially influenced by tinting. Finally, we paint vertex color channels in the geometry to determine whether skin or hair tinting should be applied.
|Character Configuration ( Click To View Full Size )|
What all this technical mumbo-jumbo means is that we are able to merge together the hair, head, and body skin geometry into a single piece of geometry, halving the draw call count from 8 to just 4. Multiplied by our 100 characters and we just saved ourselves 400 draw calls.
The next step is to create the face and hair variations.
Siege Machines and Traps
Having presented the concept art for a number of siege machines and traps in Dev Blog 9, the Art Team have finished modelling and animating the Human Repeating Crossbow, Goblin Trebuchet, Goblin Battering Ram, Goo Trap and Flame Trap. The Spike Trap is done but I'm just not happy with it so I think we'll take that one back to concept.
Concept art development continues, with pre-production visualization of the Butcher and Hunter, Butcher's Shop, Fisherman's Hut and Hunting Lodge all completed in the last fortnight. Concept art remains raw and functional rather than beautiful and polished. Being indie we don't want to spend time and funding prettying up concept art when that's better spent elsewhere.
|Character Concept: Male and Female Butchers|
|Character Concept: Male and Female Hunters|
|Building Concept: Butcher's Shop|
|Building Concept: Fisherman's Hut|
|Building Concept: Hunter's Lodge|