Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flowfield pathing #1620

Open
wants to merge 112 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
0b3a0e6
path: Initial cost field implementation.
heinezen Jan 27, 2024
c4b1094
path: Define common cost values.
heinezen Feb 4, 2024
dea91a7
path: Initial integration field implementation.
heinezen Feb 4, 2024
7d14a6a
path: Flow field value types.
heinezen Feb 9, 2024
c1b6890
path: Flow field computation.
heinezen Feb 9, 2024
a58b631
path: Integrator implementation.
heinezen Feb 9, 2024
5d97ce8
path: Rename old A* cost type to avoid conflicts.
heinezen Feb 9, 2024
7ddd25d
path: Test flow field calculations.
heinezen Feb 9, 2024
a112009
path: Test individual field types.
heinezen Feb 10, 2024
a1449a4
path: Add demo skeleton for flowfield pathfinder.
heinezen Feb 10, 2024
fc2e9b6
path: Render background in flow field demo.
heinezen Feb 10, 2024
e17d052
path: Convert indent in multi-line comments to tabs.
heinezen Feb 13, 2024
8f0242a
path: Draw cost field in demo.
heinezen Feb 13, 2024
51f09ae
path: Move camera in dem so that whole grid is visible.
heinezen Feb 13, 2024
a6840b4
path: Draw grid lines on top of field.
heinezen Feb 15, 2024
29e49ff
renderer: Fix unindexed mesh being drawn with wrong primitive.
heinezen Feb 15, 2024
02e666b
path: Show cost as tile colours on grid.
heinezen Feb 15, 2024
3cb4983
path: Draw integration field in demo.
heinezen Feb 16, 2024
2dfde71
path: Fix method argument name.
heinezen Feb 17, 2024
c885c6e
path: Fix integration update overflow.
heinezen Feb 18, 2024
520c9cf
patg: Get individual flow field cell values.
heinezen Feb 18, 2024
01bff57
path: Draw flow field in demo.
heinezen Feb 18, 2024
791fa60
path: Change field that is rendered with F1-F4 keys.
heinezen Feb 23, 2024
d24bc06
path: Reset flow field values on build.
heinezen Feb 24, 2024
0b0774e
path: Change goal with right mouse button.
heinezen Feb 24, 2024
89b210d
path: Create RenderManager in demo for all graphics code.
heinezen Feb 24, 2024
53bee9d
path: Remove old renderer code from demo.
heinezen Feb 25, 2024
e3005a8
path: Toggle vsibility of steering vectors.
heinezen Feb 25, 2024
94a423e
path: Change flow field tile colors depending on flags.
heinezen Feb 25, 2024
ea1a01d
path: Update rendering when switching targets.
heinezen Feb 25, 2024
164ed60
path: Fix wavefront algorithm.
heinezen Feb 25, 2024
2800ac8
path: Turn off OpenGL debugging for demo.
heinezen Feb 25, 2024
1746590
path: Add helpful log messages to demo.
heinezen Feb 25, 2024
88fd1f1
path: Add log messages for field types.
heinezen Feb 25, 2024
23d8298
path: Add constant for initial flow field cell value.
heinezen Feb 25, 2024
67d6067
path: Add flags to integration field cell type.
heinezen Feb 25, 2024
824fcca
path: Check for line of sight flag when building flow field.
heinezen Feb 25, 2024
35533ce
path: LOS pass in integration field.
heinezen Mar 2, 2024
a42fc33
path: Manual resetting of integration/flow field.
heinezen Mar 2, 2024
ce0210b
path: Handle LOS corners.
heinezen Mar 4, 2024
1ee2baa
path: Add another impassible cell to demo.
heinezen Mar 4, 2024
a36931f
path: Integrate cost withexisting wavefront.
heinezen Mar 7, 2024
1cfac16
path: Use wavefront blocked cells as start for cost integration in demo.
heinezen Mar 8, 2024
f9e4007
path: Fix initial wavefront hit not being considered for cost.
heinezen Mar 9, 2024
3b63113
path: Fix cost calculation for wavefront blocked cells.
heinezen Mar 9, 2024
88f42e5
path: Increase precision of wavefront blocked lines.
heinezen Mar 10, 2024
e3e420d
path: Document our bresenham's line algorithm implementation.
heinezen Mar 10, 2024
897bfe1
path: Add LOS pass to integrator.
heinezen Mar 10, 2024
b693ea1
path: Grid for multiple fields.
heinezen Mar 17, 2024
4278de9
path: Portals between fields.
heinezen Mar 17, 2024
a92b93d
path: Separate grid into sectors.
heinezen Mar 17, 2024
1f48794
path: Move old path implementation to 'legacy' folder.
heinezen Mar 17, 2024
d7424b3
path: Pathfinder object.
heinezen Mar 17, 2024
b46c9fa
path: Path request class.
heinezen Mar 17, 2024
2f58987
path: Do not render vectors for LOS cells in demo.
heinezen Mar 23, 2024
4170ff1
path: Assign IDs to grids and portals.
heinezen Mar 23, 2024
73d8062
path: Port flowfield pathfinder to coordinate system.
heinezen Mar 23, 2024
ca05032
path: Store grid size in vector.
heinezen Mar 23, 2024
f943d86
path: Demo for pathfinding grid.
heinezen Mar 23, 2024
b3b620b
path: Fix portals not being created if they end in a corner.
heinezen Mar 23, 2024
b382abb
path: Connect portals between sectors.
heinezen Mar 24, 2024
9a1cc15
path: Refactor demo 1 code for readability.
heinezen Mar 24, 2024
2dd0c3a
fix copyright years
heinezen Mar 24, 2024
bf6136b
path: Get sector size of grid.
heinezen Mar 25, 2024
87bf805
path: Append demo ID to RenderManager class name.
heinezen Mar 25, 2024
8ab759d
path: Draw grid in demo 1.
heinezen Mar 25, 2024
9d90004
path: Render grid in demo 1.
heinezen Mar 27, 2024
ca2de69
path: Daw portal tiles on grid.
heinezen Mar 27, 2024
ea9f143
path: Remove last tile check in portal search.
heinezen Mar 29, 2024
3993d41
path: Use matching types in flood fill algorithm.
heinezen Mar 29, 2024
d0f88dc
path: Store sector position relative to grid origin
heinezen Mar 30, 2024
bc9279a
path: Port A* algorithm code to grid portals.
heinezen Mar 30, 2024
42393b8
path: Fix node cost comparison on heap.
heinezen Mar 31, 2024
16710e9
path: Calculate example path in demo.
heinezen Mar 31, 2024
de9dc91
path: Remove unnecessary parameter.
heinezen Mar 31, 2024
46a544f
path: Remove cost field storage from integrator.
heinezen Apr 1, 2024
4814659
path: Use legacy namespace for old code.
heinezen Apr 1, 2024
ba505e9
path: Integrate cost via portal.
heinezen Apr 2, 2024
e701d8c
path: More fine-grained control in integrator.
heinezen Apr 2, 2024
1466aa1
path: Build flow field via portal. (partial)
heinezen Apr 3, 2024
b74d19c
etc: Pretty printers for path::flow_t and path::integrated_flags_t.
heinezen Apr 7, 2024
555d199
patg: Rename integrate_t to integrated_t.
heinezen Apr 7, 2024
6e19321
etc: Pretty printer for path::integrated_t.
heinezen Apr 7, 2024
5c708eb
path: Don't use other integration field.
heinezen Apr 8, 2024
9b4e7fb
etc: Fix pathfinding pretty printers flag lookups.
heinezen Apr 8, 2024
479e647
path: Exit high-level pathfinding early if start and target are in sa…
heinezen Apr 8, 2024
ae2785d
path: Correctly set starting cost for portal target.
heinezen Apr 9, 2024
d93380a
path: Build flow field via portal.
heinezen Apr 9, 2024
f791358
path: Exclude target cells from search in flow field.
heinezen Apr 12, 2024
bbb5ab3
path: Traverse flow field to find waypoints.
heinezen Apr 12, 2024
8fff701
path: Show waypoints in demo 1.
heinezen Apr 12, 2024
6f568b1
path: Include path start in waypoints.
heinezen Apr 12, 2024
07de19b
path: Draw start and end of path with separate colors.
heinezen Apr 12, 2024
17b53aa
path: Make some of the variable types in the demo more obvious.
heinezen Apr 12, 2024
1d384a6
path: Fix warnings about type conversions.
heinezen Apr 12, 2024
ed5d6c8
path: Initialize portals in Grid object.
heinezen Apr 12, 2024
9cc8710
path: Move flow_dir_t to types.h.
heinezen Apr 12, 2024
1f882f0
path: Document pathfinding functions.
heinezen Apr 13, 2024
78657a3
path: Add timer for path request to demo 1.
heinezen Apr 13, 2024
9ff5802
path: Add TODOs.
heinezen Apr 13, 2024
e947022
path: Fix an issue with gcc not default initializing correctly in rel…
heinezen Apr 13, 2024
066dd06
doc: Pathfinding documentaton text.
heinezen Apr 13, 2024
f9f9ae1
docs: Pathfinding documentation diagrams.
heinezen May 6, 2024
5079768
path: Set start/target in demo with mouse callbacks.
heinezen May 6, 2024
405e2dd
path: Draw waypoints in separate render pass.
heinezen May 6, 2024
e0b63a2
path: Fix check for flow field count.
heinezen May 6, 2024
8b1d427
path: Use distance between portal centers for A star distance cost.
heinezen May 6, 2024
9ebe429
path: Fix setting start/target position.
heinezen May 6, 2024
c6b7b28
path: Use window_settings type to set window size,
heinezen May 6, 2024
9a5ac8d
path: Avoid narrowing conversion to coord types.
heinezen May 6, 2024
cfebd22
path: Reset timer when path is recalculated.
heinezen May 7, 2024
12cd944
path: Fix includes after rebase.
heinezen May 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/test/shaders/pathfinding/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install(DIRECTORY "."
DESTINATION "${ASSET_DIR}/test/shaders/pathfinding"
FILES_MATCHING PATTERN "*.glsl"
)
17 changes: 17 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_cost_field.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 330

in float v_cost;

out vec4 out_col;

void main()
{
if (v_cost == 255.0) {
out_col = vec4(0.0, 0.0, 0.0, 1.0);
return;
}
float cost = (v_cost / 256) * 2.0;
float red = clamp(cost, 0.0, 1.0);
float green = clamp(2.0 - cost, 0.0, 1.0);
out_col = vec4(red, green, 0.0, 1.0);
}
15 changes: 15 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_cost_field.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 330

layout (location = 0) in vec3 position;
layout (location = 1) in float cost;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

out float v_cost;

void main() {
gl_Position = proj * view * model * vec4(position, 1.0);
v_cost = cost;
}
10 changes: 10 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_display.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

uniform sampler2D color_texture;

in vec2 v_uv;
out vec4 col;

void main() {
col = texture(color_texture, v_uv);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_display.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;
out vec2 v_uv;

void main() {
gl_Position = vec4(position, 0.0, 1.0);
v_uv = uv;
}
29 changes: 29 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_flow_field.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#version 330

in float v_cost;

out vec4 outcol;

void main() {
int cost = int(v_cost);
if (bool(cost & 0x40)) {
// wavefront blocked
outcol = vec4(0.9, 0.9, 0.9, 1.0);
return;
}

if (bool(cost & 0x20)) {
// line of sight
outcol = vec4(1.0, 1.0, 1.0, 1.0);
return;
}

if (bool(cost & 0x10)) {
// pathable
outcol = vec4(0.7, 0.7, 0.7, 1.0);
return;
}

// not pathable
outcol = vec4(0.0, 0.0, 0.0, 1.0);
}
15 changes: 15 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_flow_field.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 330

layout(location=0) in vec3 position;
layout(location=1) in float cost;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

out float v_cost;

void main() {
gl_Position = proj * view * model * vec4(position, 1.0);
v_cost = cost;
}
8 changes: 8 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_grid.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#version 330

out vec4 out_col;

void main()
{
out_col = vec4(0.0, 0.0, 0.0, 0.3);
}
11 changes: 11 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_grid.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 330

layout (location = 0) in vec3 position;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

void main() {
gl_Position = proj * view * model * vec4(position, 1.0);
}
16 changes: 16 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_integration_field.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#version 330

in float v_cost;

out vec4 out_col;

void main()
{
if (v_cost > 512.0) {
out_col = vec4(0.0, 0.0, 0.0, 1.0);
return;
}
float cost = 0.05 * v_cost;
float green = clamp(1.0 - cost, 0.0, 1.0);
out_col = vec4(0.75, green, 0.5, 1.0);
}
15 changes: 15 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_integration_field.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 330

layout (location = 0) in vec3 position;
layout (location = 1) in float cost;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

out float v_cost;

void main() {
gl_Position = proj * view * model * vec4(position, 1.0);
v_cost = cost;
}
9 changes: 9 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_obj.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 330

uniform vec4 color;

out vec4 outcol;

void main() {
outcol = color;
}
7 changes: 7 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_obj.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#version 330

layout(location=0) in vec2 position;

void main() {
gl_Position = vec4(position, 0.0, 1.0);
}
9 changes: 9 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_vector.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 330

uniform vec4 color;

out vec4 outcol;

void main() {
outcol = color;
}
11 changes: 11 additions & 0 deletions assets/test/shaders/pathfinding/demo_0_vector.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 330

layout(location=0) in vec3 position;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

void main() {
gl_Position = proj * view * model * vec4(position, 1.0);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/pathfinding/demo_1_display.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

uniform sampler2D color_texture;

in vec2 v_uv;
out vec4 col;

void main() {
col = texture(color_texture, v_uv);
}
10 changes: 10 additions & 0 deletions assets/test/shaders/pathfinding/demo_1_display.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 330

layout(location=0) in vec2 position;
layout(location=1) in vec2 uv;
out vec2 v_uv;

void main() {
gl_Position = vec4(position, 0.0, 1.0);
v_uv = uv;
}
8 changes: 8 additions & 0 deletions assets/test/shaders/pathfinding/demo_1_grid.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#version 330

out vec4 out_col;

void main()
{
out_col = vec4(0.0, 0.0, 0.0, 0.3);
}
11 changes: 11 additions & 0 deletions assets/test/shaders/pathfinding/demo_1_grid.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 330

layout (location = 0) in vec2 position;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

void main() {
gl_Position = proj * view * model * vec4(position, 0.0, 1.0);
}
9 changes: 9 additions & 0 deletions assets/test/shaders/pathfinding/demo_1_obj.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 330

uniform vec4 color;

out vec4 outcol;

void main() {
outcol = color;
}
11 changes: 11 additions & 0 deletions assets/test/shaders/pathfinding/demo_1_obj.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 330

layout(location=0) in vec2 position;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

void main() {
gl_Position = proj * view * model * vec4(position, 0.0, 1.0);
}
Loading
Loading