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 - Melssj5

Pages: 1 2 3 [4] 5 6 ... 49
46
Support / Re: Problem with shooting
« on: November 18, 2008, 05:33:00 pm »
mm I am doing a new Date ().getTime () for each movement to get the time and then print a message for each bullet, this is for logging only, I guess I will need to redefine my solution for this problem. I will post any results by the next week.

BTW: NICE APPLET. Was LOL!

47
Support / Re: Problem with shooting
« on: November 17, 2008, 11:33:39 pm »
mmmmmm, now I understand what you told me before. Accuracy is still a problem in some cases but I guess its a great suggestion. I will implement them as soon as I can work on the project again. I will post the results later.

I will joing the 3 methods, EGon, Pauls and creating Threads for moving the bullets, but instead of doing on thread for each  bullet I will create 3 Threads for that and distribute the amount of living bullets into those 3 Threads.

48
Support / Re: Problem with shooting
« on: November 17, 2008, 11:06:15 pm »
mmmmmm doing that algorytm would work only for cases when the bullets is already ver close to the target, remember that the bullets moves independent from the ships, so until the collision is done, anything can happen. That algorythm may work on the 1% of cases and could make wrong results on a higer percentage. I guess, I have not done any statuctucal work on the bullets.

49
Support / Re: Problem with shooting
« on: November 17, 2008, 04:19:35 pm »
mmm, do you mean having a relation between the whole bullets moving time and the movement distance for each bullet???? Then when they are few bullets I will need to move then and lower speeds to have the same behavior than moving faster when they take a larger time to move all the bullets??????

The problem on that is the precision and collision detection, doing the bullets jumping large distances will make them look bad on the game and will avoid doing a correct collision detection. I am talking about 350 ms for moving 40 bullets, so I guess that a normal game may have more that a hundred alive bullets on the fly, so having 1 sec for moving all the bullets will make that bullets moves at huge speeds. Anyway I will try it to see is it helps.

50
Support / Re: Problem with shooting
« on: November 17, 2008, 03:22:48 pm »
I havent try it yet, but I am running into a performance problem I would like to fix first.

The client had 3 Threads.

1.- rendering Thread
2.- Event managment and networking Thread
3.- Bullet moving Thread (a while loop moving all bullets one by one)

When they are a few bullets, the performance is good, but when they are many alive bullets then the performance goes to the hell. I mean more than 20 alive bullets.

The ship movement was the same but the bullets began to move too slowly. It was becausse the bullets moves one by one inside a while loop. So the more bullets they are, the slower they will move.

After that I created a separate Thread for moving each bullet But now I am having a global performance problem and I am afraid that having hundreds of Threads inside a single process will bring me some problems. Now all Threads are slowly and the processor usage goes to 100%:

1.- rendering Thread
2.- Event managment and networking Thread
3.- Bullet moving Thread (a while loop checking all bullet movement one by one)
4, 5, 6, 7......... A ShotMoving Thread (Moving the bullet and sleeping 40 ms)

I guess that this is happening because the processor is always being used. Maybe I should sync all the bullets movement to have a sleep on the same moment to let the rendering and event managment threads to use the processor, but I dont know. Any ideas?

51
Feedback / Re: Barcode generation for J2me
« on: November 14, 2008, 03:25:09 pm »
Hi, I checked JBars but it uses a servlet to generate the label and then just send it. Is not what I needed. I already checked the mail, and thanks a lot for that piece of code, I will use it later becausse the project is delayed by the customer so the emergency passed.

52
Feedback / Re: Barcode generation for J2me
« on: November 12, 2008, 08:26:15 pm »
Can I pass to your office so you can lend me the document? Or can you please post it!  :o

53
Feedback / Re: Barcode generation for J2me
« on: November 11, 2008, 11:14:10 pm »
I was reading but had no luck finding a good doc.  Now I downloaded a code 39 font and I am trying to get the images for each char and pass it to paint, but I am afraid it wont result. :S

Any recomended tutorial for it?

54
Feedback / Barcode generation for J2me
« on: November 11, 2008, 09:33:23 pm »
Hi, This is a not jpct related question, but feeback says: ANYTHING THAT WONT FIT IN THE OTHER FORUMS.   :o


Does anybody know an API to generate barcode images from a given 13 digits number in j2me.

I have been reading with no luck.

55
Support / Re: Problem with shooting
« on: November 11, 2008, 08:14:14 pm »
Thanks. ;D

And Yes, it may happens when the bullet or the ships moves  at great speeds, especially when they move one to each other, it may happen that. I should consider doing on that way having a max speed for a bullet considering the ship size/speed and the bullet size/speed!

56
Support / Re: Problem with shooting
« on: November 11, 2008, 05:35:41 pm »
Yes, I know that perfectly. But is about the target detection. In figure 3 the collision will be detected on the collisionListener on the ship, but the source will be the ship and the object will be ship too. In the another post before you told me that I must wait until the next bullet movement to get the next collision detection to have the objects needed to work but on the pic I am trying to show a case in which the collision is only made by the ship movement and not by the bullet movement. It was my fault to writte "NO DETECTION CASE" instead of "USELESS DETECTION CASE".

Egon, would be very very very difficult and imposible to add a:

 Object3d [] getTargets () {

 }

method??????

Sorry for being a pain in the ass!  ::)

57
Support / Re: Problem with shooting
« on: November 11, 2008, 04:25:26 pm »
Quote
If the ship moves into a bullet during the ship-move-phase, it doesn't matter, because in the next bullet iteration, the collision will be detected anyway



Yes, I was thinking on that too, but the problem is that it requires 2 movements to detectc the collision and that may result on a no detection on cases in which the bullet speed is too high. For example. (This can always happens but detecting on every movement reduces the posibilities)


58
Support / Re: Problem with shooting
« on: November 11, 2008, 03:31:27 pm »
Well, I am afarid I do not understand well what you said.

I added a new CollisionListener to each ship and bullet and the lag went to the hell, I will try what you say. but:

Quote
Not quite...if you attach the listener to the ship and the bullet moves, getObject() returns you the target,

And what if: if you attach the listener to the ship and the ship moves then getObject() returns you the target??????????

the problem is that both are moving, the bullet and the ship. first all the ships and then all the bullets, not on different Threads but anyway any of both can fire the collision.

Can you give a example about what you said before becausse I didnt quite understood.

59
Support / Re: Problem with shooting
« on: November 10, 2008, 07:07:57 pm »
Ok, I could add the listener to the ship too, but it wont change anything in that problem becausse I wont be able to know if the ship collided with an own bullet or with another one becausse Iwont be able to recognize the target. Of course that from one collision, one is the source and the another one is the target, but I cant relationate on event with the another one. Or does the Collision event has a unique numer to match?????

in my Thread. I first move all the ships, one to one, and then I move the bullets, ont to one.

But lets imagine this:

case1: Listener on the ship
Ship 1: moves and collides with Bullet 1 (I know there were a collision so I can remove the bullet from the world, and reduce the life of that ship, but as I dont know the target I cant know the kind of bullet to know: how much life to reduce and who shoted?????? and I cannot do the check for not colliding with its owner) Source: Ship1

or this another one case:

case2: Listener on the bullet
Bullet 1 moves and collides with Ship 1 (I know there were a collision so I can remove the bullet from the world and I know how much life to reduce from the target if it was a ship, but as I dont know the target I cant know the ship so I cant reduce the life to anybody and I cannot do the check for not colliding with its owner) Source: Bullet1

case3: Listener on Both, all ships and all bullet
Bullet1 moves and collide ship1 (Cant know which ship was afected becausse I cant know the target) Source Bullet 1.

I have a BulletListener class that is the collisionListener for all the Bullets, Maybe I would have to use a new CollisionCHecking class for each ship on both CLIENT and SEVER sides.  On that way I can solve the problem on case 3. I guess the only way to do it is to have exclusive Collision Checking instances for each bullet and ship in the world.
That class will hava a reference to the object, so when a collision happens I can know the objects involved. (I dont care about who was source or target, I just care about the objects involved).

Wouldnt this increase the resources needed or maybe generate a bit of lag, having a new class for each object3d?


60
Support / Problem with shooting
« on: November 10, 2008, 04:06:18 pm »
Hi again yesterday I coded a bit again on my project and I am having problems with this again. My problem is this one:


I create the bullets, set the collision mode and add a COlisionListener to them, on the client side, I move them until reaching an obstacle and then I drop the bullet from the world. My problem is, that as the bullet is shot from the craft position then it collides with their owner craft and are never shot.

I thouht about saving some information on the Bullet class to determine with craft shot it and avoid that collision to stop the bullet, but I cant determine this.

The bullet class has a String with the craft name, but when the collision is done I cant determine which object was the target of the collision generated by the bullet, so I cant know if it was the own craft or another object3d.

Would be very usefull to add a getTarget method on the CollisionListener / CollisionEvent becausse there are things that cant be done with the getSource. The getTarget should return an array with all the targets. and basicly the problem is that crafts and bullets move on the client. So, sometimes the source can be the bullet and in some other cases the source can be the craft, But I must check on somehow who was hit by a bullet. Any ideas about how to sove this?????

Pages: 1 2 3 [4] 5 6 ... 49