3,238 reputation
717
bio website redblobgames.com
location California
age
visits member for 4 years, 2 months
seen 9 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).


Dec
14
comment Tetris rotation without using arrays
You should use whatever's easiest. This doesn't seem like it's worth optimizing, unless the profiler tells you you're spending a lot of time there. O(n^2) hardly matters when n is 4.
Nov
29
answered Why is 2D light ray collision result getting inverted at specyfic angle
Nov
17
comment How to draw the contour of a hexagon area, like in Civ 5
If you really need to build polylines, each edge endpoint is connected to two more edges. Only one of those two edges is the one you need to follow. There is a hex to your left, a hex to your right, and a hex in front of you. If the hex in front matches the one to the left, you need to follow the edge to the right; otherwise follow the edge to the left.
Oct
30
comment Required number of images for octagonal tiles
While looking for something else unrelated, I found this page that has a visualization of the patterns: jasondavies.com/necklaces ; it shows that once mirrors are taken into account, the number drops from 36 to 30.
Oct
27
revised Required number of images for octagonal tiles
removed redundant sentence
Oct
26
answered Required number of images for octagonal tiles
Oct
16
comment isometric movement
Whatever you end up picking for movement, I recommend doing it in the game world coordinates, not the isometric view. See the diagram on this post. Things are simpler if you do all the game logic in the game world coordinates and then apply isometric only for rendering.
Oct
13
answered How to calculate left/right oriented angle between two 2D vectors?
Oct
11
awarded  Yearling
Oct
10
comment Artificial Intelligence - when to update pathfind?
If you're precalculating for every node, use Floyd-Warshall instead.
Oct
9
answered Why does my A* implementation overflow the stack?
Oct
7
comment Random Placement of Objects on a Tilemap
Some noise functions (including Perlin Noise) will let you generate any portion without generating the whole thing. For storage, you can use a hash table that uses (x,y) as the index. In C++, that could be std::unordered_map<pair<int, int>>. That way, you can store only the parts of the map you generate, and you also get to use negative indices. In practice, you'll probably generate a chunk at a time instead of one tile at a time.
Oct
7
answered Random Placement of Objects on a Tilemap
Oct
4
reviewed Approve Why is it bad to hard-code content?
Sep
30
comment What's the 'proper' way to get unit vectors?
sqrt is also relatively fast these days, and the overhead of a function call will be larger than the cost of the sqrt itself. Write clean code, and if it's not fast enough, run the profiler, then focus on the areas that are slow.
Sep
30
comment What's the 'proper' way to get unit vectors?
Since you're working in python, I'd suggest - just use the sqrt and don't worry about it.
Sep
24
awarded  Autobiographer
Sep
9
comment How to handle a negative coordinate 2d map with a growing map size
Ah, cool. Just be careful — some of the methods like slice() behave differently when given negative indices.
Sep
9
answered How to handle a negative coordinate 2d map with a growing map size
Sep
3
comment Building stable ecosystems
"Cybernetics", "Systems Theory", and "Control Theory" are probably the fields of study you're looking for. All fascinating! You might also find this interesting reading (and part 1 and part 3.