path grid recrod

Everything about development and the OpenMW source code.
corristo
Posts: 495
Joined: 12 Aug 2011, 08:29

path grid recrod

Post by corristo »

Ok, I've managed to load some PGRD records.
Here is some output.

Code: Select all

loading PGRD for Azura's Coast Region x=20 y=4
PGRP size is 240
Path grid points count is 15
0's point: 97 2627 1061
1's point: 384 2616 1029
2's point: 385 3071 1000
3's point: 693 2806 984
4's point: 1020 2725 964
5's point: 1016 2114 984
6's point: 385 2152 1049
7's point: 364 1695 1035
8's point: 434 1027 950
9's point: 968 1046 984
10's point: 987 1523 984
11's point: 224 694 874
12's point: 15 504 798
13's point: 1349 1535 939
14's point: 1667 2033 785
PGRC size is 128
Path grid edge count is 16
0's edge: 1 0
1's edge: 6 3
2's edge: 2 1
3's edge: 3 1
4's edge: 2 4
5's edge: 3 6
6's edge: 14 1
7's edge: 5 7
8's edge: 6 8
9's edge: 7 11
10's edge: 9 8
11's edge: 10 9
12's edge: 13 8
13's edge: 12 11
14's edge: 10 14
15's edge: 5 13

loading PGRD for Azura's Coast Region x=19 y=4
PGRP size is 560
Path grid points count is 35
0's point: 5478 2301 1181
1's point: 5165 2181 1116
2's point: 4863 2086 1046
3's point: 5944 2248 1159
4's point: 6150 2532 1082
5's point: 6398 2246 1080
6's point: 6596 2849 1057
7's point: 7044 3102 1099
8's point: 6863 3288 1055
9's point: 6615 3356 1027
10's point: 6918 3816 1016
11's point: 7730 3017 1140
12's point: 7888 2629 1140
13's point: 7947 2301 1247
14's point: 7818 1894 1278
15's point: 8060 1476 1042
16's point: 8089 1121 1042
17's point: 7755 809 1042
18's point: 6620 2253 1294
19's point: 7109 2251 1274
20's point: 6441 3823 1016
21's point: 5987 1869 1199
22's point: 6004 1464 1543
23's point: 5690 1076 1545
24's point: 5740 696 1545
25's point: 6093 831 1624
26's point: 6049 409 1545
27's point: 5549 1179 1542
28's point: 5375 1325 1441
29's point: 4953 1352 1441
30's point: 4552 2240 987
31's point: 4612 2719 913
32's point: 5211 2487 1162
33's point: 4907 2389 1085
34's point: 5266 1970 1159
PGRC size is 296
Path grid edge count is 37
0's edge: 3 1
1's edge: 32 0
2's edge: 2 33
3's edge: 32 34
4's edge: 1 30
5's edge: 33 34
6's edge: 0 5
7's edge: 4 21
8's edge: 3 6
9's edge: 3 18
10's edge: 4 7
11's edge: 6 8
12's edge: 11 7
13's edge: 9 10
14's edge: 8 8
15's edge: 20 7
16's edge: 12 11
17's edge: 13 12
18's edge: 14 13
19's edge: 16 15
20's edge: 17 16
21's edge: 5 19
22's edge: 18 10
23's edge: 3 22
24's edge: 21 23
25's edge: 22 24
26's edge: 27 23
27's edge: 25 26
28's edge: 24 24
29's edge: 23 28
30's edge: 27 29
31's edge: 28 2
32's edge: 31 30
33's edge: 0 1
34's edge: 33 1
35's edge: 2 32
36's edge: 1 2

loading PGRD for Sadrith Mora x=18 y=4
PGRP size is 1392
Path grid points count is 87
0's point: 0 6677 687
1's point: 218 6849 698
2's point: 106 7069 860
3's point: 369 6329 684
4's point: 0 5835 644
5's point: 915 6239 704
6's point: 1428 6262 769
7's point: 1662 6505 883
8's point: 1967 6798 976
9's point: 1823 7327 979
10's point: 1737 7708 1012
11's point: 1520 7939 1253
12's point: 1348 7558 1129
13's point: 1072 7450 1115
14's point: 1049 7229 1286
15's point: 2303 7497 967
16's point: 2484 6898 895
17's point: 2915 6944 822
18's point: 3105 7282 837
19's point: 3306 7381 1051
20's point: 2424 6214 1011
21's point: 2385 5669 1123
22's point: 1859 5244 1176
23's point: 1317 5220 1231
24's point: 818 5158 1211
25's point: 529 4807 1261
26's point: 0 4288 1241
27's point: 0 3574 1256
28's point: 0 2942 1256
29's point: 516 3325 1240
30's point: 1169 3333 1457
31's point: 3191 6519 728
32's point: 3781 6141 573
33's point: 4272 5791 640
34's point: 4635 5680 750
35's point: 4713 5562 821
36's point: 4542 5450 1014
37's point: 4949 5208 900
38's point: 4914 6017 813
39's point: 4709 6016 875
40's point: 4618 5856 952
41's point: 4714 5671 1046
42's point: 4895 5690 1129
43's point: 4993 5826 1210
44's point: 4944 5965 1278
45's point: 5209 5487 893
46's point: 5228 4652 992
47's point: 4965 4793 955
48's point: 5462 4470 1208
49's point: 5037 4256 875
50's point: 5221 5039 945
51's point: 5519 4909 1132
52's point: 5786 5141 1234
53's point: 5958 5292 1473
54's point: 5063 3575 723
55's point: 5439 3066 721
56's point: 6000 2704 870
57's point: 5492 2308 740
58's point: 4990 1570 890
59's point: 4609 976 900
60's point: 4469 475 782
61's point: 4802 0 914
62's point: 4121 0 811
63's point: 2392 641 964
64's point: 2256 789 1112
65's point: 2595 356 934
66's point: 2759 0 891
67's point: 6 720 389
68's point: 109 1051 511
69's point: 236 1250 730
70's point: 495 630 419
71's point: 710 7 409
72's point: 0 0 389
73's point: 1770 3721 3388
74's point: 1751 2961 3388
75's point: 1580 3487 3388
76's point: 1585 3142 3388
77's point: 1835 3157 3388
78's point: 1835 3486 3388
79's point: 1210 3384 777
80's point: 1202 2999 758
81's point: 1911 2920 725
82's point: 1886 3407 713
83's point: 1428 3350 984
84's point: 2225 3101 731
85's point: 4859 5455 844
86's point: 4958 5774 817
PGRC size is 896
Path grid edge count is 112
0's edge: 1 3
1's edge: 0 2
2's edge: 3 1
3's edge: 0 1
4's edge: 4 5
5's edge: 3 3
6's edge: 6 5
7's edge: 7 6
8's edge: 8 7
9's edge: 9 15
10's edge: 16 20
11's edge: 8 10
12's edge: 12 15
13's edge: 16 9
14's edge: 11 15
15's edge: 12 10
16's edge: 9 10
17's edge: 13 12
18's edge: 14 13
19's edge: 8 9
20's edge: 10 16
21's edge: 8 9
22's edge: 15 17
23's edge: 20 16
24's edge: 18 20
25's edge: 31 17
26's edge: 19 18
27's edge: 8 16
28's edge: 17 21
29's edge: 20 22
30's edge: 21 23
31's edge: 22 24
32's edge: 23 25
33's edge: 24 26
34's edge: 25 27
35's edge: 26 28
36's edge: 29 27
37's edge: 29 27
38's edge: 28 30
39's edge: 29 17
40's edge: 32 31
41's edge: 33 32
42's edge: 34 33
43's edge: 35 34
44's edge: 36 45
45's edge: 85 86
46's edge: 35 45
47's edge: 47 50
48's edge: 85 39
49's edge: 45 86
50's edge: 38 40
51's edge: 39 41
52's edge: 40 42
53's edge: 41 43
54's edge: 42 44
55's edge: 43 35
56's edge: 37 38
57's edge: 50 86
58's edge: 47 48
59's edge: 49 50
60's edge: 51 37
61's edge: 46 49
62's edge: 50 46
63's edge: 46 47
64's edge: 54 37
65's edge: 45 46
66's edge: 47 51
67's edge: 46 50
68's edge: 52 51
69's edge: 53 52
70's edge: 49 55
71's edge: 54 56
72's edge: 57 55
73's edge: 57 55
74's edge: 56 58
75's edge: 57 59
76's edge: 58 60
77's edge: 59 61
78's edge: 62 60
79's edge: 62 60
80's edge: 61 64
81's edge: 65 63
82's edge: 63 66
83's edge: 65 68
84's edge: 70 72
85's edge: 71 67
86's edge: 69 70
87's edge: 68 67
88's edge: 68 71
89's edge: 72 67
90's edge: 70 72
91's edge: 67 70
92's edge: 71 75
93's edge: 78 76
94's edge: 77 73
95's edge: 76 77
96's edge: 78 74
97's edge: 75 77
98's edge: 78 74
99's edge: 75 76
100's edge: 73 75
101's edge: 76 80
102's edge: 83 79
103's edge: 81 82
104's edge: 80 82
105's edge: 84 80
106's edge: 81 84
107's edge: 79 81
108's edge: 82 35
109's edge: 37 86
110's edge: 35 38
111's edge: 45 85
Looks like that path grid point coords given in local cell coordinate system (i.e. x & z from 0 to 8192 for exterior cells). Coords definitely not floats, tried read them as floats, they're all near 0 or NaN

I can try to add special console command which would trigger path grid rendering in-game. I think we should do it anyway, it may be useful when implementing pathfinding.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: path grid recrod

Post by Zini »

See here and here (TPG, TogglePathGrid).

The implementation should go into apps/openmw/mwrender/debugging.*. See the original MW game for how it should look.
Last edited by Zini on 06 Mar 2012, 13:25, edited 1 time in total.
corristo
Posts: 495
Joined: 12 Aug 2011, 08:29

Re: path grid recrod

Post by corristo »

thanks, got it
corristo
Posts: 495
Joined: 12 Aug 2011, 08:29

Re: path grid recrod

Post by corristo »

How opcodes for commands are selected in miscextensions.cpp? Are they from original game?

Also, I should add code for add/remove path grid meshes to MWRender::Debugging? Now here is only toggling of collision debug, wireframe mode toggled in RenderingManager.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: path grid recrod

Post by Zini »

Also, I should add code for add/remove path grid meshes to MWRender::Debugging? Now here is only toggling of collision debug, wireframe mode toggled in RenderingManager.
Yes, please. All the debugging stuff (only used while developing content) should go into Debugging.
How opcodes for commands are selected in miscextensions.cpp? Are they from original game?
Nope. We use a different virtual machine than vanilla MW. Just pick the next unused opcode. They are listed in apps/openmw/mwscript/docs/vmformat.txt. Make sure to pick the right segment (see other toggle type instructions for examples).
corristo
Posts: 495
Joined: 12 Aug 2011, 08:29

Re: path grid recrod

Post by corristo »

okay, I need some way to detect cell changes in Debugging & access to RenderingManager instance from Debugging.
Second is easy, any ideas about first?

UPD: nevermind, found RenderingManager::cellAdded & removeCell methods
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: path grid recrod

Post by jhooks1 »

Unfamiliar with path grids; They are used for AI correct?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: path grid recrod

Post by Zini »

NPC/Creature pathfinding
corristo
Posts: 495
Joined: 12 Aug 2011, 08:29

Re: path grid recrod

Post by corristo »

Looks like we need dedicated struct for storing path grids in ESMStore, like CellList for Cells, because we need separate lookup methods for interior/exterior cell's path grid.

But there is a problem: we can't be sure if path grid is for exterior or interior cell without looking into CellList. Pathgrid contains only name & (x,y) coords for cell, but no info about interior/exterior.

There is 1:1 relation between Cell & Pathgrid, right?

UPD:
We can use one lookup method for PathgridList with following internal data structure:
map<string, Pathgrid *> for path grids with x=0, y=0 — all interior + 1 exterior cell
map<pair<int,int>, Pathgrid *> for other path grids.
But if one interior cell would have same name with exterior (x=0, y=0) it would break :(
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: path grid recrod

Post by Zini »

Pathgrid contains only name & (x,y) coords for cell, but no info about interior/exterior.
Can you check if the (x, y) coordinates for all interior cells are (0, 0)? If that is the case we could address pathgrids via a combined (x, y, name) structure, making the path grid container totally agnostic about the interior/exterior distinction.
There is 1:1 relation between Cell & Pathgrid, right?
I think there can be cells without a pathgrid, but no pathgrid without a cell.


I see in your implementation that you are deferring the actual loading of the path grid data like it is done for the cells. This doesn't match our overall data structure concept. But if the volume of pathgrid data is comparable to the cell ref data, than that is obviously what we need to do.
Post Reply