Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - manumoi

Pages: 1 ... 3 4 [5] 6 7 ... 9
61
Support / help!
« on: May 18, 2006, 07:22:33 am »
Hello,

In JPCT apps, you have the KeyMapper class to help you. Here is an example of how you can use it (taken from i don't remember which example of Egon)

Code: [Select]

   private void poll(){
KeyState state = null;
do{
   state = keyMapper.poll();  // call to the poll method of the KeyMapper instance
   if (state!=KeyState.NONE){
keyAffected(state); // call to a keyAffected method that will describe the action to do once a key is pushed
   }
}
while (state != KeyState.NONE);
    }


And an example of the keyAffected related method
Code: [Select]

  private void keyAffected(KeyState state){
int code = state.getKeyCode();
boolean event = state.getState();
System.out.println(code);
switch(code){
case (KeyEvent.VK_ESCAPE):
   escape = event;
   break;
case (KeyEvent.VK_LEFT):
   left = event;
   break;
case (KeyEvent.VK_RIGHT):
   right = event;
   break;
case (KeyEvent.VK_UP):
   forward = event;
   break;
case (KeyEvent.VK_DOWN):
   backward=event;
   break;
}



Manu

62
Support / mouse controlled objects
« on: May 18, 2006, 07:07:31 am »
hello, to select an element in a 3D environment, you can do something like that
Code: [Select]

  public Object3D pickingObject(int mouseX, int mouseY){
SimpleVector ray=Interact2D.reproject2D3D(camera, buffer, mouseX, mouseY);
  int[] res=Interact2D.pickPolygon(theWorld.getVisibilityList(), ray);
if (res!=null) {
   return theWorld.getObject(Interact2D.getObjectID(res));  
}
    return null;
    }

where mouseX and mouseY can be obtained by the mouseEvent. The mouseEvent also contains information on which button triggered it.

To make elements move from a point to another, you have to obtain the position of your starting point and your ending point in order to use a pathfinding algorithm. In general a 3D environment is linked with a 2D array that contains useful information for this algorithm (pathfinding can also be done in X dimensions but it s more and more complex).

You can for example add a method to your element class like this one:
Code: [Select]

public ArrayList doPathfinding(Dimension endingCoordinates){ // make a  raycast on a mouse event more or less like in the previous method in order to obtain the ending coordinates
     Dimension startingCoordinates = selectedElement.get2DPosition(); // this method should return the current position of your element in the 2D map
     return processPath(startingCoordinates, endingCoordinates); // method where you apply your pathfinding algorithm. The ArrayList obtained contains the different node of the path.
}


This should work for non dynamic pathfinding (meaning that you don t have a dynamic environment i.e. an environment where elements that could "collide/affect the path" are moveable).

Doing dynamic pathfinding is far more complex in order to be efficient.

Hope this helps


Manu

63
Projects / Idea
« on: May 03, 2006, 07:41:51 pm »
Hello,

while surfing the net, i found a website where a guy finally decoded the md4 format, a file for skeletal animation. He implemented a loader in C++ for this kind of file.

I think it would be very interesting to have access to skeletal animations. However i m not an expert in 3D stuff, i didn t recently used C++ and i have other projects and important deadlines.  So I don t think I will be able to learn and do all this stuff alone in a decent timeline.

My idea is why not using all the good willing people of the JPCT community, working as a virtual team and implementing a function for md4 models in the JPCT Loader class ....  The more we will be the easier. A good way to learn from others also.

Here is the website

http://gongo.quakedev.com/

Emmanuel

64
Projects / JFlightSim
« on: May 03, 2006, 07:16:37 am »
Doh, sorry guys, i thought there was the shadow of the mountain at the end of the ballon.avi but obviously i was wrong.

 :oops:

65
Projects / My project
« on: May 03, 2006, 01:22:29 am »
I guess it s also time for me to talk a little bit about my own project.

Well I m trying to create what is called an Intelligent Tutoring System (i.e. a system that is supposed to teach you something but that has the ability to adapt its teaching depending on a dynamically created profile of the user).

I am interested in creating a RPG- like learning environment because some theories make me suspect that it could have a very high value in term of user motivation

Currently I am using JPCT for 3D rendering, JADE a multi agent platform is used for dealing with the supposed-intelligent part of the system (collaborative work of agents --> the goal is to interact, according to pedagogical strategies, with a learner when this one needs information)
I m also beginning to use JESS (a rule based engine) to help agents behave in a more intelligent way.... (but i can t tell more or i will have to kill you).
Finally, this is a client server architecture based on the NIO package (inter agents communication inside jade use RMI but it s too slow to deal with world logic using this technic).
The system is not far from its first usable version...

Here are some screenshots

A general view from the client interface



Some part of a map


again some part of the map from a different point of view


A test to make agents discuss with users



PS:  if someone has low polygon models (md2, 3ds) more or less related to the greek mythology, i would be very interested by it.



For those who are interested in :

JADE :  http://jade.tilab.com/ (LGPL license)
JESS :  http://www.jessrules.com/ (a license is requested but it s free one if it is for academic purpose)

66
Projects / JFlightSim
« on: May 03, 2006, 12:37:01 am »
Hello,
cool. Is it possible to see the piece of code that produces the shadow (if i correctly understand you).
Quote
The shadow is rendered by jPCT.


Thanks,

Emmanuel

67
Projects / JFlightSim
« on: May 02, 2006, 02:59:51 am »
Ca a l air sympa. Bonne continuation. Ca m interesserait de savoir comment tu geres les textures sur tes montagnes... Et est ce que c est moi ou est ce qu il y a une gestion dynamique de l ombre produite par les montagnes?

Manu

PS:  In english :P
I was just saying that i was interested in his way of dealing with textures on his ground (looks similar to the method used by rolz in Technopolis but who knows... And also there seems to be something like shadows on the mountain and i was wondering if i was dreaming??? :D


PS2: And concerning rolz?

Anybody has news from Belarus?

68
Support / remove an Object from the World
« on: May 02, 2006, 02:52:54 am »
it depends of what you need. If there are some object that will be frequently reused. I think it is better to keep it in memory instead of having to reload it (which is a very CPU consuming process if your object is complex).

I never tested the following proposition but i was thinking about it... Is the cost of cloning an object in term of CPU similar to the fact of creating a new one using the Loader class? I think cloning should be far more efficient but i never tested it. If so, you could create a set of frequently created objects (those object would not be linked to the world and would only be used to create cloned models that could be linked to the world). The CPU usage would be reduced but it would cost you some space in memory. Everything is a question of balance :P

I suppose if your Object3D is created without being linked to anything and you do not use it for a certain period, the garbage collector should destroy it... But maybe there is some kind of list in the JPCT architecture where all objects are referenced once they are created (which could explain the NO_OBJECT field)... I suppose only Egon can answer to this question.

69
Support / How to get a 2D position related to an Object3D
« on: April 10, 2006, 08:51:29 pm »
Hello,
Dummy question i suppose :shock: . I would like to know how you do to have the 2D position (in the canvas) of a 3D object as it is done in Karga or technopolis to find a position in order to display words said by avatars. I can pick objects (i.e. having coordinates and finding object) but i didn t find the way to do the inversed process

And another small question, do you have a sample of a code used to do transparent dialog panels (in the GL rendering way)?

Thanks all,


Manu

70
Support / Error: out of memory
« on: April 07, 2006, 04:25:09 pm »
Hello Mellsj
here is what i do to avoid rendering every polygons in my scene, I put the fog  at a distance smaller than the farPlane value,
My maxPolysVisible is 50000 and it works just fine. But as Egon said, i m surprised that your problem comes from this point

Code: [Select]

private void setupFog(){
        theWorld.setFogging(World.FOGGING_ENABLED);
        theWorld.setFogParameters(1000,0, 0, 0);
        Config.farPlane = 1020;
    }

71
Support / Error: out of memory
« on: March 27, 2006, 08:14:46 pm »
hello, maybe you can show us your JPCT code if it s not copyrighted (or some parts only if too big).
Currently i have no clue on your problem.

Manu

72
Projects / Technopolies
« on: March 24, 2006, 01:53:55 am »
Yes very sad news, I wish the best for you and your family. Here also in Canada, we hear about the situation in your country daily and for what i have heard, many governments, the OCDE and other international organisms are also watching it carefully. Best luck for the next days and hope to see you soon here after the happy ending.

Manu

73
Support / Error: out of memory
« on: March 22, 2006, 06:39:39 pm »
Hello Melssj,

Are you sure you dont  create more than one version of the same object? I mean the garbage collector works with weak pointers to determine which memory for which object can be reallocated. If there are no more reference on an object, the value of the pointer for this object is changer and this object will be put in the list of the garbage collector but if there is at least one reference (for example if you keep it in a collection), the garbage collector will never be able to liberate the memory.

I think it must be something like that... but as Egon notices it s very difficult to determine where this error is provoked.

Manu

PS : maybe you can look in your code where you call "new" and see if it s really necessary.

74
Support / Error: out of memory
« on: March 22, 2006, 07:54:29 am »
Hello,

Try using the option -Xmx of java like :

java -Xmx256m Bob  // if your main method is in Bob.class

the value after -Xmx refers to the size of memory that will be allocated to the  virtual machine process (here 256 meg....  but you can also specify a number of meg without using the suffixe m like java -Xmx100000000 Bob).

Manu

PS: of course, if needed don t forget other options like -cp or -D

75
Support / referencing or copying???
« on: March 20, 2006, 05:51:20 am »
Hello,

Concerning your problem, when programming on network, there should not be direct reference between objects in the server and client sides unless you clearly mention it (and in fact, if feasible - and i m not sure of it in JAVA at least- I don't see the usefulness of such a thing in this case...)
In your case, you must keep in mind that JAVA uses a garbage collector so it s sometime difficult to determine when the memory is effectively cleared... And maybe your problem doesn t concern memory allocation. A piece of code concerning the client and server communication methods (and also your method to delete World) could help understand what your problem is.

Manu

PS: i m also unsecure about the fact of having a World object on the server side if your topology is a classical server <--> clients. Why not just having the World object on the client side and sending updates of the game/application logic as processed by the server side in order to create/delete/update objects in the world of the clients side? In general, the 3D environment is rendered only on the client side. But maybe your application has some specificities that needs it also on the server side. Hope this helps  :?

Pages: 1 ... 3 4 [5] 6 7 ... 9