pandai help!

I am working on a small game where “units” are created
during playtime. These “units” are using pandai pathfinding.

The problem is that only the last created one can pathfind. If I try to pathfind whit one of the others panda crash.

Any help would be much appreciated!!

It is very difficult to help with your problem with so little information on it. Could you post the error that panda crashes with when it crashes, and the code snippet where the crash originates?

If I use this code:

def createBehavior(self, u):

        n = u.getNetTag("id")

        self.aiChar = AICharacter(n, u, 50, 0.05, 15)
        self.aiWorld.addAiChar(self.aiChar)
        self.aiBehavior = self.aiChar.getAiBehaviors()

        self.aiBehavior.initPathFind("navmesh.csv")

        self.ais.append(self.aiBehavior)

I get this error:

Assertion failed: !is_empty() at line 1834 of panda/src/pgraph/nodePath.cxx
couldnt find source
Traceback (most recent call last):
  File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 61, in eventLoop
Task
    self.doEvents()
  File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 55, in doEvents
    processFunc(self.eventQueue.dequeueEvent())
  File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 124, in processE
vent
    messenger.send(eventName)
  File "C:\Panda3D-1.7.2\direct\showbase\Messenger.py", line 388, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "C:\Panda3D-1.7.2\direct\showbase\Messenger.py", line 473, in __dispatch
    method (*(extraArgs + sentArgs))
  File "mainPanda.py", line 111, in Go
    ai.pathFindTo(p)
AssertionError: !is_empty() at line 1834 of panda/src/pgraph/nodePath.cxx
:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
  File "mainPanda.py", line 157, in <module>
    run()
  File "C:\Panda3D-1.7.2\direct\showbase\ShowBase.py", line 2630, in run
    self.taskMgr.run()
  File "C:\Panda3D-1.7.2\direct\task\Task.py", line 502, in run
    self.step()
  File "C:\Panda3D-1.7.2\direct\task\Task.py", line 460, in step
    self.mgr.poll()
  File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 61, in eventLoop
Task
    self.doEvents()
  File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 55, in doEvents
    processFunc(self.eventQueue.dequeueEvent())
  File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 124, in processE
vent
    messenger.send(eventName)
  File "C:\Panda3D-1.7.2\direct\showbase\Messenger.py", line 388, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "C:\Panda3D-1.7.2\direct\showbase\Messenger.py", line 473, in __dispatch
    method (*(extraArgs + sentArgs))
  File "mainPanda.py", line 111, in Go
    ai.pathFindTo(p)
AssertionError: !is_empty() at line 1834 of panda/src/pgraph/nodePath.cxx

And if I use this code:

def select(self, n):

        a = 0
        self.u = None

        while a != len(self.units):

            if self.units[a].getNetTag("id") == n:
                self.u = self.units[a]

            a = a + 1

        if self.u != None:

            self.aiChar = AICharacter(n, self.u, 50, 0.05, 15)
            self.aiWorld.addAiChar(self.aiChar)
            self.aiBehavior = self.aiChar.getAiBehaviors()

            self.aiBehavior.initPathFind("navmesh.csv")

I get this error:

Assertion failed: !is_empty() at line 1333 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1834 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1258 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1685 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1408 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1373 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1408 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1383 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1408 of panda/src/pgraph/nodePath.cxx
Assertion failed: !is_empty() at line 1393 of panda/src/pgraph/nodePath.cxx
Traceback (most recent call last):
  File "mainPanda.py", line 126, in aiUpdate
    self.aiWorld.update()
AssertionError: !is_empty() at line 1333 of panda/src/pgraph/nodePath.cxx
:task(error): Exception occurred in PythonTask UPDATEAI
Traceback (most recent call last):
  File "mainPanda.py", line 155, in <module>
    run()
  File "C:\Panda3D-1.7.2\direct\showbase\ShowBase.py", line 2630, in run
    self.taskMgr.run()
  File "C:\Panda3D-1.7.2\direct\task\Task.py", line 502, in run
    self.step()
  File "C:\Panda3D-1.7.2\direct\task\Task.py", line 460, in step
    self.mgr.poll()
  File "mainPanda.py", line 126, in aiUpdate
    self.aiWorld.update()
AssertionError: !is_empty() at line 1333 of panda/src/pgraph/nodePath.cxx

I haven’t used pandai myself, so I’m not sure how much help I can really offer you on this particular crash.

I would hazard a guess that the assertion error in this case means that the pandai system can’t find something that should be there. Probably something related to your navigation mesh. I’d recommend reviewing the navigation mesh and the process you used to create it to ensure there aren’t any problems with it.

Unfortunately, without knowing pandai better, I can’t really help you out much more than that.