Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Clock Ingame
Topic Started: Jun 3 2008, 08:22 AM (625 Views)
Linkin
Member Avatar
Forum God
[ *  *  *  *  *  * ]
How can i use global.time_factor to create a clock in game that runs at the same speed as a real life clock and is not effected by the fps.

Thanks
Posted Image
Want something done in Photoshop, make a request Here

Formerly known as DS-Development.
Offline Profile Quote Post Goto Top
 
Electricity
Chaos vs. Cosmos
[ *  *  *  * ]
i would've used current_time, current_second, current_minute or current_hour to make a clock...
Offline Profile Quote Post Goto Top
 
B4Rt
Member Avatar
Leader of INSIDEinteractive
[ *  *  * ]
Electricity
Jun 3 2008, 01:40 PM
i would've used current_time, current_second, current_minute or current_hour to make a clock...
me too
Sorry my bad english.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
I used to use my Dad's high resolution time DLL, but since I lost my HD, I use Yourself's now.
Blog|EHS
Offline Profile Quote Post Goto Top
 
Linkin
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Quote:
 
i would've used current_time, current_second, current_minute or current_hour to make a clock...


Yes but this is not based on the real time, it just progresses at the same speed as real time.
Posted Image
Want something done in Photoshop, make a request Here

Formerly known as DS-Development.
Offline Profile Quote Post Goto Top
 
zelda4evr
Member Avatar
Forum God
[ *  *  *  *  *  * ]
im pretty sure you can find the code in a few of dr. bests examples, like for instance, i think i remember something about him using this to make it so the animation speed isn't affected by the fps.

Posted Image
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Yes, he divides the current_time variable smartly so there's no time rounding errors, like I used to get all the time because I'm a freaking retard.

Edit:
Quote:
 
How can i use global.time_factor to create a clock in game that runs at the same speed as a real life clock and is not effected by the fps.

Thanks

But reading it a second time, it would be like current_day since the day documented in the manual. You do a simply subtraction, division, and a mod if you insist and you've got your clock.
Edited by skarik, Jun 4 2008, 02:08 AM.
Blog|EHS
Offline Profile Quote Post Goto Top
 
silverfire56
Forum God
[ *  *  *  *  *  * ]
every step you check to see if a second has passed using the current_second function and compare it to the last step. if it has
gametime +1
save that to a file and ur set
its no atomic clock but its good enough for your needs
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
using "fps" is a bad idea because it doesn't update well enough
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
Zedman3d
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Cant you do: alarm[0]=fps;

so it would activate the alarm 0 code every second..... maybe adding one second to the time in there?
Quote:
 
Eanbro: My problem with C++ is that not everything is included to start making projects with it.
Quote:
 
Dr.B: Your problem with C++ is that you want it to be like Game Maker...
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
Zedman3d
Jun 6 2008, 08:48 AM
Cant you do: alarm[0]=fps;

so it would activate the alarm 0 code every second..... maybe adding one second to the time in there?
What? That doesn't even make sense. If the FPS was at 60, it would set the alarm to 60-and the variable "fps" does not update fast enough, because that is how GM is.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
@Zed
Yeah, it would work, providing you start the alarm on the right step where the variable fps is updated.
Blog|EHS
Offline Profile Quote Post Goto Top
 
Zedman3d
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Eanbro
Jun 6 2008, 04:43 PM
Zedman3d
Jun 6 2008, 08:48 AM
Cant you do: alarm[0]=fps;

so it would activate the alarm 0 code every second..... maybe adding one second to the time in there?
What? That doesn't even make sense. If the FPS was at 60, it would set the alarm to 60-and the variable "fps" does not update fast enough, because that is how GM is.
I beleive it makes perfect sense actually as 60FPSecond is what the alarm should be set to. You just need to update it at the same time the fps does. And it would work because the FPS is updated every second.
Quote:
 
Eanbro: My problem with C++ is that not everything is included to start making projects with it.
Quote:
 
Dr.B: Your problem with C++ is that you want it to be like Game Maker...
Offline Profile Quote Post Goto Top
 
Linkin
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Yes i have tried this idea, but as Eanbro said it does not update fast enough, this is compared to Yourselfs High res timer.
Posted Image
Want something done in Photoshop, make a request Here

Formerly known as DS-Development.
Offline Profile Quote Post Goto Top
 
Zedman3d
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Well i say use silverfire56's idea and get the value of seconds from the pc at the start of the game and plus 1 to the games seconds every time the value of seconds on the pc goes up.
Quote:
 
Eanbro: My problem with C++ is that not everything is included to start making projects with it.
Quote:
 
Dr.B: Your problem with C++ is that you want it to be like Game Maker...
Offline Profile Quote Post Goto Top
 
Go to Next Page
« Previous Topic · Off-topic · Next Topic »
Add Reply