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.

Newcomers DBPro Corner / Jerky camera

Author
Message
Mr Niceguy
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location: The zoo
Posted: 7th Feb 2005 22:41 Edited at: 8th Feb 2005 03:59
Hi everyone.

I've been programming with Dark Basic Classic and Pro on and off for about a year. I haven't spent much time with it yet, so I'm not very good, but I want to start learning it better now.

I've "been around the block", so I know not to start with a MMORPG, so I figured I'd just make a simple little 3D platform game. Well, I've got the basic movement done, and I've got a pretty cool camera system, but it's really choppy. I've attached the source code, so if someone could take a look and maybe show me what's wrong, I'd really appreciate it.

Thanks!

BTW, this is being made with DBPro.


Where my hat is at?
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 10th Feb 2005 12:24
Hello Mr. Niceguy,

Try placing all of the camera rotation and movement calculations and camera updates as the last lines of your code, and then it should not be so choppy. I have no clue why up to this point, but in coding an experimental 3D shooter, the camera rotation and movement was very choppy and unstable. However, once I moved the lines of code involving the camera's orientation down below the rest, it smoothed it's movement and rotation tremendously. Also, make sure that your camera's rotation calculations and updates are placed after it's movement calculations and updates.

This should fix the problem. If not, then I have no idea what I am talking about. Hehe. Good luck!

+NanoBrain+
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 10th Feb 2005 15:04
Hi Mr. Niceguy, I'm not sure if the camera jumping is due to the camera routine itself or if it's part of all that movement routine going on there, or a combination. I'm working on some Object Based AI projects (the intent is to reduce the amount of programmed math needed) and have come up with a workable camera routine that's pretty easy to follow. Anyway, this may not be a direct answer to your question, but feel free to look through this code and see if any of it is useful to you.



Note: The only reason I bother to use the AI object is because the Set Camera to Object Orientation command is bugged. Otherwise, I would only use the camera commands (and life would be much simpler).

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
DeHonCha
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: A world of my own...
Posted: 12th Feb 2005 05:58
i'm really sorry mr. niceguy - but i dont know dbp - it doesnt even work on my crappy computer

For when they said I couldn't, I did...
Mr Niceguy
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location: The zoo
Posted: 13th Feb 2005 02:47
@NanoBrain: Thanks, I tried that, but I still have the same problem.

@RiiDii: Well, I know how to rotate the camera with the left and right keys, but what I want is for it to rotate only when the character is standing still, and he moves relative to the camera angle.

If you don't see what I mean by "choppy", hold the down arrow, then "swerve" left and right. The camera will jump around.


Where my hat is at?
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 13th Feb 2005 15:10 Edited at: 13th Feb 2005 15:26
I see what you mean Mr. Niceguy about the choppiness. I don't have an answer just yet, but I am pretty sure it's your object movement, not your camera movement (esp. since your camera movement is directly based on your object movement) . I'm going to keep plugging at it though.

Edit: In the meantime, here's some recommended changes to the move_it: subroutine. Doesn't solve anything .

1) fined-tuned the angles to 45 deqrees instead of 90 (not sure if that's something you want, but you can take it out easily).
2) reduced the lines of code by a few.
3) organized the If upkey()... stamements.



"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 13th Feb 2005 16:28 Edited at: 13th Feb 2005 16:29
Found it! In your Camera subroutine, switch the order of the lines to look like this (place the ca#= last):



Heh - I was wrong about the object movement

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Mr Niceguy
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location: The zoo
Posted: 14th Feb 2005 10:22
Thanks a lot RiiDii. That was just what I needed. And thanks for cleaning up the movement, too. I tweaked the code a bit, and I'm not having any more problems. It still isn't as smooth as I'd like, but I'm pretty happy with it. Check it out if you want.


Where my hat is at?
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 14th Feb 2005 17:13
Good work Mr. N!!! I'll be looking forward to seeing the final product. Especially since that's an interesting movement routine you've got there - very unique (imo). Most games the camera just follows the player from behind with a little smoothing. But yours is a little less disorienting.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II

Login to post a reply

Server time is: 2024-11-27 22:26:16
Your offset time is: 2024-11-27 22:26:16