Mugen87 / dive

Shooter AI showcase with Yuka.
https://raw.githack.com/Mugen87/dive/master/app/index.html
MIT License
82 stars 22 forks source link

Question: Costtable #4

Closed AleksandarMIlenkovic closed 4 years ago

AleksandarMIlenkovic commented 4 years ago

HI, first of all to say, i love yuka, great library! Last year I was playing with it making a game from shooter example http://gamestudiohx.com/bata/som/entity/shooter/ , and since i saw dive and all new features, i wanted to implement navmesh and some other cool stuff you've added since... I wanted to ask how do you make costtable json for navmesh. Is there a tool for that or if you can give me some directions. Thanks

Mugen87 commented 4 years ago

I wanted to ask how do you make costtable json for navmesh.

There is not CLI tool yet since I needed cost tables only once for Dive so far. However, you can do it like so: When you nav mesh is ready, load it via NavMeshLoader into your application. After loading, use the following code to setup a new instance of CostTable:

const costTable = new CostTable();
costTable.init( navMesh );
const json = costTable.toJSON();

I've then downloaded the resulting JSON and put it in my project directory.

Unfortunately, since NavMeshLoader has some browser dependencies, it's problematic to implement this code as a node.js CLI tool.

BTW: Cool game^^.

AleksandarMIlenkovic commented 4 years ago

Great, thanks!