Gamestudio Links
Zorro Links
Newest Posts
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
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 831 guests, and 5 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
even minor lag strongly affects physics, what am I doing wrong? #305014
01/12/10 15:58
01/12/10 15:58
Joined: Aug 2003
Posts: 716
Canada, Toronto
thegamedesigner Offline OP
User
thegamedesigner  Offline OP
User

Joined: Aug 2003
Posts: 716
Canada, Toronto
Even minor lag, strongly affects my player's movement (it's a marble). I get the impression I'm just doing something wrong.


Ok, so here is a (cut down version) my player action:

action player_act
{
...
player = my;
...
while(1)
{
...
phent_settype(my,ph_rigid,ph_sphere);
phent_setmass(my,10,ph_sphere);
phent_setfriction (my, 0);
phent_setdamping(my, 90, 30);
phent_setelasticity (my, 0, 20);
phent_setgroup(my, 1);
ph_selectgroup(1);

//moving
vec_set(dir,nullvector);
if(key_a == 1){dir.y+=1;}
if(key_d == 1){dir.y-=1;}
if(key_s == 1){dir.x-=1;}
if(key_w == 1){dir.x+=1;}

vec_set(tempvec1,camera.pan);
tempvec1[1] = 0;
vec_rotate(dir,tempvec1);
vec_normalize(dir,10000*time);
phent_addforceglobal(my,dir,my.x);

vec_set(dir,nullvector);
dir.z = 1;
vec_normalize(dir,100000*time);

phent_addforceglobal(my,dir,my.x);
...
wait(1);
}
...
}


Everything else in my game runs fine, because I use * time. I've not been able to get this effect with physics, even a small blip will cause the player to jump three times as high.

Any help? I'm sure this is my fault, I'm just looking to learn people's methods for dealing with this?


My games - www.spyeart.com
Re: even minor lag strongly affects physics, what am I doing wrong? [Re: thegamedesigner] #305018
01/12/10 16:26
01/12/10 16:26
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
* time is old code... use * time_step instead!

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: even minor lag strongly affects physics, what am I doing wrong? [Re: Helghast] #305019
01/12/10 16:36
01/12/10 16:36
Joined: Aug 2003
Posts: 716
Canada, Toronto
thegamedesigner Offline OP
User
thegamedesigner  Offline OP
User

Joined: Aug 2003
Posts: 716
Canada, Toronto
Fine, but I didn't mean that. *time is working fine in the rest of my game. I just meant I don't know how to use *time (or *time_step) in physics.

Should I be doing add_force * time_step? I didn't think that worked?

I want my physics to not go crazy at the slightest lag. I don't know how. Should I lock the FPS? Should I use time_step? Can someone give me an example of physics movement on a marble that stays the same even though the frame rate dips?


My games - www.spyeart.com

Moderated by  HeelX, Spirit 

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