It looks like you're new here. If you want to get involved, click one of these buttons!
orx clock
7 messages
Eyecreate Sun, Nov 15, 2009 at 7:14 PM
To: iarwain
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
To: Eyecreate
Hi,
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
list.
2009/11/15 Eyecreate
iarwain Sun, Nov 15, 2009 at 7:59 PM
To: Eyecreate
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.
2009/11/15 iarwain
Eyecreate Sun, Nov 15, 2009 at 7:59 PM
To: iarwain
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
To: iarwain
if you can get it so that each object can have a clock attached to it: ex.
[player1]
clock=playerclock
[bullets]
clock=sceneclock
[enemies]
clock=sceneclock
[playerclock]
speed=1
[sceneclock]
speed=0.5
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
To: Eyecreate
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
second, etc...).
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
practical.
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
To: Eyecreate
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:
[ObjectBase]
Clock = SceneClock
And you can add any other 'common' properties for your objects
[Bullets@ObjectBase]
[Enemies@ObjectBase] etc, ...
A clock would be something like
[ClockTemplate]
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.
Comments
Maybe it's something to ask on Box2D forum if someone ever tried to do such a thing but I'm afraid orx doesn't have any direct control over it.
I assume joints wouldn't be such a problem though, probably more motors as joints would react to stimuli in a time-consistent way. Motors however don't react but act and there might be some parameter to change according to one object's linked clock, but it's pure speculation on my side.
As soon as this works in every cases (sound included), I'll add the data-driven feature for the clocks (probably tomorrow or before the end of the week anyway).
As I don't trust in code working perfectly at first try, please let me know whenever you find the bugs!
I still need to have config handling for clocks. Right now you can associate clocks with code using orxObject_SetClock()/orxObject_GetClock().
As for Scroll, the alpha is ready, I couldn't add the last feature I wanted (backups when saving) as it turned out 5 functions of orxFileSystem haven't been implemented by their author back in the days when I wasn't alone in the team. Unfortunately I haven't time to add them now, so the backup feature will wait for Scroll beta!
I still need a very simple idea of a level-based game to ship an example with Scroll (something I can code within a couple of hours would be nice). If I get no ideas, I'll probably add a "ship" and some random simple enemies to kill to finish a level. However, game design/level design definitely isn't my strength!
I might go with something like this if I'm not too lazy!