Author Topic: Are any of you familiar with certain rl sources?  (Read 7635 times)

Conal

  • Newcomer
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Are any of you familiar with certain rl sources?
« on: June 17, 2010, 01:32:45 AM »
HI again guys I am getting somewhere with my project all be it progress has slowed owing to pathfinding.

Anyway I got further because I cut out certain datastructures and opted for something that would help me understand.

However its not perfect and I am looking for source code to aid my learning which immplements a BFS for ai, I am preferably looking for a respectable rl but not one thats so well done its overly fancy using trees etc, or if it does use trees it only uses them in conjunction with nodes that are formed via a struct pointer.

Im looking for code that is as basic as possible, no added extras to the bfs but at the same time node creation and use is done in a simple manner, I like using basic arrays for an open and closed list or even a vector in c++ , I know there are lots of examples but I have yet to find one in the context of a full rl


I am not hopeful of getting my hands on really readable stuff pertaining to how I have done my rl map i.e in a 2d map array and then bfs with just 2 search arrays but I figured I would fire it out there :)

Thanks

corremn

  • Rogueliker
  • ***
  • Posts: 700
  • Karma: +0/-0
  • SewerJack Extraordinaire
    • View Profile
    • Demise RogueLike Games
Re: Are any of you familiar with certain rl sources?
« Reply #1 on: June 18, 2010, 12:25:44 AM »
I think a tree search algorithms is out of place in a RL game.

Other path-finding algorithms adapt easily to a grid based games, e.g Dijkstra's and A*, hence variants of these algorithms are used in RLs. And you will find a lot of examples of them in RLs and without.  I had A* up and running in a few hours (and I am not that clever).

Personally I use A* which is a best-first search algorithm, which, IMHO, would yield quicker results in most cases.
« Last Edit: June 18, 2010, 12:32:51 AM by corremn »
corremn's Roguelikes. To admit defeat is to blaspheme against the Emperor.  Warhammer 40000 the Roguelike

Gravecat

  • Newcomer
  • Posts: 12
  • Karma: +0/-0
  • Forget it, Donny, you're out of your element!
    • MSN Messenger - gravecat@gmail.com
    • AOL Instant Messenger - Gravecat666
    • View Profile
    • Gravecat: Blogging Like It's 1999
Re: Are any of you familiar with certain rl sources?
« Reply #2 on: July 04, 2010, 12:07:38 PM »
I second that opinion. At first I tried to write my own pathfinding algorithm, which was clunky and horrible, moved on to Dijkstra, and finally settled on A* as the best trade-off of speed and accuracy. It's really not as daunting or complicated as it first seems; I got A* working from scratch within an afternoon.

Here's a great tutorial that covers it from the ground up, and explains pretty much everything you'd need to know. It helped me a lot. :) http://www.policyalmanac.org/games/aStarTutorial.htm

Edit: Personally I used a single vector of structs (containing details like X,Y coords, parent node, etc.) for both the 'open' and 'closed' lists, and a bool within the struct to specify whether the tile is open or not. If you're good with vectors, then it's very easy to make it work. :)
« Last Edit: July 04, 2010, 12:09:27 PM by Gravecat »
My goals in life include world domination, buying a really cool hat, and travelling back in time in order to warn myself not to eat that potato salad.
SUDD: An all-new sci-fi/fantasy roguelike in the making!

ThackeG67

  • Newcomer
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Are any of you familiar with certain rl sources?
« Reply #3 on: July 30, 2010, 01:46:36 AM »
Thanks for sharing this! I learned so many things because of your post. Now I understand what to do to my project. Good job!