Game Development Community

Moving objects on a path too frequently can break the path?

by Dave Calabrese · in Torque Game Builder · 01/11/2007 (5:05 pm) · 3 replies

I have a path that is a simple straight line with 10 nodes on it, like so:

+--+--+--+--+--+--+--+--+--+

Through script, I am mounting and moving objects left and right on this path. However, if I don't wait at least 3 actual seconds between each call to move an object, then it is possible for objects to not move to a node, yet think they did, or become stuck somewhere between nodes.

Examples of this include:

-) Tell ObjectA to move from Node 3 to node 5. Object A gets to node 4 then stops, yet thinks it is on node 5.
-) Tell ObjectA to move from Node 3 to node 5. It gets to where a node 3.7 would be, stops there, and thinks it is on node 5.


Is this a bug or limitation to the engine I am finding? I only have up to 10 objects being moved around at once... I would think the system is capable of handling MANY more than this. Is there any kind of optimization code I can use here to improve this, or a better way to script it? My scripting for this currently reads as such:

%object.setPathStartNode(%startNode);
	%object.setPathEndNode(%endNode);
	%object.setPathMoveForward(1);

And then that is just called frequently for the various objects (frequently, as in, up to once per second).

Suggestions? Advice? I suspect the engine can handle this, I'm just missing something...

#1
04/29/2010 (11:41 am)
Hi Dave,

Did you ever figure out what the problem was?
#2
04/29/2010 (11:47 am)
The problem, if I recall correctly, was based on timing issues when relying on script. Since then (as that was 3 years ago), we have almost entirely switched our programming to C++, and no longer have any problems related to timing issues such as this. So, I would suggest keeping all of your logic code in C++, and only using TorqueScript for more simpler tasks in your project.
#3
04/29/2010 (7:55 pm)
Well, that's discouraging. Has anyone built a decent game without diving into the source?