@CAE,
Two things right quick. First, I found an old thread here where you gave us access to a script you wrote for BGT with a whole lot of math functions. I tried downloading it, but the link that was given is now dead. Do you still have it, and if so, can I have access to it please?
Second thing: I think that at the moment my main issue is that I am trying to figure out the best way to structure this with respect to the changes in the way I am handling movement, and I'm trying to figure out the most efficient, best way to implement DT. I've read so many conflicting opinions, so I would greatly appreciate some advice from an actual dev who has actually worked with these concepts in the past.
The way things are structured now, when the game starts, the factors that impact things are continuously monitored within a function called check events. This function does things like monitor for keyboard input,
takes care of retrieving info from packets, etc.So with respect to DT, updating movement, etc., do I add the lines for updating position, velocity, etc. of my vectors here, or do I do that within the actual ball object? Or, would I do it in the function that sets initial state and starts the game? I.e.:
void StartMatch()
{
//set initial values
//Restart the game clock
//do any other crap for before-game setup.
//load the ambience sounds, and then:
ambience.play_looped();
while(true)
{
CheckEvents();
B.position += B.velocity*DT; /*I'm assuming that I can just use the entire velocity vector at once, instead of the more verbose:
B.position.x += B.velocity.x*DT;
B.position.y += B.velocity.y*DT;
B.position.z += B.velocity.z*DT;
wait(5);
}
}
Or, do I place the updating of positions and such in the clock.update method, since that's where the clock is reset for the next frame?
bool update()
if (time.elapsed>=delay)
{
B.position += B.velocity*DT; user.position += user.velocity*DT;
time.restart();
time.resume();
return true;
}
return false;
}
Where do I actually call the tick mothod in the clock object? Do I do it in checkevents, so that each time it is checked, tick is called again? Or, do I do it each time the position is actually updated?
And where should I put the actual calculations on the associated movement vectors of the ball and the player? Should I do that in my math.bgt script, or should I do it like this:
class ball
{
float x, y, z;
int slot;
Spin spin;
bool tossing = false;
bool moving = false;
bool rising = false;
bool choosing = false;
ball()
{
vector position(0, 0, 0);
vector velocity(0, 0, 0)
}
ball(position, velocity, int slot)
{
this.slot = slot;
}
void move()
{
//vector calculations here.
//update movement position here.
}
I apologize again for being such a pain in the ass. I feel like a moron at the moment because I'm forced to ask all of these questions. But like I said in a different topic post, I am determined to finish this, and I am not giving up. I'm stuck at the moment because I am unsure of exactly how to structure this so that it is the most efficient, done right, and structured right so that I'm not forced to rewrite this again, and so that the quality can be the best I can make it. And in that vein, please do not hesitate to point out flaws in my code and tell me where I'm wrong. I have no problem with being shown where I'm incorrect. I might be annoyed that I am forced to totally restructure so much, but on the flip side, I am enjoying the fact that I am learning at the same time. I think that once I figure out where to put the tick calls and where to actually update positions, etc., and where to actually put the mathematical calculations on the associated movement vectors and behaviors, i.e., what happens when the ball bounces, etc., resultant of mathematical calculations, I can make some headway. I am sure I'll have more questions in the future, and I am sure that some of them might be stupid, but at least once I get a handle on this part I can actually move forward and make some progress. I also want to thank you for being willing to put up with the pain in the ass questions and for being willing to help. You are the only one who has responded to my questions. I must admit that I am a little surprised by that fact. I would have thought that I would have seen advice and support from more than one dev in this community, given the nature of accessibility in the mainstream market, and given that we all share a love for gaming. I'd think that we should support one another's development projects and try to help one another as best we can, since every project that is completed benefits the entire community. But that's neither here nor there. I just wanted you to know that your help, patience, and willingness to share your knowledge are greatly appreciated.
JLove