Examples of Perception


Examples of fr.utbm.gi.vi51.framework.environment.Perception

    List<Perception> perceptions = getPerceivedObjects();

    if (this.seekBehaviour!=null && !perceptions.isEmpty()) {

      Perception percept = perceptions.get(0);

      if (percept.getPerceivedObject() instanceof MouseTarget) {
        Point2d target = new Point2d(percept.getPerceivedObject().getPosition());

        // run the seek behaviour
        output = this.seekBehaviour.runSeek(position, linearSpeed, getMaxLinear(), target);
      }
      else {
View Full Code Here

Examples of fr.utbm.gi.vi51.framework.environment.Perception

      double x1 = agent.getX();
      double y1 = agent.getY();
     
      // add mouse target in perceptions
      if (this.mouseTarget!=null) {
        allPercepts.add(new Perception(this.mouseTarget));
      }

      double bestDistance = Double.MAX_VALUE;
      AgentBody nearestBody = null;
     
      for(AgentBody b1 : getAgentBodies()) {
        if (b1!=agent) {
          double x2 = b1.getX();
          double y2 = b1.getY();
          double distance = new Vector2d(x2-x1,y2-y1).length();
          if (distance<bestDistance) {
            bestDistance = distance;
            nearestBody = b1;
          }
        }
      }
     
      if (nearestBody!=null) {
        allPercepts.add(new Perception(nearestBody));
      }
    }
   
    return allPercepts;
  }
View Full Code Here

Examples of fr.utbm.gi.vi51.framework.environment.Perception

    List<Perception> perceptions = getPerceivedObjects();

    if (this.seekBehaviour!=null && !perceptions.isEmpty())
    {
      Perception percept = perceptions.get(0);
    }

    //Take a decision
    currentAction.setAction(Action.BuildABridge);
   
View Full Code Here

Examples of fr.utbm.gi.vi51.framework.environment.Perception

          }
        }
      }
     
      if (nearestBody!=null) {
        allPercepts.add(new Perception(nearestBody));
      }
    }
   
    return allPercepts;
  }
View Full Code Here

Examples of marauroa.common.game.Perception

    }
    return ruleProcessor.createCharacter(username, character, template);
  }

  private Perception getPlayerPerception(PlayerEntry entry) {
    Perception perception = null;

    IRPZone.ID id = new IRPZone.ID(entry.object.get("zoneid"));
    IRPZone zone = world.getRPZone(id);

    if (entry.requestedSync == false) {
View Full Code Here

Examples of marauroa.common.game.Perception

          playersToRemove.add(entry);
          continue;
        }

        if (entry.state == ClientState.GAME_BEGIN) {
          Perception perception = getPlayerPerception(entry);
          sendPlayerPerception(entry, perception, entry.object);
        }
      } catch (Exception e) {
        logger.error("Removing player(" + entry.clientid + ") because it caused a Exception while contacting it", e);
        playersToRemove.add(entry);
View Full Code Here

Examples of marauroa.common.game.Perception

    rand.setSeed(new Date().getTime());

    objects = new LinkedHashMap<RPObject.ID, RPObject>();
    modified = new HashSet<RPObject>();

    perception = new Perception(Perception.DELTA, this.zoneid);
  }
View Full Code Here

Examples of marauroa.common.game.Perception

      }

      return prebuildDeltaPerception;
    } else /* type==Perception.SYNC */{
      if (prebuildSyncPerception == null) {
        prebuildSyncPerception = new Perception(Perception.SYNC, getID());
        prebuildSyncPerception.addedList = new ArrayList<RPObject>(objects.size());
        for (RPObject obj : objects.values()) {
          if (!obj.isHidden()) {
            prebuildSyncPerception.addedList.add(obj);
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.