Monday, May 23, 2011

A Valley Without Wind Pre-Alpha #11 -- Story, Setting, Explorers, Evil Outposts, and Animations

It's been a while since our last update -- we've been really busy, as you might expect.  The game has now been in development for 17 weeks, but this week we don't have a new fully-produced video mainly because we're running short on time.  However, a number of the new animation updates that are in this batch of changes really can't be described very well with words, so I've put together this animation test video that shows off each new thing for you:

Interior Generation
This is something that I posted a lengthy technical post about yesterday, but the short version is that procedurally-generating the interiors of buildings is coming along well.  It's a problem that lots of other people have solved in various ways, but which nobody seemed to have solved in the specific way that I needed.

So I've come up with a moderately new approach to the problem, basing part of my work on what an indie working on roguelikes created, and that's leading to really interesting and varied interior floorplans at this stage.  In a month or two, once that's all further polished I'll be releasing the C# source code for my interior generator as open source under the MIT license, so that others can make use of it.

Story And Setting
Perhaps the most shocking thing we've changed in the last three weeks is the story -- the broken-earth setting, former ice age, etc, all remains, but the real-world future setting has been replaced.  Instead this is now a purely fantasy world called Environ.  Rather than trying to explain all the differences, let me just give you the new intro story for the game:
It is the year 888.  Wind-blasted snowfields have covered the world of Environ for centuries.  Survivors in this ice age are few and isolated, caged by the bitter cold.  If they travel, the world itself seeks to devour them.  For most, only the enigmatic Ilari provide any shelter against extinction. Driven by desperation, others ventured into the forbidden lands to unearth and reclaim citadels of ancient and wonderful technology. Wary of the ill-understood machines, some have embraced the talents of magic and telekinesis that have emerged in recent generations despite fear of accepting those powers from the Ilari.

Now the glaciers have begun to recede, and a few brave souls venture forth.  What they discover is something no one expected:  Industrialized cities from the 5th century lie in just-abandoned ruin, next to far-flung bronze-age towns from the first century of the ancient era, near enclaves of skeletal robots from a time after people.  Most people from those fragments of other times are dead, but some live on despite periodic scouring windstorms and roving monsters.  These people are as lost and confused as the refugees from the ice age.

This is a deadly new world, and the scattered peoples of Environ must work together if they wish to stay alive.  They must thwart the wind, the monsters, and the would-be tyrants popping up.  They must explore and scavenge the time-shards to find the materials they need.  And they may need to enlist the Ilari to help rebuild civilization.  If the survivors can find out what happened to their world, that would seem a luxury.  Such massive damage seems irreversible, but some may build what all now dream of: A home free of fear and death.  A "valley without wind."
Why the change?  Lots of reasons; this has been building for a while.  I think that Keith always would have preferred a more fantasy-focused setting, but I was pushing for the broken earth setting because of lingering attachments to the setting from Alden Ridge.  But as we've been doing the project, I keep coming to the realization that this or that thing would be more interesting if it was vaguely like the real world, but set in a fantasy world.  I talk about that some relating to interiors in particular in the Interior Generator post.

So now we have a world called Environ instead of Earth, and all the peoples and nations are fictitious instead of historical, though some historical influences should be obvious as in many such fictions.  Instead of the real timeline of civilization, we have something that goes roughly like this:

The Ancient Era (before year 0, encompassing many things such as the bronze age and so on)
The Major Event (year 0)
The Middle Ages (0-300 or so)
The Modern Era (300-500 or so, and very similar to our 1900-2010 period)
The Ice Age (500-888+)
The Future (not saying, but that's where the skelebots are from)

And actually there's a lot more detail to everything than that -- ancient Atlantis-style high technology civilizations, etc -- but I'm not going to go into more depth at this time for two reasons.  First, I think that's spoiler-y enough just with the above, heh.  And secondly, we actually would like to have some divergence in history timelines from world to world.  Not saying that will definitely be something we do pre-1.0, but it's ultimately where we want to take this.  So the "major event" might be some bad cataclysm, or it might be some major good event, depending on the world in question.  We'll see.

There's never a shortage of ideas, though, and going with a more fantasy/sci-fi mixed setting, while keeping elements from the real world, gives us pretty well the ultimate in flexibility.  That lets us tell all sorts of stories, which of course is the big goal here.

The Minimap
Visually, the minimap looks the same as it did last time.  But functionally, we've changed a lot with how that works.

The system we were using before was to have "points of interest" that were these little black doohickeys on the ground with a red glow that you had to walk near to.  When you did, the red glow would go out, and you'd get some EXP, and the minimap would reveal a piece of itself that was tied to that POI.

In practice, this made exploration an enormously time-consuming and annoying activity.  Finding a little tile-sized POI object in the middle of this giant overworld region was not fun, not fun at all.  And the way that the EXP was gained actually had some problems with that as well, but I'll get into that more next time -- some general changes coming with EXP.

So what we did to solve this problem, anyway, was that we got rid of visible POIs but kept their sort of segmentation for the map.  So as you walk around the map, whatever segment you happen to be into gets revealed as soon as you enter it.  This makes exploration comparably straightforward, and prevents you from ever having to scour around an empty field looking for some tiny object, for instance.

The minimap is so insanely useful because it helps you efficiently navigate; and the new segmenting system still keeps the fun of exploration because on intricate twisty maps you still have to find your way around obstacles, etc.  So this works out as a very nice balance, and best of all when we're playtesting now the exploration just feels right, and feels fun.

Also, as a convenience we've made it so that doors to buildings that you (or another player) have previously gone through now show up as green instead of red on the minimap.  This is sort of an auto-breadcrumb feature, but we're also going to have manual breadcrumb features where you can magically mark places that are notable or that you want to come back to (or that you don't want to come back to, if you prefer).

Lastly, the entrances on the minimap are now actually drawn where the entrances are, rather than centered on the entity housing them.  This makes the minimap yet another bit more informative (so you can tell when a building has two side entrances, etc).

Evil Outposts
These aren't 100% complete yet, but their structure is in there now.    Essentially, these are dens of bad guys that harass your settlements or cause other trouble.  These are less notable than an evil overlord lair, but still cause a lot of grief to whoever they are bothering.  You can undertake to destroy these outposts, or you can actually use friendly NPCs to soften the outpost up before you go in.  The mechanics of that we're keeping under wraps until you get to try it in beta, but we're very excited about it.  Hey, we've got to leave some things for you to discover in-game right?

Explorer NPCs
The game now supports NPCs that are explorers, and which will go out looking for things.  This is very useful, because a lot of important things in the game aren't apparent on the minimap until some player or NPC has found them.  You can control where NPCs explore by where you place wind shelters, which adds a bit of a strategic layer to this part of the game.

If you're looking for an evil overlord outpost, or some new settlement to visit, you can have NPCs go and try to at least locate that stuff for you, rather than you having to search completely manually yourself.  Or if you're one of the "kill everyone I meet" sort, you can of course do the exploring on your own time.

Settlement Changes

At one time I believe we were saying that the only survivors in the world would be scattered NPCs that were alone or in very tiny groups.  And that any settlements that existed in the world would be ones that you'd create yourself.  That's changed.

In practice, we found that this would just be too tedious.  Creating your own settlement from scratch is fun and interesting, but not if it's something you have to do a lot of times in succession.  So our goal is that you'll want to do that at least once in your playthrough, but that it won't be a regular thing.

Instead, you'll get to focus on the more fun mechanic, which is shepherding, customizing, and growing settlements.  Getting them started is the boring part.  Consequently, there are now smallish settlements (at the moment, about 5-10 NPCs starting out in most) scattered all around the map as you explore.  As noted above in the Explorer section, these won't be obvious as you're moving about on the world map, so you can either explore deeper yourself to find them, or use the explorer NPCs to make that process quicker (trust me, there's no shortage of things for you to explore directly, so having the NPC take on some of the grunt work doesn't lose you anything but a grind!).

Visual Additions

* Many spells and such are now able to ripple grasses and other plants like that as they pass over them.

* When your character has died, a status message at the top of the screen now says "[Name of Character] has perished. Press confirm to choose another."

* Similar context-sensitive info messages at the top of the screen are now shown when you can pick up a player bag, talk to an NPC, or are standing in front of a door you can go in through.

* Monsters, NPCs, and player characters now have (usually single-frame) hit and magic animations that get played.  The hit animations for players usually involve a ducking hand-motion as the player telekinetically thrusts or slashes a glowing weapon.  For spells, the pose the character takes varies quite a bit more, which injects some more visual personality into each type of sprite.
** These animations are super fast, well under a second, which is why they only need to be one frame.  That makes it so that they don't take up much time or cause you gameplay lag of any substance, but the positive impact on the feel of the game is really great.  It's a lot more immersive this way.  This was another big item that took a lot of code additions to get working.

* Bats now barrel-roll when they hit the player.

* Espers now have a spin visual effect when they are attacking the player.

* When entities die, they now collapse into the ground in a paper-like fashion, making for a much more satisfying effect when trees and other large objects are shot, in particular.

* Extensive, extensive work has been done on "cross chunk transitions," which basically makes all the objects on the screen collapse into the ground when you leave, and then all of the new ones shoot up out of the ground when you come back.  The ground itself is fading in/out to black as it does so, so it's a very neat look that adds a unique flair that's only possible with the specific sort of visual style we have going on here.  I'd say it looks sort of like a popup book as it does this, but that sounds childlike and un-cool.  This is something that looks really fun and that I could just watch over and over again (and have, while getting all this working).  This was another really big job, but it makes the game feel vastly more polished to play.

* Added in a new fancy visual effect for when new tiles are discovered on the world map, causing them to swirl around and then settle as they appear.

* The game now supports non-square textures (that are still powers of two on each side), which makes for some slight loading speed improvements as well as some render-speed improvements.

* When player characters pick up something like dropped loot, they now briefly stoop to do so (for a quarter second or so) and stop moving as they do so.

New Spells

* Teleport uses a tracer object that moves quickly for 0.25 seconds, and then teleports the character to the location of that tracer object.  Thus teleportation through solid walls and such does not work, but teleportation across chasms and water does.

* Ball Lightning is basically a more powerful fireball that is a bit slower to use and also wider, which is worse for small areas but easier to hit moving targets with.  It's also more expensive to make and has very different (and cool) visuals.  It's not really that exciting compared to other spells I have planned, but the visual effect was something I stumbled across by accident while doing teleport, and I figured this would be a fun "minor variety" sort of spell.

And Lots Of Other Stuff
There were also lots of other bugfixes and internal tweaks and changes, but I won't bore you with that list.  It has things such as accuracy of coming out of doors, not letting energy lances slide around objects, making light snakes not collide with entities, making object collisions multi-source for mob situations, and the list goes on.

I try to keep to the more interesting stuff here, but once we hit beta the lists of changes in each version will be all-inclusive as our AI War fans are used to.  But so far there's just no point in doing that here, as that's only relevant notes for active players.

Thursday, May 19, 2011

AVWW Interior Generator (Technical Overview)

I'll have a full developer diary #11 (no video this week, though) posted in the next day or so.  However, first I want to talk about interior floorplan generation.  This is something that I'm going to release as an open source example program in a month or two, once it's fully polished.

This past week has been both the most productive and the most mind-numbing that I can remember in a long time, for me.  That's a really odd combination, no?  Well, there's a reason that I've been putting off the interior floorplans work for A Valley Without Wind since March.

Discarding The Map-With-Variances Approach
Initially I had thought I would do a map-with-variances approach for interior floorplans, basically a similar version to what we are doing for external overworld chunks.  The problem is, while outside wilderness areas are nice and blobby and organic and lend themselves well to that sort of approach, interior floorplans really don't.  The first time somebody sees the bathroom opening directly into the kitchen, or finds a conference room that can only be accessed by passing through a small storage closet, the jig is up.

Then there's the problem that I have to model building interiors based on exteriors that are pre-rendered.  What I mean is, the vague shape of a building (ignoring windows) needs to be the same as the outer shape you're seeing in the overworld chunks.  If the exterior walls are angled in the pre-rendered image for outside, they have to be angled inside, too.  If the door is in the front center of the building, then it has to be there on the inside, too.  If your building is rectangular or square, tall or short, and on and on.  And that's before you get into function, even -- houses look one way inside, office buildings another, etc.

We've only got maybe three dozen building graphics so far, and lots more are planned, but already we have a staggering number of combinations of shapes, which was going to make that map-with-variances approach an incredibly intensive amount of content generation, as well as profoundly disappointing to players that expect something procedural.  Externally, our map-with-variances approach works so well because it augments the procedural generation techniques, providing more variance through complex human-created inputs than a pure-procedural approach is likely to make.  Internally, the variances would be too small because of the need to make the whole structure make some sort of human-constructed sense.

Examining Existing Fully-Procedural Approaches
So my next thought was to just go fully procedural for the interior of the buildings, after all.  I started cooking up some ideas for how to do this, and then decided to do some research.  And that quickly shot holes in pretty well all of my ideas.  Turns out that this has been a much-studied problem, and there is even one guy who did his masters thesis on how to model 3d house interiors -- just houses, not any other kind of building.  There were some other scholarly papers on other forms of building interiors, but most of those were behind paywalls and were likely to be full of examples in math, not code.  I think in code, not math.

This was mostly stuff for 3D models, though, anyway -- much more complex than I wanted.  I turned instead to roguelikes, which are a very well-understood form of interior generation, with a lot of different kind of algorithms.  Last fall I got into procedural maze-generation algorithms for some of the latest AI War map types, and these roguelike algorithms were only somewhat more complex on the whole.

The problem is that the maps they create are full of holes.  If you've ever seen a roguelike, you know what I mean: most dungeons have a room, with some hallways off of it connecting to other rooms, and all of this is floating in this big, empty blackness.  The overall extents of the rouguelike dungeons tend to be unpredictable, there's all sorts of non-accounted-for holes all throughout the map, and it definitely doesn't conform to any sort of exterior building shape.

Perhaps the simplest example of these approaches was one by Jason LaPier.  Here's his Javascript example that you can play with in your browser, and here's his blog post about it.  I was attracted to his approach because it was very simple and was able to take in human-created data points in the form of room shapes, which would allow for a lot of flexibility even after the initial algorithm was complete.  However, it still suffered from all the drawbacks (for my purposes) of any roguelike algorithm, in that it created a roguelike-looking dungeon.  Which wasn't my goal.

Setting: Creating Unique Architecture
Before I continue on with my technical explanation, there's something else that I'd like to note: namely, that as I was looking at all these methods for making both fantastical and realistic building interiors, I realized how much more interesting the fantastical ones were.  Houses and offices are actually kind of boring buildings, when you get right down to it.

That's why you see games like Left 4 Dead having all sorts of passages blocked off and destroyed, and parts of the buildings collapsed, etc.  Normally most buildings are meant to be as easily-traversal and non-maze-like as possible, for the sake of usability.  We want people who enter an office building to be able to get from point A to point B as quickly and simply as possible, in the real world.  In the game world, it's far more interesting for players if the path from point A to point B is as convoluted and challenging as possible (well, within reason).

This is something I'd run into in the exterior areas, too.  Normally, in real life, when you're in a big field of grass or in the woods... you can just pretty much walk any way you want.  Sometimes there are bushes, but you can go through them if you really want to.  And going around is rarely far.  Most of a grassy field is going to be hugely boring to you, because it's all just the same grass, essentially.  What made the exteriors in AVWW suddenly take on a life of their own is when I started to diverge from reality -- making lots of little streams, lots of chasms, and various other obstacles to get in your way.

Suddenly the exteriors felt mildly to majorly maze-like (depending on the area), and were a lot more fun and interesting to explore even without having more interesting points of interest yet.  That was a really key thing for me to learn.  And if you look at something like Minecraft, you can also see how effective the terrain-generation is there, too, even with very few types of terrain.  This is also something that really adds to the attraction of roguelikes, I think -- because their dungeons are very abstract and unrealistic, they are also very maze-like and excitingly unpredictable.  They feel like somewhere you'd be chasing after dwarves or orcs, not like someplace you'd be doing your taxes.

With all this running through my mind, the choice was easy -- this game needs to take a more fantastical turn when it comes to interiors.  Instead of trying to model real house floorplans, let's model house interiors that are as interesting and crazy as possible.  Floorplans that have all the parts you'd expect -- kitchens, bedrooms, bathrooms, etc -- but which are built to be intentionally game-like and thus maze-like.

A lot of games that are trying for realism just use the aformentioned techniques of building damage and rubble to accomplish the same effect, but to me that just wouldn't provide enough procedural variance.  Players can tell when the floorplans are boring but rubble is just moving around.  Of course it's still my upcoming of challenge to actually populate the buildings with interesting things, but right from the floorplans on up I wanted to have buildings that felt unique, unpredictable, and excitingly foreign.  Like a roguelike, then, but without all that soupy blackness between rooms and halls.

Crafting My Own Approach
The things I really liked about LaPier's roguelike example was how he defined his room templates as char arrays that were easily human modifiable, and how he randomly mixed them up on a row-by-row basis to create random variances.  Since he graciously released his Javascript code under the MIT license, I decided to start with those pieces as a core for my work, and go from there.  Instead of doing halls and such in his fashion, I'd do something of my own.

The other challenge that I was going to have was that we use a faux-3D perspective in AVWW that is identical to most SNES RPGs but very divorced from anything roguelikes are doing.  As with most maze-generation algorithms, they assume a flat grid and walls that take up exactly one tile each on the grid

What I had to do was somehow implement walls that had perspective, which meant that side walls would be one wide while top and bottom walls would be three high at minimum, but preferably not more than three high without converting into side walls or a big ceiling block above a certain point.  What a challenge!

This was the other reason that I really liked LaPier's approach: I could build those elements of faux perspective into the room templates themselves, which would give me a good start on having a correct map once they were seeded in.  Then I'd just have to figure out a new way to add doors and hallways, to make sure everything was connected, and to correct all of the literally hundreds or thousands of perspective errors that were likely to result from just plopping everything together in this fashion.

So that's what I sat down to do, a week ago.

The Process
This is the process that the interior generator goes through, in sequence:

1. The type of floorplan is based on an enum, and the size of the overall floorplan in width and height is encoded into the enum name for the sake of brevity.  Note that these sizes are inflated compared to the actual size that the building appears to be on the outside -- common to most RPG games.  That gives us much more interesting interiors, and exteriors that we can actually see the whole of.

2. A random seed is passed to the FillMap method, along with the InteriorGenerationStyle enum.   Given those same two inputs, and the same desired floor (Z Index), the result will always give you the same map, which is helpful.

3. The first mapgen step is to set all of the InteriorGenerationStyle-related variables, which includes defining the broad profile of the building's outer walls to match the exterior.  This also places the exterior doors or ladders.  For side doors, since you can't see those in the exterior graphics in the game, those can be placed at any Y offset along each wall.

4. There are a couple of different room templates that I have defined in a similar style to what LaPier was doing.  Which are used varies by InteriorGenerationStyle as well, and I have four different possible definition types.  W is "provisional wall," C is "provisional blocking ceiling," b is "provisional non-blocking ceiling," period is "generic floor," and blank space is "hallway."  At this stage in the process, that's all we need.  I'm not defining room types, and I'm also not defining possible door-points.

5. For buildings that have more than one floor, it decides how many floors they will have between min/max values for both the upper and lower bounds.  It then clamps the requested floor to the actual floor bounds -- so if you request floor 0 and the max floor is -1, you get floor -1 as your topmost floor (so, this would be an underground building, like the ice age hatch).

6. Now we actually cut staircases between the floors.  Starting at Clamp(0) floor, it starts deciding where to place floors, and then it recursively moves toward the floor you actually requested, collision-detecting and stripping out two-floors-away staircases as it goes.  The result is that you wind up with staircases that are always lined up perfectly and never sitting on top of one another.  Beyond that it's a little hard to explain, so I'll leave the code to speak for itself on how exactly I made that work, when the code is released.

7. Now that we have the outer shape of the building in place, the doors or ladders to the outside, and the interior staircases, it's time to actually start filling in walls and rooms and hallways.  To do this, I use LaPier's method with a few modifications: I don't intentionally leave space between each room, and when there is leftover space I distribute it completely randomly in the X and Y bounds of each row.  I also randomize the list of rooms per row after all of them have been picked, so that there isn't a trend of having smaller rooms to the right of the building.

8.  Step #7 happens in isolation, in a completely different code structure from the actual building I've been building so far.  What I wind up with is an identically-sized LaPier-method overlay of rooms with no external shaping that I can plop down on the staircases, the doors, and the exterior walls that I've defined so far in steps 1-6.  During this step, I never overwrite the actual existing building structure that we've defined in those first six steps.  The staircases, the doors, and the exterior walls cause all sorts of disruptions to the LaPier-style rooms, and that's completely okay as that actually adds substantially to the variance once we combine the two.

9. Now I'm done with the LaPier method, and I have a perfect external shape, random staircases, doors to the outside, and some pretty interesting rooms layered about -- and filler hallways naturally develop based on how I designed the LaPier room templates, too. However, there are no internal doors between any of the rooms or hallways, and all sorts of things are inacessible and invalid.  The perspective of the walls is munged up in many places, because the various room templates haven't been blended together, they've just been set next to one another.  When working with rooms with perspective, that's deadly to the realism.

9.a. From here on out, we enter a master method called CleanUpInteriors, which is what I spent the bulk of this past week creating.  It has 22 steps that it goes through with the "provisional" walls and floors and ceilings, and then it converts all the provisionals to actuals, and then it goes through a further 30 distinct cleanup steps.

9.b. The very first thing that we do in CleanUpInteriors is 8 cleanup steps that get rid of the most obvious problems: walls that are incredibly high or short, ceilings that are placed incorrectly, and so on.

9.c. Next, and optionally, the game looks at all of the defined rooms (any contiguous areas of GenericFloor), and it cuts random doorways between a room and anything that's not part of the room, in a random direction.  Later we'll definitely be more precise about making sure everything is connected in a valid way, but this is a handy way to disrupt things early.  Some InteriorGenerationStyles use it, others turn it off

9.d. Now we go through another 11 of those cleanup steps, some of them quite lengthy.  The goal here is to get things prepped to the point that the overall structure of what is closed off and what is open is now pretty set.  We need to know which tiles the player is allowed to traverse in some fashion in order for our next step to work right.

9.e. Having the data on traversable tiles in hand, now I use a pathfinding algorithm to find all the grouped traversable tiles that are unable to be traversed to one another.  For buildings with two exterior doors, I actually use a pathfinding trick that allows for each door to have a separate set of rooms and hallways that does not connect to the other.  That doesn't always happen, but it can, which is a neat variance.  Sometimes one of the side doors just opens into what amounts to a coat closet, or sometimes it's just half the building, etc.

At any rate, once I have the data on where connections are missing, I add in randomly-sighted doors such that everything is connected.  It makes sure that a valid connection will result from each door so that it doesn't put in excess doors, but where it places that door out of the pool of valid places per contiguous traversable tile set is completely randomized.

9.f. Now we have a fully-traversable interior floorplan, but there are still a lot of details that are messed up, and the cutting of the new doors (and in some cases, hallways) has caused some new minor disruptions.  So it's time for one last cleanup step on the provisional tiles, then the conversion to the non-provisional tiles, and then the final 30 cleanup steps.

9.g. Some of these final 30 cleanup steps added in chasms (for rooms that are completely inaccessible by any means for some reason), and courtyards (for rooms that aren't directly accessible via an interior door or hallway, but instead require going under the edge of a ceiling to get into them.  The chasms and courtyards are fanciful and just part of the AVWW theme; you could easily leave them as hallways or GenericFloor, at your preference, if you're using this algorithm in another game.

10. Now the game has a fully-defined, polished set of interior rooms, halls, chasms, and courtyards, inside an outer structure, with staircases up and down and exits to the outside on a single floor out of potentially many.  FUTURE STEP: All of the rooms are now nicely defined, distinct from the hallways, based on being either GenericFloor groups or Hallway groups.  These GenericFloor groups can instead be changed into more specific floor types, such as Bedroom, Kitchen, Bathroom, Office, etc, etc, etc.

This is actually a comparably straightforward step, although I'll have to be careful not to put bedrooms leading into the kitchen, or bathrooms without any doors.  Anyway, I haven't don this step yet, which is one of the main reasons I'm not yet releasing the code (the other reason being that the numerous cleanup steps need more testing and tuning time, although at this stage they're looking pretty solid).

Once the above process is completed, you have a hard-won array of tiles that define an interior floorplan.  It's devoid of any objects, but it lays out the rooms and doors and stairs and all that good stuff.  It also doesn't really lay out anything specific about the walls or ceilings, etc.

So the game itself has to decide when to draw a front-left-corner ceiling tile, or things of that nature.  These were already things I'd implemented in AVWW when I was creating floorplans by hand in xml, and it's a really straightforward bit of logic (if there is ceiling to your top and right, but not your bottom or left, draw the front-left-corner ceiling, etc).

Also, the game itself will have to go through and actually put in things like tables and beds, ovens and debris, and so on.  But since the algorithm above (with the later addition of step 10) will determine the function of rooms (which tiles belong to the kitchen, etc), that makes for nicely encapsulated, relatively straightforward sub-algorithms.

This algorithm also doesn't do any setting of tilesets -- to choose what the walls, ceilings, or floors look like.  That's yet another thing the game has to do, and something I'd already coded back in March.  That stuff is trivial compared to actually making the floorplans, I can tell you.  But the cool thing is that this represents nesting within nesting within nesting (actually deeper than that, in reality).  So the floorplans are quite unique when just looked at on their own, but when you combine those with different entity-seeding logic in each room and hall, with different tilesets, with different enemy populations, and so on -- you get a pretty insane amount of variance.

Example Floorplans In My Ugly GDI+ Tester Program

Ice Age Hatch Examples 1-4

Little Shop Examples 1-4

Log Cabin Lodge Examples 1-4

Modern Ruins 3 Examples 1-4

In Conclusion
If you're absolutely desperate for an algorithm like this and this is the one you think you want, then shoot me a note and I'll send you the C# code now.  But I'll be officially making the code public under the MIT license in a month or two, once I've got things completely ironed-out and step #10 in there.

The tedious part of all this was getting all the various cleanup steps tested, and tested, and tested.  I had the working exteriors and interior walls put together after a day or two (most of that time spent on research of various interior wall methods), and I figured I was almost done then.  What I didn't figure on was another 2,000 lines of code that would be required for cleanup alone.

In a lot of respects, this sort of cleanup very much reminds me of the sort of work I used to do whenever we had a business client with dirty data in Excel that we needed to scrub and get set up in a properly-validated database.  What I didn't expect in this particular instance is that these cleanup steps add even more to the procedural variance in the floorplans.  Based on everything that gets combined, scrubbed, cut, and so on, you get a ton of room shapes emerging that were never in the base room templates.

Oh, and the other thing that I should mention is that at any time I can add more room templates, and get even more variety without adding new code (same benefit as with the base LaPier method).  Right now I did enough so that I could differentiate the various types of buildings, and so that I could really get a lot of starting variance, but there's lots of room for more later.

All right, that's it for now.  Like I said at the top, I'll do an actual sans-video post on our overall progress on the game at this stage, but this was my big project for this period and it was pretty interesting, so I figured it was best as  its own post.

UPDATE: The source code is now available.

Wednesday, May 4, 2011

Q&A: A Valley Without Wind Economies And Crafting

Thanks to some excellent questions by Flatfingers in our forum, I'm reminded to talk a bit about the economy in AVWW, as well as crafting.

Q: What will the process of crafting something feel like? Will it be a simple one-step action, or can it be a sequence of steps that benefit from knowledge and planning?

To craft something, you just open up the crafting menu for that type of profession (say, Weaponsmith), and then you have a list of the materials that you currently have in your inventory.  So if you have, say, Bronze and Silver, that's all you see in the list there.  When you select Bronze, you see a list of all the recipes that include bronze.  Any of them that you have all the components for show up as active, the rest are grayed out.  You can see what will be produced as you scroll past each one, and when you see one that you like and that you have all the materials for, you can simply press the Confirm key on that item, and it gets created -- that's it.

So there's not any sort of skill or dexterity to the crafting; it's not a minigame or a puzzle.  However, what there IS, in great abundance, is choice.  A hunk of bronze could be useful for traps, for weapons, armor, crests, and so on.  A ruby gemstone could be useful for crafting spell gems that cast a fireball, or it could be used as part of a trap, weapon, or crest to give it some sort of fire-related properties.  It can also be combined with certain other gemstones to create some things that are only tangentially fire-related (such as some of the stuff that has both properties of fire and light, and so uses ruby and quartz).

Q: Will source resources have different properties, and if so will the resource properties affect to some amount the characteristics of the crafted item?

Yes, many of the resources are basically tied to an ability.  Rubies have fire-related effects.  Quartz is related to light.  Other materials would lead to homing spells when combined with spells that don't normally have homing, and things of that nature.

Q: Will crafted items be unique, or will most items of the same type be identical?

Well... it depends on what you mean, really.  An iron rapier is an iron rapier and that's pretty much it.  However, that would be just the most basic recipe.  There would also be recipes for an iron rapier with slots, or possibly with something like a fire gem inside it or something.  And when you put crests or spell gems into slots, then you get other combinatorial effects such as a rapier with a speed crest to swing faster, or a fire gem to have fireballs shoot out when you swing it.  Or both, if there are multiple slots in there.

Given the same recipe and the same stuff put in your slots, you'll always get exactly the same result.  There's not any sort of random rolling of stats or something.  But our goal is to make it so that there are so many recipes that you have a real buffet of choice with any given thing.  Early in the game there are no slots at all, and so things tend to be more generic then while you're still just getting used to everything.

Then you start getting one slot on items, then two slots per item, and maybe more than that much later on (not sure yet on that).  And that's where you can get into some interesting stats-augmenting, which is basically what the slots are all about.  But unlike the core crafting system, the slots aren't currently planned to be irreversible (so you can make a speed-fireball iron rapier, and later change it to something like a strength-strength iron rapier or whatever)

Q: [Will AVWW] have a money economy anywhere or pure barter everywhere?

At present we plan to have no money whatsoever.  Mostly it's not even barter, either -- other characters won't have stuff that you can get from them, and you won't have anything they want most of the time, either.  In specific cases where somebody needs some of X resource, you might happen to have it or you might need to go get it, but that's more of a favor than a barter, because you won't get anything back from them in any direct sort of sense.  Instead, you've just helped them on to their own goals, and you may have improved their attitude toward you in the meantime.

Both of which CAN benefit you in very direct ways.  If they are sufficiently happy with you, then they are more likely to do YOU favors (like crafting stuff, etc), and they're more likely to listen to things like your suggestions that they come to X settlement or whatever.  For people that already like you fine, helping them further their goals quite possibly also helps you: making the settlement more protected might have uses of its own; helping a guy become a better weaponsmith means that he can make better weapons for you as well as anyone else he's making weapons for.  And so on.

This is a post-disaster situation.  I don't know if you've ever been through one of those, but I've been through several -- mainly hurricane and tornado aftermaths, though this has more in common with hurricane aftermaths because those affect everyone.  I've observed that in those situations there's a lot of neighborly help going on.  You have a chainsaw and I don't, so you come over and cut the logs off my driveway so that I can get my car out.  This isn't in exchange for anything, and I'm not obligated to you in any way after that.  You just were helping out because you had a chainsaw and I didn't.  And the power is out inside for everyone, so it's not like any of us have anything else to do, anyway.  Heh.  But later, it's perfectly natural for me to help me lug tree remains down to the woods if you lost a ton of trees and I didn't.  And so on.

So it's one of those situations like that, where we all have individual interests but are also willing to help one another out.  I wouldn't even call it altruism, it's just how everyone tends to come together in the wake of a disaster.  I'm walking down the street and see somebody I don't know struggling to get debris off their car, and I stop to help because I happen to be there and I have the time.  They'd do the same for me, unless they actively disliked me, were way too busy, were hurt or disabled, or were unusually selfish or whatever.

More or less... this is what we're modeling.  But it's something that is growing and changing, so three months from now that answer might not really be correct or all-encompassing.  I really doubt we'll move to having money, though, because it's simply not that sort of game.  There's not a shop that you can go to to buy... anything.  You have to go out and scavenge or discover everything, but those are also all just raw materials -- you aren't finding guns and swords like in Diablo or Borderlands.  So what we actually have is an expertise trade, where you give me the resources and I give you back a finished good because I'm able to and it's not that much work for me.  Assuming I don't hate you or mistrust you, and I'm not lazy or selfish.

Q: It's pretty refreshing to see a game that really wants players to focus on the post-disaster experience rather than on conventional gameplay. I'm just thinking that the economy-free approach could be a shock to a lot of today's gamers, who've come to think that games without certain features are somehow "broken."

Well, and I appreciate that.  Thing to remember is, we really don't want to do what other games have done.  And I really don't think that, once things are to a certain point development-wise, people will see the things we omit as a flaw -- because we're including so much else that's never been seen before. 

It's kind of like with AI War, where there are no civs -- basically unlike every other strategy game out there -- but I've literally never had anyone complain about that fact because the way we made it was basically "build your own civ" and works just as well or better.  In terms of not having any PvP in that game, despite the fact that's the RTS mainstay mode, there have been some folks that looked, didn't see that feature, and avoided the game I'm sure.  But that's a pretty easy decision to make when you're evaluating games; I've self-sorted out many games without co-op, when I'm looking for new games to play.

The other thing to bear in mind is that in a fairly literal sense there is an economy, in the same sense that AI War has civs without having them.  We just streamlined it.  Having an in-game economy is all about power, and options.  What are you able to do, and how can you become able to do the things you currently are not able to do. 

Having a currency is the least possible imaginative way I can think of to do that, because then the answer to any question is almost always the same: get more money.  Grind monsters, collect their money and loot drops, sell the loot you don't like, and buy the thing you want.  I used to really enjoy that in RPGs, but that's been done so many times since the NES days that now I'm really sick of it.

Here you're not bartering with other folks or buying things from shops -- that whole survivor mentality and all that -- but you are bartering your time against the types of activities you undertake.  You want a level III fire spell?  You can't just go grind monsters and then build it.  You'd better go find a level III ruby, which requires figuring out where level III rubies might be, and then going there and essentially going through the "dungeon" (to use the Zelda term) to find one or more.  Then once you have that level III ruby, suddenly you realize you can build a lot more than just a fire spell -- but you can only choose one of the available options per ruby you have, so that creates an economy of choice.

You could just grind away getting level III rubies to build everything, of course, but by the time you finish that you'll be leveled up enough that you might want level IV rubies to really keep up with the monsters that are appropriate to your level.  So just trying to grind is futile, you have to actually make choices.  And those choices have permanent effects either great or small, but they aren't irreversible -- if you make a level III fireball spell and find it not to your taste, at level IV (or even if you find another level III ruby) you might use your rubies for something you like better.

Anyway, the reason we don't have shops or money is because every other game does it, it's played out to us, and we have a more interesting and strategic way of handling things.  Even though I don't want to be labeled a "strategy game developer," both Keith and I do think along those lines when it comes to game design, and we're always looking for ways to add in interesting decisions rather than the time taxes that are common to RPGs.  I really can't imagine that someone will come and see this system and then be mad they bought the game because they thought there was going to be shops and money.

Q: At any rate, "it's not a sim."

Though the game is a "sim of a sim," if that distinction makes sense.  This is a game of Zelda or Crystalis in terms of most of its gameplay, but one thing those games have in common with each other but not AVWW is that their worlds are static and unchanging, and you can't really interact with NPCs except in really scripted, limited ways.  Here that's not the case, because you can interact with each NPC, and the overall world, in various substantial ways.

The game is not a sim, in the sense that the simulation isn't deterministic or high-fidelity, but we will have lots of "approximation algorithms" during the "fast aging" step that simulate what a sim might have done during the time you were away.  So if you've been away from some NPCs for two game hours, and you come back, then during the fast aging step it does two hours worth of stuff.  It looks and thinks "what were the NPC's goals, and what would they have had time to do during the time," and then approximates those things.

Thus you wind up in a world that feels alive and which is ever-changing, but it's incredibly light on the CPU and it's also easier to program in the sense that we don't have to be super-specific in detailed simulations of characters walking around, chopping wood, re-growing trees, and so on.  All of that stuff is off-screen and not related to you-the-player and how you play, anyway, you only care about the result.  It's much the same reason that with AI War I shortcutted the AI from having an economy.  As some players have put it, "the AI is playing Risk while you play AI War," and that's really true.  The combat AI is the real deal, but the AI economy in AI War is just a simulation of a simulation because it's stuff that happens offscreen and that you-the-player only care about the result of.

Put another way, my focus is always on the player experience.  What is fun, what is new and interesting, what twists your brain a bit?  To me, having a detailed simulation usually has nothing to do with any of those things: at the level that most games do it, it's simply a programming parlor trick.  "Look how clever I am," says the programmer, "that I could simulate an entire [whatever] to this depth!"  I like being a clever programmer as much as the next person, but I take that in small doses -- I like shipping games that are huge and fun and made by incredibly too-small teams even more.  So my attempts at cleverness manifest as ways in which to "simulate simulations" and thus cut out the boring behind the scenes work that nobody sees, anyway.

Thanks very much to Flatfingers for his insightful comments and questions!  He's also got a pretty cool blog about game design and other things, as well.

With anything like AVWW that is trying to break new ground all over the place, the proof is always in the pudding.  It's easy to talk about AI War because the game is out and people can play it and offer their own opinions; with AVWW, there's only half a dozen people in the world who have even seen it in person at the moment, let alone played it.  It's also still very much in a gestational stage, so some things are incomplete and others are so far missing entirely (like fast aging).

This is very much why we chose not to do a public alpha, because we wanted people's first hands-on experiences with the game to be with a more mature version that represents all of what I've said above more closely.  We're still looking at "sometime this summer" for the beta, and we're really looking forward to sharing the actual game itself with folks.  In the meantime we'll continue doing videos, blog posts, and so forth!

Monday, May 2, 2011

A Valley Without Wind Pre-Alpha #10 -- Overworld Maps, Soft Focus, and NPCs

It's been a busy two weeks!  This is the game at 14 weeks of development.  The new screenshots are on the official AVWW page, and here's the new video:

Here's a quick rundown of what is new since update #9, followed at the bottom by a few longer explanations of some of the items (overworld maps and soft focus in particular):

The Executive Summary

The most visually apparent change is the new soft focus style around the entire game.  It makes our colors more saturated and dramatic, it ties all the elements together, and it's really a big improvement.

We've also hugely redone the way that overworld sections work, and it's way more varied and interesting now -- marrying some procedural techniques with some aspects of hand-crafting.

And last but definitely not least, we've put in a ton of work on crafting, NPCs, settlements, and more -- all that "what is my motivation for playing this" sort of stuff, versus the mechanics of how to play.

Overworld Map Changes

* We now have a map editor, which is a standalone .NET 2.0 program.  It's got a variety of functionality for drawing, filling, smoothing, and so forth.

* Overworld chunks now use heavily-randomized maps to generate a  structure of obstacles, entrances, lost-in-windstorm points, and open paths.  This marries designer creativity with procedural processing, resulting in thousands of possible obstacle setups per individual map; and when combined with the existing randomization and chunk scripts for populating outdoor areas, the possibilities are multiplied even further.

* We now have three maps in six variants, four done by myself and two done by Erik.  This already creates a huge variety, but there's much more to come!  Some are very open, and others are more closed and twisty at the moment.

* All of the overworld chunks are now 256x256 in size (many of them were previously 128x128).  This is fourfold increase in size, making each tile on the world map something like 2/3 the size of the the entire Zelda 1 world map.  The maps that are applied also now make them vastly more twisty, which makes them feel even larger.

* The Ice Age (thawing and regular) now are the first regions to include new "Point of Interest" scripts, which define certain unusual landmarks that are not centered around a building.  Very little has been done with this so far, but a lot more will be in the coming months.

* Having a sky visible over the top of a cliff used to be something that was more limited and which was built into the chunk script itself, but now it's randomized by region type and these can appear at any time.  This makes for less duplication of chunk scripts while still providing more variety.  These also dynamically combine themselves with the overworld maps, making for even more variance.

New Entities And Background Tiles, Etc

* We now have both flowing water and flowing lava in many chunks (lava only in the lava flats, and with three different visuals possible all in one chunk), and these are presently always bordered by one of six different kinds of sedges (plants) for water, and one type of burnt-sedge for the lava.

* We now have a new shadbush obstacle type that is used in places like the woods and small towns.

* We now have a new winter mahonia type of reed, which is dramatic bright red and now used in the ice age in some circumstances around buildings.

* Added in a new Weed Patch type of plant, which is a tall and imposing sort of armpit-level undergrowth that you can walk through.  Presently this is limited to Small Town areas; some are absolutely plastered with it, while others just have a few spots of weeds here and there.  It really differentiates them more from other areas now.

* Added two plum trees and one walnut tree, which can be seen in the various grasslands areas (walnut trees mainly in the grasslands-with-tree-clumps regions).

* Added about sixteen new vehicles (including new ice age futuristic cars), including many more that are broken, flipped over, etc.

* Added three new "factory stacks," and some concrete barriers, that currently show up in the junkyard and later will be used elsewhere.

* There is now a second type of sky, in addition to the one we've had since the first developer diary!

* Added in a higher-level new The Deep region, which is an evil place filled with pulsing darkness.  We're not going to be showing screens or video of this, players will have to find them in-game on their own!

* There are now chasms, rocks, and large birch bushes that work as obstacles on the world maps in addition to the aforementioned lava and water.  The south, east and west sides of the chasms aren't completely polished yet, but they're getting there.  Most of the angles and the north are the way I want.

* There are now shortswords, broadswords, and rapiers in addition to longswords, and they all handle a bit differently (stabbing versus slashing, speeds, powers, etc).

* Three massive new ice age fossils are now seeded as occasional "points of interest" in the ice age regions.  These are a good example of something that is interesting but which isn't a building, which serves as an anchor point on the map. 

Minimap Improvements

* Dropped item bags (that a player intentionally put down, or dropped when they died) now show up as a blinking orange blip on the minimap, so that they can actually be found again in the middle of large chunks.

* The minimap now shows obstacles as dark tiles, aiding in actually finding your way around.  Additionally, trees, hatches to the underground, vehicles, shipping containers,and roads all show up as a middle-dark color, adding extra shaping and information to the minimap.  All of this is only shown in parts of the chunk where you've actually found the Point of Interest that reveals that section, of course.

* There are now three sizes of minimap that can be toggled through using the M key (128, 176, and 256).  128 is the old size, and 176 is the new default.  Personally, on my really large screen I really like the largest minimap size.  It's really easy to see a ton of detail even in giant outdoor chunks on it, now.

* The player dots on the minimap now blink between a larger state and a smaller one, making them MUCH easier to see and find.

* Entrances are now shown in the minimap, instead of explored points of interest (which are mostly pointless to show, anyway).  The entrances are now shown in full red, rather than light red, so that they are much more visible, as well.

* The region level is now shown in the in-game hud (that's pretty important info!).

Settlements And NPCs
* Settlements are now a part of the game, which is a huge step forward, although they are fairly simplistic so far.

* NPCs who live in settlements can ask you to forge a safe path (using wind shelters) between their settlement and another nearby settlement.

* NPCs can now ask you to clear the area of monster nests to protect the settlement they live in, in order to gain more trust for them.

* NPCs can now ask you to explore nearby regions to their settlement, providing them with some degree of protection from the unknown.

* NPCs can now ask you for a certain quantity of an item (which if you don't give them, they probably will eventually get on their own, anyway).

* NPCs in general now have an underlying system of hopes and needs, and they have intermediate goals along the path to their hopes.  These are things that can be accelerated by your intervention, but many of these are also things that the NPCs will eventually solve on their own without your help.  So you can help out where you want, without being forced to babysit a guy who wants to be a better blacksmith or whatever, if you don't particularly care about his smithing ability.  But if it's useful to you, you can help him along much faster!

* Characters now have crafting profession tiers, and get more proficient with crafting through various means (as hinted at, above).

* NPCs are now able to migrate from one chunk to another, useful for when they agree to migrate to a settlement (which you can now do, in a testing sort of fashion that's the basic framework for what we later have planned).  They do this only after you've also left the chunk they are in.

* A lot more internal work on the state of NPCs in general is now in place.

* NPCs can now have various personality traits that affect their hopes and needs, such as professional pride and protective, as the two we're currently working on.

* NPCs now have an interest in actually building up their settlements, and there are now those with a Builder interest that build small homes and bunkhouses for other NPCs to live in.


* There are now a variety of metal and crystal material types, all used for crafting different kinds of weapons and equipment.

* All of the various spells and equipment items now have some sort of crafting recipe that can create them.  And in the case of physical weapons like swords, etc, those have multiple metal tiers at which they can be crafted in.


* There are some "monster nests" that can now be found around the world, and which spawn monsters.

* It is now possible to Wait on the world map, advancing the windstorm counter by one, rather than having the only way the windstorm counter decrements be to move.

* Added a new Light Snake ability to the third ability bar.  It replaces the idea of the light tracer, this time with a slower, snake-like stream of particles that move past obstacles and then clump somewhere.  The snake lasts for 10 seconds and casts quite a lot of light as it moves.  It has a very long logistical recharge time of 15 seconds, though, as its main cost.

* More work on the melee weapons and effects, but it's not quite there yet.  We are now planning all manipulation of swords and such to be telekinesis-based, which we have some cool effects for, but it's only partially implemented.

* The system for cooldowns has been made vastly more robust, and now prevents things like spamming the healing while also mashing the attack buttons.  You have to actually be strategic and thoughtful with things, now!


* Pretty much ALL of the in-game graphics have been post-processed with a new Soft Focus effect that makes the entire game have a super attractive (to us, anyway) stylized color that also is much more cohesive.  Boy is this a big difference all throughout the game.

* Graphics for the twigs in the lava flats have been replaced with vastly nicer-looking burnt-bushes.

* The lava clouds in the lava flats area are only half as intense as they were before, aiding visibility and making it look nicer in general.

* The visuals for roads have been upgraded somewhat.

* The way that bushes at the edge of cliffs are done has now been completely changed -- they are no longer immobile, and are now glowy and evil looking (what I'll call "The Deep" look).  I'd always intended for it to be the case where the earth was pulled down into a supermassive chasm where the sky is visible, partly by the force of evil plants, and now they look it. :)

* There's a very cool new heal visual effect.

* Lots and lots of spell effects have been rendered out, although they haven't been coded in yet.  Coming soon! :)

* The new lighting model now has dimness in the center eyesight areas, like the simple eyesight model does.  I had thought it couldn't be done, but it turns out it sure could!  It's quite a big improvement, as players had suggested it would be. :)

* Also visuals for several new kinds of enemies that we haven't had time to actually add to the game yet (giant amoeba, etc), but which look cool.  Also coming soon! :)

* The player ghost and player bones states now have an animated "spirit fire" effect.

* Characters now glow with a color that is relevant to their spell as they cast spells.

* Finally got around to updating the remaining world map icons that were still painterly.

* There are some other new ground backgrounds, such as the pine needles in the evergreen forest areas.

* Espers are now ghostly white.

* Player characters, NPCs, player bags, and dropped items all now have a new ShouldRenderOverlay property set on them, which makes it so that their outline is always drawn on top of themselves (using the new HardOutline), which gets drawn after basically everything else in the game.  This makes it so that you can still see the outlines of these things from behind solid objects, grass, or whatever else.
** The MustBeVisible property has been taken off these objects, and the Sparkle ongoingcondition is now gone from the droppeditem object.
** I'm undecided on whether to always have this be on for player characters or not, as it can be a bit annoying/disconcerting in grass or shadows, but for dropped items this is definitely the way to go instead of the sparkle -- and at worst I would relegate this to a settings option, since some players have specifically asked for it.


* Improved the AI for wandering enemies such that if they are stuck at a specific point for more than a quarter of a second, they'll choose somewhere  else to go.

* Several performance improvements have been made; it was already a really high-performance game, but this fixes some relative slowdowns with high-grass areas and with chunk-gen.

* Lots and lots of name files have been prepared by Erik, ready and waiting for new character sprites of different genders, ethnicities, and time periods.

* World files are now compressed to disk in a very CPU/RAM friendly way that shrinks each chunk down from 1.8mb to about 22kb, on average.

* Plenty more music and sound work, as usual!  In particular there's been a big batch of sound effects this time around.

More About Soft Focus

All along I've been trying of course to make a unified visual style for the game, and the chief way that I've been doing that has been with the painterly style on all the sprites.  That works very well, but that's detail work and only shows up in full-size screenshots or really uber-detailed video of the sort that youtube doesn't really do.  Or any other streaming service.

What that has left us with is something that doesn't really reduce well at all, and my main way of trying to combat that was with special effects.  Again, that was working pretty well, and certainly explosions and fireballs draw the eye.  But we can't have those in every last screenshot, and it doesn't really help with the overall perception that the art just looks kind of cheap.

This is ironic because, even though the art is actually commodity models rather than custom ones, it's the sort of models that are unsuitable for games because their polygon counts are too high -- they have above average detailing, higher than something like Crysis, even, in many cases.  The state of raytraced modeling in non-realtime formats is just lightyears beyond anything that can be done in realtime raster formats (aka games), and that's something I thought I was taking advantage of pretty well -- but again, it doesn't reduce well, and everything in the game is pretty small despite being a lot more HD-sized than most other games out there that are sprite based.

So I had been thinking about about two weeks ago, and I was looking at the latest raytraced art by one of our community members (eRe4s3r), and I was for the jillionth time thinking how annoying it was that since I'm rendering all these objects into sprites, I lose a lot of the advantages of raytraced art such as having cross-object dramatic lighting, ambient occlusion, and so forth.  A lot of those effects are what really make eRe4s3r's images "pop."

And that's when it hit me: in a macro sense, it's not so much the fancy effects, as it is what it does to the color value of the image, and how that color interacts with nearby objects.  What makes that image so darn attractive, even when it's tiny, is that the colors are really stylized and over-dramatic and saturated.  I'd originally been going with a down-saturation look  for AVWW, thinking of Silent Hill mostly, but that was a big mistake as it just makes things look bland.  Silent Hill is an awesome game, but it looks bland -- that's part of what makes it feel gritty and scary.  But that only works in true 3D, I think.  Bad role model.

Anyway, long story short, what I've wound up doing is basically doing a "soft focus" effect on all the sprites, which accomplishes two things.  First, within each sprite it adjusts the colors so that they are over-dramatic and heavily stylized, while still keeping the underlying shape and brush strokes.  In the case of some of them, it makes them overly dark shapes, but that sort of contrast and attention to overall form rather than detail actually serves the game well, I think.  That can't be every object, but it works well when it's about 10% of them.  Secondly, it also applies a bit of a Gaussian blur haze around each object, such that it almost seems to "bounce" its color to nearby objects -- mimicking ambient occlusion without actually using it (since we can't in any realtime game prior to DX11, and that's only for basically Crysis, anyway).  This helps to tie each object to its surroundings a bit better than before, which is something I'd really been struggling with for the buildings in particular.

All in all, this creates a style that minimizes better, in some cases much better, aside from looking much better full-size.  The colors are more attractive and vibrant, and the overall style of color hues has more in common with games like Bioshock and Crysis than they do with any 2D games I can think of.  I was also inspired some by the Death Rally remake on iPhone, the screenshots of which really make me salivate.  In some respects, this new style is a bit over the top and surreal, sort of like the Twilight sections of Zelda: Twilight Princess.

So this is a real departure in overall visual tone and look, but the staff has been really excited about it, which bodes well.  And personally it's the sort of thing that I'm just gaga over, I just can't get enough of colors like that!

More About Overworld Maps
Previously, an individual chunk only had two levels of detailing: it had a general "chunk script" that it would follow, which is a dynamic very-broad-recipe for chunks that players can create and which we also create; and it had sub-scripts for creating buildings and seeding stuff around them.

This was okay, but it tended to lead to chunks that felt big and empty.  Really, they also felt smaller than they were, because the shortest path between two points was always basically a line.  It wasn't a very creative use of the outdoor space (but hey, that hadn't originally been planned to be the end state for outdoors areas, anyway).

Now what we've added in is a third layer of detailing, with a fourth coming soon.  The third layer is the overworld maps, while the upcoming fourth will be the "points of interest seeding" that I talked briefly about above.  More on that in another week.  The overworld maps alone create a massive change to the feel of the overworld areas, making for blockages and dead-ends and paths you have to explore to find your way through.

For instance, it's possible to have an area on the screen that you can't get to without finding a long way around, which is new for this game (not that new in adventure games overall, of course).  Now it's also possible that there are only 1-4 exits from a given chunk to the overworld, so when you get lost in a windstorm you might be really lost; it's no longer a simple matter of walking in any direction and living until you escape.

Here are some examples of how a single map from the map editor can vary in even the broadest senses:
There are four examples each of the Slashes and Vines map types, and three of the Tiger Stripes map type.

Most of the dark areas on the map are obstacles like water, lava, rocks, chasms, or bushes -- that is randomized and you can't tell from just the minimap -- but some of the big areas that are completely blocked are actually sections that are completely surrounded by such obstacles, and which are thus inaccessible to the player.  These sections won't have any buildings or anything else useful in them, and so the player doesn't lose anything by not being able to get into them.

Another thing you'll notice is that along the top of some of these maps there is a "hairy" line -- Slashes 2-3, Tiger Stripes 1-3, and Vines 3-4.  Those are actually cliff edges to open sky, with the evil black plant tendrils being the hairy lines in question.  Those open sky areas were not defined in the map editor, but get seeded in randomly depending on the type of region the map is being used in (a lot of things vary by the region, such as even what sort of obstacles are employed, and a single map could be used in many regions).  All of these minimaps are from thawing ice age plains, which has a very high chance of open sky cliffs, which is why you see so many of these having them.

You'll also notice that some of these are very open, and others are very closed.  Slashes 3-4, Tiger Stripes 2, and Vines 1-4 all are the closed variants of themselves.  In these closed versions, there is a 50% chance of having only a single exit from the entire chunk, and a 50% chance of having 2-4 exits.  There is only ever one entrance to an outdoor chunk, period -- you always come in the same way. 
But whether that is the only way out, or whether there are a few other exits, is the question.  Of course, in the Open versions of the maps, there are quite a few ways out of the chunk.

All of that was just speaking to the very broadest level of description about the chunk -- the new overworld maps.  Then of course the pre-existing two layers, the chunk scripts and the sub-scripts, kick in.  That's where you see all those little details on the minimaps: the little rectangles with red dots are all buildings of some sort, and you can see how widely they vary in their position.  The little white dots are all monster spawners.  And the various lighter gray shapes are things like trees, vehicles, and other destructible obstacles.  If there were any roads in these sections (which there aren't), you'd also see those in light gray like that.

So.  As you can see, there's now a much larger amount of variance in how the surface regions get constructed.  All of these are just from three maps alone, all in a single chunk with just I believe one chunk script and maybe two sub-chunk scripts.  That's a huge amount of variance from relatively few inputs, because each type of input is so randomized in and of itself.  And as we -- and players! -- add more and more inputs -- more chunk scripts, more sub-scripts, more maps, and the upcoming "points of interest" scripts -- the amount of variance is just going to skyrocket even further.  This is a good example of the power of combining hand-crafting techniques with multi-layered procedural techniques!

More About Surface Region Sizes
In the past, most of our chunks were sized at 128x128 tiles.  Each tile is 64px square.  The various "hostile" chunks were sized at 256x256, however, to make it harder to quickly escape from them when you could just run in a straight line to get out from any side.

Now, of course, the chunks are twisty and sometimes labyrinthine, so it's always slower to escape from them, anyway.  So did we shrink the hostile chunks?

Of course not!  We instead increased the size of all the outdoor chunks to 256x256, making that our new standard.  The primary reason for this is space for buildings -- I was finding that in maps with any degree of twisty passes, there just wasn't enough room to have buildings in unpredictable locations.  You'd wind up with the buildings always clustering on the right, or whatever, which made the maps not seem very varied.

Bumping the map size up 4x, from 128 to 256 squared, solved that problem really nicely, as you can see from the example minimaps above (as well as the minimaps in the video).  This means that all of the non-hostile outdoor areas are now nominally four times larger in area, but really the feel of it is that they are 10x larger or something along those lines.

The reason is simple pathing: before, to get from point A to point B, it was always a line you'd walk in, except to go slightly off the line to go around trees or buildings.  Now it's sometimes a very complex and maze-like situation to get from point A to point B, which means that the distance you have to travel to get from point A to point B might be much further and more interesting.

None of that is exactly ground-breaking for adventure games, as they all use the same techniques in terms of breaking up the landscape.  All the way back to Zelda 1, you see that sort of pattern.  But it's new to this game this week, and it's really interesting to me to see how much that one simple change really transforms the entire feel of playing the game.

Speaking of Zelda 1, there are some interesting size comparisons to be made.  Zelda 1 had 8x8 pixel tiles on each screen, and each screen was 32x22 tiles in size.  So that's 704 tiles per screen.  AVWW has 64x64 pixel tiles, and a 1280x1024 screen can show 20x16 tiles at once.  So that's 320 tiles on the screen at once -- there's a lot more detailing on each tile, obviously, given that each of our tiles has sixty four times as many pixels as a Zelda 1 tile (8x8 = 64, 64x64 = 4096).

So in some senses it is a little more "zoomed in," but you're also getting a lot more detailing on each tile.  It's interesting to note that the beloved Zelda: Link to the Past made the same decision: it moved to a 16x16 tile size, four times larger than that of Zelda 1, and it could show 16x14 tiles on-screen at once (the SNES output resolution was 256x224).  That's equivalent to playing AVWW at 1024x896, which is still plenty zoomed out for both AVWW and Zelda 3.

Okay, enough about screen resolutions -- let's talk about map size, which is actually a lot more interesting.  So, Zelda 1 had 704 tiles per screen.  The entire Zelda 1 overworld was made up of 16x8 screens, so that's 90,112 tiles in the entire Zelda 1 overworld.  Since the AVWW surface chunks are now 256x256, that's a total of...65,536 tiles in a single surface region of AVWW.  Note that each tile on the world map of AVWW is a region.  So by the time you've traversed two of those regions, that's more surface area than the entire Zelda 1 overworld.

To those who had worried that the surface chunks seemed a bit on the small size (at 128x128, that would have been 16,384 tiles per chunk), that's definitely no longer the case!  Not only are the chunks now more twisty and interesting in their shapes, they are also now larger and have more stuff in them.  And we're only going to be packing in more and more stuff per chunk, too, which is a big part of what's coming up for us in the next few months.

Until Next Time!
Lots more coming down the pipe soon, as always.  Keith is hard at work on NPCs, settlements, and that sort of thing.  I'm doing more stuff with chunks and seeding, and then moving into underground areas and interiors again, as well as some more spells and art stuff.  Pablo is hard at work as always on music and sound.  And Erik is working on more maps, "wiring up" new objects that I do the art for, more randomized names for things, and so on.  Stay tuned!