3,553 reputation
820
bio website redblobgames.com
location California
age
visits member for 4 years, 8 months
seen 18 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).


May
18
comment Line of sight on a 2d grid
BTW, use length = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)) to match the interpolation code I posted. I believe it will not generate any duplicates, and then you don't need lastX and lastY.
May
17
answered Line of sight on a 2d grid
May
16
comment Dynamic thruster balancing of space ship
I went down a similar path and ended up writing a demo on this page. As you move the thrusters around (drag them on the ship to set position and power) it draws three shapes. The intuition is that you can think of all possible movements as a point in 3d space (x, y, rotation), and being limited to 0-1 is a constraint in that space. So you end up with a 3d shape containing all possible movements. If you want no linear velocity you're looking at the (x=0,y=0) line in that space (Q,W,E,S all 0 in my demo)
May
14
comment How can I Intercept object with a circular motion
Idea: Consider what the intercept looks like in space-time. The spaceship's trajectory is a line in (x,y,t) space, and it has a minimum slope (relative to t). The planet's trajectory is a helix. Among all lines that meet that helix and exceed the min slope, which one intercepts at the lowest t? Might be messy this way :(
Apr
21
comment Can I prevent diagonal movement from exploring more of the map?
Would a circular shape help here?
Apr
14
answered Generate a 2D distance grid in one pass
Mar
27
comment How to make character gain acceleration?
The simplest thing to do is probably to use interpolating functions such as the ones shown on easings.net (they don't have implementation code though)
Mar
10
answered Java Scrolling 2d Block game - Optimise my code?
Mar
3
answered Modify random distribution functions :: Make it less likely to get multiple similar values in a sequence
Feb
15
awarded  Nice Answer
Feb
10
comment 2D to 3D perlin noise, I'm not sure I get it
The sides of your blocks aren't tall enough to draw the difference between adjacent heights; if you drew taller sprites, I think it would cover the gaps.
Jan
29
awarded  Nice Answer
Jan
25
comment How to implement uniform grids
Take a look at gameprogrammingpatterns.com/spatial-partition.html
Jan
25
comment How can I incorporate the path of a jump into my A* implementation?
@eBusiness: with Dijkstra you have a variable cost, not 1 at every step, and you have to order the queue just like A*. I think you're thinking of Breadth First Search.
Jan
24
comment How can I incorporate the path of a jump into my A* implementation?
Scoreboard? Search tree? Collisions? Can you give more details about what you mean by these, and how it's different from Dijkstra's algorithm?
Jan
19
comment How do I make a natural-looking map from some Voronoi regions?
The borders you're looking at often are based on water or mountains. Noisy edges look more natural than straight edges, so add some sort of noise. Arthur's answer uses waves; I used 1D midpoint displacement for my polygon maps; check out this article with its demo. Either works. If you add a lot of noise, the borders might cross; see the Noisy Edges section of my article for how to add constraints to help prevent that.
Jan
17
comment 2D lighting causes black rings to appear
My wild guess would be that you need to use a different blend mode (maybe with premultiplied alpha) for drawing the textures. But this is just a really wild guess.
Dec
9
comment Randomly generating the hallways between a network of rooms
This site has in-browser demos of various maze generation algorithms. However, these mazes don't have “loops” in them.
Dec
7
awarded  Nice Answer
Dec
6
revised Why can't my A* implementation find a path out of an open room?
frontier is another name for the fringe