Re: An opurtunity for work, for only some small code!

@26, apologies, I had not taken into account you meant the origin of [0, 0]. I understand now. And I think you understood my thing about orientation. Orientation is not needed to know the distance of something. However, in most sound libraries, they either place hard restrictions on orientation vectors (i.e. both must be perpendicular to each other) and error if that isn't the case, or they put those restrictions but cause "undefined behavior" when you fail to give them the right orientation. (I've never seen a sound library that does the second, but FMOD definitely does the first, and I think OpenAL does too.)
I do apologize  for the no/know thing, the phrasing was confusing.
@redfox, as I said in 25, start small: try creating mazes. That particular activity is energising because you can toy with the algorithms and create new, interesting things. Then once you've got a maze generator you like written in your game (and yes, write it yourself), add onto it. And build up from there. But start small. Here's a list of algorithms you might want to try:

  • Aldous Broder: Starting at an arbitrary location in the grid, move randomly from cell to cell. If moving to a previously unvisited cell, carve a passage to it. End when all cells have been visited. (This one is highly inefficient but is one of the more easier ones.)

  • Backtracking generator: Starting at an arbitrary location, perform a random walk, avoiding previously visited cells. When no more moves are possible, backtrack to the most recently visited cell and resume the random walk from there. The algorithm ends when it tries to backtrack from the cell where it started.

  • Binary tree: For each cell in the grid, randomly carve either north or east. (I would highly recommend you try this one first; it is by far the simplest and fastest algorithm.)

  • Recursive division: Begin with an open grid, with no internal walls. Add a wall that divides the grid in half, with a passage through it linking the two halves. Repeat on each side of the grid, recursively, until no open areas remain.

  • Ellers: Consider the grid one row at a time, sequentially. Assign the unvisited cells in the current row to different sets. Randomly link adjacent cells that belong to different sets, merging the sets together as you go. For each remaining set, choose at least one cell and carve south, adding that southern cell to the set as well. Repeat for every row in the grid. On the final row, link all adjacent cells that belong to different sets.

  • Growing tree: This algorithm is a generalization of the Prim's algorithms. Start by creating a set and adding an arbitrary cell to it. Then, choose a cell from the set. If the cell has no unvisited neighbors, remove it from the set; otherwise choose one of the unvisited neighbors and link the two together. Add the neighbor to the set. Repeat until the set is empty.

  • Hunt-and-kill: Starting at an arbitrary location, perform a random walk, avoiding previously visited cells. When no more moves are possible, scan the grid, looking for an unvisited cell next to a visited cell. If found, connect the two, and resume the random walk. The algorithm terminates when it cannot find any unvisited cells.

  • Kruskal: Begin by assigning each cell to a different set. Randomly link two adjacent cells, but only if they belong to different sets. Merge the sets of the two cells. Repeat until only a single set remains.

  • Prims (simplified): Initialize a set with an arbitrary cell. Randomly choose a cell from the set. If it has no unvisited neighbors, remove it from the set. Otherwise, choose one of the cell’s unvisited neighbors, link the two together, and add the neighbor to the set. Repeat until the set is empty.

  • Prims (true): First, assign every cell a random weight, and initialize a set with an arbitrary cell. Choose the cell with the greatest weight from the set. If it has no unvisited neighbors, remove it from the set. Otherwise, choose one of the cell’s unvisited neighbors, link the two together, and add the neighbor to the set. Repeat until the set is empty.

  • Sidewinder: Consider the grid one row at a time. For each row, link random runs of adjacent cells, and then carve north from a random cell in each run. Treat the northern row specially, linking all cells into a single corridor. (Another easy one.)

  • Wilsons: Choose an arbitrary cell and add it to the maze. Starting from any other cell, perform a loop-erased random walk until you encounter a cell belonging to the maze, and then add the resulting walk. Repeat until all cells have been added.

You can also make your own, if you are so inclined. Don't be bothered if ts slow, though -- that happens to everyone! I won't tell you how to create a grid; I'll leave that up to your creative and intelligent mind.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Lucas1853 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ironcross32 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : braille0109 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector

Reply via email to