DaemonEngine / daemonmap

Deprecated navmesh compiler for the Unvanquished game
https://unvanquished.net
Other
3 stars 1 forks source link

properly increase cell height when needed #13

Closed illwieckz closed 1 year ago

illwieckz commented 2 years ago

Properly increase cell height when needed, also make sure cell height is not greater than step size.

I don't know what was doing the previous computation, but this one works.

Also the new code prevents crashing if an user passes from command line a cell height greater than step size.

This patch makes possible to generate navmeshes for this map:

slipher commented 2 years ago

Where does the rule cell height can't be greater than step size come from?

illwieckz commented 2 years ago

Where does the rule cell height can't be greater than step size come from?

From experience, you can yourself try to build some navmeshes with daemonmap before this patch, setting a step size smaller than cell height:

daemonmap -nav -stepsize 16 -cellheight 17 maps/anthill.bsp
0...1...2...3...4...5...6...7...8...9************ ERROR ************
Could not build heightfield layers

************ ERROR ************
Could not build heightfield layers

************ ERROR ************
Could not build heightfield layers

************ ERROR ************
Could not build heightfield layers

************ ERROR ************
Could not build heightfield layers

Segmentation fault

While keeping default step size (which is 18), you can increase cell height up to 18 (included) without crashing, and you'll notice it will crashing as soon as cell height is greater than 18 (for example, 18.1), in the same way, if you manually reduce step size from command line, daemonmap starts crashing as soon as you set a cell height greater than the step size you provided.

I have no knowledge about what is what, I just noticed by experience that step size must not be smaller than cell height.

Note: segfault probably comes from the fact the Error call in thread exits the thread and not the parent. I don't get the segfault if I limit to one thread by using -threads 1, it exists properly. That segfault instead of quitting nicely is another issue.

ghost commented 2 years ago

Those infos I found might help on the question:

From this link:

For the agent being too tall: this should not happen if walkableHeight is specified correctly. Try to make sure your actual agent height is a multiple of your cell height to ensure you don't lose precision here.

And from this one:

Does the max climb always need to be equal to or less than the agent height? ... It should be always less, preferrable around 0.5 agent height, but at least one cell height less than agent height.