Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Warping multiple times in a specific radius
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Buy.ini Post :: Post Football source up for grabs....  View next topic  
Author Message
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Mon Sep 12, 2005 9:32 pm    Post subject: Warping multiple times in a specific radius Reply to topic Reply with quote

How would I specify a certain number of tiles to warp randomly in on a command?

Like...



Just tell me how to specify the radius in this case, please..
I want to try to code the rest myself..

TY in advance...
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Mon Sep 12, 2005 9:39 pm    Post subject: Reply to topic Reply with quote

I dont think you explained it very well, but if you want it to be warped somewhere randomly within that region, you need to come up with a way to check if a point is in it. For a square it would be much easier, just get a random x between x1 and x2, and likewise for y. Or, you could specify a center tile and add or subtract a random amount of tiles within 0 and the radius.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Mon Sep 12, 2005 10:01 pm    Post subject: Reply to topic Reply with quote

I mean.. like... I do want to make it square.. So you're saying to get a random number? and then how would I specify the coords around the random number?

What command in other words.. I can get a random number, but how could I tell the bot what coords are around the number i specified? Is that a good enough explaination?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:41
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Mon Sep 12, 2005 10:28 pm    Post subject: Reply to topic Reply with quote

If you want to pick a random spot inside of a circle, you choose two random values. One value is anywhere between 0 and the radius of the circle. The next value is anything between 0 and 2*pi. Now, using trigonometry, convert those polar coordinates into rectangular. Then add those X and Y values to the center point of the circle.

To help you learn this, I'll leave out the math for converting polar to rectangular. Use google or a math book to work that one out.
Back to top
View users profile Send private message Add User to Ignore List Send email
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Mon Sep 12, 2005 10:47 pm    Post subject: Reply to topic Reply with quote

k ty.. lol i never took this before except basic trig tongue.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Mon Sep 12, 2005 11:03 pm    Post subject: Reply to topic Reply with quote

jeeeeeeeeeeeeeeeeeeeesus this math is crazy.... this must be like advanced trig.. wtf loll... i'll get through it
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Mon Sep 12, 2005 11:49 pm    Post subject: Reply to topic Reply with quote

I suggest going with a square for now which will be much easier until you learn the polar to rectangular coordinates...

Get two random numbers between your radius and the negative value of your radius, then just add one to the x-coord and one to the y-coord and you've got a random spot in the square.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
SamHughes
Server Help Squatter


Joined: Jun 30 2004
Posts: 251
Location: Greenwich
Offline

PostPosted: Tue Sep 13, 2005 12:05 am    Post subject: Reply to topic Reply with quote

Mine GO BOOM wrote:
If you want to pick a random spot inside of a circle, you choose two random values. One value is anywhere between 0 and the radius of the circle. The next value is anything between 0 and 2*pi. Now, using trigonometry, convert those polar coordinates into rectangular. Then add those X and Y values to the center point of the circle.

To help you learn this, I'll leave out the math for converting polar to rectangular. Use google or a math book to work that one out.


This method isn't very evenly distributed. Provided your values in [0, r) and [0, 2*pi) are evenly distributed, a given area at distance x from the center will get twice as many 'darts' as an equally sized area at distance 2x from the center.

If an even distribution mattered (I actually like your distribution better, but I might as well mention...), I'd use rectangular coordinates where x ranges in [-r,r] and y ranges in [-r,r] and pick random coordinates until x*x + y*y < r*r.

MGB's distribution gives an average radius of r/2, with a denser distribution near the center point, while the even distribution gives an average radius of 2r/3.
Back to top
View users profile Send private message Add User to Ignore List
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Tue Sep 13, 2005 7:32 am    Post subject: Reply to topic Reply with quote

Smart.

Last edited by Quan Chi2 on Tue Sep 13, 2005 9:35 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Tue Sep 13, 2005 9:42 am    Post subject: Reply to topic Reply with quote

no we're not. It's the pathagareon theorm (distance formula). r = sqrt(x^2 + y^2). All he did was sqaure both sides to speed up calculating it on the computer (r^2 = x^2 + y^2)
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Tue Sep 13, 2005 3:52 pm    Post subject: Reply to topic Reply with quote

lol i learned that! :d last year i didnt think that i would ever have to use it again :/
pfft lol
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Tue Sep 13, 2005 3:55 pm    Post subject: Reply to topic Reply with quote

k now what commands/functions am i using here? I have to get a radom number, that I know.. but what other commands am i using? I saw the antiwarp src on Distort's site.. and it said 'radius'.. will i have to use something like that? is radius a built in command?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Tue Sep 13, 2005 3:57 pm    Post subject: Reply to topic Reply with quote

no you'll have to use variables. Find a good c++ reference online or in book form.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Tue Sep 13, 2005 8:59 pm    Post subject: Reply to topic Reply with quote

k icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Tue Sep 13, 2005 10:31 pm    Post subject: Reply to topic Reply with quote

I'll have to include the math header file right?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Tue Sep 13, 2005 11:26 pm    Post subject: Reply to topic Reply with quote

for what?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Wed Sep 14, 2005 12:15 am    Post subject: Reply to topic Reply with quote

i dunno... im trying to figure out how to make exponents in the code lol.. im reading C++ for dummies biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
SamHughes
Server Help Squatter


Joined: Jun 30 2004
Posts: 251
Location: Greenwich
Offline

PostPosted: Wed Sep 14, 2005 12:56 am    Post subject: Reply to topic Reply with quote

You don't need exponents to square a number.

What would you need exponents for? Anyway, if they're double-precision approximations of numbers, you'd use the function pow; if they're integers, you could make your own function if you wanted.
Back to top
View users profile Send private message Add User to Ignore List
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Wed Sep 14, 2005 7:30 am    Post subject: Reply to topic Reply with quote

k ty
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Wed Sep 14, 2005 5:45 pm    Post subject: Reply to topic Reply with quote

um...

int radius;
Sqrt (4*4) + (3 * 3);/*Pythagorean Theorem read from a website*/


i have a strong feeling that im doing this wrong :/
I don't mean to be annoying.. i've just never done this before :/ Im looking through references though.

I'll learn by trial and error I guess.. But am I doing it wrong?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Sep 14, 2005 5:46 pm    Post subject: Reply to topic Reply with quote

In a word, yes.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Wed Sep 14, 2005 6:04 pm    Post subject: Reply to topic Reply with quote

yesss biggrin.gif wait.. noooo... Wait you mean its correct? or is it not?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Wed Sep 14, 2005 6:10 pm    Post subject: Reply to topic Reply with quote

Not.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Sep 14, 2005 7:01 pm    Post subject: Reply to topic Reply with quote

Quan Chi2 wrote:
yesss biggrin.gif wait.. noooo... Wait you mean its correct? or is it not?


You asked if you were doing it wrong. I said yes. Draw your own conclusion.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Wed Sep 14, 2005 9:31 pm    Post subject: Reply to topic Reply with quote

lol k
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 15 page(s) served in previous 5 minutes.

phpBB Created this page in 0.457983 seconds : 49 queries executed (92.5%): GZIP compression disabled