Jul 012013

Took me forever to solve this issue. Found a single post on a single site. A site was in a redirect loop because a page had a 301 redirect at one point with a really long cache time. I noticed the error to late (changed it to a 302 redirect). Broke Firefox and chrome for a while until I did a hard reload and empty cache on chrome. For firefox, after dumping the cache and it not working, I finally found out the trick is to simply open your Firefox history, right-click the troubled website there, and then select “Forget About This Site”. That should solve all your troubles for the end of time!

Apr 042013

I’ve recently been playing around with S3Stat to analyze the traffic to a web application I run with a friend.

In the beginning of the month we got billed significantly more than expected for bandwidth. We were surprised so we looked into a way to parse our s3 stats without a pain in the neck. S3Stat appeared on a few forums so we tried it out. We caught our first hotlinker in the first 2 days and got them to stop. But a few days later it looks like they started up again.

s3 bandwidth

Kind of obvious isn’t it? That little dip between the large ups is our normal bandwidth consumption. And this is information we’d never know about without S3stat or having to write our own solution.

While the chart doesn’t tell you who is contributing to the bandwidth consumption, their other data does. They provide a list of URLS by bandwidth used so we could find which file was being requested the most. More conveniently, they provide a list of referrers to our site. That let us easily pinpoint who was using our bandwidth so we could let that site know that we could not support them for much longer.

So thanks to S3Stat we are now saving (lots of!) money and we know exactly where our bandwidth is being used at. I think we’ll keep using them for a long time.

Dec 152012

I’ve been working more on the Zombie Prototype. I’ve added procedural generated rooms and corridors in a labyrinth/dungeon/cave type style. I randomly generated a specified number of rooms spread out and only overlapping by 2 tiles at most. Then I chose an entrance/exit from each room and calculate the path to each other room from it using an A* formula with no diagonals. If no path can be found, it skips it, so it could be possible for an isolated room at this point. Of course, I’d love to add a lot more to it sometime in the future. Getting the basics down is good for now. After running, it usually generate a map that looks something like this:
Tribulation Rooms
The brown scattered tiles that seem out of place is an alternate entrance/exit that was also calculated in case I’m going to change the way these rooms are connected.

Then I scanned through the rooms and generated an estimated number of zombies. Right now I set a total count and it generates somewhere around that many zombies (some randomness involved) all divided into their own rooms. The zombies are them spawned on the center tile of each room with a little variation so spreading out will be easier. Since I’ve added a repulsion algorithm to each zombie they naturally spread out into a better looking formation. A demo I ran with 25 zombies specified (up to 30 zombies can be generated since it the algorithm generates n to 1.2n zombies) and here is how they spread out after a second or two:

And then, to get a better look at how the repulsion algorithm works and to make sure it actually is working, I correctly scaled the map (previous pictures are at .6 scale) and spawned the player in the first room. After moving around a bit to collect the attention of zombies, I let them swarm for a bit around me. They generated a roughly circular shape as expected, each trying to push the others out of the way to get to me. Just like any real zombie would. The repulsion is a double check. If a different zombie is within the inner radius of another, the different zombie will get a strong repulsion. If the different zombie is within the outer radius, the same will happen though with a smaller repulsion force. This helps keep zombies from overlapping for sure (strong repulsion) and spread out a bit (weak repulsion) when they are following the player. Here is their clustering:

(Yep, there is some repulsion bugs currently when too many zombies are in one spot, which shove zombies outside of rooms unfortunately. You can see these bugs in the top left and top right)

And of course, I turned on the dynamic lighting. You can also see a bit of their following clustering in the image as well. They are quite spread out while they are attempting to reach me.