The Savage Within

By Shamus Posted Tuesday Jan 31, 2006

Filed under: Rants 1 comments

A while ago I was talking about how our civilization is greatly shaped and often dominated by our base instincts. In that post I was talking about our drive to “protect the children”, which has been an excuse for a lot of really destructive behavior.

But that is, in many ways, peanuts compared to the drive of males to compete and dominate. This business of blaming it on video games, movies, and sports is bizzare and infuriatingly counter-productive. Take a peek at nature. I think people would be shocked at just how much of our violent behavior is a result of base, primitive drives that reflect behaviors we see in animals. Even the most timid, rotund little accountant has the genes for skull-splitting combat buried beneath all the layers of civilization.

Think about the first time your girlfriend was attracted to another guy. How did you feel? Upset that she was so feckless? If you were a teenager, you probably wanted to kick his ass, even though that doesn’t make any sense. That’s the same wiring used when males needed to compete, via combat, for the right to mate. Now there it is in your 15-year-old civilized brain and you don’t know what to do with it.

You can’t educate these drives away, and the next best thing is to find a non-destructive way in which to satisfy those primal urges. Sports are another way to accomplish this.

We have other base drives, and we (ahem) manage to satisfy those even when we’re not in a position to actually mate. Take sports and games out of our lives, and those primal combat drives will still be there, but we will be without the tools to deal with them.

 


 

About me

By Shamus Posted Tuesday Jan 31, 2006

Filed under: Pictures 5 comments

I’m Shamus Young, a 34 year old software engineer and a happily married father of 3. In my free time I tend to play videogames, watch Anime, play D&D, and write software of dubious value. I also tend to write about these things here.

I don’t have any sort of degree.

You can probably extrapolate the rest by just looking around the site. I’m a stereotypical nerd. I’m the author of this Cyberpunk novel, and was the guy behind this politcal satire site.

You can reach me at:

shamus at shamusyoung dot com

 


 

Terrain, Part 1

By Shamus Posted Monday Jan 30, 2006

Filed under: Programming 25 comments

UPDATE 2/20/2006: After about a month, the project is now finished. You can go through the series and read my explanations for each step, or you can just page through and gander at the pretty pictures. If you’re the impatient sort, you could just jump to part 10 right now and see how it turned out.

The Project: Terrain Engine

My goal is to write a terrain engine from the ground up, using entirely new code. In most situations, something like this would be a component of a computer game. I will approach this project as if it was.

I’ve worked with several terrain rendering engines in the past. In my professional work, I maintain a large codebase that includes terrain rendering code. I’ve also messed with the Unreal Engine, which has an attractive terrain system. On the right are a few random terrain renders from different engines that I gathered up via Google image search. This is just to give an idea of where this project is headed, although I have a long way to go before I can make anything like those images.

I’m doing this in the interest of self-education – I don’t have a purpose in mind for this, although I will be setting goals and writing code as if this were part of a larger project. That means writing clean code (as opposed to slapdash prototype code) and being careful with processing power and memory usage, even though I’ll have plenty.

The first step is deciding what sort of terrain engine I want to write. If this were part of a game, how would the engine be used? Will it be viewed from ground level, like a first-person game, or will it be viewed from above as in a real-time strategy or a sim game? Even though this thing will not really be used in a game, I need to pretend that it will be, in order to know how to optimize things. So what’s the difference?

In a first-person game, nearby hills may block your view of far-off scenery. Fog or darkness usually limits visibility, to prevent seeing all the way to the horizon. You usually can’t see more than a mile (and usually much less than that) and the landscape is often very hilly. If I go this direction, I’ll have to write code for figuring out what areas are blocked by nearby hills and not rendering those parts. Terrain needs to look great up close: the player view is almost never more than six feet from the ground. (their own eye height) The world needs to be richly detailed and sharply rendered. In the images on the right, the third from the top is of Unreal Tournament, which is this sort of game.

By contrast, the other sort of game is usually viewed from an overhead perspective. The view distance is far gearter, but the ground doesn’t need to be quite as detailed since the user never gets very close to it. However, these sort of games usually require the ability to draw the entire landscape at once. In the images on the right, the topmost is from Black & White, which is this sort of game.

I don’t want to design a program that can do both but is good at neither. Since I have experience with the first type (first-person views) I’ll shoot for the other type and design this program to be good at rendering overhead views of terrain.

Techical info: I'm programming in C++ and using OpenGL for the rendering. While it is common in games to begin writing them with the expectation that computers will be twice as fast and have twice as much memory by the time you finish, I'm making the machines of today my target platform. I don't want to get sloppy.

The basics

The first step is a bit dull. I set up a project, add a seperate console window for debugging (not pictured), made it so I can fly around the terrain using the mouse, and a bunch of other very dull stuff.

Then I make the very first iteration of the terrain engine. For testing, I’m going to make the map a grid of 512 x 512 squares. This is not unreasonable. At this point, I’m making no attempt to optimize whatsoever. I just send the raw grid of data for rendering. The result is:

The most boring image ever!

512 x 512 squares comes to 262,144 squares, each of which is divided into two triangles for rendering. So, we’re looking at 524,288 total polygons. Each polygon is made up of three vertices (points), and so I send 1,572,864 vertices for rendering. That is a lot of data. Modern graphics cards can handle this with no problem, but once we start adding some stuff like trees, cities, alien armies, bikini girls, giant robots, pokemon, or whatever the hell else to the scene, we are really going to run out of processing power very fast. This “engine” is useless in its current form, unless all you want to do is look at terrain.

Adding elevation data

Before I can do anything interesting, I need some hills! Most games use terrain that was created by an artist, which means very unrealistic hills shaped like squashed hemispheres rising out of flat areas, elevated bowl-like depressions, and other nonsense. That looks passable when you’re on the ground, but looks fake from above. This sort of data also tends to be easier to optimize. I don’t want that.

I don’t want to wuss out, so I want something that looks real. This means using either USGS survey data or terrain created with an erosion simulator. I prefer the latter, since I can still control the overall shape of the world. I have some fabricated data left over from another project and it was easy to bring it over for this one.

A common approach is to keep the elevation data as a big greyscale image. This makes it easy to edit, and easy to “see” what the land looks like outside of the program. I’ll use a bitmap (windows BMP files are a good choice since they are easy to load, easy to create, and have lossless compression) where each pixel represents a single point on our grid. The brighter the pixel, the higher the point. That’s a good start, but greyscale BMP files don’t have very much depth. Each dot has a value between zero (totally black) and 255 (totally white). When you’re using the data to store high-resolution elevation data, 256 distinct values isn’t enough. If you want to really stretch the elevations out, so that you can have deep valleys and high mountains, then the terrain will end up looking like “steps”. This is very bad. It looks fake, and the jagged shapes will work hell on any attempt to simplify the terrain. To get around this, I’m still using a BMP file, but I’m using all three color channels. The BMP is really made up of three seperate images like so:

The red channel is the “overall” shape of the terrain. This channel is used for making the mountains and valleys. In this case, I just have a single bright blob in the middle. This will create a large gradual rise in the middle of the map, like a large (mountain-sized) pitcher’s mound. The green channel is our “real” elevation data, which has realistic hills like you would see in the real world. The blue channel is just uniform noise.

The red channel deals with values on the scale of hundreds of meters. The green channel deals with values of dozens of meters. The blue channel deals with values on the meter and sub-meter level. This is arbitrary: I could make the channels work on any scale I want, it’s just that this setup seems to be easy to work with and likely to generate some nice looking landscapes. These three channels are combined to form one composite image, which will be used to describe the shape of the terrain in our world.

This is a much reduced version. The original is 1024 x 1024. I’m only using one-fourth of it (since my world is 512 x 512 right now) but the rest of the data is there in case I want to go larger.

So I drop the new data into place. The result:

Not bad.

You can see how the grid of squares forms the landscape. The program pulls up the points that make up this grid, deforming it. This is a bit like throwing a blanket over something and determining its shape by observing how the blanket falls. This is the most common way to make terrain by far. I’m sure other methods exist, but I’ve never seen them in action.

Note one drawback: We only pull points up and down, but never move them horizontally. This means that we can never have things like an overhanging cliff or even a sheer vertical cliff. I don’t plan to re-invent the wheel here and try to find a way around this. Most people don’t notice these limitations, and overcoming them would require something far more sophisticated than what I’m planning. In games, if the designer really needs a sheer cliff or overhang, they usually add an object to the world (just like they would add a building or a tree) that creates the shape they need.

That’s it for our first update. Next time I’ll be taking this terrain and trying to render it using less polygons while retaining the smooth appearance.

 


 

Session 9, Part 5

By Heather Posted Saturday Jan 28, 2006

Filed under: D&D Campaign 5 comments

19th of Last Summer (Evening)

Once Skeeve and Enoch emerge from the meeting with the Queen, Fulan meets them in the main hall. Their travel papers are returned. Fulan provides them with additional horses, so that they will no longer have to share. This will speed travel for all of them.

The entire party returns to the inn. There is much to discuss. Endo and Beck join them. They debate at length on the job the Queen has given them. She has asked them to kill Noreeno. Now, they are happy to do this job. In fact, Eomer promised Noreeno that he would kill him. However, they have noticed that everyone seems to have secret motives and agendas. They are wary of being used again.

At length they come up with a plan: Endo is to ride south and seek out his friend, the prince. The rest of them will ride north and attempt to intercept Noreeno. However, instead of killing him outright, they plan to capture him and see what information they can extract from him before he dies.

Continue reading ⟩⟩ “Session 9, Part 5”

 


 

Like Christmas on Cybertron

By Shamus Posted Friday Jan 27, 2006

Filed under: Nerd Culture 5 comments

This came in the mail today. Like I said, this is my first new CD in about half a decade. There just hasn’t been much new music that made me want to pay full price for an album. Until now.

This is an innovative album full of infectious hooks and solid beats. Notable tracks include Organix, which has a fun rhyme and a punchline ending. JZ75 is another impressive track, where the group’s high-speed, high-bandwidth delivery will make you wonder if they really are machines. Precogni2 and Precognito are variations on the same brilliant lyrics, both of which are essential. Finally, Fuzzy Dice and Ford vs. Chevy are witty and fun tracks. The tracks are short but plentiful, keeping things fresh and coming at you from a lot of different angles.

Lead vocalist Wheelie Cyberman comes up with numerous complex and ever-changing Rhymes, while Bass player Stumblebee shows a great skill at coming up with basslines that puts the whole album on wheels.

The only nitpick is that a few tracks end with about 30 seconds of Japaneese(?) chatter and static. I’m not sure where they were going with this. It’s short and amusing at first, but after a few trips through the album I was anxious for them to end and get back to the fun.

 


 

Planet Nerf

By Shamus Posted Thursday Jan 26, 2006

Filed under: Rants 7 comments

Photon Courier has a bit on the pernicious self-esteem movement. This touches on something that has facinated me for a long time. See also this bit from QandO where Dale Franks argues that:

What separates man from the animals is that, unlike them, man is a rational actor. Rather than acting from instinc, or in simple responses to immediate stimuli, we can plan rationally, guage the effects of our actions on others, and measure the harm or good that comes from our actions. Because we can do so, and exercise our will, then being a rational actor also makes us, automatically, a moral actor. So, when we talk about natural rights, what we are really discussing is a set of moral claims that arise directly from human nature.

In an ideal world I suppose this would always be the case, but I’m often shocked at how often we are, in fact, like animals – even when trying to make rational decisions. I’m always amazed at how much our base animal drives shape our otherwise highly advanced world. We write software, design new soft drinks, send spaceships to other planets, compose music, and engage in long philosophical debates on the internet about natural rights. We are, in many ways, a race of highly advanced and creative badasses. And yet, through all of this our primate nature still pokes through from time to time and exposes (some of?) us as a bunch of monkeys dressed up in ill-fitting pants and ironic t-shirts.

The obvious one: The effect of sex on our culture and entertainment is so complete and universal that I don’t think we need to even bother looking for specific examples. Our drive to eat, driven unchecked in a place with practically limitless food and little need for manual labor, has given rise to a massive industry dedicated to helping us to fight that same drive. And despite all the effort, the weight-loss industry is losing.

So what does this have to do with self-esteem? Well, another drive we have is the drive to protect our children. Many people who don’t don’t have kids have trouble trying to imagine just how powerful this drive is. This drive has served us very well over the millenia. For a long time this meant keeping out animals that thought of us as a delicous addition to the food chain. It also meant being ready if a rival society came riding over the hill with the intention of starting a tiff over who gets to live in our homes. Eventually we fixed those problems. Dangerous animals are few and far between, and the ones left are the ones smart enough to stay away from roads and guns. Barbarian societies still exist, but our relative military strength is such a mismatch that they don’t come riding over the hill anymore.

After fixing these two biggies, we were able to turn our attention to the other major dangers to our kids. Antibiotics stopped infections from killing kids at such a fierce rate. Santitation saved millions more. For an encore, we cured polio. By this point we’d stopped almost every major threat to the lives our children. Time to relax, right?

Of course not. The drive to protect children is still there. Each generation comes to see the world as they find it as “normal”, and when they grow up they will have a whole different scale for what they consider to be “dangerous”. They still want to make the world a better place for their kids, which is a bit tricky since it’s already pretty great, kid-wise. So what’s next?

Dangerous playground equipment. Dangerous toys. Choking hazards. None of these problems got suddenly worse, it’s just that the previous top dangers were eliminated, and stuff like this made it into our collective “most wanted” list. No longer content with protecting kids from death, we’re moving on to protecting them from little cuts & abrasions, and the very odd chance they might choke on a random toy. So now our playground equipment is safer, toys are rounded off and no longer launch anything, and anything smaller than a basketball is labeled as a choking hazard. Sure, playgrounds are a little less fun, some toys are less interesting, and we have warning labels written for morons plastered over everything, but we might have saved a life or at least an eyeball. And just one life makes all this hassle worthwhile, right?

At this point it should become obvious that we’re dealing with the law of diminishing returns. These changes are starting to cost us something and aren’t giving us a lot more safety. But we’re not done!

Ban fireworks. Mandatory bike helmets. Bus everyone that lives more than ten feet from school. Enact laws that dictate how and where you may build yourself a swimming pool, and how you may use it. Ban television shows that show people doing dangerous things, or add long stupid pre-show “don’t try this at home” warnings. Make sports more non-agressive and non-competitive.

At this point we’re no longer dealing with random external dangers. We’re talking about eliminating risks that people choose to take. And still it goes on. Each generation comes forward with the self-assigned mission to make the world safer for our children. Now we live in a foam-padded world where the biggest danger that faces our kids is that they might have their feelings hurt. This is about as good as life gets. And even that risk can’t be tolerated.

The people who advocate this silly business need to realize that there is no end to this. The kids will never be “safe”. They are on a fool’s errand, acting on a base drive that pushes them to advocate ever more irrational measures. The worst thing about these people is that as they advocate increasingly preposterous public policy in the name of safety, they do so at the bidding of an instinct that has become a sort of collective obsessive-compulsive disorder. Despite this, when these fancy-pants monkyes start grunting and shrieking about “self-esteem”, they believe they are being rational.

Keep piling up the banannas, monkeys… but I think you have plenty.

 


 

Chizumatical Sabatical

By Shamus Posted Thursday Jan 26, 2006

Filed under: Nerd Culture 0 comments

So Steven Den Beste’s Chizumatic is still down. His site went down when he moved to Seattle a couple of weeks ago (Just in time to lose the superbowl to the Steelers, too bad!) and hasn’t re-appeared since. Geeze Steven, whats the holdup? Need an extention cord? Help unpacking boxes? Maybe go over to your new neighbor and borrow a cup of DSL?

Chizu was one of my never-miss-it stops for the day. I need to seriously start thinking about finding a new anime blog. This is a bit tricky. A lot of anime fans aim for the more boobies-and-robots end of the spectrum, and I tend to enjoy the more thoughtful and slower-paced stuff.

Barring that, I should at least learn to stop clicking on my Chizumatic bookmark every morning. Sheesh.