Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / A Tank That Looks Where It Is Going

Author
Message
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Aug 2011 23:26
I've made a tank as a Neural Network. It needs to turn its turret to look where it is going. My tank is one object with limbs. The turret is a limb. Inside the turret are two spare limbs for direction.

One of the limbs is in the centre of rotation.. limb 5.
The other limb is at the end of the barrel .... limb 3.

So from limb 5 to limb 3 is the line of sight.

Now I want to Sparky raycast from limb 5 to limb 3 and outwards with a turning turret.

Spent all day on it, and I placed cubes around to see where I am raycasting. The cubes don't go with the turret, they just move with the tank.

Thanks.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 2nd Aug 2011 23:44
Can you give a bit more info, like what input do you give the ANN, and what does the ANN output exactly? I also don't quite get why you'd ray cast from the center of the object to the end of the barrel, how does that help?

Sorry for not understanding...

TheComet

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Aug 2011 23:57 Edited at: 2nd Aug 2011 23:59
The ANN is a tank that learns to look for mines, and roll over them. The turret is its eyes. I don't want to raycast to the end of the barrel. I want to raycast past the end, and outwards. But limb 5 to limb 3 make the right direction, but not the right length. I tried Offset Limb 3, and the tank went juddery. The limb orientation is wrong.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2011 01:21
Can you draw a vector from 1 point to the next, and then have it project outwards to give you new 3d coordinates in a straight line?

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 3rd Aug 2011 04:06
^ so what's the problem?

You can get the two positions fine right? The center of rotation and the end of the barrel?

So... if you magnify the vector by some large number, everything will work out.

IE:
P1 is the center of rotation of the camera
P2 is at the end of the cannon

line P1 P3 is a line that starts at P1, intersects with P2, and then keeps going a ways
P3=(P2-P1)*100+P1

or in other words:

p3.x=(p2.x-p1.x)*100+p1.x
p3.y=(p2.y-p1.y)*100+p1.y
p3.z=(p2.z-p1.z)*100+p1.z


Why does blue text appear every time you are near?
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Aug 2011 10:21 Edited at: 3rd Aug 2011 10:36
So you are re-creating the ANN example from AI-Junkie Here's a link for everyone who doesn't know what this is about : http://www.ai-junkie.com/ann/evolved/nnt1.html

EDIT : Neuro Fuzzy has it nailed...

BUT, and here comes that but... The Smart Sweepers example uses a vector to the nearest mine, and a vector to describe the current angle as an input, not a raycast as you're using it... If I were you, I'd do it like AI-Junkie did it, not try to do something completely different.

TheComet

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2011 15:22
Quote: "So you are re-creating the ANN example from AI-Junkie Here's a link for everyone who doesn't know what this is about : http://www.ai-junkie.com/ann/evolved/nnt1.html

EDIT : Neuro Fuzzy has it nailed...

BUT, and here comes that but... The Smart Sweepers example uses a vector to the nearest mine, and a vector to describe the current angle as an input, not a raycast as you're using it... If I were you, I'd do it like AI-Junkie did it, not try to do something completely different.

TheComet"


Yeah, I started it a long time ago, but I didn't give it eyes at the time, just a distance routine. It needs eyes, because I'm building it up towards a Neural World simulator, with tanks, and armies, and stuff.


http://forum.thegamecreators.com/?m=forum_view&t=168058&b=8

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2011 15:24 Edited at: 3rd Aug 2011 15:26
Quote: "^ so what's the problem?

You can get the two positions fine right? The center of rotation and the end of the barrel?

So... if you magnify the vector by some large number, everything will work out.

IE:
P1 is the center of rotation of the camera
P2 is at the end of the cannon

line P1 P3 is a line that starts at P1, intersects with P2, and then keeps going a ways
P3=(P2-P1)*100+P1

or in other words:

p3.x=(p2.x-p1.x)*100+p1.x
p3.y=(p2.y-p1.y)*100+p1.y
p3.z=(p2.z-p1.z)*100+p1.z"


The problem was that I didn't know how to do it..lol.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2011 16:46 Edited at: 3rd Aug 2011 16:47
Still doesn't work. The cube object 10001 should be in the position 100 from gun, but it is in the middle of the tank.




DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 3rd Aug 2011 17:21 Edited at: 3rd Aug 2011 17:25
I think you just have it backwards on one of your lines so to speak. Try changing it to.

I could be wrong as I haven't tried it, but that seems more logical.
Edit- Always struggling for graphics on my projects of late, I don't suppose you would help me spruce them up a little? Don't worry most are simple, not Samurai Showdown or anything .

http://s6.bitefight.org/c.php?uid=103081
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2011 17:36 Edited at: 3rd Aug 2011 17:36
I've just tested the limb positions on screen, and they are all identical, no matter where they are placed in the tank. Not sure what has happened there. So the maths doesn't work because the positions don't work.

I'll have to have a look at your graphics to see how long it would take.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2011 18:06 Edited at: 3rd Aug 2011 18:06
I've glued objects to the tank, and now it works, apart from the raycast hardly ever gets a result.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2011 18:39
Nope.. now the glued objects aren't altering their object positions either. They rotate correctly, but always return the same object x, object z.

Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 4th Aug 2011 06:45
Try set object to camera orientation? Or maybe point object?

Set Object to Camera Orientation should have the turret rotate and follow where the mouse looks.

If i was making a tank game, id have the mouse control the look, the WASD/arrow keys control the tank, and have the body be one model and the turret be another and then looking and moving shouldnt be terribly hard after that.

Im not expert though, hope that helps a little.
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 4th Aug 2011 18:20
Something you might consider, (once you get the limb positioning correct) is to put a plane at limb 5, point it toward limb 3, and then move it however far you want. You could then raycast from limb 3 to the position where the plane is. Just a thought.

Login to post a reply

Server time is: 2026-07-10 20:58:40
Your offset time is: 2026-07-10 20:58:40