8,452
edits
Paradox-01 (talk | contribs) mNo edit summary |
Paradox-01 (talk | contribs) m (updating the PF section again) |
||
Line 558: | Line 558: | ||
====<Rooms>==== | ====<Rooms>==== | ||
The | The Rooms tag is mandatory. It contains an import path to BNV and ghosts (*.dae) which are used to create pathfinding grids. For information on binary data see [[OBD:AKVA|HERE]]. | ||
Exemplary code piece of the master xml file: | Exemplary code piece of the master xml file: | ||
<Import Path="env/lab_bnv.dae"/> | <Import Path="env/lab_bnv.dae"/> | ||
'''Fundamentals''' | |||
* '''BNV''' are '''volumes''' (sometimes also named '''rooms''') that have a pathfinding grid assigned to them. | |||
* '' | * For practical reasons you only need '''floors and ramps''' to build BNV. (Like seen in [http://edt.oni2.net/images/Hideout_BNV.jpg HERE.]) | ||
* | ** A BNV polygon can consist of 3 or more points but it's recommended to use '''shapes with 4 points''' because the other shapes usually waste more grid space. At the moment you can import only '''[[wikipedia:Convex|convex]]''' shapes. | ||
* Secondly there are so called '''ghosts''' (vertical quads) that connect '''neighbouring BNV'''. AI can transit BNV only through ghosts. | |||
* | : OniSplit gives error messages for ghosts that don't have 2 neighbouring BNV, for example: | ||
BNV Builder: Ghost 'grid2' has no '''adjacencies''' at <-72,41 1,999 -166,6> and <-71 1,999 -168,21>, ignoring | |||
'''Tolerance values''' | |||
* horizontal distance from ''room'' to ''ghost'': 1 | * horizontal distance from ''room'' to ''ghost'': 1 | ||
* vertical distance from ''room'' to ''ghost'': 18 | * vertical distance from ''room'' to ''ghost'': 18 | ||
Line 586: | Line 579: | ||
* under optimal circumstances pathfinding works on a plane that is +4 world units above or -0,5 beneath the pathfinding grid | * under optimal circumstances pathfinding works on a plane that is +4 world units above or -0,5 beneath the pathfinding grid | ||
* normally characters can't pass low verticals like at staircases/curbs if those don't have a ramp, near ground level Y=0 is an exception where characters are allowed to step on a plane that is 4 world units above pathfinding grid; higher planes need a ramp | * normally characters can't pass low verticals like at staircases/curbs if those don't have a ramp, near ground level Y=0 is an exception where characters are allowed to step on a plane that is 4 world units above pathfinding grid; higher planes need a ramp | ||
* max degree of ramp you can go on is 70°; bigger degrees make characters | * max degree of ramp you can go on is 70°; bigger degrees make characters fall through to death | ||
'''More notes on PF processing''' | |||
* Actually, BNV and ghosts can have any name and don't need any texture. | |||
* During pathfinding calculation OniSplit creates a new folder called "temp" and a subfolder "grids". There again is a file "''levelname''_grids.dae". That file contains ''rooms'' with textures "bnv_grid_''N''.tga" marking obstacles in the pathfinding. ''Ghosts'' will have a transparent texture "'''_marker_ghost'''.tga". You get those things also when you export a level. Transparent ''ghosts'' make it easier to see the rest of your level if you have many of those planes. | |||
* In Mod Tool ''ghosts'' and ''rooms'' can be grouped under a null object. Right-click the null object to select all its children, then use "Selection Only [x]" as saving option. That way all the planes can be quickly saved to a *.dae file. | |||
* You can influence the pathfinding creation of dangerous zones with danger quads. Read on [[#marker textures|HERE]]. | |||
* Another kind of influence is the [[#<Model>|gunk flag]] IgnoreGrid. It can be used to let OniSplit ignore the object during pathfinding creation. The grids in that place will be white. | |||
[[Image:Pathfinding_grid.JPG|thumb|200px|right|''ai2_showgrids = 1'' in action]] | [[Image:Pathfinding_grid.JPG|thumb|200px|right|''ai2_showgrids = 1'' in action]] | ||
'''BSL commands''' | |||
* chr_show_bnv = 1 | * chr_show_bnv = 1 | ||
:: shows number of bnv the player is standing on | :: shows number of bnv the player is standing on | ||
Line 611: | Line 612: | ||
* Additionally we create a plain (invisible if necessary) under the object so that Oni doesn't think there's a hole. | * Additionally we create a plain (invisible if necessary) under the object so that Oni doesn't think there's a hole. | ||
* The ghosts must be taller than the highest polygon to walk on. (This has been tested up to a height of 2000 world units.) | * The ghosts must be taller than the highest polygon to walk on. (This has been tested up to a height of 2000 world units.) | ||
Line 619: | Line 619: | ||
B) AI loses PF if tracked enemy performs animations that are out of the pathfinding volume. [http://youtu.be/vfKPzP5hiCo Here's] a video about of the "B" symptoms. | B) AI loses PF if tracked enemy performs animations that are out of the pathfinding volume. [http://youtu.be/vfKPzP5hiCo Here's] a video about of the "B" symptoms. | ||
'''Missing boundaries''' | |||
Let's say you have a BNV, tall ghosts, and a GridIgnore-flagged hill with trees and brushes and stuff. | |||
Why do AI run against the trees? The vegetation isn't on the BNV so no red grids were created. | |||
Add simple geometries like ''_marker_impassable fences'' near the BNV to fix the problem. | |||
Line 626: | Line 635: | ||
** to see them you must use the -debug option in the level creation command (available with OniSplit '''v0.9.93.0+''') | ** to see them you must use the -debug option in the level creation command (available with OniSplit '''v0.9.93.0+''') | ||
OniSplit.exe -create:level ''output_folder'' '''-debug''' ''input_folder''/''master_xml_file''.xml | OniSplit.exe -create:level ''output_folder'' '''-debug''' ''input_folder''/''master_xml_file''.xml | ||
Not all debugging/testing needs to be done in Oni. There also the [http://mods.oni2.net/node/256 file browser] which can display the whole level. | |||
For example you can load the AKEV*.oni, selected the level name and use the hotkeys [B] and [P] to display BNV and ghosts. | |||
Line 720: | Line 733: | ||
* blue - border 3 | * blue - border 3 | ||
* blue dark - border 4 | * blue dark - border 4 | ||
* orange - danger | * '''orange - danger''' | ||
* red - impassable | * red - impassable | ||
edits