Ball logic

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:

Ball logic

Postby Oss117 » Sat Dec 08, 2007 10:34 am

Question related to ball motion and logic

I was able to add the ball to Open Kick Off, but I am trying to fit as close as possible to KO2 rendering.

So, I would need some informations about how the ball is displayed.

Steve Screech already gave me some inputs but I need more informations

Here what Steve told me:
from Steve Screech
date Dec 5, 2007 11:49 AM
subject RE: Open Kick Off

Ok can't tell you too much about the ball physics but the ball display on the screen was fairly simple. A percentage of the balls height was added to the vertical position of the ball to give it a little movement up the screen the higher the ball went and the shadow was offset from the ball position in a similar manner with the vertical position dependent on a percentage of the ball height and the horizontal also on a percentage of the ball height. Can't remeber the percentages but experimentation by you should solve this.

For the tactics i can't remember the exact ordering or format but you are pretty much correct with your assumptions. The double tactics we used in the later version made for a more tactical game however the game was also less exciting with them as it made them far harder to break down. As far as I can remember I don't think the files were encrypted at all but i guess it is possible especially due to you difficulties reading the extra pitch types


Related to the ball's sprites, I wanted to know at which height level which ball's sprite is displayed, there are 8 sprites and 1 for the shadow, let's define them as ballSprite[0], ballSprite[1], ..., ballSprite[8] where ballSprite[8] is the shadow

Image

Would it possible Steve to make a special KOCV version which display during a game informations about the ball.

eg. ball velocity, ball direction angle, ball angle from the pitch, ball height, ball position (x,y), shadow offset position (x,y), ball's sprite displayed

All informations needed to understand ball motion and display
Thanks :)
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7527
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Postby Steve Camber » Sat Dec 08, 2007 11:09 am

From KO2PC:

Code: Select all

void DrawBall(float x,float y,float z)
{
   //8 balls getting bigger, then shadow

   int scrx=x;
   int scry=y;
   int shadx=scrx+(z/2);
   int shady=scry-(z/2);

   int ballframe=shadx-scrx;
   if (ballframe<4)
   {
      //low ball, sprite contained in shadow
      scry-=z/2;
      if (ballframe>=0 && ballframe<8)
         DrawSprite(scrx,scry,ballframe);
   }
   else
   {
      //draw shadow
      {
         int spr=8;
         DrawSprite(shadx,shady,spr);
      }
      //draw ball
      scry-=(z/2);
      ballframe=min(3,z/32);
      {
         int spr=ballframe+4;
         DrawSprite(scrx,scry,spr);
      }
   }
}
--
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 :)
Torchiador
3000+ poster!
3000+ poster!
Posts: 3491
Joined: Sun Sep 07, 2003 3:34 pm
Location: Kick Off House - Milano - Italy
Contact:

Postby Torchiador » Sat Dec 08, 2007 11:49 am

Damn! this is Greek to me!
I'm sure that Spyros and Alkis have no problems into read the post above...
Image
User avatar
Oss117
Posting is free!!!
Posting is free!!!
Posts: 117
Joined: Wed May 11, 2005 12:10 pm
Location: France
Contact:

Postby Oss117 » Sat Dec 08, 2007 3:30 pm

Steve Camber wrote:From KO2PC:

Code: Select all

void DrawBall(float x,float y,float z)
{
   //8 balls getting bigger, then shadow

   int scrx=x;
   int scry=y;
   int shadx=scrx+(z/2);
   int shady=scry-(z/2);

   int ballframe=shadx-scrx;
   if (ballframe<4)
   {
      //low ball, sprite contained in shadow
      scry-=z/2;
      if (ballframe>=0 && ballframe<8)
         DrawSprite(scrx,scry,ballframe);
   }
   else
   {
      //draw shadow
      {
         int spr=8;
         DrawSprite(shadx,shady,spr);
      }
      //draw ball
      scry-=(z/2);
      ballframe=min(3,z/32);
      {
         int spr=ballframe+4;
         DrawSprite(scrx,scry,spr);
      }
   }
}


omg it works pretty well, is this code is reinterpreted from the original KO2 assembly source code Steve ?

Soon I will post a new demo with the ball, it is so funny to see it react as KO2 original, I tell you :lol:
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7527
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Postby Steve Camber » Sat Dec 08, 2007 5:36 pm

Oss117 wrote:omg it works pretty well, is this code is reinterpreted from the original KO2 assembly source code Steve ?

Soon I will post a new demo with the ball, it is so funny to see it react as KO2 original, I tell you :lol:

Yes, it's practically a line by line translation of the 68000 original, converted to C :) It looks correct in KO2PC, so I'm confident that I haven't messed up anywhere!
--
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:

Postby Oss117 » Sun Dec 09, 2007 8:08 pm

Steve Camber wrote:
Oss117 wrote:omg it works pretty well, is this code is reinterpreted from the original KO2 assembly source code Steve ?

Soon I will post a new demo with the ball, it is so funny to see it react as KO2 original, I tell you :lol:

Yes, it's practically a line by line translation of the 68000 original, converted to C :) It looks correct in KO2PC, so I'm confident that I haven't messed up anywhere!


Cool!

Here is the little demo I promised, double click on jar file or on the run.bat

http://www.yourfilehost.com/media.php?cat=other&file=4780KOTrials.zip

Don't pay attention to the ball/player collision, it is still buggy and noisy ;) , but when pushing the ball and while pressing S or Z key, you will see the ball effect almost as the original KO2, thanks Steve! S for shoot, Z for a goal keeper shoot like :D

Btw Steve, I would be very interested to have a look into KOPC, may I ask you to put the source file as a zip file on your ftp, please ? :?

Next step for Open Kick Off is a refactoring of the player class. And a big cleanup of the code.

Still nobody interested to help me 8) ?
Torchiador
3000+ poster!
3000+ poster!
Posts: 3491
Joined: Sun Sep 07, 2003 3:34 pm
Location: Kick Off House - Milano - Italy
Contact:

Postby Torchiador » Sun Dec 09, 2007 9:00 pm

Great work, man! really impressive!
I'd like to help you but I'm not able, I'm sorry.
Image
Freshmaker
Moderator
Moderator
Posts: 12024
Joined: Sat Apr 06, 2002 12:00 am
Location: Humlebæk, Denmark
Contact:

Postby Freshmaker » Sun Dec 09, 2007 9:25 pm

wow. Tried it. Sweet. :D
-----------------------------
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
GingerPete
2000+ Poster!
2000+ Poster!
Posts: 2256
Joined: Tue Mar 05, 2002 12:00 am
Contact:

Postby GingerPete » Mon Dec 10, 2007 1:25 am

ok now i am confused.

Whats going on here, KOPC? When did you convert this code steve?
And how much have you done?

Also why not using pointers?

ALso whats open kick of in ? is it java? shame i would love to help, only i worked in c++ when i was making a remake. Only got as far as players on a pitch, a very crude tactivc engine and some simply AI, stay in positions or chase the ball or go there etc etc, but players could pass messages to each other, which was cool. Like pass to me, etc. Not quite how Kick off did i i suspect
User avatar
Stainy
4000+ Poster!
4000+ Poster!
Posts: 4304
Joined: Wed Jun 13, 2001 12:00 am
Location: Concord,NC, USA
Contact:

Postby Stainy » Mon Dec 10, 2007 7:42 am

GingerPete wrote:ok now i am confused.

Whats going on here, KOPC? When did you convert this code steve?
And how much have you done?

Also why not using pointers?

ALso whats open kick of in ? is it java? shame i would love to help, only i worked in c++ when i was making a remake. Only got as far as players on a pitch, a very crude tactivc engine and some simply AI, stay in positions or chase the ball or go there etc etc, but players could pass messages to each other, which was cool. Like pass to me, etc. Not quite how Kick off did i i suspect


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

Postby Oss117 » Mon Dec 10, 2007 9:17 am

GingerPete wrote:Also why not using pointers?


Don't understand what you mean by saying this... Anyway everything is pointer in Java :wink:

GingerPete wrote:ALso whats open kick of in ? is it java? shame i would love to help, only i worked in c++ when i was making a remake. Only got as far as players on a pitch, a very crude tactic engine and some simply AI, stay in positions or chase the ball or go there etc etc, but players could pass messages to each other, which was cool. Like pass to me, etc. Not quite how Kick off did i i suspect


Yes, Open Kick Off is written in Java, why
* Java is cross-platform
* Java is now fast, Double buffering with bufferstrategy or volatile image
* OpenGL renderer via JOGL or LWJGL, Hardware-accelerated images
* Fully object oriented library, utilizing Java OOP to maximum
* Java is actively developed, especially for games (mobile etc...)

So If you want to learn this language, Open Kick Off is a funny project to enter the Java world.
User avatar
Steve Camber
Mad! 7000+ poster!
Mad! 7000+ poster!
Posts: 7527
Joined: Sat Jun 16, 2001 12:00 am
Location: Sheffield, England
Contact:

Postby Steve Camber » Mon Dec 10, 2007 9:54 am

GingerPete wrote:ok now i am confused.

Whats going on here, KOPC? When did you convert this code steve?
And how much have you done?

It's KO2PC - http://www.ko-gathering.com/phpbb2/view ... hp?t=13333

Image

GingerPete wrote:Also why not using pointers?

Why use pointers here?!
--
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:

Postby Oss117 » Mon Dec 10, 2007 10:16 am

Steve may I ask you to have a look into the KO2PC source file? Could you make a zip file available on your ftp for download please ;)

Who is online

Users browsing this forum: No registered users and 4 guests