Official development blog

Inventory Management, Revisited

Few roguelikes are without some kind of inventory system, as it’s a familiar and flexible way to provide access to the tools a player uses to overcome challenges. Regardless of however many items an inventory might contain--2, 26, 52, or something else--how it interacts with the rest of the mechanics, as well as how the player interacts with the system itself, both play important roles in shaping the player’s experience.

With Cogmind in particular, there is a huge amount of inventory management involved in regular play. By comparison, with many roguelikes you settle into a set of equipment that only changes when you find some better individual item, rather than when that equipment has simply been damaged too many times, or an enemy suddenly gets a lucky critical hit that destroys one. In Cogmind all attached items essentially act as physical shields that protect you to varying degrees, and they can all be destroyed. According to the combined stats of reported runs from the previous version (Alpha 8), 43.5% of all items players equipped were destroyed before being removed or replaced. That’s a surprisingly high number for a roguelike, but is of course something the player expects and can prepare for. (Note that for the purposes of this topic, “inventory” also includes “equipment in use,” thus bringing the number and types of slots into play. These concepts are essentially inseparable with regard to the management aspect.)

Back in 2014 during pre-alpha development I wrote an article on Inventory Management (hence this title’s “Revisited”), that one explaining the purpose of inventory and the ideas behind dynamic inventory size and decision forcing. Since then however, there have been a few changes, and certainly an expansion on the interface side of things, altogether enough to warrant another more in-depth look.


From a UI perspective, with Cogmind an important goal of the inventory system was to make interacting with it as simple as possible. As one would expect with a system marked by high turnover, there’s a lot of item removal, equipping, and swapping to be done, and the UI had to be designed to facilitate that.

With such a variable inventory state and the relevant actions being quite frequent, priority #1 is to keep the number of required commands down. The first step towards achieving that goal is to ensure both the inventory and equipment are visible on the main GUI, thus they occupy a non-insignificant 29% of the screen space at all times.


The base 4:3 layout for the main interface, with dedicated inventory/equipment areas highlighted. Even the 16:9 layout is 24% inventory.

Without the need to open a separate menu for inventory actions, the number of commands is already cut in half--a minimal OPEN > SELECT > EQUIP > CLOSE becomes SELECT > EQUIP! But there are many ways to do even better than that.

On the mouse side, Cogmind supports drag-and-drop inventory management, allowing mouse-using players to just drag items where they want them to go. This is the most intuitive method of item manipulation for beginners, helping keep the barrier to entry low.


Drag-drop inventory management example.

The dragging doesn’t even have to be to a specific location--items will automatically be equipped to the first applicable slot, or if there is no room then dragging to a specific target allows it to be swapped. Drag to the inventory to unequip, drag to the map to drop… Also for mouse users, ctrl-clicking an object on the map bypasses the inventory completely and equips it.

But playing with the mouse isn’t necessary, and pure keyboard players have access to a number of extremely convenient features as well. In addition to single-command equipping (Ctrl-#), single-command unequipping (Alt+Letter), and single-command dropping (Alt-#), items can be equipped directly from the ground with the ‘a’ key, in which case if there isn’t any free space they will intelligently replace a current item that is outright inferior, and if the replaced item is better than something in the inventory, it will be stored and the worst item will be dropped instead. (The same system applies to equipping items from the inventory, and picking up items from the ground (‘g’)--all of them use the same automated system.)


Cogmind smart inventory explanation.



Keyboard-driven example, just moving around pressing ‘a’ to automatically replace parts.

Here it’s worth mentioning a helpful aspect of Cogmind’s design contributing to inventory management’s simplicity: only one item may be present on the ground at a given location. So when you go to pick something up there is no need to specify what it is you want! Very handy. (This same feature aids rapid assessment of what items are nearby, compared to some other tactical grid-based games in which you may be faced with stacks of items, requiring a more indirect way of seeing what they are and therefore adding an extra layer of abstraction between player and items.)


So how many items are we working with here? Cogmind only has four types of equipment slots--power, propulsion, utility, weapons--and starts with seven slots divided evenly among them (only one for power). That slot count, which equates to the number of items that can be in simultaneous use, gradually increases to 26 (that number oh-so-common in roguelikes for obvious reasons :P). Using a common humanoid system as a comparison, that’s like having a character with several heads and bodies, a couple amulets, all 10 ring fingers, and numerous arms and legs. Cogmind’s pure inventory, on the other hand, is rather small compared to most roguelikes, with a base size of only four, though that size is flexible depending on the player’s strategy. It can increase to 20~30 or even more if the player is willing and capable of devoting enough of their slots to storage space. The average peak inventory size of all reported runs in Alpha 8 was 8.78 items, though an average of only 5.03 items were carried at any given time (wasteful!). (The first post about inventory management talks more about flexible inventory sizes.)

The trade off is that extra storage is heavy and slows you down, so the tankier the build, the more likely it can maintain a larger inventory capacity (and will also probably need one due to increased combat attrition as a slower mover).

For balance purposes, back in Alpha 6 I did remove the largest inventory expansion module, Hcp. Storage Units (+8), otherwise we’d likely be seeing a higher average capacity. Now the heaviest single-slot inventory boosting item gives an extra six slots. Some players like to stack two or even three of those to get an inventory size of 16 or 22. The largest recorded inventory capacity in Alpha 8 contained 28 slots.

Still, a large inventory is not always necessary, and a game can be won simply on the back of the versatility afforded by a couple dozen pieces of active equipment. That and with the removal of Hcp. (“high-capacity”) storage, it’s a little easier to reach the point where the slot cost of maintaining a given inventory size reduces a build’s overall effectiveness (because storage doesn’t do anything but hold spare parts :D).

About slots: Most items only occupy a single slot, to facilitate swapping and avoid unnecessary complexity (in terms of design, implementation, and most importantly on the player’s end), but some less common special-purpose items might occupy multiple slots at once (usually just two, though there are a few items even larger than that). I added that feature (which didn’t exist in the first prototype) as a way to enable another type of “cost” that could be traded for some benefit.

More UI!

An important consideration when you have so much in the way of items/equipment to manage is ways to organize and compare them. To that end, there is a feature that sorts attached items by subtype so that same and similar items can be grouped together, quite useful when you have a couple dozen pieces of equipment divided into only four slot types.


Equipment sorting in action.

The inventory can also be forward- and reverse-sorted by mass, type, and integrity (all three accessible by both keyboard and mouse).


Inventory sorting in action.

In terms of additional information, the space out to the right of items is used to show stat visualizations, of which there are currently six:


Cycling through item data visualizations: Coverage, Details, Integrity, Energy, Heat, Mass. A seventh will be added soon, and we’ve recently been discussing the possibility of adding yet more alternative graphs to suit other player preferences.

Frequent swapping of items (of which there are quite a few) is also made easier by side-by-side comparisons that highlight any differences.


Item stat comparisons.


Stat comparison in action.

All these features combine to support the inventory management aspect of the game, and players of course really like it when whatever they want or need to do is easy.

The primary remaining imperfect aspect of the inventory management system is dealing with very large inventories, because the inventory displays no more than 12 items at a time, of which you can only interact with 10 (since the two at each end are themselves scroll buttons).

At one point on the forums we were talking about a special “inventory management” mode that could involve a temporary window displaying the full inventory contents and make it easier to do multiple inventory actions in a row. Maybe something like this:


Mockup: An open full-size inventory window.

But since then, with somewhat smaller inventory sizes (no Hcp.) and a large number of convenience features (above), I’m pretty sure this is no longer an issue worth introducing another major interface feature for. Also, as of Alpha 6 processors and hackware can no longer be repeatedly swapped out, which was the primary cause behind a frustrating amount of inventory shuffling for optimal play, so it looks like the issue has solved itself through other evolutions in the game.

Still, every time it seems like some part of the interface is done, another way to improve it pops up for some reason or another, so I’m sure we’ll be seeing yet more in terms of inventory management features :D

Posted in Design | Tagged , , | Leave a comment

Iterative UI Design

Today I’d like to share the process behind the development of a singular UI feature, in particular the part (equipment)-sorting implementation, which is a good example of taking a simple premise and working it one step at a time, examining the results of each new element added throughout the process until as a whole it satisfied (and even exceeded) expectations.

The Issue

Inventory turnover is quite frequent in Cogmind (more on that here), and the result is almost inevitably a cluttered list of equipment in the HUD, especially later in the game when you can equip a couple dozen different parts, and especially with utilities, the most versatile category of parts capable of a wide range of functionality.


A cluttered list of parts.

While playing I’ve found myself sometimes having to take time out to reorganize that list, grouping multiple parts with complementary effects like heat sinks, hackware, or other processors to better understand my build at a given time. And I know that some other players do this as well, as having a list of equipment that’s easier to parse facilitates rapid decision-making and avoids otherwise unnecessary mistakes.

So what we needed was a way to quickly and automatically group identical parts, or parts with similar functionality.

Initial Work

With interfaces there’s of course the important question of how to present this feature to the player, but in this case I didn’t start there, having only a vague idea of how best to do that. Instead, it made more sense to start with something more fundamental--without regard for appearances, the first step was to simply make sure the sorting algorithm itself worked, and just display the final result.

In game development, piling on too many features at once, even just multiple facets of a single feature, unnecessarily increases the complexity of the task. Everything should be broken down into the smallest understandable pieces so that any bumps along the way can be smoothed without too much confusion as to where the problem might lie.

Where the sorting is concerned, nothing special is going on, it simply reorganizes items by moving all empty slots to the end of their own category, while the items are listed in ascending order determined by comparing each item’s internal database ID number.


Stage 1: Sort and instantly move parts to their new location.

As expected, that didn’t quite work so well the first few times I tried it--bugs here and there, crashing immediately the first time I tried to use it (this is common :P), and on subsequent attempts doing odd things like stacking a bunch of items on top of each other, or erasing them completely -_-

All issues were resolved quickly, though, because the code was unburdened by whatever else I’d end up doing later to improve it for the final iteration.


It’s no secret that I like to animate everything I can, so it’s never a question of if, but how. Animations not only have a lot of potential cool factor, but when done right can also provide good visual feedback for an action or command.

For the sorting I decided to start out with something really simple, which would likely not be good enough for a permanent solution but required the same code along the path towards where I felt like I wanted to head, anyway. Basically the idea is rather than “teleporting,” items should somehow actually move, so I started with just having them slide directly from their current slot to their destination.


Stage 2: Slide vertically to post-sort position.

To accomplish this, I repositioned entire subconsoles themselves as part of the animation, which is an approach I’ve actually never used anywhere else in the interface, though is something I’ve been looking forward to doing for a long time. (For a detailed look at what I mean by “subconsoles,” see this piece I wrote on Cogmind’s UI implementation.)

The result is better than nothing, but with all the items shifting over one another it’s really hard to tell what is and isn’t moving, so the animation doesn’t add anything of value to the process.

A better way to make it more obvious what is moving is to shift them along more than one axis, i.e. offset them a little to one side.


Stage 3: Slide along an arc to the destination.

At the above stage I also wanted to try and convey some information in the amount of offset, specifically that items moving further from their previous position would travel along a wider arc, like so:


Arc sorting path visualization example (not actual sort targets).

But the effect was a little too messy for my tastes, especially since the coarse grid resolution of a strict terminal interface doesn’t leave any room for gradual pixel offsets (a rule I’ll not break in Cogmind for any reason). Items are either barely offset, or offset quite a bit.

Note: I originally thought I’d have some of them, perhaps the empty slots, offset to the right while everything else moved along the left side,  but assumed that would reintroduce too much chaos.

Seeing as the distance-based variable offset was causing a problem, I just removed the variability, setting them all to use a static animation offset whether they were moving to an adjacent slot or to a position ten slots away. At this point I also changed the movement path from an arc to a straight up rectangle to make it easier for the eye to follow given the grid.


Rect sorting path visualization example (not actual sort targets).



Stage 4: Slide along a rectangle to the destination.

With the desired movement path more or less determined, I saw that when many items were moving at once, while you could sorta tell which they were, it would be far more helpful if the movements were easier to follow, and the first way to tackle that is to simply not do them all at once!

Thus each item is “staggered,” beginning its movement animation at a random time within an acceptable range from when the command is entered (in this case 0~700ms). Each item takes 300ms to reach its destination, regardless of the distance, so the entire animation will take no longer than 1 second, regardless of the number of items involved.

In addition to the staggering, it was also time for some cosmetic enhancements to moving items in order to further improve readability. Two such effects were added:

  • Any item that will/is/was moving will have its reference letter repeatedly replaced with a random one for the entire duration of the sort. The letter is going to change anyway (because it’s moving to another position in the alphabetical list), so rather than just have it suddenly change, why not spruce it up with a little something? This also works well in combination with the staggering, since any given sorted item is only moving about one-third of the time during the sort, but even while it’s not moving you’ll be able to identify which those are.
  • On arriving at its final position, an item will flash white and fade back to its original colors, a process that takes 400ms. The flash reinforces which items just moved, and just plain looks cool. To me this plus the staggering really makes the whole effect :D

Stage 5 (final): Staggered sliding with randomized letters, and white flash on arrival.

Oh yeah, and there’s a little beep each time an item reaches its destination :D

From inception to its final form, this process took approximately four hours.


Other considerations encountered during implementation:

  • Item order doesn’t normally hold any meaning, except with weapons, which when active will fire in the order listed. For strategic reasons some players may prefer that certain weapons to fire first, so in that case it was necessary to add an option to ignore them for sorting purposes. Sorting was primarily meant for utilities, anyway, and to a lesser extent propulsion. I do a lot of weapon toggling myself, but don’t really care about their firing order, so I’ll be happy to sort them with this new feature :)
  • Further improvements could maybe include the option for fully automated sorting which operates immediately when a part is attached, so the player never even has to use a command to do it manually. Less impressive than seeing a bunch of items being sorted together, though :P
  • The current system doesn’t yet take into account integrity differences between items with identical ID numbers (this is obvious with the Exp. Heat Sinks in the final sample, as they reverse positions twice), so there is still room for better consistency and other sorting improvements.
Posted in GUI | Tagged , , , | Leave a comment

Cogmind, 1 Year of Alphas

Cogmind Alpha Access is one year old! (One could optionally end this sentence with “!?!?”)

“Year 1″ since release in May 2015 overlaps with some previous postmortems I’ve done, so rather than rehash that content here I’ll just be linking to it where appropriate. That said, there is plenty of fresh data to share, too :)

The Year 2 of the Cogmind recap is a pretty good general summary of 2015, something I’ll do again at the end of this year. Since then a lot of the work has gone towards overhauling a few mechanics to improve gameplay, and adding more and more content to complete the full world as planned. So, yeah, eight major releases later Cogmind development is still rolling along.

Today though I’d like to focus more on sales and other aspects specific to the alpha which haven’t been covered as much before.

Also, this week I’ll be updating the Cogmind website‘s text and all screenshots. Here are some of the scenes I’ve been working with for the new site:


Composite gif featuring gratuitous ASCII destruction.


Still of that reactor array exploding. (Click here for separate full-view image.)

On to the data…


As of today Cogmind has 2,119 players. Or maybe that’s “players,” because in reality the majority would be better classified as supporters at the moment, i.e. those who joined the alpha program to help the project see 1.0, and maybe try it out every so often before then, or just wait.

There are also an additional 738 people on a special one-time mailing list accessible at the top-right of the buy page, to be notified when Cogmind reaches its intended lower base price (for those who can’t afford to chip in now, or who simply want a lower price for whatever reason). Of course, a number of those people may have signed up earlier and eventually bought anyway, and another portion will never see an email because it’ll end up in their spam box :P

In terms of active players, based on the uploaded game stats there are usually about 20 runs played per day, though that number has fallen in recent months as sales have started to decline somewhat, something you’ll see further down. However, the caveat there is that I don’t actually know everyone who’s playing, only those who opt in to data uploading via the options menu (I do know that not everyone opts in). The active player count is naturally above average in the week after a new release.

Many thanks to the core group of players who have been a continuous help when it comes to providing feedback on each release--zxc, Happylisk, Decker, Sherlockkat, Shobalk, and more have stuck with it for a long time and have helped improve the game for everyone. Even others who simply talk about their experiences give me a lot to go on when I consider balance and potential features, revealing any disparities between the intended vs. perceived vs. actual effects of any changes.


I’m not broke yet!

If you’d like detailed coverage of the first month of sales and other data and issues surrounding launch, you can read my in-depth postmortem here. Crazy and exciting times, that first month :D

But that was only a month, and there have been eleven more since then :P

On the funding side those eleven months have been noticeably less exciting, though there were a few unexpected sales spikes in the first few months after launch. Unexpected because I haven’t been doing any advertising, but I did write that first postmortem which apparently got some traction, and Cogmind has also occasionally been picked up by news and review sites.


Cogmind Year 1 gross revenue, annotated.

Each new alpha release naturally tends to give a slight boost to sales simply because news gets posted around, so there’s the obvious incentive to get new releases out there, but at the same time I want each one to be truly significant, so it’s a balancing act to work on a major version as long as possible before it really needs to be released.

Still, the ongoing sales numbers are so small compared to the initial release (lots of people were waiting for that…) that the alpha release effect isn’t so apparent above. Looking at a monthly revenue chart will explain a little more about the long-term cycle


Cogmind Year 1 gross revenue by month.

The first 3-4 months were all about the initial wave of attention based largely on pent up interest, so they don’t really count. Then revenue started settling into a long, slow trend downward. I believe in the bigger picture November was a pre-holiday slump, since I don’t have any Cogmind-specific details to explain why that was the lowest month. I can say that sales and releases of other games don’t seem to have any real impact on Cogmind sales, likely because Cogmind’s numbers are so small to begin with (really, a couple sales per day makes that day for me :D), plus it’s a unique game.

February I can explain, though. That was a release leap month, when I was working on a big alpha update laying the foundation for the development of a whole new and very different part of the world, so it took extra long and there were the usual news updates but no releases during that period. The effect was also likely amplified by a post-holiday slump, especially after a fairly successful December and January.

Ever since February I’ve started expecting that revenue could truly flatline at any time, but that has yet to play out (whew!). This May is turning out to be another February-like month, though, so it’s increasingly important that I start looking forward. More on that later.

For fun, here’s the revenue by country for the corresponding period.


Cogmind Year 1 gross revenue by country.

Nothing surprising there, given that Cogmind is only available in English. There are dozens more countries on the list below that, among them my own--Taiwan, where currently there are only two supporters (no, I don’t know them!).

So in short, Cogmind has grossed US$ 62k in its first year. That sounds like a lot, but “first year” means first year on sale--development has been ongoing as my primary job for nearly three years now, averaging out to a little over $20k per year, or barely enough to get by. (Right now assuming minimum wage I’m still short $10k.)

Am I happy about it? Hell yeah! While I wouldn’t call commercial traditional roguelike development sustainable just yet, I’m confident that I’ll actually start turning a profit (to fund the next game!) with increased exposure and the inevitable 1.0. And for now at least it’s been enough to continue on without too much worry, instead of rushing to 1.0, which means a better/more game for you :D


Thanks to everyone for your support so far! If I wasn’t on this full time we wouldn’t have seen anywhere near the current progress. Here is a composite changelog from the past year, Alphas 1 through 8, and this is where the time has been invested:


Cogmind development time, July 2013 -- April 2016 (excludes 2012 7DRL work).

The total time investment comes to 5,218 hours.

Cogmind is a code-heavy game, since the vast majority of visual assets are scripted rather than drawn manually--that same graph for other games would look quite different. Not surprisingly two-fifths of development is spent writing code.

As is common with most (successful) indie games, community efforts play a large role in that success. At least a third of my time is spent writing blog posts, posting development updates, and (more recently this past year) on the forums interacting with players.

Sure it would be nice if more of that effort could instead be funneled directly into the game itself, but honestly a portion of that community interaction helps get the word out about the game (thereby enabling everything else because that’s where revenue comes from :P) while also having a number of indirect benefits for the game itself. Interacting with others, or even just writing for a reflective audience of me, has helped shape the game over the years. This approach is the foundation of well-rounded healthy development, something enjoyed by few AAA studios, where everything takes a back seat to marketing and revenue concerns. (The #1 goal there is to maximize profit, after all. If my goal with Cogmind was to maximize profit at minimal risk rather than make a dream game, it would be on Steam and at “1.0″ already.)

In the graph you can also see the Content category is starting to rear its head there, an increasingly important part of late-alpha development as most of the mechanics and systems are in place, but the world has plenty more locations to fill in.

The Future

Where do we go from here? Well, as usual there’s the development roadmap outlined over on the FAQ which is updated with every release.


Cogmind roadmap as of April 27, 2016.

As indicated it’s really just a general outline, and there are quite a few other features (and even new locations) I want to edge in there if I can afford to.

In the near term, another release will be out within the next few weeks, then there will be a slight lull for part of the summer as I take a trip to visit family (it’s been years) and hopefully recover from my recent injuries without issue. Then it’s back home to work on late-game stuff and releases will continue throughout the rest of the year.

The biggest elephant in the dungeon is obviously Steam--Cogmind needs to be there eventually, most importantly as a way to reach new players. It’s unfortunately not anywhere near as simple as I’d like it to be (my current arrangement is super simple by comparison). Due to my situation, I have no choice but to remotely set up a company in the U.S. (as a foreigner) to sell Cogmind via Steam. Yeah, not fun. (WTF I JUST WANNA MAKE GAMES /minirant.) That’s only one factor among many, though.

Increasing exposure and expanding the player base requires a huge investment of time that would further drag on development, but it might become necessary before long depending on how many new players the next couple months bring. Tough to balance!

Cogmind is far enough along (and close enough to completion) that it’s about time to see what if any effect a slightly lower price will have on take up. So to celebrate the one-year anniversary of Cogmind Alpha Access, starting this week I’ll be offering a new limited-quantity tier at $25. Although one could say it’s 17% off the $30 price, it’s not technically a “sale” because the new tier doesn’t come with any perks, so it has somewhat lower intrinsic value as well. I’m extremely curious what kind of impact this will have on sales. As usual, I’ll be sharing the results at some point.

But for now, because they took forever to create and I want my money’s worth, here are a few of the updated website images to come :D


Activating a terrain scanner.


Activating a transmission jammer.


Dev shot of a fully-revealed factory map generated using the latest algorithm (lots of important changes from a year ago).

Posted in Post-Mortem | Tagged , , , | 8 Responses


Fabrication has just been redone, and it is good.

I wrote a little about Fabricators a long while back when they were first introduced to Cogmind as a new feature we didn’t have in the 7DRL, allowing you to build robots and parts if you could get your hands on the schematics and meet other conditions.

Then for years the mechanic sat dormant, and honestly even untested (for gameplay) for that entire duration up until the first alpha. That’s when it became obvious it was likely the most broken part of the game, failing to satisfy its purpose on multiple different levels. It got a couple of quick fixes right away to address the most egregious problems (including an oversight that allowed patient and determined players to construct an army of late-game allies at the beginning :P), but even then it was not well integrated into the whole Cogmind experience.

I can’t say this was a surprise, since complex systems need testing and tweaking before confirming they actually work in the broader context, and since so many other parts of the world had yet to undergo rigorous playtesting, it made sense to wait to do any serious work on fabrication since it was a “secondary” mechanic, anyway.

So it was intentionally left at the wayside. Until now.


First of all, why did fabrication even become a thing? At its core, Cogmind is obviously a game about adapting to the situation, building and rebuilding yourself from salvage as necessary.

But with the right limitations, a system whereby players can sometimes exert more control over what they have access to offers a lot of interesting possibilities. Perhaps you’ve found a really useful part you’d like to duplicate? Perhaps a certain build needs a specific part to really take off? (Or to simply avoid annihilation :P) Or perhaps there’s a very special part but you can’t obtain it directly, only get a schematic after which you’ll have to take the extra step of building it.

Thus fabrication serves to supplement the core mechanic, without completely supplanting it. The goal is that it should be impossible to build everything one needs to survive, instead occasionally filling holes in a build/strategy or just providing access to something special, without being a clearly superior option in every situation.

It should also avoid tedium, and as anyone who’s played will know (and as others can read about below) the process used through Alpha 8 is very tedious…

Original System

Quite unlike the rest of Cogmind’s mechanics, which are streamlined to facilitate relatively quick play and involve only so many elements at once, building anything under the old system is an exercise in tedium. The build process:

  1. Acquire a schematic. (Terminal hacks; Scanalyzer scans or extraction.)
  2. Acquire a container and fill it with matter. (Found; taken from Workers.)
  3. Find a Fabricator of high enough rating to build the schematic. (Found; Terminals.)
  4. Hack to load the schematic. (May fail.)
  5. Hack to start the build process. (May fail.)
  6. Wait for the build process to complete.

It was rarely worthwhile to do all these steps, and even if it were, it’s not much fun.

The original purpose behind the large number of restrictions was to counteract the old hacking system: Prior to the hacking overhaul of Alpha 6, it was theoretically possible to hack forever until you got what you wanted. (Technically fabrication wasn’t the only undertested pre-alpha feature--all of hacking was waiting on the sidelines for proper playtesting and integration.) Now that traces can no longer be reset, unless you’re an insanely good hacker, a single machine/Fabricator can only be used so many times. This paved the way for much simplified fabrication mechanics.


A sample schematic, which looks like the normal item information window, with the addition of fabrication details at the bottom.

Schematics are still a part of the new system, in fact playing an even more vital role as you’ll see later.


Various matter containers.

The container requirement was originally conceived as a cool way to link a general-purpose utility with the fabrication mechanics. Cool in theory. It was actually one of the more tedious steps, and also unnecessary from a logical perspective (the machines can draw their matter from a central network, sure). So that was the first thing to go--no more inserting containers of matter.

To me the most annoying requirement, terrible from a design standpoint, was the level restriction on schematics. Schematics could only be built by a sufficiently advanced Fabricator, but the formula to determine the required tier was completely opaque, and even though it was indicated on the schematic itself, it was just another factor that would vary from item to item, an annoying little detail to remember and consider when searching for a Fabricator (while potentially further reducing the number of applicable fabrication locations). So that was the second thing to go--any Fabricator can build anything!

Under the old system, even if you did get a cool schematic, it was still too much trouble to go through all the steps to try and get it built. Some players would try, but as you can see it was an effort-intensive process and quite possibly that effort would go to waste at any given point of failure. Not fun.

New System

The new build process:

  1. Acquire a schematic. (Terminal hacks; Scanalyzer scans or extraction.)
  2. Acquire a container and fill it with matter. (Found; taken from Workers.)
  3. Find a Fabricator of high enough rating to build the schematic. (Found; Terminals.)
  4. Hack to load the schematic. (May fail.) -- Now much easier.
  5. Hack to start the build process. (May fail.)
  6. Wait for the build process to complete. -- Easier to wait, and can be much faster.

Item for item the new system doesn’t look hugely different from before, but the changes already touched on, along with some others, make for quite a different experience.

Schematics still form the foundation of the system, and are obtained using the same means as before, although even that step is somewhat less problematic because Scanalyzers are much less restrictive regarding what they can scan. (I’ll talk more about other related machine changes later.)

Instead of the old bring-your-own-matter system, matter is instead drawn from a map-wide network itself allocated from the central complex matter stores. The amount of matter available fluctuates over time, sometimes receiving a new infusion from the central stores, and others being drawn down from local use, including your own.


Results of the new “Network(Status)” hack.

Your own use, however, is of course unauthorized, and the further you drain the local network below its normal operating levels, the more likely the missing matter will be discovered after the fact and the entire network will be shut down. Causing a network outage is a fairly big hit on the security level, so there are obviously long-term trade offs involved with building bigger and better things, or more of them. But at least you don’t have to worry about supplying the matter :). (Related: One of several new Trojans reduces the chance that unauthorized matter use will be discovered by siphoning part of the required matter from other systems.)

Choosing a Fabricator is also much less of a problem now that rating restrictions have been lifted. Anything can be built by any Fabricator (hence the increased importance of schematics under this system--once you have a schematic you can build it anywhere). Rather than differentiating Fabricators based on what they can build, high-tier Fabricators instead build even faster. (Like, really fast.)


The new schematic readout indicates the base build time at each type of Fabricator, from tier 1 to the most advanced tier 3.

Hacking to load the schematic is quite easy now, though still only more effective hackers will have a good chance of successfully initiating the build process for better parts and robots. (Design note: The hacking part was split into two separate commands partially for UX purposes, enabling selection of a schematic and first giving feedback on the requirements, and also making it easier to repeat the more difficult second (build) hack without having to again select a schematic from a list. The third reason, implied earlier, was the original possibility of unlimited hacking and a corresponding need for a two step-process so that players had at least some chance to be both detected and traced in a single session.)


Visiting a low-tier Fabricator without hackware assistance.

Then there’s the waiting. This works more or less as before, though for multiple reasons fabrication can be completed more quickly than in the past. The time formulas have been adjusted, advanced Fabricators build extremely quickly, and there is a Trojan which can further accelerate the process by prioritizing all matter requests by a given Fabricator.

And while a couple alpha players wanted instant build times, I feel the strategic implications of a time cost are important because time effectively ties the fabrication into existing systems and gameplay. Any number of things can happen while waiting around ;)

There was one long-standing issue with waiting, though: It often required a little mental math. When the build process begins, it tells you how long the process will take, but then the best thing to do is add that number to the current turn count and wait until then. (In hindsight it could have also given the completion time, but it’s still something to keep track of--we can do better than that!) You could also just keep waiting until the build finished and popped out the results, though that approach is a good way to waste precious turns by over-waiting.

My first instinctive solution was to add an auto-wait feature, a command with which you could automatically wait until a nearby process completed. Unfortunately that involves unresolvable complications like how to treat potential threats that have appeared on your sensors, but may not be threatening at all (or you’re intentionally ignoring them).

Seeing as it’s quite easy to just hold a button (or spin the mouse wheel) for a short while to wait, what’s really needed here is a visible timer. So when a build starts, as each turn passes a little label pops up to report the number of remaining turns.


Starting a build and waiting through the process while the timer runs down.

The timer is also color-coded, so you don’t even have to pay close attention to the numbers--red is a while off, then orange, then yellow, and if it’s green then you know it’ll be done pretty soon and can start paying closer attention.


Short-lived friends making the ultimate sacrifice, and not even complaining that I’m doing nothing to help them.

Note that you could/can always open the machine info window to see the same countdown timer there, but that’s not nearly as convenient. Cogmind’s UI is all about making pertinent information as accessible as possible, and this works well to that end.


Whereas before it was almost never worth it to build things except maybe as a novelty, it can now become an integral part of player strategy. This will be especially true for those carrying at least some hackware, but even those without can make occasional use of the system.

There’s always the chance that in the right hands this less restrictive system might be open to abuse, but we’ll get to tweaking it depending on how it’s actually used in practice rather than based on theoretical analysis and what shows up in a few playtests. I’m curious how players will use it in its current state.

That said, I don’t (and never did) intend for every Cogmind to be great at fabrication, and it’s still an entirely optional part of the world.

Other Machines, and the AI

With the Fabricator updated, it made sense to make similar changes to other machines in order to maintain balance (and working on related systems at the same time is a more efficient approach to development).

To that end, Repair Stations can now repair anything--rating restrictions have been lifted. Like Fabricators, tiers instead affect the repair duration, which means better stations will repair much more quickly. They also get to make use of the new on-map timer:


Repair Station displaying a timer while that process is underway.

Similarly, Scanalyzers can also scan anything! More advanced Scanalyzers are less likely to require additional scans to create a schematic, as well as less likely to break the part in the process.

With that, all machines have now been improved since Alpha 1 last year, working together to enable a wider range of interactions, and hopefully inducing fewer “meh, whatever”s as Cogmind spots a new one :P

Speaking of interactions, the central AI now also makes use of Fabricators, too, a bonus that comes along with the new mechanics. It builds non-combat robots to eventually replace some of those destroyed (rather than sending them in through map access points), builds combat robots to supplement garrison forces, and builds new parts that are picked up by Haulers for delivery to garrisons. It’s nice to tie another machine into the visible ecosystem, similar to how we have mechanics based out of Repair Stations, operators interacting with Terminals, recyclers using recycling units, and more.

Posted in Mechanics | Tagged , , | 4 Responses

FOV Aesthetics

At its most basic, displaying field of vision in a roguelike is simply a matter of whether you see a cell or don’t. These cells are in view--draw them; those cells aren’t--don’t draw them :P

But there can be more to it than that!

There are plenty of ways to get better-looking FOV, though before recently I hadn’t spent any time exploring them in the context of Cogmind. By contrast, this was something I did early on with X@COM, because FOV plays an even more central role in that game, being directional and having control of multiple units each with their own viewpoint. With Cogmind it was never a high priority or even something I seriously considered since the FOV system’s original iteration couldn’t handle additional processing, and the central algorithm had already been highly optimized as part of the pre-Cogmind engine’s code base.

However, last week while playing around I realized there’s now a lot more breathing room in the system, enough to make some experiments worthwhile.

These experiments have paid off in the form of new FOV features described below :D

To clarify, this article is concerned with the aesthetic side of FOV, rather than how to determine what is visible from a given position. For the technical side you can see an earlier post from 2013, and also check out this FAQ for how myself and others calculate it.

Within FOV

Some roguelikes allow for dynamic FOV-affecting elements within the player’s own FOV. This includes features like light sources, or fading/darkening objects that are further from the player.

Dynamic lighting is great for realistic environments. I use it in X@COM, where it’s quite an important part of both the realism and mechanics, so there are lamps, light posts, flares etc. that can light up areas of the FOVs around them when ambient light is otherwise low.


A night scene from XCOMRL, showing light emitted from soldiers (triangles) and lights (‘L’--the source of light for the gray ones along the road is actually three floors up).

Cogmind intentionally doesn’t do any of this, but I’m including this feature in the discussion for completion’s sake, and to explain why :). Unless a roguelike is specifically designed around this (say, a pure stealth roguelike where lighting is a core mechanic, or a world in which light plays an important role in creating the atmosphere), it can easily become an unwanted barrier, obscuring tactical information in a way that brings out biological differences between players (e.g. eyesight), something best avoided where possible in game design.

The FOV area is where a player needs to be especially aware of what objects can be seen, and just as importantly, where those objects might not be seen. The latter can be difficult to discern within an FOV of variable (non-uniform) brightness. Clarity of tactical information is of utmost importance to a roguelike given the emphasis on gameplay over visual appeal. This is also why Cogmind’s map view is generally quite static, and contains a lot of black (few to no background colors except when something important is happening/displaying, like combat or object labels and other UI feedback).

So I’m glad this isn’t a necessary part of Cogmind’s world (that way it doesn’t interfere with other goals of the design), though I’ll likely want to put more work into the FOV design when continuing the X@COM project (yeah, “it’ll happen one day”).

Outside FOV

How to display what’s outside the player’s FOV is pretty important, too, though of course for different reasons. Players need to be able to scan previously explored areas for reference, and those areas need to be sufficiently distinguishable from currently visible areas (especially the floors so that it’s possible to easily locate the FOV edge in open areas). At the same time objects outside FOV ideally must be distinguishable from each other as well!

From the outset, Cogmind has technically included four different “extra-FOV display modes” that it inherited from X@COM. These alternative modes make sense in a game like X@COM, but are pointless in Cogmind, as ambient light levels are static and uniform, and there’s no dynamic lighting, so Cogmind has only ever used one of them (of course it’s the most processing intensive one :/). But while we’re here, might as well look at what they are:


Comparing XCOMRL’s four methods of displaying non-FOV space (click for full size). Bonus image: FOV coverage mode showing exactly where each unit can see.

For Cogmind, to fit the theme an additional green overlay was layered over method #4 (unlit grayscale):


FOV vs. non-FOV areas in a Factory map.

Note that because the original colors of terrain and objects outside the FOV are different, and that helps distinguish them under normal circumstances (while in view), the grayscale method is best because it reflects those differences. The simpler alternative, using some static darker color for everything outside FOV, is harder to parse because objects lose that relative brightness and then shape takes over as the only way to tell objects apart. Not very helpful:


The previous scene shown instead with a uniform green--no good. I am, however, considering an additional FOV toggle for non-FOV areas, which you can see in these darkened and full color experiments.

Conclusion: Grayscale conversion is awesome.

I use the luminance method to convert, taking the original RGB components of a cell’s foreground color and setting each value to a new value created by combining 30% of the original color’s red component, 59% of its green, and 11% of its blue (e.g. r = g = b = 0.3*r + 0.59*g + 0.11*b).

FOV Transitions

So most of the above is background/supplementary to the meat of what I’ve really been working on lately. While I haven’t made any changes to the appearance of FOV, inside or out, when the player is just sitting around thinking about what to do next, a lot of time is also spent moving, and that now involves some interesting new display options.


FOV options!

Delayed Updates

Since 2012 (!), when any obstructing terrain was destroyed, FOV would not be updated until the current action completed. This could delay an update until a 1-second explosion fully plays out, for example.


Delayed FOV updating in action.

There are multiple drawbacks to this method: We can’t always instantly see all the results of an action (feedback delay), and explosions appear overly constrained in some situations despite having technically already blown through obstructions.

The main advantage is speed: FOV is only calculated once no matter how many doors, walls, or machines an explosion blows through. The locations of every FOV-affecting change to the environment are stored in a list while the effects of an action are being carried out, and at the end of that action the engine checks if the player can currently see any of those locations. If they can then it updates FOV.

This “delayed update” option is still available, because as the least processing-intensive method it might be useful on an extremely slow old CPU. Otherwise there’s no reason to not go with method #2: real-time updating.

Instant Updates

Last week I realized that Cogmind doesn’t really calculate much in the way of FOVs, not like its parent game X@COM (dozens of units each calculating FOVs in a 3D environment, on top of omnidirectional FOV-based light sources). Cogmind has hundreds of AIs in a single map, but they use a non-FOV visual detection method, so all we have to calculate is the player FOV and possibly those of their active drones.

The “instant update” option also checks the same list of environmental changes, but rather than waiting until the action is complete, it’s allowed to recalculate FOV every single frame as long as there has been some change.


Instant FOV updating in action.

This is the common and natural way to handle it in a terminal roguelike, but large-scale turn-based games with other CPU-intensive routines to carry out might delay this kind of update until the end of an action (or they’ll delay it for design reasons). Cogmind’s original FOV system, together with the game’s heavy use of animations in some cases, was that kind of barrier to instant updates when it was first developed, which is why instant updates weren’t a thing to begin with.

Fade In

Even with instant updates, when Cogmind moves or obstructions are removed, newly revealed FOV areas just *pop* into existence like you see in most roguelikes.

Why not have the new area fade in? Some players will appreciate the extra flair, and it does perhaps introduce a slight benefit in that for a split second you can differentiate between what’s new and what isn’t.

Doing this isn’t too hard: When calculating a new FOV, if a location is visible but wasn’t visible on the previous calculation, store its coordinates in a list; then, when rendering the map, fade in the cells at those coordinates.

At first the fade-in code wasn’t working, so as part of my tests I ran this debugging mode that showed FOV changes in red. It looks kinda cool so I’ll just show that here :D


FOV record debugging visualization.

After confirming that FOV changes were being properly recorded, it was just a matter of tweaking the fade formula to actually render those changes dynamically.

Specifically, when each location is stored by the FOV algorithm it must also store the time when that particular change took place, and while rendering the engine uses the time elapsed since that point to calculate the amount of fade, which in this case is not actually a simple linear fade in from black to the target color. Instead it uses a 400-millisecond linear interpolation along a sine curve from the RGB color (0,48,0) to the target color. (0,48,0) was chosen to approximate the dark green colors used to display known areas outside FOV, to give a smoother transition from outside to inside FOV. Each cell’s record is removed after its 400 millisecond timer has expired.


Fade-in FOV updating in action (tiles mode).


Fade-in FOV updating in action (ASCII mode).

400 milliseconds isn’t very long, but it must be responsive so that fast-moving players can clearly see what’s ahead. Besides, the best secondary animation effects are subtle--in my own work I most often use fade timers in the 200-400ms range.

Performance-wise this is another step slower than the instant update, but it’s not like we’re updating a ton of units here, so it shouldn’t be an issue.

The biggest issue I did run into, and one I initially thought might keep me from enabling this feature, was how to reconcile the differences between revealing unknown areas compared to previously known areas. Unknown areas are black, and previously known areas are, as per the grayscale-with-overlay method, displayed in various shades of green. So in revealing new FOV areas, the ideal linear interpolation would shift from black or the relevant green shade to the new color, but it’s impossible to achieve a perfectly smooth transition without knowing the actual color from each source cell. Unfortunately there would be a lot more code (and processing) involved in figuring that out, so the easiest route here was to pick a single source color that was dark enough to work for black-to-light transitions, and also compatible with the various shades of possible green from known areas.

Before coming to that conclusion, in the search for a perfect transition I experimented with another alternative: using a static uniform color for everything outside FOV. As described earlier, however, failing to account for relative brightness of individual objects is a a pretty poor way to handle non-FOV display, being difficult to parse.

So, back to the chosen color, (0,48,0). Using a static color to transition from a variable source causes a bit of flicker at the FOV edges depending on what color the walls are, most noticeable while racing down a narrow corridor where the majority of your FOV is walls.

And with that we have the final results of our new FOV updating features: See explosions in all their glory!


Instant FOV updating with fade-in on explosive removal of terrain.

I think I might prefer the Instant method for its traditional feel and instant feedback, though technically the coloration only applies to the map itself, and not animations nor the most important feedback mechanisms like labels and indicators--those still appear all the same regardless of the fade-in effect. Either way, for now I’m setting the game’s default to Fade In, because it’s “better.” What do you think?

Posted in Design | Tagged , , , , , , | 6 Responses