Physics metrics etc...

Talk about EVERYTHING related to Kick Off 1 + 2.

Moderator: Moderators

User avatar
Oss117
Posting is free!!!
Posting is free!!!
Posts: 117
Joined: Wed May 11, 2005 12:10 pm
Location: France
Contact:

Physics metrics etc...

Postby Oss117 » Wed May 14, 2008 3:29 pm

Hi all,

Just wanted to know more about physics applied inside the game. for example the real speed of players.

In open kick off, I have separate view from model, that means for example, when a player is running I first record the current time as start of running time, then I set the player speed to 0 from 8 (8m/s) and when the player stop I subtract the current time from the start running time to compute his new location. In fact it is computed each time requesting the player location for displaying sprite.
With all the metrics discussed already in this forum, eg. 1px -> 7.62 cm (3 inches), pitch 1392 x 914 px -> 106.0704 x 69.6468 meters, the players seems to be so slow with a speed of 8-10 ms which is a realistic speed for an human.
So what is the speed inside the game assigned to the players ?
I know that the pace is in the range of 0 - 200, but from this index how is computed the real speed ?
Is everything is computed in real value and then converted to screen value ? If yes is it computed in UK metrics or meters ?
Do we have some snippet of code about these specifics parts ? :roll:

For the ball, which is works quite well now into open kick off (very thanks to Steve :D ), it s seems to respect the normal physics and speed, but I am wondering which angle and strength is given to the ball by players when shooting, passing and for lob...

Btw, if Steve or John or others can extract the dribble routine part of code and explain how it works It would be great :mrgreen: , right now In open kick off, when the player collides with the ball, I apply the current player speed and direction, it works but need fine tunning, any helps is welcome

Code: Select all

class PlayerBallCollision extends PreciseCollisionGroup {

   public PlayerBallCollision() {
      // Check on pixels. Else we would have only rectangle CollisionShapes.
      pixelPerfectCollision = true;
    }
    protected void collided(Sprite s1, Sprite s2) {
        BallSprite b2 = (Ball) s2;
        PlayerSprite p1 = (PlayerSprite) s1;

   if (p1.getStatus() == PlayerSprite.MOVING) {
            b2.shoot(p1.direction(), p1.speed(), Math.PI/9);
        }
    }
}


Soon, I will give you an other preview of open kick off, with team and tactics enabled, it's funny you will see. The project goes slowly but I am preparing my weddings for august so all you know how it is ;)
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7511
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Re: Physics metrics etc...

Postby Steve Camber » Wed May 14, 2008 4:05 pm

Just had a quick look.

Running speed = (((PACE/4) + 180) * TeamSpeedFactor)/100

PACE = your "0-200" value
TeamSpeedFactor = 90 to 100
--
SteveC - Kick Off engineer - Ranked somewhere waaaay down the list
18 Dec 2003 - "One day I'm going to disassemble the 68000 code, and find out exactly what's going on in there!! "

Ask me about online KO2 :)
User avatar
gdh82
6000+ Poster!
6000+ Poster!
Posts: 6197
Joined: Fri May 26, 2006 8:16 pm
Location: Birmingham, England

Re: Physics metrics etc...

Postby gdh82 » Wed May 14, 2008 4:23 pm

Steve Camber wrote:TeamSpeedFactor = 90 to 100


Interesting posts, guys :)

Is this where the human speed avantage comes from ? human=100, cpu=90 ? Or even A>B ?
All the goals, the stats, the stories & more from the KO2 WC 2011 - please click here

And click here for everything you'll ever need to know about KO2!
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7511
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Re: Physics metrics etc...

Postby Steve Camber » Wed May 14, 2008 4:36 pm

Are you really doing sprite collisions?! :eeko:

KO2 ball-player collision detection is done in full 3d maths, just like modern games (although just a simplistic point vs cylinder method). Go Dino!
--
SteveC - Kick Off engineer - Ranked somewhere waaaay down the list
18 Dec 2003 - "One day I'm going to disassemble the 68000 code, and find out exactly what's going on in there!! "

Ask me about online KO2 :)
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7511
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Re: Physics metrics etc...

Postby Steve Camber » Wed May 14, 2008 4:44 pm

gdh82 wrote:Is this where the human speed avantage comes from ? human=100, cpu=90 ? Or even A>B ?

Nope, it's 90% if division 4 or else 100%. I'm guessing from other unused bits of code that it's also used to make teams more tired for one reason or another. Maybe just in PM.
--
SteveC - Kick Off engineer - Ranked somewhere waaaay down the list
18 Dec 2003 - "One day I'm going to disassemble the 68000 code, and find out exactly what's going on in there!! "

Ask me about online KO2 :)
User avatar
gdh82
6000+ Poster!
6000+ Poster!
Posts: 6197
Joined: Fri May 26, 2006 8:16 pm
Location: Birmingham, England

Re: Physics metrics etc...

Postby gdh82 » Wed May 14, 2008 4:45 pm

I see - thanks Steve.
All the goals, the stats, the stories & more from the KO2 WC 2011 - please click here

And click here for everything you'll ever need to know about KO2!
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7511
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Re: Physics metrics etc...

Postby Steve Camber » Wed May 14, 2008 4:52 pm

So from my equation.. Running speed = (((PACE/4) + 180) * TeamSpeedFactor)/100

a pace of 200 equates to a player speed of..

((200/4 + 180) *100)/100 = 230

so at 50fps, over one second the player accumulates a distance of 50*230 = 11500

Due to the 16:16 fixed point format KO2 uses, we call that 11500/65536 which is 0.1754 of our beloved ko2 units (where 1 unit = 3 inches).

Therefore a ko2 player running 100% speed in one second covers 0.1754/3 inches = 0.0585 inches = 0.148569743 centimeters

This is obviously crap.

JOHN!!?! HELP!!!!!
--
SteveC - Kick Off engineer - Ranked somewhere waaaay down the list
18 Dec 2003 - "One day I'm going to disassemble the 68000 code, and find out exactly what's going on in there!! "

Ask me about online KO2 :)
User avatar
Oss117
Posting is free!!!
Posting is free!!!
Posts: 117
Joined: Wed May 11, 2005 12:10 pm
Location: France
Contact:

Re: Physics metrics etc...

Postby Oss117 » Wed May 14, 2008 6:06 pm

Steve Camber wrote:Are you really doing sprite collisions?! :eeko:

KO2 ball-player collision detection is done in full 3d maths, just like modern games (although just a simplistic point vs cylinder method). Go Dino!


It is sprite collision yes, but it is position x,y,z related
But tell me more about simplistic point vs cylinder method, example from original source code ? :roll:
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7511
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Re: Physics metrics etc...

Postby Steve Camber » Wed May 14, 2008 6:28 pm

Oss117 wrote:But tell me more about simplistic point vs cylinder method, example from original source code ? :roll:

It's pretty straightforward..

IF point.z < cylinder.height AND (point.x-cylinder.x)^2 + (point.y-cylinder.y)^2 < cylinder.radius^2 THEN collision
--
SteveC - Kick Off engineer - Ranked somewhere waaaay down the list
18 Dec 2003 - "One day I'm going to disassemble the 68000 code, and find out exactly what's going on in there!! "

Ask me about online KO2 :)
John Wilson
Posting is free!!!
Posting is free!!!
Posts: 113
Joined: Wed Oct 10, 2007 12:33 pm
Location: Sheffield
Contact:

Re: Physics metrics etc...

Postby John Wilson » Wed May 14, 2008 7:47 pm

Steve Camber wrote:So from my equation.. Running speed = (((PACE/4) + 180) * TeamSpeedFactor)/100

a pace of 200 equates to a player speed of..

((200/4 + 180) *100)/100 = 230

so at 50fps, over one second the player accumulates a distance of 50*230 = 11500

Due to the 16:16 fixed point format KO2 uses, we call that 11500/65536 which is 0.1754 of our beloved ko2 units (where 1 unit = 3 inches).

Therefore a ko2 player running 100% speed in one second covers 0.1754/3 inches = 0.0585 inches = 0.148569743 centimeters

This is obviously crap.

JOHN!!?! HELP!!!!!


...not had much time to play with FW recently (or indeed post on this forum) but I've just had a look now and this is what I think is the case.

To clarify Steve, I believe your equation is the one that converts the stored Player Manager attributes to the ones used during the game.

When the player's position is being modified during the game (once per frame) the amount of movement is given by:

Pos[x,y] = Pos[x,y] + (PlayerSpeed * DirectionCoefficients[x,y])

The direction coefficients are 2D vectors such as:
0, -1000
707,-707
1000,0 ...etc

i.e. the value you calculated above needs multiplying by 1000 (and multiply by 3 to get inches per sec :) ):

so at 50fps, over one second the player accumulates a distance of 50*230*1000 = 11500000

And, cos of the 16:16 fixed point:
11500000 / 65536 = 175 * 3 inches per second
= 526.4 inches per second
= 13.37m/s

This sounds about right for the super speedy genetic freaks that frequent the KO2 pitch! No would they unintentionally slide now and again :D

@ Oss117. Sounds like great work :) I look forward to seeing the results. I'll try and have a look at the dribbling routine when I get a chance.
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7511
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Re: Physics metrics etc...

Postby Steve Camber » Wed May 14, 2008 7:56 pm

Thanks John, of course, the 1000 factor :D It was staring at me, but in my head I saw 1.0 and 0.707 :lol:

I hope that's of some use oss117 mate!
--
SteveC - Kick Off engineer - Ranked somewhere waaaay down the list
18 Dec 2003 - "One day I'm going to disassemble the 68000 code, and find out exactly what's going on in there!! "

Ask me about online KO2 :)
Freshmaker
Moderator
Moderator
Posts: 11971
Joined: Sat Apr 06, 2002 12:00 am
Location: Humlebæk, Denmark
Contact:

Re: Physics metrics etc...

Postby Freshmaker » Wed May 14, 2008 8:01 pm

This is common knowledge you guys.
-----------------------------
Jørn F.M.
Founding member of FÖKOF (and FAKO).
The Aftertouch Podcast.
Wayne's and Nick's Carreer Ender
Manager of The People's Lockout!
Il portiere è mongoloide!
User avatar
gdh82
6000+ Poster!
6000+ Poster!
Posts: 6197
Joined: Fri May 26, 2006 8:16 pm
Location: Birmingham, England

Re: Physics metrics etc...

Postby gdh82 » Wed May 14, 2008 8:31 pm

:lol: :lol: :lol:

1+1=2 man! ;)
All the goals, the stats, the stories & more from the KO2 WC 2011 - please click here

And click here for everything you'll ever need to know about KO2!

Who is online

Users browsing this forum: No registered users and 1 guest