Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: Mathmatical AI vectory question? [Re: Error014] #206720
05/15/08 09:24
05/15/08 09:24
Joined: Nov 2004
Posts: 862
Australia
DavidLancaster Offline OP
User
DavidLancaster  Offline OP
User

Joined: Nov 2004
Posts: 862
Australia
Originally Posted By: Error014
Quote:
Your first attempt Error014 really confused me, I don't think it needs to be complex but you gave me the basic idea of calculating where the ball and player will be.


frown I'm sorry for confusing you, but math-wise, that approach should be pretty okay, I think! Maybe if you could put your confusion into specific questions, I could help you?

Honestly, it's actually not that hard. If you understand the graphics and the general concept, you can pretty much take the rest for granted, as thats just "putting it in math-speak" and then getting the proper conditions for "t". I know that it looks confusing, but isn't it at least worth a try? You just need to convert the last line into script (by which I mean: replace "|v_b|" with "vec_length(v_b)", and "x²" with "x*x"), but then, you should have a working piece of code!

It's not a guarantee, mind you, but I still don't see a rpoblem with the math, and I do think that its worth a try. We can try simplyfing it when we find that it works generally.


Found some time to test out your code error, couldn't get it to work, thanks for all your effort.

Let me know if you see anything wrong with the code:
Code:
			my.time_to_ball = (sqrt(-pow(ball_ent.x,2) * (pow(ball_velocity.y,2)-pow(vel_p,2))+ 2*ball_ent.x*(ball_ent.y*ball_velocity.x*ball_velocity.y + my.x*(pow(ball_velocity.y,2) - pow(vel_p,2)) - my.y * ball_velocity.x*ball_velocity.y)-pow(ball_ent.y,2)*(pow(ball_velocity.x,2)-pow(vel_p,2)) - 2*ball_ent.y*(my.x*ball_velocity.x*ball_velocity.y-my.y*(pow(ball_velocity.x,2)-pow(vel_p,2))) - pow(my.x,2)*(pow(ball_velocity.y,2)-pow(vel_p,2))+ 2*my.x*my.y*ball_velocity.x*ball_velocity.y - pow(my.y,2)*(pow(ball_velocity.x,2)-pow(vel_p,2))   )       - pow(my.x,2)*(pow(ball_velocity.y,2)-pow(vel_p,2)) + 2*my.x*my.y*ball_velocity.x*ball_velocity.y - pow(my.y,2)*(pow(ball_velocity.x,2)-pow(vel_p,2))  );


Re: Mathmatical AI vectory question? [Re: DavidLancaster] #206797
05/15/08 18:59
05/15/08 18:59
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Uhm. Well. Err.

Okay, so I had to trick the forum by clicking on "Quote", just so I got the complete line.

I then tried to check it and got confused about a billion times. I think there was a mistake, though, but I can't be sure.

I did a quick Replace on it on Notepad .... probably the same you did .... and this is what I got. I'm not putting it in code-tags since that will cut part of the line.


(sqrt( - pow(ball_ent.x,2) * (pow(ball_velocity.y,2)-pow(vel_p,2)) + 2*ball_ent.x*(ball_ent.y*ball_velocity.x*ball_velocity.y + my.x*(pow(ball_velocity.y,2) - pow(vel_p,2)) - my.y * ball_velocity.x*ball_velocity.y) - pow(ball_ent.y,2)*(pow(ball_velocity.x,2)-pow(vel_p,2)) - 2*ball_ent.y*(my.x*ball_velocity.x*ball_velocity.y-my.y*(pow(ball_velocity.x,2)-pow(vel_p,2))) - pow(my.x,2)*(pow(ball_velocity.y,2)-pow(vel_p,2)) + 2*my.x*my.y*ball_velocity.x*ball_velocity.y - pow(my.y,2)*(pow(ball_velocity.x,2)-pow(vel_p,2)) ) - ball_ent.x*ball_velocity.x - ball_ent.y*ball_velocity.y + my.x * ball_velocity.x + my.y*ball_velocity.y )/(pow(ball_velocity.x,2)+pow(ball_velocity.y,2)-pow(vel_p,2))


Huh.

I assumed:

s_b = ball_ent.x
s_p = my.x
v_p = A positive number holding the length of the velocity-vector of the player (i.e., how fast can he run)
v_b = ball_velocity.x

If its not working, it might be because one of those values is wrong...

(or maybe we're leaving acknex variable-range)

No idea if its true, no idea if its going to work. A computer actually solved that mathematical line for me. I only thought up the approach.


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: Mathmatical AI vectory question? [Re: Error014] #206914
05/16/08 14:17
05/16/08 14:17
Joined: Apr 2008
Posts: 235
TEXCOORD3
Foxfire Offline
Member
Foxfire  Offline
Member

Joined: Apr 2008
Posts: 235
TEXCOORD3
Just use simple calculus:
set the players direction to a Euler angle equal to dy/dx of the ball's path.
Can't get easier than that.

Last edited by Foxfire; 05/16/08 14:18.

http://www.groundtacticsgame.com/
Alienware m17x R Custom laptop
specs:
Intel Core 2 Extreme Quad CPU Q9300
2x Nvidia 280GTX 2GB vram
6GB ddr3 memory@ 1333Mhz
512GB SSD
1200p 17' screen
runs Crysis Warhead on max settings at 1200p at 90 fps
Re: Mathmatical AI vectory question? [Re: Foxfire] #214558
07/05/08 11:19
07/05/08 11:19
Joined: Nov 2004
Posts: 862
Australia
DavidLancaster Offline OP
User
DavidLancaster  Offline OP
User

Joined: Nov 2004
Posts: 862
Australia
Originally Posted By: Foxfire
Just use simple calculus:
set the players direction to a Euler angle equal to dy/dx of the ball's path.
Can't get easier than that.

That sounds easy, I'd have no idea how to code that though, any ideas? Thanks!

Re: Mathmatical AI vectory question? [Re: DavidLancaster] #214615
07/05/08 18:49
07/05/08 18:49
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
i have coded a solution but it wont work because i use a linear ball speed...
(EDIT: and my solution is still unfinished yet)

Last edited by Puppeteer; 07/05/08 18:50.

Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: Mathmatical AI vectory question? [Re: Puppeteer] #214633
07/05/08 22:22
07/05/08 22:22
Joined: Nov 2004
Posts: 862
Australia
DavidLancaster Offline OP
User
DavidLancaster  Offline OP
User

Joined: Nov 2004
Posts: 862
Australia
Linear ball speed is fine, better than nothing smile Can't wait to test it!

Re: Mathmatical AI vectory question? [Re: DavidLancaster] #214691
07/06/08 13:01
07/06/08 13:01
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Originally Posted By: DavidLancaster
Linear ball speed is fine, better than nothing smile Can't wait to test it!

it will definitely work but i just have some math problems :-D


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Page 3 of 3 1 2 3

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1