Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (VoroneTZ, TipmyPip), 1,333 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Timing problem #253493
02/25/09 00:48
02/25/09 00:48
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
Hellooo, I've made a little test arrangement:

You let a physical object, let's say a ball, jump with the space-key. When the ball is hitting the ground and space is pressed a force, i use phent_addvelcentral(ENTITY*,VECTOR* speed), will move the object. No problem so far.
You keep pressing space. Now you see, the jumps doesn't have a constant height. Sometimes the ball jumps right in the moment when he has touched the ground. And sometimes he sticks to the ground a few millisecs and makes a jump half of the height as the jump before.
The ball doesn't move and doesn't rotate, its only jumping. You can clearly see, something at the timing goes wrong eek

I've set fps_max = 60 and when i raise the "ph_fps_max_lock" the collision-detection gets a bit better, but its far from good. Any idea ?

Re: Timing problem [Re: theDust] #253494
02/25/09 01:05
02/25/09 01:05
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi there,
You could set up a timer which handles the amount of time a jump could happen.

In this way you can prevent that behaviour.
For example when you hit the space key, the timer starts to count, now you define how much time a jump may take. Just make sure that another jump only can happen when this timer has a certain amount.

You could handle timer-counting and reseting by traces, with a trace downward you always can find out if your ball/player is touching the ground or not.

hope this helps...

cheers

Re: Timing problem [Re: zwecklos] #253548
02/25/09 11:47
02/25/09 11:47
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
Thx ! But later the object should jump across the world, with nonlinear jumps --> calculating the time of 1 jump would only work with linear jumps, always at the same position.
When the object is moving around while jumping its harder to spot that the timing is wrong, but it is wrong frown

Yes, c-trace is a nice thing, i use it already.

Sooo, a GS-master is needed ! smile

Last edited by theDust; 02/25/09 11:48.
Re: Timing problem [Re: theDust] #253549
02/25/09 12:00
02/25/09 12:00
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
upload your script/test app so we can get a inner look.


3333333333
Re: Timing problem [Re: Quad] #253553
02/25/09 12:40
02/25/09 12:40
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
Here the code :
Code:
#include <acknex.h>
#include <default.c>

ENTITY* pointer;
VECTOR global;
VECTOR check;
VECTOR jump;

var checkj = 0;

function main() 
{
	video_screen = 2;
	video_mode = 8;	
	mouse_mode = 1;	
   fps_max = 60;  
   wait(-1);
	level_load ("level1.wmb"); 
   ph_setgravity (vector(0, 0, -700));   
} 


action playerj() 
{
  pointer = my;
  my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); 
  phent_settype (pointer, PH_RIGID, PH_SPHERE); 
  phent_setmass (pointer, 1, PH_SPHERE);
  phent_setfriction (pointer, 500); 
  phent_setdamping (pointer, 50, 50); 
  phent_setelasticity (pointer, 0, 0);
  
  jump.x = 0; jump.y = 0; jump.z = 150;  

   while (1) {    
  	  global.x = my.x ;
  	  global.y = my.y ;
  	  global.z = my.z ;
  	  
  	  check.x =  my.x;
  	  check.y =  my.y;
  	  check.z =  my.z-23; //the height of the ball/2
  	   
     checkj = c_trace(global,check,USE_BOX);
     
     if(key_space && checkj != 0)
     {     
         phent_addvelcentral(pointer,jump);
     }
     wait (1); 
  }

}

And here the whole project, jump with space :
http://www.file-upload.net/download-1482643/testjump.rar.html
Be a bit patient, sometimes the weird timing needs a few jumps to get visible wink

Last edited by theDust; 02/25/09 12:41.
Re: Timing problem [Re: theDust] #253724
02/26/09 12:08
02/26/09 12:08
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
I have really no clue how to solve this, maybe i use c_trace wrong, but I think that's not causing the problem. Help would be great !


Gamestudio download | chip programmers | 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