3,193 reputation
717
bio website redblobgames.com
location California
age
visits member for 4 years
seen 8 hours ago

I help people make games. On my new site ("Red Blob Games") I post interactive tutorials and guides to game algorithms. On my previous site (Amit's Game Programming Information) I collect links to useful pages about maps, grids, tiles, pathfinding, and AI. On my blog ("Blobs in Games") I post experiments and projects and ideas. Previously I was an advisor to Wild Shadow Studios (Realm of the Mad God) and Root 1 (educational games).


Aug
25
answered Is there a library that handles hexagon tiled 2D maps?
Aug
21
revised Hexagonal grid/tiles tutorials
edited tags
Aug
21
comment How do I get pixel to hex coordinates on an array based hex map?
This is a reasonable approach. You can speed it up by scanning a smaller range of rows/cols instead of scanning all of them. To do this you need a rough idea of where the hex is. Since you're using offset grids, you can get a rough guess by dividing x by the spacing between columns and dividing y by the spacing between rows. Then instead of scanning all columns 0…cols-1 and all rows 0…rows-1, you can scan col_guess - 1 … col_guess+1 and row_guess - 1 … row_guess + 1. That's only 9 hexes so it's fast and not dependent on the size of the map.
Aug
21
answered How do I get pixel to hex coordinates on an array based hex map?
Aug
19
comment How could I figure out the shortest way to turn, and whats the angle?
Note that in most cases you should use atan2 instead of atan. It handles the divide by zero case, as well as figuring out which quadrant you're in.
Jul
26
comment Procedual terrain generation and biomes/predetermined variation
You write in a comment that biomes determine height. Have you considered making it the other way around? Generate noise functions for height, moisture, and anything else, and then use that to determine biomes. That way, the underlying height, moisture, etc. are all continuous across biomes and won't have any nasty borders.
Jul
26
comment What are some methods to represent train tracks?
I've written a longer article about using circular arcs to represent roads and train tracks.
Jul
18
comment Procedural river or road generation for infinite terrain
The roads in that project were contour lines that followed specific heights, so you could possibly generate them locally. It worked there but the height maps not generated with Perlin noise.
Jul
5
awarded  Necromancer
Jun
17
comment Vertices shaking with large camera position values
Wild guess: are you using single precision floats anywhere? That could be loss of floating point precision.
Jun
16
comment How to determine the demographics of a game after release?
It seems like you want to use demographic data as a proxy for ways to make the game better. Is there a more direct way to figure out how to make the game better? Do you need to choose to make something for only one audience, or can you make options for multiple audiences and then see which ones work best?
Jun
12
comment Generate equal regions in a hex map
Real countries often have boundaries on rivers or mountains. As you're expanding in a random direction, you might try decreasing the probability of expanding if the next hex is on the other side of a river or a mountain ridge.
Jun
10
awarded  Caucus
Jun
9
revised Line draw on “even-q” vertical flat topped hex grid
Added "hexagon" tag
Jun
9
answered Line draw on “even-q” vertical flat topped hex grid
Jun
7
revised JavaScript “Floats”, or ThreeJS wrong positioning?
Retag question - it's about floating point in general, not three.js
Jun
7
answered JavaScript “Floats”, or ThreeJS wrong positioning?
Jun
4
awarded  Nice Answer
May
26
answered Pathfinding library
May
24
comment Hexagon collision detection for fast moving objects?
I've not tried this before but it seems that instead of hexagons in 2d space, you can think of the movement in 2d as volumes in 3d space where one axis is time. You're then intersecting two 3d polyhedra with (x,y,t) coordinates. If the two solid objects intersect then you want to find the minimum t value. You might simplify a little bit by converting all of B's coordinates to be in A's reference frame. I haven't implemented this but that's where I'd start.