3,193 reputation
717
bio website redblobgames.com
location California
age
visits member for 4 years
seen 1 hour 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).


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 suggested edit on 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.
Aug
10
answered A star pathfinding and discrete/smooth positions
Jul
21
comment Fast, simple procedural 2d island generation
You might be able to use fewer octaves. The lower octaves are smoother than the higher ones. Or you might post-process in some way, to smooth out the corners with some sort of blur algorithm. For example, set a block to water if its eight neighbors include at least 3 water (you might need to try different numbers). This might remove some of the rough borders.
Jul
20
answered Fast, simple procedural 2d island generation
Jul
12
comment Set value in an array[3], that the sum of all three values is always 1.0
That looks like it should work. A unit test for this function should include cases where rates before and after are 0.0 and 1.0.
Jul
12
comment Set value in an array[3], that the sum of all three values is always 1.0
Note that this solution can still fail, if 1.0 - rate[index] is 0.0. That will happen when 100% of the resource is assigned to one value, and you try to take away from it. I guess you'd have to handle this special case, probably by evenly distributing the remainder to the other values. If you treat 0 values as epsilon instead of 0.0 then it will work out, I think.
Jul
12
answered Set value in an array[3], that the sum of all three values is always 1.0