2009/10/22

While working on my game, I decided that I will at some point want to have line of sight for a unit. This is how I did it.

The game is on a hexagonal grid, so to make it easier, I decided that a circle around the outside of a hex is the size of whatever blocks vision. All I had to do was check each hex to see if it blocks vision, then for each of those hexes, mark all the ones behind them as invisible. What I was left with was a problem like this:

The unit is at A, the hex at B blocks vision, and everything further away than B that is between the yellow and red lines is invisible. So all I had to do was find the equations for the two lines. They turn out to be really elegant. After many pages of math where I made mistakes and relearned algebra, I found the two equations and plugged them into my map editor for testing. Anyone want to give it a try? I'll post the answer in the comments.

Here are the results!

A Small, Simple Map with a blocking hex and a unit:

Showing the LOS:

Yay it works. Here's a bigger example. This is supposed to be a cave interior, so the black is wall, the red is lava and the rest is just ground. The selected unit is in the middle.

2009/10/10

First of all, atheism and agnosticism are not mutually exclusive. Atheism to me, and a lot of people who's views I agree with, is the rejection of theism. It is a lack of belief, not a belief in non-existence. An atheist does not necessarily assert that there is no god. Clearly, no one knows whether there is or not. Nor do we know whether the universe is all a computer simulation. We don't know whether magic exists, of if the Force is real and if flows through all of us and binds us. You could call me agnostic toward the Force, but this would send the wrong message. I do not believe in the Force, magic nor a god.

There has been much debate about the word atheism and whether it is the right word to use for the growing number of non-believers. Prominent atheists have suggested other words, some more condescending than others. Sam Harris doesn't like the use of the word because of its baggage. But it is important to recognize the bigger picture. The world (and especially the US) has a huge number of evangelical religious lunatics who believe Barack Obama is the antichrist or that they will receive 72 virgins in the afterlife. There are polls showing that atheists are the most hated and distrusted minority. IDiots and creationists (I know, I'm repeating myself) are constantly trying to stop the teaching of evolution and/or inject their own religious beliefs into the public school systems. It is for all these reasons and more that a large number of high profile atheists are starting to join forces and speak out. Groups like the Atheist Alliance, for example, are trying to create a positive voice for atheism (see here).

Finally, just to reiterate, you can either be a theist and believe in a god, or an atheist and not believe in a god. While it is true that a person who asserts the non-existence of god is also an atheist, that is not what we are all doing, and standing on the sidelines as a wishy-washy agnostic is not helping the greater cause for, among other things, womens rights and science.