XML:ONLV: Difference between revisions

653 bytes added ,  26 August 2013
m
updating the PF section again
mNo edit summary
m (updating the PF section again)
Line 558: Line 558:


====<Rooms>====
====<Rooms>====
The Room tag is mandatory. It contains an import path to BNV data (*.dae) which is used to create pathfinding grids. For technical information on BNV see [[OBD:AKVA|HERE]].
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"/>


BNV consist of 2 parts: rooms and ghost quads. (What again does BNV stand for?)


* Those ''rooms'' are in fact horizontal planes, they are used to determine the area where pathfinding will be calculated. Areas without ''rooms'' won't have pathfinding at all.
'''Fundamentals'''
* ''Ghosts'' are vertical planes. You need at least one ''ghost'' to connect two ''rooms'' at parallel edges.
* '''BNV''' are '''volumes''' (sometimes also named '''rooms''') that have a pathfinding grid assigned to them.
* ''Ghosts'' are very often standing in a 90° fashion but it's also possible to use other angles (like seen in [http://edt.oni2.net/images/Hideout_BNV.jpg HERE])
* For practical reasons you only need '''floors and ramps''' to build BNV. (Like seen in [http://edt.oni2.net/images/Hideout_BNV.jpg HERE.])
* Place the ''ghost'' where AI shall be able to transit from one room to another. Be careful with the ''ghost'''s width.
** 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.
* Actually, those horizontal and vertical planes can have any name and don't need any texture.
* Secondly there are so called '''ghosts''' (vertical quads) that connect '''neighbouring BNV'''. AI can transit BNV only through  ghosts.
* 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.
: OniSplit gives error messages for ghosts that don't have 2 neighbouring BNV, for example:
* 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.
BNV Builder: Ghost 'grid2' has no '''adjacencies''' at <-72,41 1,999 -166,6> and <-71 1,999 -168,21>, ignoring
 
 
;Danger quads
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.




;Tolerance values
'''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 slide down a bit and then fall through to death
* 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
'''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.)
For example this trick can bypass [https://dl.dropboxusercontent.com/u/139715/temp/bad_BNV.png pathfinding problems with pyramids.]




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


8,452

edits