FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: Process finished with exit code 139  (Read 3572 times)

conan

  • Newbie
  • Posts: 17
    • View Profile
Process finished with exit code 139
« on: November 05, 2015, 09:16:31 pm »

Hi,

I got into a situation when I get this cryptic error:
Process finished with exit code 139
That's it, nothing else, no trace... so I guess it's in the C++ side.

When I try to debug it, I go step by step until the engine pumps and then it exists with that error without any other explanation.

There are two situations that create this error:
  • One is when I manually create an object:                 
Code: [Select]
object = self.world.model.getObject("dummy", "namespace")
dummyInstance = layer.createInstance(object, newlocation.getExactLayerCoordinates())
    At that point it doesn't complain but the next time it pumps, it crashes. If I just comment the createInstance line it doesn't crash.[/li]

  • So I commented that part out and did a huge code change (just refactoring), but after those seemingly neutral changes and after commenting out the previous failing line, it again fails with the same error code.

Help would be appreciated! Thank you!
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Process finished with exit code 139
« Reply #1 on: November 06, 2015, 08:35:03 am »

You need to add the following line after creating the instance:
Code: [Select]
fife.InstanceVisual.create(dummyInstance)
Logged

conan

  • Newbie
  • Posts: 17
    • View Profile
Re: Process finished with exit code 139
« Reply #2 on: November 07, 2015, 05:39:37 pm »

Thanks for your response. Unfortunately that didn't do the trick :/

I made a workaround to avoid that problem but then later this problem happened again. What I'm trying to do is show a projectile (like a bullet or whatever) that goes from a unit to the target. For that I do:

Code: [Select]
def __init__(self, world, origin, destination):

        super(Projectile, self).__init__()

        ## Show projectile
        self.layer = origin.getLayer()
        object = world.model.getObject("projectile", "fallen")
        self.instance = self.layer.createInstance(object, origin.getExactLayerCoordinates())
        self.instance.addActionListener(self)
        self.visual = fife.InstanceVisual.create(self.instance)
        self.visual.setVisible(True)
        self.instance.move("stand", destination, 1)


    def onInstanceActionFinished(self, instance, action):

        if action.getId() == "stand":
            self.layer.deleteInstance(self.instance)

This code crashes with exit error code 139 the next time it pumps. Any ideas?
Logged

conan

  • Newbie
  • Posts: 17
    • View Profile
Re: Process finished with exit code 139
« Reply #3 on: November 07, 2015, 07:05:16 pm »

Hi!

Apparently I found the problem. It seems that it's not very verbose when it finds some missing part or some part is wrong on the object configuration files such as the .xml . I had to clone an object that I knew it worked for sure and then slowly change the parameters one at a time till it worked like I wanted. However, I get another different error. Now, when I try to move the bullet, it doesn't work. This is my code so far:

Code: [Select]
class Projectile(fife.InstanceActionListener):
   
    def __init__(self, world, origin, destination):

        super(Projectile, self).__init__()

        self.start = False
        ## Show projectile
        self.layer = world.scene.map.getLayer("TrajectoryLayer")
        object = world.model.getObject("SBT", "fallen")
        object.addWalkableArea("land")
        object.setBlocking(False)
        print "Attacking from: " , origin.getLayerCoordinates()
        print "To: ", destination.getLayerCoordinates()

        self.instance = self.layer.createInstance(object, origin.getExactLayerCoordinates())
        self.instance.addActionListener(self)
        self.visual = fife.InstanceVisual.create(self.instance)
        self.visual.setVisible(True)
        self.instance.setCellStackPosition(0)
        #self.instance.move('stand', route.getEndNode(), 5)
        destination.setLayer(self.layer)
        self.instance.move("move", destination, 1)
        #print "\n\n\nProjectile action ID: " , self.instance.getCurrentAction().getId()
        print "\n\nbullet created!"
        self.start = True


    def onInstanceActionFinished(self, instance, action):
        print action.getId()
        if action.getId() == "move" and self.start:
            print "\n\nDestroying bullet"
            self.layer.deleteInstance(self.instance)
            self.visual.setVisible(False)



The result is that as soon as self.instance.move is run, the onInstanceActionFinished is triggered before even we get out of the __init()__ function! Additionally the bullet sprite appears on top of the unit and doesn't move and it never gets deleted.

I'm doing something wrong but I can't see what. I think it's quite a simple code :/ I'll look more and post the solution if I find it before someone here with a sharp eye does. Thanks!
Logged

conan

  • Newbie
  • Posts: 17
    • View Profile
Re: Process finished with exit code 139
« Reply #4 on: November 07, 2015, 08:33:44 pm »

I found something! Sorry for the monologue here, hehe!

So, there were two problems: one is the layer where the instance lives. If the layer is the normal "TechdemoMapGroundObjectLayer" where all the other instance live, then as it starts off a blocking cell (since it starts from the position the attacker is), then the movement ends right away. I tested this by starting the shot from the next cell.

Additionally, when I tried the dedicated layer "ProjectileLayer", then the instance doesn't move either. Is there something I should do so that instances can move on a layer? I check Layer.isMovable() and it is.

Finally, is there any way to bypass all layers and just make an instance move from point A to point B in a straight line regardless of blocking cells etc?

Thanks!!!!
Logged

conan

  • Newbie
  • Posts: 17
    • View Profile
Re: Process finished with exit code 139
« Reply #5 on: November 08, 2015, 06:50:31 pm »

Finally!!!!!!!!!!!!!!!!

I finally found my problem. The thing is that I was trying to delete the instance from the onInstanceActionFinished() callback. The thing is that the engine then looks for the instance right after that method is finished and as it was deleted it couldn't find it and it would crash. WOW that was a hard one to find.

I still have to figure out how to make bullets go on a straight line instead of following the grid. It looks kind of fake now but at least it works. Any idea?
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Process finished with exit code 139
« Reply #6 on: November 11, 2015, 02:51:23 pm »

For bullets it's probably best to just move them manually with instance.setExactLayerCoordinates(), since there's no need for pathfinding in this case. Check the shooter demo for an example of how to do it.

If you need an additional layer with stuff movable by the pathfinder, it needs to be set as walkable (layer.setWalkable(true)), and it needs to have a CellCache (layer.createCellCache()) of appropriate size. The easiest way to ensure it's big enough is to place some instances on the corners of the map on that layer, it should be resized automatically.
Logged

conan

  • Newbie
  • Posts: 17
    • View Profile
Re: Process finished with exit code 139
« Reply #7 on: November 11, 2015, 07:14:03 pm »

Hi Niektory,

Thank you for your response. The answer was so simple and I was thinking about such a complicated way of doing it!

I can even implement nice parabolic shots now.

Jon.
Logged