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.

Work in Progress / EZrotate - Big update in the works!

Author
Message
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 10th Sep 2007 19:19 Edited at: 10th Sep 2007 19:21
Hello all!

I have been wanting to do an update to EZrotate for some time now. Recently, I decided to give it a go.

There are two purposes to this update:
1. SPEED!
2. Easier to use

So far, both of these goals are definately being met. I have re-worked ALL of the commands to get every possible ounce of speed out of them. I originaly wrote EZrotate back in early 2004. It was my FIRST ever project in C++. Needless to say, I've learned a lot since then.

Here is a quick speed comparison between the new and old version:
This was tested on a P4 3ghz laptop with 1gb ram.
Each test was done by performing the command 1 million times:

EZro_SetEuler - Old Time = 2734ms, New Time = 390ms = 701% speed increase!
EZro_FindEuler - Old Time = 1313ms, New Time = 359ms = 366% speed increase!
EZro_FindAxisAngles - Old Time = 2794ms, New Time = 703ms = 397% speed increase!
EZro_GX, EZro_GY, EZro_GZ - Old Time = 1094ms, New Time = 297ms = 368% speed increase!
EZro_LX, EZro_LY, EZro_LZ - Old Time = 7968ms, New Time = 375ms = 2125% speed increase!
EZro_Vector - Old Time = 7985ms, New Time = 406ms = 1967% speed increase!
EZro_Orbit - Old Time = 46719ms, New Time = 759ms = 6155% speed increase!

All of the other commands (such as RotateTo) will also have similar increases because they actually use these core commands as part of them.
Also, all of the updates to these commands will be completely transparent to you. So, that means you should get a huge speed boost with NO CODE CHANGES!

In addition to the speed increases, I have also added commands to work directly with objects and cameras. I will also be looking at adding commands that will work directly with object limbs. This saves a few steps. You would no longer have to setup EZrotate with your object's rotation and the return the results.
The command to use local rotation on the X axis of an object looks like this:
EZro_objLX ObjNo, angle#
There are no EZro_SetEuler, EZro_FindEuler, and EZro_GetEulerX (Y and Z) comands required.
There are similar commands for all features of EZrotate that directly work with the DBpro entities.

The update itself is almost done! I still want to look at adding some commands that add direct interaction with limbs. I also still have to update the helpfile with all of the commands that I have added.

Any comments, questions and suggestions would be appreciated. Any features that you would like to see added? Please let me know!

Also, if anyone is interested in testing, please let me know. I'd love to know that all of the commands are working EXACTLY like they were. Since all of the commands have been completely rebuilt, there definately needs to be some testing. All of my code seems to work good so far, but the extra re-assurance would be comforting.

Thanks!

Edit:
Also, when this update is complete, I will be looking to make it available to GDK and GDK.net!


-Ron

Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 10th Sep 2007 19:38
That's a pretty nice speed increase

Is there any chance that you will be updating the basic version?
My project uses the local rotation commands quite a few times per loop, and it would be nice to have them faster.

-Jeff

Space Game WIP
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 10th Sep 2007 19:44
Jeff,
I will definately look at doing that in the near future (updating the free version). I need to get a couple of other things done first though.

-Ron

Deathead
18
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 10th Sep 2007 21:29
Is that you Wolf?

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 10th Sep 2007 21:59
Quote: "Is that you Wolf?"


No, no... This is your grandma
My, what big teeth I have.....

Yes. It is me. WOLF
I had my forum name changed. I have used the name WOLF since I joined the original forums wayyyyy back in early 2000. I thought is was time for a change! I figured those that know me would recognize my avatar and sig.

Kenjar
19
Years of Service
User Offline
Joined: 17th Jun 2005
Location: TGC
Posted: 10th Sep 2007 22:16
Will this just be speed increases or will you be adding additional math tricks?
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 10th Sep 2007 22:27
Quote: "Will this just be speed increases or will you be adding additional math tricks? "


Well, if there are any features that you would like to see added, now is the time to ask. Anything in mind? Currently, it solves just about every rotational problem that I have come across, so I'm not sure what else to add. Any ideas?


a.k.a WOLF!
Deathead
18
Years of Service
User Offline
Joined: 14th Oct 2006
Location:
Posted: 10th Sep 2007 23:02
@Ron: Is it okay if I still call you WOLF because Ron will be to hard for me to remember.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 10th Sep 2007 23:39
What about converting the internal rotation matrix to a matrix4 structure in DBP, and also things like storing an objects transformation matrix in there, etc.

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 11th Sep 2007 02:13
Quote: "What about converting the internal rotation matrix to a matrix4 structure in DBP, and also things like storing an objects transformation matrix in there, etc."


That is a good idea. I could add that pretty easily. I guess it would be useful to store and reteive it later. Although the new commands that work directly with the DBpro entities will kind of make that a bit redundant. I will definately look at adding that ability though. It could have some uses.

Quote: "@Ron: Is it okay if I still call you WOLF because Ron will be to hard for me to remember."

Sure. Although, if you ever forget my name, you can just look at the top of my post


a.k.a WOLF!
Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 11th Sep 2007 04:53
I was waiting for you to become a mod.

tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 11th Sep 2007 05:11
All sounds impressive, but since I would expect no less from you I'm not giving compliments.

O/T:
Thanks for your kind words over at the SW3D Forums about the Evochron Renegades CD-cover (I don't know if you read my reply?), and congrats at becoming a mod!

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 11th Sep 2007 15:11
Quote: "All sounds impressive, but since I would expect no less from you I'm not giving compliments. "


Thanks!

Quote: "Thanks for your kind words over at the SW3D Forums about the Evochron Renegades CD-cover (I don't know if you read my reply?), and congrats at becoming a mod!"


Yes. I read your reply. I have been following the forums there, but I don't post much. I don't have much to say because I'm not as familiar with the games as you all are and I haven't had much free time to get too deep into testing.


a.k.a WOLF!
Kenjar
19
Years of Service
User Offline
Joined: 17th Jun 2005
Location: TGC
Posted: 11th Sep 2007 16:17
I'd like to see a pesudo physics system. Something that deals with basic stuff, such as if a round ball hits a wall, work out the bounce off angle based on the entry angle, and the angle of the object struck, a command to get the angle of the polygon struck might be useful but that's getting pretty close to fully physics then! This would be useful for simple games such as pong for example, or pool, or any other game that involves a ball. Perhaps a command that deals with a selection of primative shapes. I'm not saying you need to work out the impact force, or matrials or anything. Just the angle based perhaps on the basic collision meshes that DBPro allows you to setup.

It would also be nice to have an orbit command that moves in ovals as well as circles, for games with solar systems.

Things like that, that use mathematics, and deosn't require heavy physics processing to achive, yet gives the illusion that it's going on.
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 11th Sep 2007 16:36
Kenjar,

I could probably setup a "reflection angle" command pretty easily. All it would need is a normal for the contact wall.
Without getting into my own collision system, I don't know how much more of a physics system that I could implement. I don't really want to get into my own collision system.


I had thought about setting up an "oval orbit" command before. The problem is that it needs SO MANY parameters.
Basicly, you would need to pass to the command:

The origin point of the axis to rotate around
AxisOriginX#
AxisOriginY#
AxisOriginZ#

The vector from the origin point that describes the rotation axis
AxisVectorX#
AxisVectorY#
AxisVectorZ#

Radius1# - The first radius definition of the orbit oval distance
Radius2# - The second radius definition of the orbit oval distance

OvalAngle# - The rotation that the Radius1# distance is from zero around the rotation axis vector

Angle# - The rotation of the object around the rotation axis vector

The current orbit command uses the current distance from the rotation axis as it's radius. This command would have to completely take over the position of your object based on the angles that you pass to it.


a.k.a WOLF!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 11th Sep 2007 19:10
@Wolf
It would not be redundant, not everybody wishes to use your plugin just for rotating stuff The DBP 3D maths commands are very useful, like finding the inverse of a matrix and things like that

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 11th Sep 2007 19:35
Diggsey,

You are right. It definately has it's uses. I have already started looking at adding that functionality. Thanks for the suggestion


a.k.a WOLF!
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 25th Sep 2007 11:45
Hey Ron,

Just come across this thread and wanted to say cheers for adding in the direct object rotation commands. This should make it almost too easy for people!

Any news on when the update is being released? I've had EZrotate for a long time but never found call to use it until the last few days.

On a side note, I did some messing around with inverse kinematics a while back (only in 2d mind) and I'm just curious whether you could add/develop commands to make IK with jointed limbs possible?

Keep up the good work,
Jase.

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 25th Sep 2007 16:24
Quote: "Just come across this thread and wanted to say cheers for adding in the direct object rotation commands. This should make it almost too easy for people!"


Yes. It is MUCH easier to just pick up and use now. I think a lot of people are going to really like the new commands.

Quote: "Any news on when the update is being released?"


Should be soon! I was hoping to have it done by the end of the month, but I still have all of those updates to the helpfile for all of those new commands
My real life job got it the way over the last couple of weeks. I've been way too busy lately.

Quote: "On a side note, I did some messing around with inverse kinematics a while back (only in 2d mind) and I'm just curious whether you could add/develop commands to make IK with jointed limbs possible?"


Right now, I have added commands to work directly with objects and cameras. I want to add commands to work directly with limbs. If/when these commands are added, then an inverse kinematics system would be much easier to do. Being able to rotate limbs to a global angle (not caring about the it's parent limb's rotation) is half of the battle. I think I have everything figured out to do this except the time involved to add it. It may have to come in the NEXT update


@Diggsey:
I was able to add a command to pull out the data from a DBpro MATRIX4 structure and throw it right into the EZrotate data. Unfortunately, there isn't a way to make this happen in the other direction. There is no way to get a pointer to the DBpro MATRIX4 data so I can't copy data from EZrotate into it. I've asked Mike about this functionality, and he said that he could add it to the next DBpro update if needed. So, if/when TGC add this functionality to the DBpro MATRIX4 structure, I will add the ability to EZrotate.


a.k.a WOLF!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Sep 2007 12:17 Edited at: 27th Sep 2007 12:18
I've removed the comments from this code, but if it looks like a complex enough scenario for you, I'll happily test it. It includes setting Eulers, Positions, GetMAT**, Offsets, vectors and orbits. Oh, and it gets processed constantly at around 100 FPS.



jasonhtml
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location: OC, California, USA
Posted: 27th Sep 2007 16:35
yay! i just bought EzRotate a few months ago, and now an update! my game does a lot of calculations constantly, so im glad i can find more speed increases with this!

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 27th Sep 2007 19:01
Quote: "yay! i just bought EzRotate a few months ago, and now an update!"


...and hopefully it won't be the last!


@Steve:
I just sent you an e-mail with a test version of the update. The update is finished and ready to go! I am probably going to update the GDK version and create the GDK.net version before I release though. Should be soon...

If anyone else wants to test things out, just let me know. I'll be happy to send you a trial version of the update!


By the way, here is a list of the new commands:

Object Commands:
You can now work directly with your objects in DarkBasic Professional.

Setup:
EZro_SetupFromObject - Setup EZrotate with the data from an object
EZro_ApplyToObject - Apply EZrotate’s internal data to an object
EZro_ObjApplyQuaternion - Rotate an object with the specified Quaternion data
EZro_ObjApplyAxisAngles - Rotate an object with the specified Axis Angle data

Rotation:
EZro_ObjGX - Rotate the object on the global X axis
EZro_ObjGY - Rotate the object on the global Y axis
EZro_ObjGZ - Rotate the object on the global Z axis
EZro_ObjLX - Rotate the object on its local X axis
EZro_ObjLY - Rotate the object on its local Y axis
EZro_ObjLZ - Rotate the object on its local Z axis
EZro_ObjVector - Rotate the object on an axis based at its origin
EZro_ObjOrbit - Rotate and move the object around a created axis

Pointing:
EZro_ObjRotateTo - Rotate towards coordinate using the X,Y and Z axis.
EZro_ObjTurnPitchTo - Rotate towards coordinate using only the Y and X axis (preventing roll).
EZro_ObjTurnTo - Rotate towards coordinate using only the Y axis (preventing roll and pitch).
EZro_ObjPitchTo - Rotate towards coordinate using only the X axis (preventing roll and turn).
EZro_ObjRotateSurfToSurf - Rotate an object from a surface to a surface of another object.
EZro_ObjPolyAlign - Align the object to a surface
EZro_ObjFindLocalYangleToPoint - returns the object's local Y angle between its facing axis (z) and the specified 3D coordinate.

Offsets:
EZro_ObjFindPointFromOffset - Converts offset distances relative to your objects rotation into a global coordinate
EZro_ObjFindOffsetFromPoint - Converts a global point into offset distances to each axis of your object relative to its rotation.

Camera Commands:
You can now work directly with your cameras in DarkBasic Professional.

Setup:
EZro_SetupFromCamera - Setup EZrotate with the data from a camera
EZro_ApplyToCamera - Apply EZrotate’s internal data to a camera
EZro_CamApplyQuaternion - Rotate a camera with the specified Quaternion data
EZro_CamApplyAxisAngles - Rotate a camera with the specified Axis Angle data

Rotation:
EZro_CamGX - Rotate the camera on the global X axis
EZro_CamGY - Rotate the camera on the global Y axis
EZro_CamGZ - Rotate the camera on the global Z axis
EZro_CamLX - Rotate the camera on its local X axis
EZro_CamLY - Rotate the camera on its local Y axis
EZro_CamLZ - Rotate the camera on its local Z axis
EZro_CamVector - Rotate the camera on an axis based at its origin
EZro_CamOrbit - Rotate and move the camera around a created axis

Pointing:
EZro_CamRotateTo - Rotate towards coordinate using the X,Y and Z axis.
EZro_CamTurnPitchTo - Rotate towards coordinate using only the Y and X axis (preventing roll).
EZro_CamTurnTo - Rotate towards coordinate using only the Y axis (preventing roll and pitch).
EZro_CamPitchTo - Rotate towards coordinate using only the X axis (preventing roll and turn).
EZro_CamRotateSurfToSurf - Rotate a camera from a surface to a surface of another object.
EZro_CamPolyAlign - Align the camera to a surface
EZro_CamFindLocalYangleToPoint - returns the camera's local Y angle between its facing axis (z) and the specified 3D coordinate.

Offsets:
EZro_CamFindPointFromOffset - Converts offset distances relative to your camera’s rotation into a global coordinate
EZro_CamFindOffsetFromPoint - Converts a global point into offset distances to each axis of your camera relative to its rotation.

Other:
EZro_SetupFromDbMATRIX4 - Setup EZrotate with the data from a MATRIX4 in DarkBasic Professional’s 3D Math command set


a.k.a WOLF!
Joe T
17
Years of Service
User Offline
Joined: 27th Sep 2007
Location: United Kingdom
Posted: 27th Sep 2007 23:37
Ron, is there currently any way to rotate towards an angle in all three axis? I realise there are currently commands to rotate towards a point, but I am trying to smooth out the alignment of an object as it moves along a not-so-smooth polygonal surface (the EZro_RotateSurfToSurf command works very nicely however!) If there is a way to accomplish this I am keen to know how, and if there isn't a specific command to perform this task, then maybe this is an idea for the next release?

Keep up the fantastic work!

Joe
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 28th Sep 2007 04:32
JoeT,

That really sounds like what the EZro_RotateSurfToSurf command is used for. Maybe a better addition would be a command to convert angle values into the normal vector that is used for the surface alignment. Would that be suitible?


a.k.a WOLF!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Sep 2007 15:55 Edited at: 28th Sep 2007 15:55
Do you need to use a setup command before an action? For example, if you want to EZro_CamRotateTo then you must first EZro_SetupFromCamera? Or does the one command do the setup, calculation and the movement / rotation?

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 28th Sep 2007 16:05 Edited at: 28th Sep 2007 16:07
They are seperate things.

You don't have to use the setup commands when using the object or camera direct interfaces. You just specify which camera or object and the command automatically grabs all of the data from the entity, then does it's magic and applies the results directly to the entity. So, if you wanted to rotate you camera on the global Y axis, all you would have to do is:
EZro_CamGY CamNo, angle#
You don't have to set anything up or apply it to your object after the rotation command!

The EZro_SetupFromCamera and EZro_SetupFromObject commands serve an entirely different purpose. It will just pull the data from your camera or object and pop it into the internal EZrotate data structure that you used to setup with the EZro_SetEuler and EZro_SetPos commands. It is just a shortcut so that if you still want to manually mess with the data of a camera or object, you don't have to use the EZro_SetEuler and EZro_SetPos commands anymore. When you are done manually playing with the data, you will notice that there are also commands to apply the internal EZrotate data directly back to an object or camera.

How are you liking things so far?


a.k.a WOLF!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Sep 2007 16:11
Everything looks fantastic - in theory! Unfortunately my project is a VB.net / DBP hybrid and I have just come to realise that the VB.net portion is approximately 20 miles away at home . I have been scratching my head for an hour, before realising that the framework is about a month out of date!

It looks like a good combination of new and old. It caters for the "what if" scenario, where you want results based on an object, but not necessarily to take any action.

Readability will be much better. I am glad I have used the original so that I understand the concepts. But it will be nice to tidy up the code now. I have sections where I modify numerous objects one after the other, so the code reductions will be massive.

And how have you packed in all of this extra stuff, and made the DLL almost half the size?!?!?

Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 28th Sep 2007 16:19
Quote: "And how have you packed in all of this extra stuff, and made the DLL almost half the size?!?!?"


Better all the way around, eh?

Quote: "It looks like a good combination of new and old. It caters for the "what if" scenario, where you want results based on an object, but not necessarily to take any action."


That is what I was aiming for. I wanted all changes to be transparant, so users wouldn't HAVE to update any of their code to take advantage of the new version. Unfortunately, I don't think I'll be able to pull that off with the GDK version. It looks like changes will not be transparent to the users.

Hopefully I can make a significant improvement to EnAn too!


a.k.a WOLF!
Joe T
17
Years of Service
User Offline
Joined: 27th Sep 2007
Location: United Kingdom
Posted: 28th Sep 2007 18:22
Quote: "That really sounds like what the EZro_RotateSurfToSurf command is used for. Maybe a better addition would be a command to convert angle values into the normal vector that is used for the surface alignment. Would that be suitible?"


The EZro_RotateSurfToSurf command doesn't rotate around the local y axis, what I was describing would result in the objects (or whatever) having exactly the same orientation. However, I have realised that this isn't really what I want, as I wish for the local y-rotation to align immediately. I have accomplished this by using EZro_RotateSurfToSurf with an angle dependent on the angle between the surfaces, and then doing a local y-axis rotation using EZro_FindLocalYAngleToPoint; it seems to work well .

And yeah, I think a command to produce a normal from an angle would be a useful shortcut, maybe also have a parameter to specify the axis?

Login to post a reply

Server time is: 2024-11-27 20:46:18
Your offset time is: 2024-11-27 20:46:18