Page 1 of 4

Chess Clock, Python, SDL's and Global Animation

PostPosted: Thu Feb 28, 2013 1:47 pm
by Karkadann
Iv been thinking of building a chess clock for one of my ages, so far I found out it may be possible with global animations, sdl,
and a python dummy. what I was hoping to do is set the Chess age to a one hour day use global animations for the minute hand
and every time the minuter hand completes one full animation it would move the hour hand one stage in a 12 stage animation.

I have to be able to turn on and off the global animation (assuming thats possible)
I was thinking of having a one hour animation for the minute hand and have the Chess age set to a 12 hour day for the hour hand but I think thats a bit much.
I was also wondering if I can have two DayLength's a 1 hour DayLengh for the minute hand and a 12 hour DayLengh for the hour hand using prp files

Some how I get the feeling im missing obvious, perhaps a way of setting the DayLengh to a 12 hour day and set the minute hand to rotate 12 times in one day.

this particular project is a bit out of my league but I do have a few ideas on how it might work, I was hoping I could get some of the people here
with more knowledge on coding and game engines to help out with some advise on how it may or may not be possible

Thanks in advance

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Thu Feb 28, 2013 2:44 pm
by Christopher
Karkadann wrote:Some how I get the feeling im missing obvious, perhaps a way of setting the DayLengh to a 12 hour day and set the minute hand to rotate 12 times in one day.


Where is the problem with this? You can simply animate the minute hand to rotate 12 times during the day length... This would also be the easiest way.

Christopher

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Thu Feb 28, 2013 2:58 pm
by Karkadann
OH I get it, so I just set up the animation to rotate 12 times and set the hour hand to rotate once and set them both on global

Like I said I get the feeling im missing the obvious thank you
/hits self in fore head

I assume that you can stop and start global animation like a normal animation

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Fri Mar 01, 2013 12:44 am
by Karkadann
another question, when you type /reset in the old game engine shards does it just reset the puzzles and put the kickables back where they where or does it reset the time as well, because im gonna need a way to reset the clock so that the minute hand is at 12

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Fri Mar 01, 2013 1:28 am
by Christopher
I think you don't understand global animations correctly... AFAIK you can't start/stop or reset them. Global animations are a continuous cycle and one cycle has the daylength set in the .age-file.

Christopher

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Fri Mar 01, 2013 4:26 am
by diafero
As far as I know, /!resetage does not reset the time. The current position in the global animation is calculated based on the current actual time, so it is in sync even across Shards. Hence to sync the hands of the clock, you will have to properly choose the initial position.

However, I see no reason to use global animations for a chess clock. Why don't you go with normal animations? The main feature of global animations is they also proceed when nobody is in the age, but you shouldn't need that for a chess clock.

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Fri Mar 01, 2013 10:12 am
by Karkadann
Because i never tried hour long, or a 12 hour long animation.? I guess theirs a first time for everything.
I wonder how much lag an animation that long will cause if any?

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Fri Mar 01, 2013 12:36 pm
by Christopher
The python api has a function called "animation.speed(...)" So you can make an animation of 1 minute length and slow it down to 1,66% speed. So the function would look like "animation.speed(0,0166)" or "animation.speed(1/60)". This would be a much better way than making an 1 hour animation.

Christopher

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Fri Mar 01, 2013 2:00 pm
by Karkadann
umm..........his their a tutorial on how to alter the Python api speed?

Image

Re: Chess Clock, Python, SDL's and Global Animation

PostPosted: Sat Mar 02, 2013 2:56 pm
by Karkadann
So should I wait for the python file or just go ahead and use the one hour animation and the 12 stage animation and add the python file later