Chess Clock, Python, SDL's and Global Animation

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

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

Postby Jojon » Tue Mar 12, 2013 3:08 pm

I'm afraid there is nothing I, for one, can do with anything MAX. :7

The test clock was actually with a second and a minute hand, rather than a minute and hour one (because I'm an impatient sod), so the fat hand should actually rotate one 60th of a turn, per full rotation of the thin one, and take one hour in total... It did perfectly on my end, checking with a stopwatch and running on the POTS build of Plasma. Maybe if you are running in on MOUL, your results may vary, on account of the previously mentioned 16bit limitation...

There are probably a whole host of ways in which you could rig a full day solution up, while working with the limitations.

Going Python altogether may be the easiest solution in many ways; Letting the script keep the time and "forcibly" taking care of rotation, foregoing keyframe animation.

You could also make the hands move in discrete jumps, every minute/hour, rather than slowly crawl, which would not require the looong curves.

Another idea, if one want both to do it with animation and have the crawl, could be to parent the hands, maybe with an empty object or two, as intermediaries, to overcome the timeline length limitation. Set an animation marker that calls back after half an hour and have the event, that waits for that callback, restart the minute hand's half-rotation animation, as well as increment the two frame rotation animation of the hand's parent (should together result in a full hour rotation, hopefully without any annoying spats every full- and half hour). (EDIT: Same thing for the hour hand, but with a 24 frame parent - could use the same callback as the minute hand.)

Just some half-baked thoughts...
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

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

Postby Jojon » Tue Mar 12, 2013 3:31 pm

I suppose there is a limit on for how long you can edit a post, so here I go, responding to myself... :P

"EDIT2:" Callback from a marker at the end of the hour hand's parent would trigger the responder's set of events for the end of the game (stopping the clock, raising flags). I think this would actually be a rather compact little thing to set up - marginally more complex than with unlimited timeline length.
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

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

Postby Christopher » Wed Mar 13, 2013 3:02 am

Code: Select all
# -*- coding: utf-8 -*-
""" *==LICENSE==*

CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011  Cyan Worlds, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Additional permissions under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.

You can contact Cyan Worlds, Inc. by email legal@cyan.com
 or by snail mail at:
      Cyan Worlds, Inc.
      14617 N Newport Hwy
      Mead, WA   99021

 *==LICENSE==* """
 
from Plasma import *
from PlasmaTypes import *

Clock1Anim = ptAttribAnimation(1, "Clock 1 Animation")
Clock2Anim = ptAttribAnimation(2, "Clock 2 Animation")

class chessClock(ptResponder):

    def __init__(self):
        ptResponder.__init__(self)
        self.id = 6745 #change this number to whatever you want
        self.version = 1

    def OnServerInitComplete(self):
        Clock1Anim.animation.speed(1/60) #slows your animation from 1 minute to an hour
        Clock2Anim.animation.speed(1/60)



Paste this into a file named chessClock.py. It shows up in my Max so I assume it works. The ID is some random number. You probably want to change it to something like <AgeID>001.

Christopher
User avatar
Christopher
 
Posts: 276
Joined: Mon Jul 19, 2010 3:25 am

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

Postby Karkadann » Wed Mar 13, 2013 11:12 am

Thanks again Christopher but I could not figure out how to get that python working...............
I Don't Have A Cell Phone, I have Freedom!
User avatar
Karkadann
 
Posts: 1224
Joined: Sun Aug 02, 2009 10:04 am
Location: Earth

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

Postby Karkadann » Wed Mar 13, 2013 1:05 pm

I seemed to have forgotten the old adage K.I.S.S.
Going back to the basics I think I got it working for a one hour game, using the info from Adam about the 30 minute max I have both clocks on a 30 minute animation, and I think it works however its gonna take a few one hour tests to find out.
I gotta make sure the flag works, and Im gonna try to figure out a 30 minute game and maybe a 15 minute game.
Also I have to get the pressure plates working, Im hoping to have it done before spring break.........I hope :D

So I should be able take the out of order sign down soon,
Show Spoiler
I Don't Have A Cell Phone, I have Freedom!
User avatar
Karkadann
 
Posts: 1224
Joined: Sun Aug 02, 2009 10:04 am
Location: Earth

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

Postby Karkadann » Sun Mar 17, 2013 10:59 am

OK if any one wanted a sneak preview I got the clock working for a one hour game, I have not had a chance to test it more then once or twice,
I got the pressure plates working and a reset button on back works although it still needs the anim timing reset, the other two buttons are to change from a 60 and 30 minute game which aint wired in yet.
I thought up two strategies which may work to get a 30 minute game and I still have a few minor details to work out overall.

http://www.mediafire.com/?kpth3mj3gylyezd

The next update is for the UAM this one is just for testing
I Don't Have A Cell Phone, I have Freedom!
User avatar
Karkadann
 
Posts: 1224
Joined: Sun Aug 02, 2009 10:04 am
Location: Earth

Previous

Return to Building

Who is online

Users browsing this forum: No registered users and 3 guests