congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
GdxAI
Code IndexAdd Tabnine to your IDE (free)

How to use
GdxAI
in
com.badlogic.gdx.ai

Best Java code snippets using com.badlogic.gdx.ai.GdxAI (Showing top 20 results out of 315)

origin: libgdx/gdx-ai

/** Executes this {@code Wait} task.
 * @return {@link Status#SUCCEEDED} if the specified timeout has expired; {@link Status#RUNNING} otherwise. */
@Override
public Status execute () {
  return GdxAI.getTimepiece().getTime() - startTime < timeout ? Status.RUNNING : Status.SUCCEEDED;
}
origin: libgdx/gdx-ai

  float currentTime = GdxAI.getTimepiece().getTime();
  GdxAI.getLogger().info(
    LOG_TAG,
    "Instant telegram dispatched at time: " + currentTime + " by " + sender + " for " + receiver
float currentTime = GdxAI.getTimepiece().getTime();
    GdxAI.getLogger().info(
      LOG_TAG,
      "Delayed telegram from " + sender + " for " + receiver + " recorded at time " + currentTime
        + ". Message code is " + msg);
  else
    GdxAI.getLogger().info(LOG_TAG,
      "Delayed telegram from " + sender + " for " + receiver + " rejected by the queue. Message code is " + msg);
origin: libgdx/gdx-ai

/** Creates a {@code BehaviorTreeLibrary} with the given debug level and using the new internal resolver returned by the call
 * {@link FileSystem#newResolver(FileType) GdxAI.getFileSystem().newResolver(FileType.Internal)}.
 * @param parseDebugLevel the debug level the parser will use */
public BehaviorTreeLibrary (int parseDebugLevel) {
  this(GdxAI.getFileSystem().newResolver(FileType.Internal), parseDebugLevel);
}
origin: libgdx/gdx-ai

@Override
protected void startLine (int indent) {
  if (btParser.debugLevel > BehaviorTreeParser.DEBUG_LOW)
    GdxAI.getLogger().debug(TAG, lineNumber + ": <" + indent + ">");
  this.indent = indent;
}
origin: libgdx/gdx-ai

@Override
public boolean finalizeSearch (long timeToRun) {
  hpfRequest.pathFound = pathFound;
  if (pathFound) {
    // Take the first move of this plan and use it for the next run through
    endNode = resultPath.get(1);
  }
  if (DEBUG) GdxAI.getLogger().debug(TAG, "LevelPathFinder finalizeSearch; status: " + status);
  return true;
}
origin: libgdx/gdx-ai

/** Draws a value from the distribution that determines the seconds to wait for.
 * <p>
 * This method is called when the task is entered. Also, this method internally calls {@link Timepiece#getTime()
 * GdxAI.getTimepiece().getTime()} to get the current AI time. This means that
 * <ul>
 * <li>if you forget to {@link Timepiece#update(float) update the timepiece} this task will keep running indefinitely.</li>
 * <li>the timepiece should be updated before this task runs.</li>
 * </ul> */
@Override
public void start () {
  timeout = seconds.nextFloat();
  startTime = GdxAI.getTimepiece().getTime();
}
origin: libgdx/gdx-ai

/** Dispatches any delayed telegrams with a timestamp that has expired. Dispatched telegrams are removed from the queue.
 * <p>
 * This method must be called regularly from inside the main game loop to facilitate the correct and timely dispatch of any
 * delayed messages. Notice that the message dispatcher internally calls {@link Timepiece#getTime()
 * GdxAI.getTimepiece().getTime()} to get the current AI time and properly dispatch delayed messages. This means that
 * <ul>
 * <li>if you forget to {@link Timepiece#update(float) update the timepiece} the delayed messages won't be dispatched.</li>
 * <li>ideally the timepiece should be updated before the message dispatcher.</li>
 * </ul> */
public void update () {
  float currentTime = GdxAI.getTimepiece().getTime();
  // Peek at the queue to see if any telegrams need dispatching.
  // Remove all telegrams from the front of the queue that have gone
  // past their time stamp.
  Telegram telegram;
  while ((telegram = queue.peek()) != null) {
    // Exit loop if the telegram is in the future
    if (telegram.getTimestamp() > currentTime) break;
    if (debugEnabled) {
      GdxAI.getLogger().info(LOG_TAG,
        "Queued telegram ready for dispatch: Sent to " + telegram.receiver + ". Message code is " + telegram.message);
    }
    // Send the telegram to the recipient
    discharge(telegram);
    // Remove it from the queue
    queue.poll();
  }
}
origin: libgdx/gdx-ai

@Override
public boolean search (PathFinder<N> pathFinder, long timeToRun) {
  if (DEBUG) GdxAI.getLogger().debug(TAG, "LevelPathFinder search; status: " + status);
  return super.search(pathFinder, timeToRun);
}
origin: com.badlogicgames.gdx/gdx-ai

/** Creates a {@code BehaviorTreeLibrary} with the given debug level and using the new internal resolver returned by the call
 * {@link FileSystem#newResolver(FileType) GdxAI.getFileSystem().newResolver(FileType.Internal)}.
 * @param parseDebugLevel the debug level the parser will use */
public BehaviorTreeLibrary (int parseDebugLevel) {
  this(GdxAI.getFileSystem().newResolver(FileType.Internal), parseDebugLevel);
}
origin: libgdx/gdx-ai

/** Scans the queue and passes pending messages to the given callback in any particular order.
 * <p>
 * Typically this method is used to save (serialize) pending messages and restore (deserialize and schedule) them back on game
 * loading.
 * @param callback The callback used to report pending messages individually. **/
public void scanQueue (PendingMessageCallback callback) {
  float currentTime = GdxAI.getTimepiece().getTime();
  int queueSize = queue.size();
  for (int i = 0; i < queueSize; i++) {
    Telegram telegram = queue.get(i);
    callback.report(telegram.getTimestamp() - currentTime, telegram.sender, telegram.receiver, telegram.message,
      telegram.extraInfo, telegram.returnReceiptStatus);
  }
}
origin: com.badlogicgames.gdx/gdx-ai

  float currentTime = GdxAI.getTimepiece().getTime();
  GdxAI.getLogger().info(
    LOG_TAG,
    "Instant telegram dispatched at time: " + currentTime + " by " + sender + " for " + receiver
float currentTime = GdxAI.getTimepiece().getTime();
    GdxAI.getLogger().info(
      LOG_TAG,
      "Delayed telegram from " + sender + " for " + receiver + " recorded at time " + currentTime
        + ". Message code is " + msg);
  else
    GdxAI.getLogger().info(LOG_TAG,
      "Delayed telegram from " + sender + " for " + receiver + " rejected by the queue. Message code is " + msg);
origin: libgdx/gdx-ai

@Override
protected void startStatement (String name, boolean isSubtreeReference, boolean isGuard) {
  if (btParser.debugLevel > BehaviorTreeParser.DEBUG_LOW)
    GdxAI.getLogger().debug(TAG, (isGuard? " guard" : " task") + " name '" + name + "'");
  
  this.isSubtreeRef = isSubtreeReference;
  
  this.statement = isSubtreeReference ? Statement.TreeTask : checkStatement(name);
  if (isGuard) {
    if (statement != Statement.TreeTask)
      throw new GdxRuntimeException(name + ": only tree's tasks can be guarded");
  }
  statement.enter(this, name, isGuard);
}
origin: libgdx/gdx-ai

float currentTime = GdxAI.getTimepiece().getTime();
if (this.lastTime != currentTime) {
origin: com.github.almasb/fxgl-ai

  float currentTime = GdxAI.getTimepiece().getTime();
  GdxAI.getLogger().info(
      LOG_TAG +
          "Instant telegram dispatched at time: " + currentTime + " by " + sender + " for " + receiver
float currentTime = GdxAI.getTimepiece().getTime();
    GdxAI.getLogger().info(
        LOG_TAG +
            "Delayed telegram from " + sender + " for " + receiver + " recorded at time " + currentTime
            + ". Message code is " + msg);
  else
    GdxAI.getLogger().info(LOG_TAG +
        "Delayed telegram from " + sender + " for " + receiver + " rejected by the queue. Message code is " + msg);
origin: libgdx/gdx-ai

  + maxVerticalVelocity * maxVerticalVelocity);
float time = (-maxVerticalVelocity + sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "1st jump time = " + time);
  if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "2nd jump time = " + time);
  if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
    return -1f; // Unachievable jump
origin: com.badlogicgames.gdx/gdx-ai

/** Executes this {@code Wait} task.
 * @return {@link Status#SUCCEEDED} if the specified timeout has expired; {@link Status#RUNNING} otherwise. */
@Override
public Status execute () {
  return GdxAI.getTimepiece().getTime() - startTime < timeout ? Status.RUNNING : Status.SUCCEEDED;
}
origin: com.badlogicgames.gdx/gdx-ai

/** Dispatches any delayed telegrams with a timestamp that has expired. Dispatched telegrams are removed from the queue.
 * <p>
 * This method must be called regularly from inside the main game loop to facilitate the correct and timely dispatch of any
 * delayed messages. Notice that the message dispatcher internally calls {@link Timepiece#getTime()
 * GdxAI.getTimepiece().getTime()} to get the current AI time and properly dispatch delayed messages. This means that
 * <ul>
 * <li>if you forget to {@link Timepiece#update(float) update the timepiece} the delayed messages won't be dispatched.</li>
 * <li>ideally the timepiece should be updated before the message dispatcher.</li>
 * </ul> */
public void update () {
  float currentTime = GdxAI.getTimepiece().getTime();
  // Peek at the queue to see if any telegrams need dispatching.
  // Remove all telegrams from the front of the queue that have gone
  // past their time stamp.
  Telegram telegram;
  while ((telegram = queue.peek()) != null) {
    // Exit loop if the telegram is in the future
    if (telegram.getTimestamp() > currentTime) break;
    if (debugEnabled) {
      GdxAI.getLogger().info(LOG_TAG,
        "Queued telegram ready for dispatch: Sent to " + telegram.receiver + ". Message code is " + telegram.message);
    }
    // Send the telegram to the recipient
    discharge(telegram);
    // Remove it from the queue
    queue.poll();
  }
}
origin: libgdx/gdx-ai

@Override
protected void attribute (String name, Object value) {
  if (btParser.debugLevel > BehaviorTreeParser.DEBUG_LOW)
    GdxAI.getLogger().debug(TAG, lineNumber + ": attribute '" + name + " : " + value + "'");
  
  boolean validAttribute = statement.attribute(this, name, value);
  if (!validAttribute) {
    if (statement == Statement.TreeTask) {
      throw stackedTaskException(getCurrentTask(), "unknown attribute '" + name + "'");
    } else {
      throw new GdxRuntimeException(statement.name + ": unknown attribute '" + name + "'");
    }
  }
}
origin: com.github.almasb/fxgl-ai

/** Executes this {@code Wait} task.
 * @return {@link Status#SUCCEEDED} if the specified timeout has expired; {@link Status#RUNNING} otherwise. */
@Override
public Status execute () {
  return GdxAI.getTimepiece().getTime() - startTime < timeout ? Status.RUNNING : Status.SUCCEEDED;
}
origin: com.github.almasb/fxgl-ai

/**
 * Dispatches any delayed telegrams with a timestamp that has expired. Dispatched telegrams are removed from the queue.
 * <p>
 * This method must be called regularly from inside the main game loop to facilitate the correct and timely dispatch of any
 * delayed messages. Notice that the message dispatcher internally calls {@link Timepiece#getTime()
 * GdxAI.getTimepiece().getTime()} to get the current AI time and properly dispatch delayed messages. This means that
 * <ul>
 * <li>if you forget to {@link Timepiece#update(float) update the timepiece} the delayed messages won't be dispatched.</li>
 * <li>ideally the timepiece should be updated before the message dispatcher.</li>
 * </ul>
 */
public void update() {
  float currentTime = GdxAI.getTimepiece().getTime();
  // Peek at the queue to see if any telegrams need dispatching.
  // Remove all telegrams from the front of the queue that have gone
  // past their time stamp.
  Telegram telegram;
  while ((telegram = queue.peek()) != null) {
    // Exit loop if the telegram is in the future
    if (telegram.getTimestamp() > currentTime) break;
    if (debugEnabled) {
      GdxAI.getLogger().info(LOG_TAG +
          "Queued telegram ready for dispatch: Sent to " + telegram.receiver + ". Message code is " + telegram.message);
    }
    // Send the telegram to the recipient
    discharge(telegram);
    // Remove it from the queue
    queue.poll();
  }
}
com.badlogic.gdx.aiGdxAI

Javadoc

Environment class holding references to the Timepiece, Logger and FileSystem instances. The references are held in static fields which allows static access to all sub systems.

Basically, this class is the locator of the service locator design pattern. The locator contains references to the services and encapsulates the logic that locates them. Being a decoupling pattern, the service locator provides a global point of access to a set of services without coupling users to the concrete classes that implement them.

The gdx-ai framework internally uses the service locator to give you the ability to use the framework out of a libgdx application. In this scenario, the libgdx jar must still be in the classpath but you don't need native libraries since the libgdx environment is not initialized at all.

Also, this service locator automatically configures itself with proper service providers in the situations below:

  • Libgdx application: if a running libgdx environment (regardless of the particular backend) is detected.
  • Non-libgdx desktop application: if no running libgdx environment is found.
This means that if you want to use gdx-ai in Android (or any other non desktop platform) out of a lbgdx application then you have to implement and set proper providers.

Most used methods

  • getTimepiece
    Returns the timepiece service.
  • getLogger
    Returns the logger service.
  • getFileSystem
    Returns the filesystem service.

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getContentResolver (Context)
  • getExternalFilesDir (Context)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Runner (org.openjdk.jmh.runner)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now