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 (AndrewAMD, dr_panther), 1,100 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
'c_move' movement #150986
08/29/07 13:52
08/29/07 13:52
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
I want to use c_move to move an entity in metres/second. 1 metres = 0.03125 quants. If skill1 contains the speed (in metres per second), how can I impelment this?

Thanks.

Re: 'c_move' movement [Re: sheefo] #150987
08/29/07 17:59
08/29/07 17:59
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
AFAIK, vars/defines are limited to 3 decimal places

DEFINE quant2meter = 0.031;

temp.x = my.speed * quant2meter * time_step;
temp.y = 0;
temp.z = 0;
move_mode = glide;
c_move(my, temp, nullvector, move_mode);


xXxGuitar511
- Programmer
Re: 'c_move' movement [Re: xXxGuitar511] #150988
08/29/07 20:46
08/29/07 20:46
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
It doesn't seem to work right. I need to make it cover 'speed' number of metres (quants * 0.03125) every real-time second.

I appreciate the help.

Re: 'c_move' movement [Re: sheefo] #150989
08/30/07 16:33
08/30/07 16:33
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
So first of all, you want to make your entity move with actually metres (in quants that is) per real time second. The real time second is just a simple calculation via this line:
Code:
 
time_step / 16;



I would advice you to use time_smooth. If time_step changes suddenly, the speed becomes inaccurate during the next frame, adding to the noticeable jerk. This can be prevented by the time_smooth variable.

Code:
  
(constant_speed * (metres_in_quants * (time_step / 16)));



I guess this should do the trick. It's a simple theory but you could improve it using physics I guess. This exemple is in figure speech a 'poor man's physics' example

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: 'c_move' movement [Re: frazzle] #150990
08/30/07 17:36
08/30/07 17:36
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
mhh maby i have a strange feeling but maby this helps

my.speed * quant2meter *(time_step/time_step)


"empty"
Re: 'c_move' movement [Re: flits] #150991
08/31/07 13:49
08/31/07 13:49
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Thanks everyone.

I got it now. The constant METERTOQUANT is 32, so he is moving MovementSpeed number of 32 quants every second.

Code:

my.MovementSpeed * METERTOQUANT * (time_frame / 16);



Re: 'c_move' movement [Re: sheefo] #150992
08/31/07 13:59
08/31/07 13:59
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Nice to see, but one question I have is, why you use time_frame ??
Probably because of the potential sudden fps increase/decrease

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: 'c_move' movement [Re: frazzle] #150993
08/31/07 16:36
08/31/07 16:36
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
I used it in my RTS for the military clock. I added "(time_frame / 16)" every frame and it looked like a very accurate way of telling the seconds (when converted to an integer), no matter what frame rate. It also worked in this movement code, so I must be doing something right

I guess it is more accurate because it changes with the frame rate, whereas time_step doesn't, expecially with fps_lock active.

Re: 'c_move' movement [Re: sheefo] #150994
08/31/07 16:40
08/31/07 16:40
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
with movement, you'll want to use time_step.

with time, (as mentioned by sheefo), you'll want to use time_frame


xXxGuitar511
- Programmer

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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