2009/10/22

Line of Sight

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.

Without LOS:



With LOS:

2009/10/10

Atheist vs Agnosticism

This is kind of in response to my brother's post here.

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.

2009/10/04

Sinfest FTW: Homophobia

Some Cool Eusocial Insects

Leaf Cutter Ants feed the leaves to a fungus and eat the excretions. They also produce anti-biotics to fight pests.



Termites also feed a fungus and produce some awesome architecture that regulates temperature like an air conditioner.

2009/09/24

Building a Windmill

Watch this.



And then watch this.

2009/09/18

A Brief Analogy

I guess to put it really briefly, what I was saying in my previous post is that I think you could make an analogy as follows:

Genes are to Life as Memes are to Consciousness.

Obviously there are some problems with this analogy, but I think it's interesting as a thought experiment.

2009/09/13

Consciousness and Life

A few days ago I had a lengthy discussion about consciousness. The result has been a mild obsession recently with the topic. I would much appreciate any comments anyone has on the subject.

To understand my view of consciousness, you first should know what Biological Naturalism is, as this is the closest view to mine that I've found. I used to think I was a materialist, but materialists deny the existence of a non reducible property of consciousness. Meanwhile, there is dualism. I haven't been a dualist since I was a kid. Dualism is hard to justify when one does not believe in the supernatural.

Biological Naturalism states that consciousness is a biological property, like digestion or photosynthesis. But unlike those properties, it is ontologically irreducible.
Solidity can be ontologically reduced to molecular behavior and consciousness cannot be reduced to neuronal behavior. To put the point more precisely, in the case of solidity the fact that we can give a complete causal explanation of solidity in terms of micro physical processes leads us to say that solidity is nothing but a certain sort of microphysical phenomenon. Causal reduction leads to ontological reduction. But in the case of consciousness we are unwilling to make the ontological reduction. Consciousness is entirely caused by neuronal behavior, but all the same we are unwilling to say that consciousness is nothing but neuronal behavior. (Searle 2004, Biological Naturalism)
So to understand where I begin to differ with Searle, consider the question "What else is an ontologically irreducible biological* property?"

... pause for effect ...

If you answered "life" then maybe you already know where I'm going with this (If you're totally lost I recommend reading some of Searle's work). Bells rang in my head when I made this connection, and I'm sure I haven't been the first. Not only do life and consciousness share this rare quality of being ontologically irreducible, and being physical properties (as opposed to epiphenomenal phenomena, like a rainbow or a sunset), but they alone also share something else that is very important: replicators.

Life is a medium of physical replicators (in the case of life on earth, genes). Replicators, in the sense I use the word, undergo copying, selection and variation. Consciousness is, and I think should be defined as, a medium for memetic replicators. A meme, in my definition, is anything that is imitated. Memes, like genes, undergo selection, variation and copying.

This theory puts a lot of the puzzle pieces into place and answers the following questions. When did consciousness first emerge? Are animals conscious? Can computers become conscious?

The first two can be answered together. As soon as animals develop the higher brain functions necessary for imitation, they contain a rudimentary form of consciousness. When a bird hears a song from it's same species it may imitate the song, copying the meme. It may miss hear, or simply make a mistake, introducing variation, and through selection, only some songs will persist over time. This rudimentary consciousness is like looking on the ancient earth at replicators first evolving. It took billions of years for life to develop into a state with so few mutations as we have today. At the start, mutations were most likely frequent and extreme, as they are with many memes. But as some genes developed to produce proteins that repair DNA, some memes produce ways of maintaining themselves as well (language, writing, and eventually electronic storage, for example).

Currently computers and machines are used to copy memes, but the variation and selection is still almost exclusively done in the brain. You could think of these memes stored in a computer as an equivalent to viruses. Viruses are not widely considered alive, despite having genes and undergoing selection. Similarly, media can contain memes, but the variation and selection is not yet done by computers. I disagree with Susan Blackmore's prediction of "temes" as a new replicator, because I do not believe memes need be in a biological brain. What she calls temes I call memes that exist entirely in computers.

When computers start to not only copy, but select and vary memes, whether intelligently or not, they will on a certain level become conscious. This scares a lot of people, and perhaps it should. Memes existing entirely in computers would have protection from mutations in the way that they do not have in the human brain. It is like we are witnessing the transition of simple replicators to single celled organisms, in that the level of self sustainability will dramatically increase. Why should we be scared? Because we don't see any self sustaining replicators outside of cells anymore. The success of the cell eliminated all the competition.

2009/09/08

A couple links

This [subnormality] is great. I always wondered why so many of my friends and even some family members like professional sports so much. Playing is one thing.. or rooting for friends, but I've never gotten into prof sports. I even tried to get into them so I could have something to talk about with "the guys".

Also.. I think I've been living in Japan too long because it took me a while to figure out why this [failblog] was supposed to be funny.

2009/08/16

Summer Update and My Game

I haven't updated my blog in a while, so I thought I'd say something about what I've been doing lately. So far this summer I went to Karuizawa and Izu. Tomorrow I leave for Kiyosato for a week to teach English at a camp for kids. I did it last year and it was pretty fun. Tomorrow is also the 3 year anniversary of my first day in Japan! It's hard to believe.

The past month or 2 I've been working a lot on making a web-based turn-based strategy game. The original goal was to make a mock-up game to test the rules for a possible board game, but now I've taken it in a new direction. The ultimate goal now is to adapt it for Facebook and play with family and friends.

The idea of the game is simple: Each player has robots. The robots are given orders and carry them out simultaneously. The catch is that you have to tell the robot what to do in advance, therefore trying to predict what your opponents will do. I want to do things like capture the flag later, but at the moment the object is to just take out all the opponents.

All the art work is done by me. For those who are curious, I'm coding it entirely in Ruby on Rails and Javascript. I'm using the YUI library for a lot of things including animation and ajax. Check out these screen shots from my latest version. I'm hoping to get a version online soon, but I'll be busy the rest of the month so it might have to wait until September.