Land Information


I need to get information from the ground and observed the same character, I tried some ways, but I need the data to a store, and to infer about them later using Machine Learning.

Does anyone have any idea?


I'm not sure what you mean by "and observed the same character," and what "information" are you trying to get from the ground?

Actually I need to do more've tried several ways you know for example if there is water near the character. I need my character note that the water of the river is rising, to enable the conduct of it.

Hmmm… I am not quite sure I understand what you mean. If you mean you want your character, controlled by a person, to be unable to walk through water, there are several different approaches:

  • have a 2D map with information about what areas are walkeable and which aren't.

  • have culled (i.e. invisible) 3D data with "walls" that prevent walking... This is what most commercial games do

  • programatically decide what areas are allowed based on properties (like slope or material)

If what you want is something to do with AI, then you would have to be much more specific of your goals.

He will not be controlled by a person, he will have to move alone. I have the map I'm trying to move it from the comments of the character. So I do so in a range of sensors around my character to seek information about the terrain, so I'm trying to learn how to do it, for example, how can I get the height of the land in a radius around a point?.

It has to do with AI yes, I'm using it to fill a basis for learning, so that he can later use the experience to walk alone, I think this might work.

Well, getHeight() would the way to go if you have created a TerrainPage. However, it seems to me that you are trying to start with very advanced concepts. I wouldn't recomend trying to learn to use jME at the same time you are trying to learn advanced AI topics, specially if (I don't know if this is the case, of course) you don't have exceedingly good experience as a programmer.

Yes, I knew I had to use this command, you understood well, I'm using jME as an interface for my

simulation, so I've been trying to make it through my environment.

At the UA, the topics have not found anything so general as I have been doing, because I have been developing

Using a framework for the BDI model, called JADEX and Machine Learning. I'm creating characters

cognitive order that they may reflect based on their own observations, and how the tests I did with a

code that I created are pretty bad I thought to see other solutions to see where they went wrong.

Based on the explanations here created this basic algorithm to partially solve the problem, so why do I still have to move the character, which I did not even think of using an A *, the more I lost when trying to engage him in this code you have any idea?

import static com.jme.math.FastMath.PI;
import static com.jme.math.FastMath.TWO_PI;

float alturaDaAgua = 50.0f; // one example ....

Vector3f posicaoDoAgente = spatialDoAgente.getLocalTranslation();
int numPontos = 8; //numbers of points to measure

float[] niveis = new float[numPontos]; // here we keep the values that the agent "saw". Positive to ground, negative for water.
final float angulo = TWO_PI / numPontos; // angle between a point and the next point
float raio = 1.0f; // radius of the circle

float anguloAtual = 0.0f;

for (int i = 0; i < numPontos; i++) {
  float x = posicaoDoAgente.x;
  float z = posicaoDoAgente.z;

  x += raio * FastMath.cos(anguloAtual);
  z += raio * FastMath.sin(anguloAtual);

  niveis[i] = terreno.getHeight(x,z) - alturaDaAgua; // Y took the height of the terrain, the position (x, z)

  anguloAtual += angulo;

// And now, an over simplified idea to escape the agents of water.

Vector3f direcaoDaAgua = new Vector3f(); // actually an "average" vector of directions that have water .. is only an approximation right !!!!! very idea Simple... but just to start ...

anguloAtual = 0.0f;

for (int i = 0; i < numPontos; i++) {
  if (niveis[i] < 0.0f) {
    // have water in the direction of this point!

    Vector3f direcaoDestePonto = new Vector3f();
    direcaoDestePonto.x = FastMath.cos(anguloAtual);
    direcaoDestePonto.z = FastMath.sin(anguloAtual);


  anguloAtual += angulo;

float velocidadeFuga = 1.0f;
Vector3f direcaoFuga = new Vector3f(direcaoDaAgua);

spatialDoAgente.y = terreno.getHeight(spatialDoAgente.x, spatialDoAgente.z);

So you have a dynamic scene (as you said, for example, the water level can rise) and want to collect information about its state (terrain height, water level, etc); and your character is an artificially intelligent agent who evaluates the info to learn to navigate through the terrain on its own (for example, avoid the water)?

Wow, sounds like a cool project, and a pretty difficult one too. :slight_smile:

What about using two data pools, T-box and A-box:

The T-box (terminology box) contains the character's general experience: Which types of scene elements are there, and what are the rules for reacting to them? For example, where can the character walk ("floor") and where not ("obstacle")?

  • The character must learn rules to treat water, fire, walls, etc, as avoidable obstacles.
  • He must learn rules to treat meadows, streets, fields, etc, as normal floors to walk on.

    The character uses his senses (as you said) to collect info about the status of the world. Stores this info in the A-box (assertion box). Mabye set up a grid, or use shades of colors to mark different types of ground, in a bitmap? In the A-Box, the character draws a map of the world, he marks "floors" and "obstacles" he sees. Then he uses a path finding algorithm on that map, and plans his way through. 

    I like the z path finding algorithm, it's simple enough for many cases:

    (It's not in Java, just a short piece of pseudocode, I'm afraid you have to adapt it yourself.)

  • The T-box contains all rules that the character has learnt: It mustn't contain any contradictions. The character must be able to trust it for his planning, so the rules should remain static during use. The t-box only changes during a learning phase (when more rules are added).
  • The A-box, however, is updated constantly during use, everytime the character uses his senses. Then the character runs the rules again on the new information, to evaluate whether he should continue on this path, or whether it has been (e.g.) flooded and he has to find a new path. The A-box usually only remains static during the learning phase – in order not to confuse the AI.

    (You see how A-box and T-box are quite the opposite of each other in this simple example.)

    I assume you have to make up you own data formats and rule formats for a-box and t-box representation – depending on your world. What is important to your character in your world? If the character just avoids fire and water and walls, you don't have to distinguish between them, they are just marked "obstacles" in your representation.

    If hoewever the character can swim and climb, then you need to mark the difference between water and walls in the representation, and give him rules to decide what to do in these cases.

    You might even have to assign a cost to certain actions ("swimming and climbing cost more energy than walking") and for every step, the rules tell him to prefer what costs less.

    … That is as much as I remember from school, I hope I got it right… :smiley: