Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / Timing Plugin

Author
Message
Aaron Miller
16
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Apr 2008 06:43 Edited at: 28th Apr 2008 06:47
Hullo all. Smiley

I've created a very simple plugin for Dark Basic Professional to help out with timer based movements. It's not advanced at all. It's just intended to be used by those people who don't want to setup a timer based movement system for every project they create - hence I made it (mainly for myself).

Here's the readme file.
Quote: "Timing Plugin v1.0
-------------------------------------------------
This is a simple plugin to help control
timing in Dark Basic Pro. This allows you to
more easily implement timer based movement which
allows for quicker development times.

I made this to help me out because I was
making a bunch of really small projects to test
out some other plugins. Each one would spin an
object around in a timer based fashion to ensure
the demo runs just as smoothly across all
computers.

Commands
-------------------------------------------------
setTimerDivisor divisor#
Sets the divisor for the returned time. The
default value is 30.0.

divisor# = getTimerDivisor()
Gets the divisor set by setTimerDivisor.

updateTimer
Updates the timer. This updates the return
value in getTimer(). Call by SYNC.

getTimer
Retrieve's the scalar timer value. The return
value can be multiplied by a 1.0 based
scalar value to keep proportionally based
timing. For example, if you want an object to
move twice as fast as normal, then multiply
this value by 2.0. If you want it to move half
as fast, multiply this value by 0.5.

Installation
-------------------------------------------------
Copy the file "Timing.dll" to the
Compilerplugins-user directory in the main DBPro
installation directory. Copy the file "timer.ini"
to the Editorkeywords directory in the main
DBPro installation directory. Restart your IDE &
it'll be ready to be used."


It can be downloaded from my forums, here.

Hopefully some of the newcomers and demo writers will find this useful.

Also, here's some example code as to how to use it:


Cheers,

-naota

I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson
tiresius
20
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 28th Apr 2008 09:16
Does this use something more higher resolution than the standard DBPro timer() function?

I'm thinking like the matrix utility's hitimer() function.

I'm not a real programmer but I play one with DBPro!
Aaron Miller
16
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Apr 2008 09:20
I can make a higher resolution timer if you like, it does it based on milliseconds - I don't see a problem with that though since most games only need to run smoothly based on 30 FPS which is much more easily done with milliseconds.

However, I can make it work like that for ya.

Cheers,

-naota

I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson
Guido Italy
16
Years of Service
User Offline
Joined: 25th Dec 2005
Location:
Posted: 28th Apr 2008 12:55
sorry for my english ...

were i can download ?????
draknir_
16
Years of Service
User Offline
Joined: 19th Oct 2006
Location: Netherlands
Posted: 28th Apr 2008 20:10
thanks, this should come in useful
Aaron Miller
16
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 29th Apr 2008 00:51
@draknir_
Thanks.

@Guido Italy
I'll repost here what I said at the other forums.

Quote: "It's attached to the bottom of the post.

http://forum.aexuni.com/index.php?action=dlattach;topic=3.0;attach=1"


Cheers,

-naota

I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson
tiresius
20
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 29th Apr 2008 07:25
Hi naota, you probably already know this but I figured I would explain what I mean. The DBPro timer() command does not use a high resolution timer. It uses the "windows timer", which seldom reports anything lower than 8 or 15ms in passing. Sometimes it reports things in skips and spurts of 0s and 15-16s. At least that's what it does in my experience...

A high resolution timer can still report in milliseconds, but reports much more accurately when a smaller timestep is encountered. So I guess my question is are you tapping into the DBPro timer() command? Or do you have your own raw C/C++ timer function you're using?

I'm not a real programmer but I play one with DBPro!
Aaron Miller
16
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 29th Apr 2008 07:44
@tiresius
I'm using the Windows GetTickCount() command - Not the DBPro timer() command. I can, however, use the QueryPerformanceCounter~ based commands to retrieve higher resolution tick counts.

I won't do it though, unless someone requests it.

Cheers,

-naota

I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson
RedFlames
15
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 29th Apr 2008 15:37
This looks really easy to use, but i cant use it unless i register at your forum... could you maybe rupload it here on the forum for everyone?

Aaron Miller
16
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 29th Apr 2008 15:41
Sure.

Cheers,

-naota

I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson

Attachments

Login to view attachments
RedFlames
15
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 29th Apr 2008 16:27
i just tested the example and for me its
divisor = 15.0 is the same speed as sync rate 60 (with turning 1 unit every frame)
and divisor = 10.0 is same as sync rate 100 ...

how would i find out the divisor for setting it to e.g. 30 fps?

Aaron Miller
16
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 30th Apr 2008 00:35 Edited at: 30th Apr 2008 00:37
30 seems to be right.

If you mean mathematically, if the divisor is 30.0 resulting in 30.0 fps then that's equal to 1. With a divisor of 15.0 resulting in 60.0 fps then that's equal to 2. I'm not that good at math though, so I *think* something like this:


The maths of the function of above when given 60.0 as fps# the returned divisor is 15.0. So that should be correct. I've only tested the function on an fps of 60.0 though.

Cheers,

-naota

I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson
RedFlames
15
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 30th Apr 2008 08:31 Edited at: 30th Apr 2008 08:32
yeah thats basically
30/fps *30 = 900/fps
and for 100 it returns 9, and i got 10 in my tests so that should theoretically work
thanks

Aaron Miller
16
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 30th Apr 2008 09:46
I think I'll incorporate that function in the next version (1.1).
I think I'll improve the timing too, I guess (Higher resolution) - no one actually requested it, but why not?


In order to get more popularity at my forums, the next version (1.1) will be uploaded there for 14 days, then uploaded to these forums. The reason being - well come on, who doesn't want people at their forums?


Cheers,

-naota

I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson

Login to post a reply

Server time is: 2022-12-02 02:57:35
Your offset time is: 2022-12-02 02:57:35