Fuel: Roads

By Shamus Posted Monday Sep 28, 2009

Filed under: Game Design 35 comments

This shows the zooming in, just to give you a sense of scale of the world.
This shows the zooming in, just to give you a sense of scale of the world.
I mentioned earlier that I wrote a road-generating program. I want to talk about that project a bit and then compare it to what we see in Fuel.

Roads are interesting because of how organic they look. They bend and twist and split and have overpasses / underpasses, change width and (from a distance) tend to resemble more a circulatory system than a circuit board.

Roads have rules which most of us intuit even when we don’t think about it, and when a virtual road breaks those rules it tends to break immersion as well. Proper public roads generally don’t bank (or only do so very slightly) but are graded such that they are higher in the middle, so rainwater will run off. Roads tend to change direction more readily than elevation. When circumnavigating a hill, the road generally cuts into a hill a bit, (as opposed to jutting out) so you’ll have a steep bank upwards on the inside and a drop downwards on the outside. If that drop is steep enough or the road curves abruptly enough, there’s usually a guard rail. Roads bend all over the place, and it’s not uncommon for you to find yourself on a “northbound” highway heading due east or west. And there is a limit on how steep a road can get.

And these are just the rules for a single road, which is what my program dealt with. (It was eventually going to be a screensaver. If I were to do it again I’d no doubt put the thing on Google code for safekeeping.) The program would load in or generate some hills of dubious realism. (This was before I did my terrain project, so the terrain system here would have been crap.) Then it would plot a road to go from the south edge to the north edge. It would examine the angle between its current location and its desired endpoint, and would try to head in that general direction while staying as level as possible. It ran on a flexible scale: The bigger the deviation between it’s current heading and its desired heading, the more willing it was to go up or down hill. This worked amazingly well at producing a road that wasn’t too hilly but didn’t get lost. It had a “create a bridge” fail-safe for when it just couldn’t find a proper solution, which happened whenever it was cut off by a steep valley. The “bridge” was just a section where the road would run straight and level until it ran into the opposite wall of the valley. All told, it wasn’t a flawless system but it produced some amazingly plausible roads on some challenging topography.

Check out this heightmap I swiped from Google Image Search:

fuel_heightmap.jpg

On the left is a straightforward heightmap. It’s like a satellite view, with brighter pixels representing higher elevations. The right is the same thing, but with a particular elevation set to red. If you were standing on that red area, you could obviously go pretty far without needing to go up or down, as long as you didn’t mind swerving around a bit. This swerving is basically the exact behavior you see on a road. My program would basically travel on the red as much as possible. If it was forced to go up or down, then the “red” area would shift radially – outward from the tip of the hill if it was moving down, inward if it was moving up.

Top: The road system on perfectly flat terrain.  Bottom: The road system in pervasively hilly country.
Top: The road system on perfectly flat terrain. Bottom: The road system in pervasively hilly country.
Fuel seems to take a similar approach. It works out a network of roads. It begins with a couple of backbone highways that cut across the zone. Between those, it will form a loose grid of evenly spaced secondary roads. And between those it makes a network of dirt roads. It deliberately tries to make them a bit convoluted. You can see this in action in White Flats, one of the last zones in the game to be unlocked. (I cheated, as unlocking this zone would have been way beyond my skill.) The land is, as the name suggests, perfectly flat. Yet the road system doesn’t just default to an axis-aligned grid. Roads intersect at odd angles and form a plausible network. However, the individual roads are perfectly straight. This suggests that the road system works not unlike the one I came up with, where roads bend due to topography. This means the bends in the road are emergent, which is pretty cool. (As opposed to the programmer trying to force the road to bend around arbitrarily to make it more “realistic”.)

While not completely unrealistic, this abrupt curve is a little dubious. (There is actually a turn like this not far from where I live.  The people who live on the outside of this bend have placed a row of massive rocks in their front yard, just in case some drunk or fool is careening down the road without paying attention.  They’ll be stopped by the rocks instead of the house.  In the above picture, note the blank gray area on the outer part of the corner, no doubt that exists to hide the awful distortion in the road lines.
While not completely unrealistic, this abrupt curve is a little dubious. (There is actually a turn like this not far from where I live. The people who live on the outside of this bend have placed a row of massive rocks in their front yard, just in case some drunk or fool is careening down the road without paying attention. They’ll be stopped by the rocks instead of the house. In the above picture, note the blank gray area on the outer part of the corner, no doubt that exists to hide the awful distortion in the road lines.

The one thing that bedeviled me was the difficulty of splicing roads together. This has gotten way, way harder as graphics have gotten better. Merging two strips of flat gray polygons is trivial, but a real road isn’t flat gray. Real roads have a very distinct pattern of light and dark stripes, which I assume are the result of tires depositing slight amounts of rubber into the asphalt. Real roads have white lines at the edges, and dashed lines (or double yellow) down the middle. Splicing two of these together is murderously complex, because you can’t allow the texture to distort at all. If you stretch one texture at the point of the splice, the lines in the road will get longer or shorter, and that will look really, really obviously bad. You can’t do a hard join and simply end one road as it intersects with the other, as the patterns of light and dark won’t match up and you’ll get a huge seam. The problem gets even harder when you take into account the fact that some roads will have different numbers of lanes, and they’ll be joining at unpredictable angles. I never did come up with a way to do it without needing multiple texture passes.

It’s hard to see, but just above my driver there is a staircase-shaped seam where the two roads were stitched together.
It’s hard to see, but just above my driver there is a staircase-shaped seam where the two roads were stitched together.
It seems like team Asobo ran into the exact same problems. They have all the seam issues I anticipated, although they to manage to make a bulk of the road joins look passable by blurring and fading the textures where they meet. Still, every once in a while you’ll see a spot where it just couldn’t solve the splice, and you’ll get all sorts of strange artifacts. (Although to be fair, you won’t notice these bits if you’re just roaring along at 100mph, which is more likely than not.) There are a pair of extra-large four-lane highways in Fuel, and they join just southeast of the center of the map. The texture mapping is predictably wonky, but the real hilarity is that one of them brings its guard rail into the merge, thus cutting off a lane of traffic with a completely inappropriate guard rail:

Guardrail fail.
Guardrail fail.

You could solve this problem by having artists make pre-fab intersections. For example, the artists could make the four-way intersection pieces, the forks, and the merges, and the program could use those the way a plumber uses pipe fixtures: Just bend the roads around and plug them in. But that only works on level land, and flattening the land around every single intersection will instantly make the world a lot more generic and repetitive.

In many cases you can get away with joining two roads with a hard edge, as is done here. It’s not perfect, but it’s not awful, either.
In many cases you can get away with joining two roads with a hard edge, as is done here. It’s not perfect, but it’s not awful, either.
There are no over passes in Fuel, and no clover leaf intersections. I can understand why. Knowing when to place one or the other, and making them look acceptable on arbitrary topography, is a huge problem to solve. Engineers design these things do so on a case-by-case basis, and in games these things are made by hand, by artists. This is the first game I’ve seen where someone took a crack at doing this with code. Sometimes you need to take away earth. Sometimes you need to build up. Often you need to do quite a bit of both. You need enough clearance on the bridge yet the ramps of a cloverleaf can’t be too steep nor turn too sharply. And of course, cloverleafs would look naked without the copious signage required to make use of them, and placing those signs where they will look right and not cause problems for either of the intersecting roads is a non-trivial problem.

To the people that have been pointing to Dwarf Fortress as the zenith of procedural content: Being unfettered by graphics, DF will never have to face the worst of the procedural challenges. That’s fine. It doesn’t need to. But the really humbling challenges will be for programmers who have to work with polygons to realize their world.

One of these days I’d like to take another crack at the highway system problem. It’s a toughie, but if you can solve it you’ll have gone a long way to making game content turnkey. Even in fixed worlds like GTA, I’ll bet the art team would love a tool that let them make roads by drawing simple lines, and having the software work out all the messy details and landscaping.

 


 

Experienced Points: Give Me a Win Button

By Shamus Posted Friday Sep 25, 2009

Filed under: Column 87 comments

Wherein I make the case that adding a win button (a game-breaking cheat or hilariously easy difficulty level) will make a game more fun without ruining things for the die-hards.

Heresy. Yet true.

 


 

Stolen Pixels #128: Quotas

By Shamus Posted Friday Sep 25, 2009

Filed under: Column 36 comments

A bit of a cross-over here, as Star on Chest appears in a Stolen Pixels.

About the thing depicted in the comic: Don’t pretend you haven’t done the same thing.

 


 

Heroes of Champions Online II

By Shamus Posted Thursday Sep 24, 2009

Filed under: Pictures 82 comments

I’m afraid I’ve let you down again. No Fuel / procedural content post today. No good excuse, really, except that I’ve been playing a grotesque amount of Champions Online. Here, let me show you:

This is <a href="http://www.champions-online.com/character_profiles/1056303">Concealed Carrie</a>.  Her bio: My mommy says it’s wrong to hit people. So I shoot them. I’m also not allowed to talk to strangers. So I shoot them, too. </p>
<p>Are you a stranger?
This is Concealed Carrie. Her bio: My mommy says it’s wrong to hit people. So I shoot them. I’m also not allowed to talk to strangers. So I shoot them, too.

Are you a stranger?

I’ve spotted a few other people going for the “cute little girl superheroine” concept, although most people mess it up and just make their character small. She ends up looking like a tiny adult. If you want a little kid:

  1. Go short, obviously.
  2. Make the head nearly as large as possible.
  3. Eyes should be really big. 90% -ish.
  4. Eyes should be as low on the head as possible. You’ll need to move the cheeks down a bit as well to keep them from interfering.
  5. Ears should be a little large.
  6. Turn muscle way down, and body mass down.
  7. Maybe nudge the feet and hands up a little in size.
  8. Shorten the limbs.

The common approach is to have a little kid with a really violent superpower like swords, claws, dark magic, or somesuch. Concealed Carrie is a munitions character, and she became my main the moment I discovered the joy of the Lead Tempest power. Did you see Christian Bale in Equilibrium? How they did that gun kata thing? Well, you get to do that. And it is awesome. Especially as a twelve year old girl.

I’ve pretty much built the character around leaping into groups of guys and then shredding the group from within in a fountain of bullets. I also use the assault rifle for when someone gets ornery. A lot of people swear by the minigun, but I haven’t run the numbers to see which is better from a time / power drain / damage output perspective. And even if I’m not getting 100% combat performance out of her, she’s still a lot of fun.

co_char17.jpg

Thematically, she should absolutely use speed or (even better) acrobatics as her travel power, but I learned the hard way that the designers of Champions Online have a cruel and malignant hatred of non-flying characters and have designed this world in order to torment them. The guys on buildings, the inexplicable cliff in the middle of the city, the rat-maze canyons in the desert, and the un-scalable mountains in Canada: These are things that will impede you on the way to fun if you cannot escape the embrace of gravity. Really, they should give speed runners the ability to run up walls for a short distance, and acrobats should get some sort of Prince of Persia style wall jump that angles upward. Both types of travelers need a way to move without needing to wade through every damn mook in the world while their flying compatriots effortlessly cruise by overhead. If you’ve never tried to go up six flights of spiraling steps in a third person game just so you can see if the guy you’re looking for is up there, then you’ve never really understood what it means to suffer. The camera doesn’t know what the hell to show you.

For Carrie, I compromised and went for swinging. Swinging is still slower than flying and is useless indoors, but at least I can get over the walls of the maze without straying too far from my character concept.

I’m not sure what inspired me to make her. I think after going through The Path I wanted to balance things out and play a little girl who could kick some ass.

And speaking of Little Red Riding Hood, here is someone Star on Chest ran into in the starting zone:

co_char12.jpg

And here is someone else, in the same zone at the same time:

co_char13.jpg

And here is the conversation they had:

co_char14.jpg

The puns on these two made me laugh:

co_char16.jpg

I love these wings:

co_char18.jpg

You have to see them in motion for the full effect, but I think they’re magnificent.

EDIT: And here is the world’s most awesome tooltip:

co_dsp.jpg

Yeah. “DSP” turns “DSP” mode on and off. Awesome. Good thing every single person in the world will instantly know what DSP is and why they might want to make it on or not on. I mean, naturally I know what DSP is. Naturally. I’m not some rube who goes around being ignorant of important things like DSP. But what if – and I’m just being hypothetical here – what if you met someone who didn’t know what DSP was? I mean, that would be hilarious, right? But how would you explain DSP to that person? Not that I’m asking. I mean, there’s no need, since I already know all about DSP. But I’m just wondering how some people would explain it using plain English.

 


 

FUEL: Defining Procedural

By Shamus Posted Wednesday Sep 23, 2009

Filed under: Game Design 46 comments

If it were possible to jump off your vehicle, Fuel would have the makings of a fairly thrilling base jumping game.
If it were possible to jump off your vehicle, Fuel would have the makings of a fairly thrilling base jumping game.
Confusion always arises when I throw out the word “procedural”, as there seem to be a lot of different (perfectly valid) definitions bouncing around. In my view, procedural content is about making things using simulation, automation, and approximation.

Some people equate “procedural” with “totally random”. It’s true that it can be random (within the limits of a computer’s ability to generate “randomness”) but it doesn’t have to be. It’s fairly trivial to make the computer generate the same sequence of random numbers, thus having a “random” area appear the same each time you visit. In any case, it’s true that there will be aspects of the world which were created without direct participation of a human being. The placement of objects will in that sense be “unpredictable”. But this unpredictability – this loss of direct control – is one aspect of the tradeoff we’re making when we aim for procedural content. The more specific you want the content, the more it needs to be built by a human being. Do you have a rigid expectation of where each and every tree should stand? No? Then let’s not waste an artist’s time by making them place the things manually.

On one end of the spectrum is the hand-made world: An artist (or a team of them) will use shaping tools to sculpt the topography of the land. Then they paint it in some meaningful way. Grass over here, dirt in this valley, exposed rock on steep surfaces, etc. Then they populate the land with trees, shrubs, rock, grass, and whatever else the game calls for. You can do something like this in an hour or so if you’ve got good tools and you’re only filling in something modest in size. On the other end of the spectrum is the purely random world: Have your world-o-matic moosh a bunch of random noise together to make generic rolling hills, and then randomly sprinkle vegetation around.

Remember this building.  We’ll be seeing a lot more of it in a later post. Also: Is anyone thirsty? Me? I could drink.
Remember this building. We’ll be seeing a lot more of it in a later post. Also: Is anyone thirsty? Me? I could drink.
The hand-made way is agonizingly time intensive, but will produce compelling scenery. The later is cheap and fast, but produces a big bland soup of scenery where seeing one spot means you’ve basically seen it all. One is stupid expensive, and the other is pointlessly dull. But the thing about the hand-made approach is that the artist spends a lot of time doing very repetitive non-creative stuff. They’re doing tasks which don’t actually require a human brain. The goal of any good procedural system should be to make sure that the artist is directly involved with the artistic decisions and is never bothered with any of the routine grunt-work.

Placing each and every tree is time consuming and needless. Instead, you observe that trees do not grow randomly in the real world, but behave according to observable rules. There are rules about where trees grow, how they’re spaced out, and how big they get in different places. Trees don’t generally grow on steep hills, and if they do they don’t get very big. Dense trees tend to choke out undergrowth. Undergrowth prefers soil to rocky terrain. Grass gets tall anywhere you don’t have tress or undergrowth. Some trees grow denser than others and have different preferences for elevation and moisture. Etc etc etc. A programmer can bang out a few rules like this and add them to the editor. Now instead of the artist saying “I want a tree here, and another here, and here, and here, and I hate my job, and here, and a couple here, and I wonder if McDonald’s is hiring, and now onto the shrubs…” The artist can just say, “Given the rules for trees, I want a forest over this region.” Boom. Forest done. Now instead of planting trees and bushes, the artist is placing forests and grasslands.

fuel3.jpg
Now, artists usually jump in here and insist that you can’t cut them out of the process like this because the resulting data will be sterile and random. But note that what’s really going on is that some of the artistic work has been offloaded onto the programmer who had to implement these rules. This is probably why it’s taken so long for people to get a handle on procedural stuff: It requires a very particular sort of programmer to do this sort of work. You either need an artist who is very good at explaining what she does in concrete terms (as opposed to saying, “I keep adding trees until it looks good”) or a programmer who has an artistic flair. I’m a good example of the latter, which is why I was able to pull of the Procedural City. (With apologies for the excessive ego for the previous statement, but I really do think this is an area of particular capability for me. Too bad I don’t get to use it more often.)

This is where people who love to haggle over definitions will jump in and say that this is no longer art. They argue that once you distill a process down to rules and numbers, you’re no longer expressing or communicating, you’re just imitating. But I see art in making the code that makes the world just as I see art in using the tools that make the world. I see the compiler as simply a very strange paintbrush. But fine. We don’t have to call this art and there’s no reason to derail ourselves by going for another trip around the “how do you define art” mulberry bush. Art or not, the goal is to create a space that feels plausible and aesthetically pleasing.

I think Fuel pulls this off.

 


 

Stolen Pixels #127: Prison Break

By Shamus Posted Tuesday Sep 22, 2009

Filed under: Column 17 comments

In Champions Online, if you’ve got the strength you can pick up and throw vehicles. You can lift a truck and hurl it into a group of bad guys, sending them flying and very likely insta-killing one of them. If you just really hate the taxpayers, you can pick up a police car and use it to pummel another police car.

I really like that they didn’t simply make it possible to use the scenery in a fight, but they actually took the time to make it an interesting, balanced, and worthwhile part of combat. Thrown objects are a good opener, but it takes a few seconds to lift the really big stuff so you can’t just throw cars repeatedly until you win.

I have to give Champions Online credit for a really clean and stable launch. I’ve logged over a hundred hours already, and the game hasn’t crashed once. No broken quests. No game-killing bugs or griefing exploits. It’s by no means perfect, but as MMO launches go, this is about as good as it gets.

 


 

A Star is Born:
Let’s Play Champions Online Pt. 1

By Shamus Posted Tuesday Sep 22, 2009

Filed under: Shamus Plays 64 comments

I’m enjoying Rutskarn’s Morrowwind series so much that I’ve decided to do one for Champions Online. This will run every Tuesday-ish until I get bored with it, people get sick of it, or I cancel my account. Or I forget. Or I die.

Starting off, I decide to create the quintessential silver-age superhero. Not one of these brooding black-caped, spike-covered, angst-ridden antiheroes like all the young people are into these days. I want someone wearing classic tights and using classic iconography. But not, you know, operating under the same silver-age idealism and respect for all life. Heavens no. I’m going to have the same approach to fighting crime as The Punisher. I’ll just be wearing stretchy clothing and a brave smile when I do my vigilante-style killing.

Looking through the powers, I discount all blade-styled weapons. Too messy. There are a couple of fighting & fisticuffs based power sets that seem to fit his style, but they’re also a little bland. (And I am already playing a couple of other melee-based characters.) Then I see Telekinesis, which is based on Ego and Constitution. Ego? I can base my abilities on the strength of my own ego? Sold!

I go for a quick run-through of the character building options and am able to craft my avatar in just under a fortnight, which is a new record for me.

ME: Let’s see… does the nose look more heroic at 10% width or maybe a little closer to 14.5% width? MY WIFE: Are you <strong>still</strong> staring at that man?
ME: Let’s see… does the nose look more heroic at 10% width or maybe a little closer to 14.5% width? MY WIFE: Are you still staring at that man?

In keeping with his silver-age design, he’s got a chin that falls somewhere between “Jay Leno” and “bulldozer”. His suit is bright and colorful, and he’s ripped like Hercules even though his powers do not involve physical strength. In fact, I can’t think of a power more fattening than telekinesis. These days the only exercise I get is from walking to, and subsequently opening, the fridge. If I could move food with my mind and fly, then it would take me about two weeks to get to the point where I could cosplay as Castle Wulfenbach.

Thus begins the journey of Star on Chest. His Bio:

Star on Chest is becoming the premiere celebrity crimefighter of Millennium City and is the author of “An Awesome Being on Being Awesome, the Story of Star on Chest”. He appeared in People magazine’s “Top 50 best-looking superheroes of 2007”, and was a guest judge on ABC’s “Dancing with the Superheroes”. He’s the exclusive spokeshero for Altmier’s Brand Zesty Hot Sauce and for State Trust Auto Insurance.

For product endorsements, public appearances, or crime fighting, please contact Champion Media Worldwide and ask to speak with his agent.

A personal message from Star on Chest: “I’ll be appearing at the grand opening of the Northwood Center Mall this weekend. Stop on by to see your favorite star-based hero in person! Autographed photos just $20! Bring a friend!”

Champions Online doesn’t have catchphrases, but if it did his would be, “Don’t you KNOW who I AM?!?”

No, wait. It won’t let me use that bio because it’s too long. Apparently the biography system is powered by Twitter. I whittle it down, but then it complains that I have profanity. After much confusion I discover it was the phrase “hero in” that was setting it off, which it was evaluating as “heroin”. The content filter was worried I was promoting the use of dangerous narcotic drugs.

Dear Young People: Heroin can reduce you to a puking husk of a glassy-eyed junkie prostitute. Eventually you’ll find yourself haggling over the price of sex because you don’t have change for a five. Please do not try heroin unless your life is already worse than that. There. That should keep the kids safe.

Anyway, I revise the bio for brevity and remove the words “hero in” so as to avoid corrupting our impressionable youth with pro-heroin propaganda.

Eventually I summon all of my strength, all of my willpower, and boldly click the start button to begin the game.

Man, I should have gone with 10% width on the nose.

You know all those anthills you stomped on as a kid? Well, payback is a bitch.
You know all those anthills you stomped on as a kid? Well, payback is a bitch.

The city is in chaos. It’s being invaded by bug aliens known as Qualar or Quaa’lar or Qua’lor or some such piffle. Aliens run rampant through the streets and the police are fending off never-ending waves of bug man from behind hastily constructed barricades. Buildings have been smashed. Fires burn. The dead litter the sidewalks. The coffee shops are all closed.

Oh, now I’m going to have that 80’s song stuck in my head all day. Thank you so much, game.
Oh, now I’m going to have that 80’s song stuck in my head all day. Thank you so much, game.

I begin my life as a hero in* the midst of this destruction. My first act is to climb out of a pile of rubble. I’m not the only one, though. Apparently this rubble has been spewing out heroes in an endless stream since launch day. This rubble is the king-hell clown car of the ages. There are actually people appearing on top of me before I can even step away from the pile. This leads to that awkward moment you get in MMO games, “Pardon me miss, but it seems we’re occupying the same physical space and you haven’t even bought me a drink yet.” I step out of the transporter malfunction and greet the nearby police officer.

Time to see what’s going on around this burgh.

* This phrase is not an endorsement for heroin.