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: Agents movement still prevented after moving instances in the map  (Read 1447 times)

duke

  • Newbie
  • Posts: 2
    • View Profile

Hello everybody!

It's just a few weeks I have started playing around with FIFE engine and first of all I would like to thank all the community for such a nice job!

At the moment, I am trying to expand the demo "rio de hola" in order to get familiar with FIFE. The game I am building prevents the player to move in some regions of the map until he completes some missions. Basically I have some regions that are "fenced" and their entrance can be unlocked as the game proceeds. To obtain this I change the position in the map of some instances from the Python code (instance.setLocation(coordinate)) in order to open passages and let the player in.

The problem I am experiencing is that sometimes, even if the instances are visually moved where they should, the agent is still prevented to walk where those instances were placed, as they were still there, so that there is no way for the player to move in the "unlocked" region of the map. I also tried different ways to open such passages, for example setting instances to non-blocking or directly removing them, but this behavior still appears.

This problem does not happen always and when it does it can appear the first time an instance is moved or after several times instances are moved around.

Is there something that I am missing from the code standpoint or should this behavior never happen?

Thank you for the help!

Logged

helios

  • Developer
  • Jr. Member
  • *
  • Posts: 61
    • View Profile
Re: Agents movement still prevented after moving instances in the map
« Reply #1 on: January 08, 2014, 05:48:14 am »

Hey duke,
I'm glad that you like FIFE :)

It isn't easy to say something about your problem without source code. The fact that the problem not always emerges is strange.
You have to consider some things:
1. The object of your "door" should be set to non static. In the object XML file, static="0".
2. You need narrow cells. Maybe not the best name for it but it means that a cell is monitored. The cells where the doors are, must be supervised by FIFE because on blocker change it can split or merge zones (sets of cells). In the XML map file is a CellCache section like in the following example.
Code: [Select]
    <cellcaches>
        <cellcache id="layer_id"  search_narrow="1">  // search_narrow=1 means FIFE try to find them automatic
            <cell x="1" y="-1" narrow="1"/>           // other option, so you can define them yourself
        </cellcache>
    </cellcaches>

If that is too complicated, you could try to place the door blockers after map load.
Your map would contain all other stuff expect the doors, after map load you can create them yourself (code wise). The result should be a map with only one zone. The disadvantage is that pathfinding is then much slower in some cases, e.g. if your player tries to walk to a locked region the pathfinder try to find a path which of course fails.

I hope that was understandable, otherwise if something is unclear, just ask ;D
Logged

duke

  • Newbie
  • Posts: 2
    • View Profile
Re: Agents movement still prevented after moving instances in the map
« Reply #2 on: January 08, 2014, 03:04:51 pm »

Perfect! That was exactly what I was missing, after those modifications it works flawlessly!

Thank you very much helios!
Logged