Reputation
3,973
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
11 21
Newest
 Revival
Impact
~118k people reached

  • 0 posts edited
  • 0 helpful flags
  • 346 votes cast
Feb
6
answered Terracing mountain features
Feb
3
comment Finding cells within range on Hexagonal Grid
The new pic you posted shows 7 hexes highlighted. This is what you would expect with distance=1. Try printing out the values. With CellPosition set to 0,0 and distance 1, the hexes you get should be (-1, 0) ; (-1, 1) ; (0, -1) ; (0, 0) ; (0, 1) ; (1, -1) ; (1, 0)
Feb
3
comment How can I implement A* so that it accounts for the size of the actor?
Can you mark each edge with the maximum size of the actor, so that when A* gets a list of edges/neighbors, you only tell A* about the ones that are big enough for the actor?
Jan
30
comment Fast, simple procedural 2d island generation
I added a better demo that lets you adjust more parameters. You can either subtract a circular shape or multiply by a cone.
Jan
30
comment How to get more gentle (cloud like) noise?
I added an interactive demo. See the Octaves section of this page.
Jan
21
comment C++ A Star Algorithm [path takes wrong route] using <deque> & unique_ptr
@RNewell122 normally in A* the accumulated cost “g” does not look at the heuristic at all; only the “f” includes the heuristic. I have some A* code here that may be a useful reference. (My cost_so_far is your accumulated cost; my priority is your f value)
Jan
16
comment How should I efficiently store faction relationships?
Have you considered a graph data structure (nodes and edges)? You could add tags to the relationships by adding labels to edges.
Jan
12
comment C++ A Star Algorithm [path takes wrong route] using <deque> & unique_ptr
I agree with @KevinvanderVelden — verify the costs of the path either by stepping through with a debugger or printing them out at the end. Where do you actually check mIsWoods, mIsWater? (Also, astar_checklists seems like it'll make your A* slower than something like Dijkstra's Algorithm, but that's a separate issue)
Jan
9
revised How to generate mesh at runtime using raycast points?
add "unity" tag
Jan
4
comment Random numbers with a left or right biased skew
I have a few ideas here but you might also consider drawing the distribution you want, and using a nonparametric approach so that you can use arbitrarily shaped distributions.
Jan
1
comment What is a good way to procedurally generate large tilemaps?
(40x40) x (100x100) isn't a completely ridiculous number of tiles. At the minimum, using one byte per tile it's only 16MB. In addition to the question you're asking, you might also try to figure out how much space you're using per tile, and whether you can use a more efficient memory layout (e.g., can you fit everything into 1 byte per tile?).
Dec
31
comment Accurately simulating the lots of dice rolls without loops?
I agree with @DMGregory that 1000 d6 should be plenty fast. In C++, you can probably get a billion random numbers per second *. Even in a slow language like Python, you can get a million random numbers per second (python -m timeit -s 'from random import randint' 'randint(1,6)'). Is your goal optimization or understanding the math of probability distributions?
Dec
31
comment Accurately simulating the lots of dice rolls without loops?
@RichardTingle Can you elaborate? A distribution curve / histogram will also include the “million 6s in a row” case.
Dec
28
awarded  Revival
Dec
27
comment Pathfinding assistance
Although my examples use grids, my A* code on my page is written to use any graph, not only a grid.
Dec
27
answered Find Minion with shortest path
Dec
23
comment how to set in vector float x y coordinates
The page you point to is not using Vector but instead using Vector2.
Dec
12
comment How do I avoid floating point indeterminism when implementing lockstep?
You don't have to make your own math library; you can use an existing one like code.google.com/p/libfixmath
Dec
8
comment 2D A* Path-Finding
(1) In the simple case where there are no obstacles and your cost & heuristic match, F will have the same value for the entire path, which is what your latest diagram shows. (2) A* is picking one of the many paths where F=26. It doesn't "know" about straight lines or prettiness; it thinks all these paths are equally good. You can use a "tie breaker" hack or use “string pulling” to fix up the path afterwards or use a graph other than the map grid
Nov
21
comment Stored Textures in C++ Projects
PNG is an image file format with headers, compression, etc.; glTexImage2D needs image data (array of color values), not an image file like PNG. You'll need a PNG loading function that can take a PNG file format and convert it into an array of colors. The format/type parameters for glTexImage2D will be the format of that array.