It looks like you're new here. If you want to get involved, click one of these buttons!
Eyecreate Sun, Nov 15, 2009 at 7:14 PM
I have a question about the orx clock. Do you have to use the clock measurement as part of calculations in order for it to slow stuff down, or can it be"applied" to objects. I ask because it seems in the examples that you use it in the calculations in order to transform them.
iarwain Sun, Nov 15, 2009 at 7:52 PM
Yes, you have to use the time info you get from the clock to ensure
time correctness in your calculations.
However, when you use functions such as
SetSpeed()/SetAngularVelocity(), if you stretch the time for the
physics clock, it will impact the object movements for objects that
have a body and the core clock for other objects.
I need to figure out a nice way of uniformising this as the objects
with bodies are updated by the physics plugin (Box2D) whereas the
other are updated manually in orx's core.
In the end I'd like to be able to group objects on separate clocks and
those clocks will finally give the information to whoever is updating
the object. I have an idea I'd like to try but it's still on my todo
iarwain Sun, Nov 15, 2009 at 7:59 PM
Actually, after giving some thoughts to it, my idea looks pretty easy
to try so if it's something you need soon I can give it a try next
week whenever I find the time.
Eyecreate Sun, Nov 15, 2009 at 7:59 PM
so, in short, the built in clocks are one for physics, which affects all physics, and one core, which affects all core objects. Then any clock you make yourself you have to manually put into the code. Is this right? I was planning on using the clocks to slow down all objects but the player object, but it would be even more difficult because most of the object I was going to have using the physics engine too.
Eyecreate Sun, Nov 15, 2009 at 8:13 PM
if you can get it so that each object can have a clock attached to it: ex.
Where each of those clocks can be attached to an object, which then relays it to where it's needed, that would work out great and save me alot of time. Of course, as I said, most my objects will be using physics too, so it'd mean each physics object would need to to have a different clock, which I'm not sure how plausible it is.(I think you said the whole physics has just one clock, but not sure if what you said you could do would fix that for individual objects. If I'm not clear, please tell me.
iarwain Sun, Nov 15, 2009 at 8:41 PM
Yes, for the built-in clocks. There are a couple of others too, but of
no interests to you (such as the FPS clock being ticked once per
The clocks you create for your logic to be updated, whenever you
slow/accelerate them, if you use the DT/Time info they give you, your
logic will be stretched in consequence. However their physical
movement when using the SetSpeed()/SetAngularVelocity() only won't be
affected. If you use SetPosition and calculating the speed yourself
with the info your clock sends you, you're fine, but it's not very
When I'm done with the idea I want to do, if it works, you won't have
to do anything with your player and just call something like
orxObject_SetClock() on your other objects so as to bind them to a
clock you've created and that you'll slow down/accelerate at will.
I'll make sure everything related to an object will be updated
accordingly, such as its physical properties (speed/angular velocity),
Spawner rate, FXs, animations. As for the sound, I could also alterate
the pitch accordingly I presume.
iarwain Sun, Nov 15, 2009 at 8:48 PM
That would be the 2nd step, when the system works. Right now there's
no config for clocks and they aren't centralized like camera for
example. It can be done but requires some more work.
Also, if you want something less tedious to write in the config, I'd go with:
Clock = SceneClock
And you can add any other 'common' properties for your objects
[Enemies@ObjectBase] etc, ...
A clock would be something like
Frequency = [Float]; in Hz
Modifier = multiply | fixed
ModifierValue = [Float]
And for the physics objects, there is only one clock to update the
whole simulation (can't change this, it's in Box2D) however, everytime I
update an object, I'll change its internal speed in Box2D according to
the clock to which the object is bound, but externally you'll still
see the values you've given to the object. That's the easiest way of
hacking things so they work in the same way for physics/non-physics
objects. What do you think?
Don't hesitate to post this on the feature request part of the forum
so that others can give their thoughts about it too.