|
| 1 | +# path_finder |
| 2 | +**:star2: A-star Path-finding application :star2:** |
| 3 | + |
| 4 | +[[_TOC_]] |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +# Controls |
| 9 | + |
| 10 | +Not much to know : |
| 11 | +- **Right-click** to add non-walkable cells. |
| 12 | +- **Left-click** to add a starting/ending point. |
| 13 | +- **Enter** to run the algorithm. |
| 14 | + |
| 15 | +# Configuration options |
| 16 | + |
| 17 | +*path_finder* is configured using a single JSON file. |
| 18 | + |
| 19 | +An example is provided in **conf/default.json** |
| 20 | + |
| 21 | +``` |
| 22 | +{ |
| 23 | + "bindings": { |
| 24 | + "clear": "Space", |
| 25 | + "analyze": "Enter", |
| 26 | + "exit": "Escape", |
| 27 | + "reload": "F5" |
| 28 | + }, |
| 29 | + "graphics": { |
| 30 | + "width": 750, |
| 31 | + "height": 750, |
| 32 | + "frame-rate": 60 |
| 33 | + }, |
| 34 | + "grid": { |
| 35 | + "rows": 25, |
| 36 | + "cols": 25 |
| 37 | + }, |
| 38 | + "analyzer": { |
| 39 | + "heuristic": "manhattan", |
| 40 | + "allow-diagonals": false |
| 41 | + } |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +## Bindings |
| 46 | + |
| 47 | +Bind actions to specific keys. |
| 48 | + |
| 49 | +| name | description | default value |
| 50 | +| ------ | ------ | ------ | |
| 51 | +| **clear** | Clear the grid (remove drawn cells) | **Space** | |
| 52 | +| **analyze** | Perform an analyze (run A-star algorithm) | **Enter** | |
| 53 | +| **exit** | Exit the program | **Escape** | |
| 54 | +| **reload** | Reload the programm (apply configuration file changes) | **F5** | |
| 55 | + |
| 56 | +## Graphics |
| 57 | + |
| 58 | +Specify display window settings. |
| 59 | + |
| 60 | +| name | description | default value |
| 61 | +| ------ | ------ | ------ | |
| 62 | +| **width** | Window width in pixels | **750** | |
| 63 | +| **height** | Window height in pixels | **750** | |
| 64 | +| **framerate** | Do not allow more than x frames/s. | **60** | |
| 65 | + |
| 66 | +## Grid |
| 67 | + |
| 68 | +Specify grid settings. |
| 69 | + |
| 70 | +| name | description | default value |
| 71 | +| ------ | ------ | ------ | |
| 72 | +| **rows** | Number of rows | **25** | |
| 73 | +| **cols** | Window columns | **25** | |
| 74 | + |
| 75 | +## Analyzer |
| 76 | + |
| 77 | +Specify algorithm settings. |
| 78 | + |
| 79 | +- **heuristic** |
| 80 | + - "manhattan" |
| 81 | + - "euclidean" |
| 82 | + - "octogonal" |
| 83 | + |
| 84 | +- **allow-diagonals** : Allow to move diagonally. |
| 85 | + |
| 86 | +# Compile and install |
| 87 | + |
| 88 | +## Dependencies |
| 89 | + |
| 90 | +*path_finder* has a build-time dependency on [**SFML**](https://www.sfml-dev.org/index-fr.php). |
| 91 | + |
| 92 | +Please refer to its [Documentation](https://www.sfml-dev.org/download/sfml/2.5.1/index-fr.php) for more informations. |
| 93 | + |
| 94 | +*path_finder* also has a build-time dependency on [**miniJSON**](../minijson) on the form of a submodule. The submodule is automatically updated within the CMake of the project. |
| 95 | + |
| 96 | +## Build steps |
| 97 | + |
| 98 | +Baically, here are the steps you might wanna do (debian example) to compile the project : |
| 99 | + |
| 100 | +1. Clone the project |
| 101 | + |
| 102 | +``` |
| 103 | +cd ~/git |
| 104 | +git clone https://github.com/MericLuc/sfml_path_finder.git |
| 105 | +``` |
| 106 | + |
| 107 | +2. Create a build folder |
| 108 | + |
| 109 | +``` |
| 110 | +mkdir ~/build && cd ~/build |
| 111 | +``` |
| 112 | + |
| 113 | +3. Build the project |
| 114 | + |
| 115 | +``` |
| 116 | +cmake -S ~/git/path_finder . |
| 117 | +make |
| 118 | +``` |
| 119 | + |
| 120 | +4. Run |
| 121 | + |
| 122 | +``` |
| 123 | +~/build/path_finder -i ~/git/path_finder/conf/default.json |
| 124 | +``` |
| 125 | + |
| 126 | +## Install |
| 127 | + |
| 128 | +*path_finder* provide an **install** target. |
| 129 | + |
| 130 | +``` |
| 131 | +cmake -S ~/git/path_finder -DCMAKE_PREFIX_INSTALL="/your/install/folder" |
| 132 | +make install |
| 133 | +``` |
| 134 | + |
| 135 | +It will install the following files : |
| 136 | + |
| 137 | +``` |
| 138 | +${CMAKE_INSTALL_PREFIX}/path_finder |
| 139 | + path_finder |
| 140 | + default.json |
| 141 | +``` |
0 commit comments