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
Ball friction (that time of year again?)
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Does Python 2.5 work with AS3? Post :: Post clientset.h What is override  View next topic  
Author Message
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Wed Mar 05, 2008 10:13 am    Post subject: Reply to topic Reply with quote

Split by Smong at March 6, 2008, 9:38 am

ball friction formula eh...

brb icon_wink.gif
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
tcsoccerman
Server Help Squatter


Age:32
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Wed Mar 05, 2008 4:11 pm    Post subject: Reply to topic Reply with quote

i suppose you wouldn't need the formula if you were recording. just wait until the next frame to display the powerball position. or did i miss something?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Dr Brain
Flip-flopping like a wind surfer


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

PostPosted: Wed Mar 05, 2008 4:31 pm    Post subject: Reply to topic Reply with quote

You missed something.
_________________
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
tcsoccerman
Server Help Squatter


Age:32
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Wed Mar 05, 2008 4:58 pm    Post subject: Reply to topic Reply with quote

ok.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Wed Mar 05, 2008 5:02 pm    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
You missed something.
lol


Did anyone made real attempts to figure out that ball formula?
With some modifications on Bak's auto-fighting bot, I believe I could make it follow the ball on radar, and then I could get values of position vs time. Try that with different friction values, pull out some equations, and solve... Could throw out a few different equation forms, and see which one fits the best. If it's not linear, the most probable thing is an exponential, which could be solved from a differential equation (i.e. loss of speed is proportional to speed, much like the air resistance when something falls down).

If I'm wasting my time and this has already been tried, tell me... But I never read anything about that, so...
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


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

PostPosted: Wed Mar 05, 2008 8:20 pm    Post subject: Reply to topic Reply with quote

it's not linear and it's not exponential. Arnk has a nice spreadsheet floating around somewhere, or if you look in really old topics you'll see some of my spreadsheets.

using the pixel radar thing won't be very accurate since that bot only gets a few frames/second not to mention the radar is very coarse.

samapico, i'd say go for it, and if you succeed you will have trumped us all proving that you are the superior human being
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Wed Mar 05, 2008 9:03 pm    Post subject: Reply to topic Reply with quote

well, I thought maybe with a good radar zoom factor, it could be relatively accurate...

I'll try to find these spreadsheets tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


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

PostPosted: Wed Mar 05, 2008 10:44 pm    Post subject: Reply to topic Reply with quote

http://rshl.org/akd/balls.xls



balls.xls - 44.5 KB
File downloaded or viewed 27 time(s)
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Wed Mar 05, 2008 11:51 pm    Post subject: Reply to topic Reply with quote

whoah... it really is a step function :/
fecking weird
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Mar 06, 2008 1:12 am    Post subject: Reply to topic Reply with quote

ok...

in 1 millisecond, speed is reduced by [something that depends on speed]:

newspeed -= (currentspeed/1000)+1

currentspeed/1000 + 1 cannot be larger than 4 apparently


Here's something that 'could' maybe work..didn't test it or anything yet
Code: Show/Hide

int ballspeed(int initialspeed, int time)
{
while (time > 0)
{
   int factor = min(initialspeed/1000 + 1, 4);
   if (time*factor > 1000)
     initialspeed -= 1000*friction;
   else
     initialspeed -= time*factor*friction;
   time -= 1000/factor;
  }
  return initialspeed;
}


(feel free to split this whole ball thing topic if needed)


it doesn't really work how I want it to.. but anyway.. the idea is to take away the speed , 1000 units at a time. And "use" a part of the time each time. Taking away 1000 units of speed between 3000 and 4000 "uses" less time than between 2000 and 3000...
I'm kinda tired so my brain can't properly code that...
In theory, if you put that in Bak's excel, and ask for the newspeed of every initialspeed with a time of (the time given), it should give close to 0 for all of them

Also, it's probably possible to simplify it a lot tongue.gif I don't really think Priitk would have cared to make a while loop for that kind of thing tongue.gif Could probably be done with a single substraction


Last edited by Samapico on Thu Mar 06, 2008 3:20 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Mar 06, 2008 12:50 pm    Post subject: Reply to topic Reply with quote

Here's one of the older threads:
http://forums.minegoboom.com/viewtopic.php?t=2747

On page 2 there's a claim the formula is found. But there's 2 more pages arguing over it.
_________________
ss news
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Mar 06, 2008 3:15 pm    Post subject: Reply to topic Reply with quote

I didn't see any realistic formula in there... just theories based on 1 or 2 numbers tongue.gif

The formula above is very ugly... however, if the speed if modified every tick, then it's pretty easy:

Code: Show/Hide
void UpdateBall()
{
   ball.x += ball.xspeed; //kind of... gotta convert this from pixels/10seconds to pixels/Tick actually
   ball.y += ball.yspeed; //same here

   ball.xspeed -= (ball.xspeed/1000 + 1)*friction;
   ball.yspeed -= (ball.yspeed/1000 + 1)*friction;

   //Of course, it needs to check for bounces...
   if (Xcollision)
      ball.xspeed = -ball.xspeed;
   if (Ycollision)
      ball.yspeed = -ball.yspeed;
}


This is still a theory, since I only had the data for friction = 1... Bak, do you still have that module that made you get those values in your excel sheet? Could it be re-done for different friction values? And possibly with even more ball speed... The fact that the ball doesn't behave the same over 4000 is intriguing me; I'd like to see what happens with very high speeds.
Basically, the faster the ball is, the more speed it loses

Would be nice to have a way to compare a model with the real thing too. Like the module could drop mines following the path of the model at the same time as the real ball travels.



It's quite simple to come to this conclusion with the data Bak posted

Code: Show/Hide

Speed Time   dTime/dSpeed
960    960   1
980    980   1
1000   1000   1
1020   1010   0,5
1040   1020   0,5
1060   1030   0,5

We can see that the ball takes 10 ticks to go from 1020 to 1000 speed, and then it takes 20 ticks for 20 speed units all the way to 0.
The exact same thing happens every 1000 speed. Except after 3000 it seems to be a constant 4 <speedunits> / millisecond

One question though... if all values are integers, how would a ball of speed=1 move if (speed/1000) is added every millisecond (or /100 if a tick is 1/100th of second).

EDIT: I wrote milliseconds almost everywhere... just realised they were hundreths of seconds icon_sad.gif
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Mar 06, 2008 4:01 pm    Post subject: Reply to topic Reply with quote

EDIT2:

Seems like there is no "limit" on the "ballspeed/1000" thing actually...

Just threw a ball with 20000 speed, and it seems to match the model I put up above. With speed being reduced of 20 every tick between 19000 and 20000.
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Mar 07, 2008 3:18 pm    Post subject: Reply to topic Reply with quote

Samapico wrote:
Code: Show/Hide
void UpdateBall()
   ball.xspeed -= (ball.xspeed/1000 + 1)*friction;
   ball.yspeed -= (ball.yspeed/1000 + 1)*friction;
}

This will make the ball eventually travel up and left. And your + doesn't take into account if the ball speed is positive/negative.

Also isn't it nicer to say something like "friction + (ball.xspeed * friction) / 1000", that way you avoid integer rounding errors.

----

Very rough calculations on "(ball.xspeed/1000 + 1)*friction"
Default svs: friction = 12, ball fire speed = 2500
Assume ship is stationary and not facing a diagonal direction.

2500 / 1000 * 12 = 30 (ignoring the + 1 for now)
2500 / 30 = 83 (I know this is lower than the actual figure if you calculate all the iterations, but it gives a ball park figure)

Looking at approx 1 second for the ball to stop using that formula. However you can see in cont it actually takes around 7 seconds for the ball to stop.

----

Also looking at my rearranged form:
(ball.xspeed/1000 + 1)*friction -> friction + (ball.xspeed * friction) / 1000
You can see it cannot work because you are always applying a minimum of friction, which if it was 12 and applied at 100 times a second thats 1200. Imagine a 2500 speed ball, 2500 - 1200 = 800, max(800 - 1200, 0) = 0 the ball would stop dead in less than 2 seconds instead of gradually slowing to a stop.

Edit: more disproving.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Fri Mar 07, 2008 4:55 pm    Post subject: Reply to topic Reply with quote

Yeah I noticed several mistakes in what I posted above too tongue.gif I never said it was really working either; Was just throwing out what I found out.

The *friction are very theoric too, since I only used the data with a friction = 1, so I have no idea what in the equation will change with different friction values... So for now I'm only working with friction=1. A possibility would be that sqrt(fraction) would be part of the formula...

Also, the function dSpeed/dT is clearly in steps... However, it's not 1,2,3,4 as I said before. I was kind of tired when I wrote that...
Speed ; dS/dT

[ 0 ; 1000] ; 1
[1000, 2000] ; 2
[2000, 3000] ; 6
[3000, 4000] ; 8
[4000, 5000] ; seems to average at 8 too
[5000, ... ] ; no data, but I'm pretty sure it goes higher than 8

...Can anyone figure out some kind of series that can do 1,2,6,8 ?? (and ideally, 1,2,6,8,8 )
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Mar 07, 2008 5:11 pm    Post subject: Reply to topic Reply with quote

Samapico wrote:
So for now I'm only working with friction=1.
I think you should be looking at a range of frictions. I don't know if you can assume friction=2 is the same as "apply the friction=1 code twice as often".
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Fri Mar 07, 2008 5:20 pm    Post subject: Reply to topic Reply with quote

Also, when I write ballspeed/1000, I assume integer divisions. For example, 2999/1000 = 2. That's how C++ does it (by default).

Quote:
2500 / 30 = 83 (I know this is lower than the actual figure if you calculate all the iterations, but it gives a ball park figure)

Looking at approx 1 second for the ball to stop using that formula. However you can see in cont it actually takes around 7 seconds for the ball to stop.
You must understand that as the ball slows down, the loss of speed will also decrease. And as I said in the above post, the formula wouldn't really look like that anyway
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Fri Mar 07, 2008 5:20 pm    Post subject: Reply to topic Reply with quote

Smong wrote:
[..]

I think you should be looking at a range of frictions. I don't know if you can assume friction=2 is the same as "apply the friction=1 code twice as often".


Quote:
A possibility would be that sqrt(fraction) would be part of the formula...

Got to make the formula work with a friction of 1 first...
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Fri Mar 07, 2008 6:31 pm    Post subject: Reply to topic Reply with quote

So far, it seems to work relatively well with the airtime... i.e. the time before the ball reaches a speed of 0. However, there is something I don't understand in the distance travelled...


Code: Show/Hide

Init.Speed    Dist  Airtime
2000          1251  15000
2060          1288  15100

Speed is in px/10s, Distance is in px, Airtime is in ms.

If you travel at 2060 px/10s during 100ms, you should travel a total of:
2060/10000 * 100 = 20.6 pixels.
Right? Divide by 10000 to get pixels per milliseconds, then multiply by the number of milliseconds. (It would be a bit less, because speed goes down from 2060 to 2000 during that time, but let's forget about that).

However, in Bak's data, the additionnal 100ms of flying at ~2060speed added 37 pixels... Almost twice as much as expected. WTF?
The same thing happens throughout the whole data... Because of this, the distance travelled shown by my simulator is always much lower than in the datasheet.
However, I'm assuming that a ball fired at 2060 will act the same as a ball fired at 2000 once it reaches the speed of 2000. This shouldn't be a problem, unless the formula includes something about the InitialSpeed. It would be very surprising and stupid, but... :/
Is there anything I don't understand in the relation between speed and distance? I mean... it should work like a simple ship right?


Here's Bak datasheet with some comments and additional calculated data




ballfriction.xls - 100.5 KB
File downloaded or viewed 24 time(s)
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


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

PostPosted: Fri Mar 07, 2008 10:19 pm    Post subject: Reply to topic Reply with quote

in case the "akd" in the url wasn't a give-away, that's arnk's data sheet so you'll have to bug him for the module (although I did make quite a few bots to measure it when I was after this grail)
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Fri Mar 07, 2008 11:04 pm    Post subject: Reply to topic Reply with quote

oh... lol thought it was all yours tongue.gif sorry
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Mar 09, 2008 12:11 pm    Post subject: Reply to topic Reply with quote

http://www.youtube.com/watch?v=eoICmuwghDQ $$
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Doc Flabby
Server Help Squatter


Joined: Feb 26 2006
Posts: 636
Offline

PostPosted: Sun Mar 09, 2008 12:17 pm    Post subject: Reply to topic Reply with quote

Does PSpace ever work out the ball friction?
_________________
Rediscover online gaming. Get Subspace | STF The future...prehaps
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Mar 09, 2008 12:17 pm    Post subject: Reply to topic Reply with quote

Pretty much the same problem as me it seems... the deceleration takes the same time, but less distance is travelled
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Mar 09, 2008 12:19 pm    Post subject: Reply to topic Reply with quote

Doc Flabby wrote:
Does PSpace ever work out the ball friction?
No I checked that. There is some commented out code that applies friction as a percentage of the current speed.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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: 618 page(s) served in previous 5 minutes.

phpBB Created this page in 0.744987 seconds : 52 queries executed (89.9%): GZIP compression disabled