Tuesday, January 27, 2015

Behavior Trees, and Stunt Concept

I've finished building a new AI frame for Legacy based on behavior trees. The main motivation was to make the AI much faster and more predictable, which also means more controllable for me. The old algorithm algorithm was a monte-carlo tree search, which worked after a fashion, but was frustratingly slow and difficult to tune (e.g. monsters would run away from heroes rather than engaging them.)

It is definitely much faster now! Before, each move would mean a 5 second pause, and each monster made 2 or 3 moves per turn. Now, choices are made without any noticeable lag (<200ms? I should measure it.. but it's so fast I don't care!) and the AI behavior sticks (mostly, perhaps there are some bugs) to what I expect.

The new strategy is a pretty simple tree, it looks like this:


I'm sure that doesn't make sense but basically it means, for each character, try to attack an enemy this turn by getting in range and using an ability. Once you can't use any more abilities this turn, prepare for next turn by moving towards or away from your enemies. (it's bad to be too close to your enemy because they can surround you, but you want to be close enough to attack them next turn if possible.) Once every team member has moved, end the turn.

More complicated abilities will probably have to modify this just a bit, but I think this should model most of the basic behavior we want from our AI. The great thing about the behavior tree model is how scalable it is. I can easily add more strategies as sub-trees, and then randomly select into them rather than the default, or even select into them based on other high-level criteria. I'm feeling good about the model and the performance.

Nothing particularly relevant here..

Onward to fun combat! I have some ideas for integrating character back stories into combat. The problem is that we want to have tons of interesting aspects that are applicable in certain contexts, without overwhelming the player with a vast ability menu. The idea I have in mind is a combination of the FATE spin/boost system and the stunt system from the Dragon Age table top RPG (I have not played but I watched this episode of TableTop. The idea is that when you attack, if you roll doubles (on 3d6) then you get to apply a bonus effect or two from the stunt table.

So the way I'm adapting that for Legacy is that instead of a crit chance and crit damage, you have a stunt chance that scales with the number of applicable aspects (and the situation), and when you stunt you apply a generic disadvantage on the target, along with some flavor text from the relevant aspect. (That's the part that is like FATE.) The temporary disadvantage is consumed in the next relevant interaction with that monster (when your ally attacks it, for example, or when it attacks on its turn) or at the end of your next turn.

The result, hopefully, will be to bring a character's background into the foreground in a way that is fun but not distracting or annoying. No huge menu full of situational abilities. Just a good chance that your background will have a positive (or negative!) effect during combat. With supporting flavor text.

So to that end I'm going to do some work on the character histories -- tying them to aspects, and revamping the combat roll. I may also revisit the longer-form histories that we used to have, since I think they are better suited to use as aspects.

Tuesday, January 13, 2015

Housekeeping

We're all moved in at the new place, and I'm back at work. Today I finished some housekeeping tasks for Legacy, too. The animation system is finally put back together, and I'm generally happy with the state of the code, so I'm ready to move forward.

It looks like one of the first things I need to do is revisit AI, because the current implementation is getting in the way of fun. I need it to be faster and more predictable, so that I can iterate on the core tactical mechanics. There's a lot of things to try out, like Beacons, and mini CCG/Dominion -style character advancement. Mission structures. Monsters and Puzzles.

You know, the fun stuff.

Friday, January 2, 2015

Beacons


Nate's been tossing around the idea of "beacons," and I'm sure he'll correct/edit this post if I get the summary wrong:

Beacons would be points on the map (maybe 2-3 on large maps?) where little shriney-looking ancient stone lanterns are. You "light" them with magic or potions or... I dunno, regular fire like a normal boring person. Once lit, they not only provide light to a large area (super convenient in dark dungeons) but probably also do something fun like give out healing energy or buff your fire spells or daze enemies. Hence the different colors.

He also brought up the idea that they can be used as "locks," where you have to light a certain color beacon that opens a corresponding door or breaks a corresponding curse or MacGuffins a corresponding MacGuffin.

Tuesday, December 2, 2014

A Storytelling Game

One thing I've been turning over in my head while I'm on hiatus (we're moving to Austin) is the idea of a storytelling game. To me as a kid growing up, "storytelling game" meant Dungeons and Dragons or a homespun variant thereof. As an adult I've played a variety of pen and paper games in the genre, but I've only played a few computer games that really approach that level of freedom and thematic coherence, Dwarf Fortress, Skyrim and Minecraft come to mind.

Legacy is not those games, but I think we have an opportunity to push storytelling computer games in a new direction. Our focus is going to be on character development rather than a (hugely complicated) modifiable world, or a (massively expensive) open world full of designed content. As an indie game we have to be strategic with our resources. I 'd love to make Dwarf-Skyrim-Craft, but I would never finish.

So that's my riddle: what is the minimum storytelling game I can create that satisfies the vision of Legacy?

Douglas was talking to me about the Yondering Lands being an American mythology. That's another thing I've been chewing on, trying to figure out what it means. I think, for me, it's a reminder to be very careful with what I pull in from other works of fantasy. Swords and magic are probably inevitable, but most everything else should be up for consideration. Take magic -- we're not going to have evocation, conjuration, and illusion, we're going to have something more like Fire magic, Rune magic, and Blood magic.

In particular, calling it an American mythology is a reminder not to get too caught up in cultures and mythologies--particularly English ones-- that I'm not actually that well versed in. The game will feel more honest standing on its own lore instead of on someone else's (I'm looking at you JRR.)

So, when I get back to it, I will wrap up the animation work that I'm in the middle of, and then keep driving towards character advancement and compelling combat.

Monday, November 17, 2014

Instrumental News

I'm still plugging away, slowly but surely, on concept piece #2. I'd like to do a sort of post-mortem on it when it's done, detailing the process, etc. The "when it's done" part because I want it to be a pointed narrative across several short posts, but as usual I'm probably over-thinking everything.

In the meantime, a few notes (pun not intended, gross) on instruments. While I definitely need continued practice on the cello, the cello itself needed to meet me halfway and get some surgery. I had the fingerboard re-planed and the bridge altered, and it is now much easier to play, more responsive, and has a clearer tone. I will need to get a lighter bow and strings (and practice a lot) before making final-final recordings of anything, but it's a start. I'm really looking forward to the cello being an integral part of the score.

Secondly (and probably most exciting), I now have a drum! A DRUM.

I spent way too much time looking up different kinds of drums and listening to/watching people play them on YouTube*, trying to figure out what kind I should get. I wanted something that could make a versatile range of sounds and could easily be played in a sort of non-traditional way so as to create a sound unique to the Yondering Lands.

At first I thought I might be able to get away with a small djembe. They're affordable, easily found, relatively easy to play, and the small ones lack a lot of the idiomatic timbre that they're known for. I wanted to get out and play some of them myself to see for sure, and ended up visiting three different drum shops in town (including one that is basically a workshop where they make African drums of many kinds, and was amazing to visit. If you ever have some time to spare near Inglewood, check out Motherland Music). I tried a lot of djembes, but nothing seemed quite right and I eventually gave up on that idea. Also on my list were floor toms (not versatile enough and way too expensive), children's toy percussion**, and frame drums. Basically anything that looked interesting I tried, but those are the ideas I went in with.

At the shops I learned two important things: 1. I like Meinl brand drum heads. Every time I came to a timbre that was close to what I wanted, it said Meinl on it. Convenient. And 2. I was pretty sure I wanted some kind of bodhran or frame drum, but none of the shops had more than one or two in stock and what they had was kindof beat up. With that in mind I went back online and found two styles of bodhran from Meinl and ordered them both so I could try them out at home.


THE DRUMS (the drums, the drums, the drums...***)

The one on the right is an "Irish" bodhran, the one on the left is "Celtic". Don't ask me how those distinctions are supposed to work, but that's what they call them in their product listings. Anyway, the Irish bodhran has dampening material around the edges which give it a nice, clear tone but not a lot of boom. The Celtic one, on the other hand, actually feels more pitched somehow despite having a lot more noise in the tone, and has a lot of resonance and ring-out if you don't dampen it at all. It is tuneable to some degree, and I'll play with that. In the end, even though I liked the tone of the Irish drum better, I decided to keep the Celtic one as it has much more versatility, and with some effort, I can make it sound pretty similar to the Irish one. I played around a soft mallet, and tipper, and just my hands. I covered the tipper in a few different materials to get different sounds and I am pretty pleased with the results. I think I have something that will fit in very well with the Yondering Lands' sonic universe.



As an added surprise, it turns out that the kind of looseness you need to cultivate in your wrist to play with a tipper is the same kind of looseness you need for bowing, so there's a transferable skill I wasn't expecting to have. The biggest challenge is going to be recording - turns out that a drum could actually be... a lot quieter than a viola. Who knew?

*while researching, I found this amazing gem
**WHY ARE THEY ALL IN BOXES, WHY CAN'T I HIT THEM IN THE STORE? I REFUSE TO BUY SOMETHING I CAN'T HIT
***Go listen to The Ting Tings, they are awesome

Friday, October 31, 2014

HDR, Bloom and Gameplay Footage

We're now using high-dynamic-range lighting and I added a bloom effect*. We've also added scenery in order to make the light and shadow make more visual sense. And I made a video showing it off.

Disclaimers: work in progress, and a lot of what you'll see and hear is placeholder. Also this is my first video and I'm not very good at it yet haha.


I like the way the firelight flickers and the way the shadows animate. I feel like the visuals are at a point where I can leave them alone for a while and go back to making the game fun. I stuck a post-it to the wall over my monitor:



Right now the game has a bunch of systems, and some interesting ideas, but it's not very fun. Playing is a bit of a chore. And that's why it's even more important to play every day.

From my recent sessions, the highest priority is improving the AI. That will also mean defining more interesting monsters and scenarios. Lots to do!

I may also take a short break to make another baby app and move to Texas.

* Yes, it's been done to death. Sue me, I think it looks good.

Thursday, October 23, 2014

Shadows!

I've been working hard on the graphics infrastructure for Legacy*, and I finally have something to show for it! Check out the shadows at the bases of the figures below:


Because of the way I'm calculating light and faking shadows**, shadows are relatively cheap for me, so we can have a lot of them.


Aside from the cool shadows themselves, you'll notice that light is now blocked by walls (those pits you see will actually contain obstructions some day, which is why I have them blocking light.

So now that we know how much light is hitting each tile, we can potentially attach mechanisms to that. I would probably need to find a way to make different light levels more distinct.

So this is a good start but I'm not happy with it. The light tends to either blow out or be too dim, and it's tough to get it balanced, so I might take a look at some HDR techniques to see if I can get better results that way. In Legacy we want to be able to show a fairly broad range of environments, from outdoor daytime to dark dungeons, so I think the HDR sidequest is justified.


*I forked libgdx to fix some bugs and have been looking into OpenGL core profiles.. a real learning experience.
**Ask me about it if you want the details, but I might talk your ear off.

Sunday, October 12, 2014

Mechanisms: Line of Sight, Fog of War

Here are some simple ones. I'm testing out a line-of-sight driven visibility system. It's fairly standard, we do a center-to-center and corner-to-center test for each pair of tiles to determine visibility.* In addition, walls adjacent to visible floors are always revealed. When terrain or units are no-longer visible, they are grayed (for terrain) or removed from view in the case of mobile units.

I'm not sure if this picture is terribly clear but I suspect I'll be doing some more work on line of sight feedback before it goes live :-)


I also wanted to mention that this mechanism isn't inevitable or final, I think there are some viable alternatives to it. For example Descent uses doors to gate monster reveals, but never hides units or terrain once revealed. True, as a board game it's more constrained, and having secret monster locations would be a pretty big opportunity for the overlord to cheat.

The other open question is if/how much we want light level to affect visibility of terrain and units. Is a stealth mechanic just too annoying? Or is it awesome? Only one way to find out I guess. My instinct is that in order for it to be good, we need to give excellent feedback to the player about how the stealth rules work, ideally to the level that when they are hovering over a movement destination, they can see whether or not they will become visible to any of the monsters that the party is aware of.

Oh yeah oh yeah - new XCOM has these "on reveal" triggers, where when you see an enemy for the first time, they hiss at you and then immediately activate and seek cover. Old XCOM had a mechanic that when you reveal a foe in the middle of a move, your move is halted and you have a chance to reconsider. Both are interesting. The great thing about movement in XCOM is that it always feels risky. Every move you take you risk triggering an overwatch or revealing too many enemies, who will then swarm you.

We may need to have some kind of "activate on reveal" for monsters just to keep the ai turn reasonable. And in the case of playing against a human overlord (a scenario I just can't drop no matter how I try!) There would need to be a mechanism to prevent him/her from gathering all the units from across the map in order to overwhelm the heroes.

So, next I still have to integrate line of sight into combat and targeting, and I might attempt to put in some kind of "cover" test while I'm at it, which would affect ranged attacks. After that I might try to figure out how doors work. That seems important.


*Mostly.. I'm reusing Wu's line algorithm here, which is an excellent approximation, but is not actually as strict as a pure "intersection of line and rectangle" test. I'm ok with that because our obstacles are visually pulled back from the tile boundaries, so it should make intuitive visual sense what you can see and what you can't.

Wednesday, October 8, 2014

Mechanics: Fireball, Flame Strike, and Fire Lash

Coming in hot. So to speak. This time it's all about the Mystics, and how they shape fire to their will. Mystics have a Charge mechanic that acts as a currency for their more powerful spells. Right now they start with 1 Charge and consume Heroism to gain an additional Charge. For now Fireball is the only spell that consumes Charge, the others are free, but all magic actions take 65 time units (out of a budget of 100), so you can only cast one per turn.
So, a warrior, a hunter, and mystic walk into a bar full of boars. A boar bar, if you will. I don't really know how the joke goes, like maybe the warrior asks the bartender for some bacon and all the boars look up from their drink, and then the hunter's all trying to calm everything down but spills beer on the mystic and then something about a fireball? I don't know whatever. But it ends with bacon.
Ok so first up, Flame Arrow. You target a nearby source of fire, which you consume to grant your ally a free attack with a bonus. The attack also lights a fire at the target. This effectively moves fire around the map.


Next, Fireball. This is currently the only mechanism the heroes have for creating fire, and it consumes Charge. It's intended to be the big flashy spell.

What's the damn punchline?
Next, we have another situational spell. Fire Lash targets a source of fire and another tile, and spreads fire over every tile on the line, also burning any units in the path. This is another way that Mystics can change the map.


All together, Mystics now brutally outclass these Boars. I might need to pull out some tougher enemies. But also this is all subject to balance, and in the game itself we might roll out these abilities one at a time over the course of the game.

Flame Arrow - active - target the closest source of fire and a ranged hero other than yourself. The hero makes a free ranged attack and also lights a fire at the target. The source fire is consumed.

Flame Weapon - active - target the closest source of fire and a melee hero other than yourself. The hero makes a free melee attack and also lights a fire at the target. The source fire is consumed.

Fire Lash - active - target a source of fire and another tile within close range of the source. Hit everything in a line with a magic attack and light the tiles on fire.

Fireball - active - consume one charge a 3x3 blast area within range. Hit every unit in the area with a fire attack, and light all the tiles on fire.

Charge - consumable - Mystics start with one Charge and can consume heroism to gain additional charge. Charge powers certain spells.

We're definitely making progress in terms of making terrain matter. I think the next big category of mechanics will have to be around sight. Line of sight, cover, light, and stealth. And for that all to make sense I'll likely have to do some work on mission visuals as well. For example, all these fires, they really should be light sources, and they really should cast shadows that dance across the floors. It's hard for me to express how much I'm looking forward to that work :-)

Tuesday, October 7, 2014

Mechanics: Heroic Death, Guard, Injury

Here's some more mechanics!

This crop is all about filling out the heroes' options and incentives. Injury is a form positive feedback that makes getting hurt extra bad. Heroic Death is a form of negative feedback that makes dying less bad. And guard allows you to take conditional actions on the enemy turn and mitigates the "bumpiness" of turn-based combat. So take Gawdion here. He's in a pretty bad spot, in between the boar and the fire. He's injured too, which means his attacks deal less damage. That might not even be relevant for much longer..


Yikes. But when he dies, the other two get +1 Heroism. (Heroism is explained here) So with that they are in a pretty good position, despite the loss of their brave comrade.


When one of your heroes dies, it is sad. But, a death also galvanizes the remaining heroes and gives them a better chance to finish the mission. Next, Ollile demonstrates Guard. If the boar comes within range, Ollile gets a free attack on it.


Now, as a farmer, Ollile's attack is not that great, and he relies on surround to bring down large foes. But Guard can be pretty powerful in the hands of a trained warrior.

Heroic Death - passive - when a hero dies, remaining heroes get +1 heroism.

Guard - active - heroes with a melee weapon can create a guard region around them. When an enemy enters that region, the hero gets to attack it. The guard goes away when used or at the start of your next turn.

Recently Injured - debuff - (Note that your health bar is divided into two segments, damage first counts against Stress, and once you're out of Stress, starts to count against Injury. Ordinary monsters don't have Stress, so they go straight to Injury. I need to make this distinction more clear in the UI.) Recent Injury negatively affects your attack rolls until it wears off. Recently Injured lasts for two of your turns, and stacks. If you take two attacks that injure you, its value will be two, and each time it is refreshed, the cooldown is reset to two turns. This stack and decay mechanic was pretty easy to implement with my new template aspects and effects.

Enraged - buff/debuff - some monsters have a variant on the Injury mechanic that strengthens their attack but weakens their defense when they are injured. So it makes them easier to finish off, but more dangerous. I basically got this for free when I implemented Recently Injured so there you go.

Mechanics are coming in hot and fast right now, I suddenly feel very productive. Funny how two weeks ago when I was tearing apart the ability system, I felt so down. That work is now paying dividends.

Friday, October 3, 2014

Mechanics: Debris and Fire

I've implemented debris and fire in order to make terrain more important. The map below spawns in with some fire. That's just for debug purposes but it gets the point across.


 When you're standing on debris, you can pick some up and throw it at an enemy in order to daze them.


Dazing takes away 25% of their time on their next turn, and can stack. In this way you can really reduce the enemy's effectiveness, but at the cost of your own actions.

Fire is more complicated. It deals damage when you enter it, and every turn you end in it (including enemy turns.) It decays after 2 turns unless it is on a Debris tile, in which case it sticks around indefinitely. Fire also counts towards surround, so backing your enemy against the fire is a great idea.

Along the way I made another round of improvements to the Effect-Action system. Fire uses the Attack/Defense mechanics to deal damage, which means that creatures could easily have resistance to fire. And since I can now trigger attacks when units move, I've done most of the work for an "Ambush" (see: Overwatch, Guard) mechanic as well.

Actions now resolve on a FIFO stack, which makes it easier to chain and combine them meaningfully. And each new trigger I add is easier and simpler, so I feel like I'm going in the right direction. Everything is feeling more flexible and uniform, and I'm able to keep all the mechanics in the data, not the code.

Next, I want to implement some abilities for the Mystic. This means AoE attacks (Fireball!), maybe a "Flame Weapon" ability which allows the mystic's ally to make a free (the mystic pays for it) attack with a flaming weapon, and a "Fire Lash" ability that allows the mystic to utilize existing Fire on the map. You may be detecting a theme.

Then.. Line of sight? Ambush? Stealth? Re-equipping? Doors? Light sources? Furniture?

Tuesday, September 30, 2014

Mechanics: Heroism, Fear and Hatred

I've been moving down the path of character advancement and combat mechanics as promised, and I've made good progress.

I did a lot of background work on aspects and abilities, simplifying them and making them more flexible. As a result I was able to implement s Heroism mechanic, and generic "Fear of ASPECT" and "Hatred of ASPECT" aspects, with corresponding combat mechanics.

I also have a very basic ranged attack, though I'm not happy with it yet. It needs more depth. But here's what we got now:


Dacolo has got himself in a bit of a bind, and he's terrified of Gorgon Boars:


But these are Warriors, not Farmers, and they have Heroism available. Pem is able to use Heroism to get into position with enough time remaining, and then slay the surrounded boar with one stroke. In the combat log, the breakdown notes +3 due to Hatred of Boars. Docolo then pivots and uses a Heroic Attack on the remaining Gorgonoid Boar.


Heroism acts as a currency: you start the mission with 1 heroism (for now), and you can use it to break the rules in different ways depending on your class. Everyone can "get an extra action" by spending heroism (it gives you extra time to act that turn), Warriors can also perform a "heroic strike" with extra damage, and Hunters and Mystics will have signature abilities powered by heroism.

The kicker is (not yet implemented), that when a hero dies a heroic death, all remaining heroes get +1 heroism.

Fear and Hatred are related aspects. For now Fear gives you -1d2 on defense and +1d4-2 on attack, and Hatred simply gives you +1d3 on attack. The idea is that Fear can be acquired as a consequence of taking injury or seeing a comrade die, but that Fear can then be upgraded to Hatred by performing a redemption quest or maybe simply by killing your hated foe.

I'm playing with the idea of variance control. I want the base attacks and defenses to be fairly predictable, but I also want epic moments to arise when a character's background or forgotten aspects suddenly become relevant. So my thought is that the more specific a situational aspect is, the higher the variance should be. We'll see if playtesting bears this out, maybe it will be super annoying.

My other major goal for the missions is creating spatial incentives. What I mean by that is, incentivizing the player to take risky, aggressive moves in order to control certain positions on the board. If board positions are important, then different maps force the player to change tactics to play optimally. If board positions are important, then procedural generation of maps is a huge multiplier on content and replayability.

Descent does this amazingly well with Glyphs and treasure, not to mention other pickups. XCOM accomplishes this via Cover and both also use doors as spatial gates. Descent has additional mechanics, specifically the race-like nature of every mission, to keep the players unbalanced. So I'm toying with those ideas as well.

Fire is the next big goal. I have some good ideas for why fire is important.

  • It counts towards surround. (If your back is to a fire, you can't defend as well.)
  • Mystics will have abilities that use fire on the board to their advantage.
  • Fire spreads light, revealing hidden enemies.
  • Fire depends on Debris or it will burn out, which makes Debris distribution important.
  • Fire is dramatic!

The main goal for fire is for it to make terrain and position matter more than they currently do.

I'm excited. Relationships like fear have been on the drawing board for over a year, and Fire has been an important combat concept for almost as long. It feels good to finally be implementing this stuff and playing around with it.

Friday, September 19, 2014

Making Decisions

The full loop is now complete, you can enter the campaign, play a mission, and come back to the campaign. So now I'm at a crossroads, in a sense.

Yesterday I tried to think about all the things I could do next, but the list was too big. So I used one of them so-called "agile methodologies" to produce this graph that covered the biggest goals I could think of:


The idea is, you do the things that are high impact and risky first, and then rotate counter-clockwise through low risk high impact, to low-risk, low impact. High risk low impact is left alone.

So this seems to indicate that I should work on character advancement and combat mechanics, since that's where I think most of the high-impact risk is. Those two are tied together somewhat, and so is Overlord AI, since the AI will have to respond to the changes in combat mechanics. But at least it gives me a place to focus.

This exercise feels a little funny with just me doing all the estimating. You're really supposed to have a group of people weighing in. But it sure goes faster with just one!

Monday, September 15, 2014

Campaigns

Progress has been a bit slow over the past couple months, due to travel and real-estate shenanigans, but here's where I am right now.

Campaigns are a thing!


You can start a campaign and it will generate a world map and some heroes for you. It gives you some time controls, up at the top. And the first thing that happens is that a mission becomes available.


When you click on this you get a party select screen, with a list of your heroes and (eventually) details about the job.



When you're happy with your party you can continue. It takes time for them to travel to their destination, and then you get another prompt to run the mission.


The mission will start and your chosen party will populate it.


 I was really, really surprised at how much work this all was. I guess I was used to having most of the scaffolding in place, like we've had for missions for quite a while. But this campaign stuff was all freeclimbing. And there's a lot left to do. For example, victory and defeat conditions for the mission, merging results with the campaign, and applying outcomes.

But well, once that's done, we should be back to a more comfortable place, where I can focus on incrementally adding game systems and content. I'm looking forward to it. I don't like going so long without showing visible progress. I've had to keep reminding myself that this systems stuff is really necessary.

Monday, September 8, 2014

Tomb/Grave Concept 1



Something I'll have to think about depicting eventually, this being Legacy and all.