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 / Greetings and Questions

Author
Message
Biocreep
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 29th Jul 2004 12:47
Hi all, just wanted to introduce myself and ask a question. I am a newbie programer, in the sense that I hadn't programed a thing in 12 or so years.I purchased DB PRO and so far I am in love with it,(reminds me of old school programming). Re-learning the basics is slow going, but seems to be going well. Ran into a few problems I couldn't find help for, when going through the tutorials and forums. All those who help the newbies like myself are terrific, and these forums are a goldmine of information. Onto my problem

As far as I can figure, I have a either a near clip plane error or I have a movement error, I can't seem to isolate which. Please excuse my coding, its not up to speed yet. I rem-ed the texture file for easy compiling if anyone would care to try.

When I run this, the box(actor) is fine until i do a left turn or right turn. It then becomes jumpy/shifty and shakes constantly. I tryed several things to try and fix it, but to no avail.
1)turned off gravity and back on
2)moved sync commands around
3)changed original function routines into gosubs
4)moved camera around different locations/distances.
5)moved gosub routines into main, tested, moved back.
6)changed camera smoothing properties from 1 to 100
7)pulled hair out, (what little I have left)
8)debated if I should just move camera, and attach box to camera movment.(instead of camera attach to box)

Any help would be appreciated. This program is a learning, testing program I was working on with all the great tutorials.

if anyone could help me with this problem I would appreciate it. Its a great learning process for me and anyone else with the problem.

ps. I REM-ed out a bunch of stuff f0r easy compilation.
Biocreep
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 29th Jul 2004 12:54
OOOPS. Sorry all, my code got messed up when I tryed to post it first time. Trying again.





REM +++++++++++++++++PRELOADINGSEQUENCE++++++++++++++++++
SYNC RATE 0
sync on
REM LOADING OF IMAGES
rem load image "textures\mud1.bmp",1
REM END OF IMAGE LIST
REM MAKE THE WORLD
make matrix 1,1000,1000,10,10
randomize matrix 1,30
rem prepare matrix texture 1,1,1,1
position matrix 1,0,0,0
update matrix 1
REM END OF THE WORLD....HAHAHA
REM position camera 1,100,1
`MAKE THE ACTOR
MAKE OBJECT CUBE 2,4
GHOST OBJECT ON 2
POSITION OBJECT 2,500,100,500
SYNC
REM ++++++++++++END OF PRELOAD+++++++++++++++++


REM ++++++++++THE MAIN PROGRAM LOOP+++++++++++
DO





GOSUB PLAYERMOVEMENT
REM PLANETGRAVITY
SYNC
loop
REM++++++++++END OF MAIN PROGRAM LOOP++++++++++++++++++++

REM ++++SUBROUTINES AND FUNCTIONS++++++++++++++++++++++++++

REM ++++++++PLAYER MOVEMENT++++++++++++++++++++++++++++++++
PLAYERMOVEMENT:
REM CONSTANTS
OBJECT_SPEED#=1
PXPOS=OBJECT POSITION X(2)
PYPOS=OBJECT POSITION Y(2)
PZPOS=OBJECT POSITION Z(2)
PANGY=OBJECT ANGLE Y(2)
REM END OF CONSTANTS


REM SET INDIVIDUAL GRAVITY
GOSUB PLAYERGRAVITY
REM END OF GRAVITY


REM SET THE CAMERA TO FOLLOW THE PLAYER
SET CAMERA TO FOLLOW PXPOS,PYPOS,PZPOS,PANGY,15,10,1,1

REM END OF CAMERA

REM MOVE PLAYER
IF UPKEY()=1 THEN MOVE OBJECT 2,OBJECT_SPEED#
IF DOWNKEY()=1 THEN MOVE OBJECT 2,-OBJECT_SPEED#
IF LEFTKEY()=1 THEN ROTATE OBJECT 2,0,(PANGY)-1,0
IF RIGHTKEY()=1 THEN ROTATE OBJECT 2,0,(PANGY)+1,0
IF SPACEKEY ()=1 THEN MOVE OBJECT UP 2,2

RETURN
REM+++++++END OF PLAYER MOVEMENT++++++++++++++++++++++

REM ++GRAVITY FIX FOR ABOVE WALKING THROUGH GROUND PROBLEM
PLAYERGRAVITY:
REM DECLARE CONSTANTS
PPZ=OBJECT POSITION Z(2)
PPX=OBJECT POSITION X(2)
PGLEVEL = GET GROUND HEIGHT (1,PPX,PPZ)
PULL=1
A=2
REM END DECLARE OF CONSTANTS
IF OBJECT EXIST (A)
IF OBJECT POSITION Y(A)>PGLEVEL+3 THEN MOVE OBJECT DOWN A,PULL
IF OBJECT POSITION Y(A)<PGLEVEL+3 THEN MOVE OBJECT UP A,PULL
ENDIF
RETURN
REM ++++++END OF GRAVITY FIX++++++++
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Jul 2004 11:37
Always use floats for object positions, the 'set camera to follow' was being given integers.

And thanks for commenting out media


REM +++++++++++++++++PRELOADINGSEQUENCE++++++++++++++++++
SYNC RATE 0
sync on
REM LOADING OF IMAGES
rem load image "textures\mud1.bmp",1
REM END OF IMAGE LIST
REM MAKE THE WORLD
make matrix 1,1000,1000,10,10
randomize matrix 1,30
rem prepare matrix texture 1,1,1,1
position matrix 1,0,0,0
update matrix 1
REM END OF THE WORLD....HAHAHA
REM position camera 1,100,1
`MAKE THE ACTOR
MAKE OBJECT CUBE 2,4
GHOST OBJECT ON 2
POSITION OBJECT 2,500,100,500
SYNC
REM ++++++++++++END OF PRELOAD+++++++++++++++++


REM ++++++++++THE MAIN PROGRAM LOOP+++++++++++
DO





GOSUB PLAYERMOVEMENT
REM PLANETGRAVITY
SYNC
loop
REM ++++++++++END OF MAIN PROGRAM LOOP++++++++++++++++++++

REM ++++SUBROUTINES AND FUNCTIONS++++++++++++++++++++++++++

REM ++++++++PLAYER MOVEMENT++++++++++++++++++++++++++++++++
PLAYERMOVEMENT:

REM SET INDIVIDUAL GRAVITY
GOSUB PLAYERGRAVITY
REM END OF GRAVITY

REM CONSTANTS
OBJECT_SPEED#=1
PXPOS#=OBJECT POSITION X(2)
PYPOS#=OBJECT POSITION Y(2)
PZPOS#=OBJECT POSITION Z(2)
PANGY#=OBJECT ANGLE Y(2)
REM END OF CONSTANTS

REM SET THE CAMERA TO FOLLOW THE PLAYER
SET CAMERA TO FOLLOW PXPOS#,PYPOS#,PZPOS#,PANGY#,15,10,1,1

REM END OF CAMERA

REM MOVE PLAYER
IF UPKEY()=1 THEN MOVE OBJECT 2,OBJECT_SPEED#
IF DOWNKEY()=1 THEN MOVE OBJECT 2,-OBJECT_SPEED#
IF LEFTKEY()=1 THEN ROTATE OBJECT 2,0,(PANGY#)-1,0
IF RIGHTKEY()=1 THEN ROTATE OBJECT 2,0,(PANGY#)+1,0
IF SPACEKEY ()=1 THEN MOVE OBJECT UP 2,2

RETURN
REM +++++++END OF PLAYER MOVEMENT++++++++++++++++++++++

REM ++GRAVITY FIX FOR ABOVE WALKING THROUGH GROUND PROBLEM
PLAYERGRAVITY:
REM DECLARE CONSTANTS
PPZ#=OBJECT POSITION Z(2)
PPX#=OBJECT POSITION X(2)
PGLEVEL# = GET GROUND HEIGHT (1,PPX#,PPZ#)
PULL#=1
A=2
REM END DECLARE OF CONSTANTS
IF OBJECT EXIST (A)
IF OBJECT POSITION Y(A)>PGLEVEL#+3 THEN MOVE OBJECT DOWN A,PULL#
IF OBJECT POSITION Y(A)<PGLEVEL#+3 THEN MOVE OBJECT UP A,PULL#
ENDIF
RETURN
REM ++++++END OF GRAVITY FIX++++++++
Biocreep
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 30th Jul 2004 14:42
Wow, thanks for the reply. It's a perfect fix. Runs very smoothly now. I'll have to file that tidbit in my brain for future reference. Hope this thread helps anyone else in learning.


Thanks again Sparky!!!!!!!!!

Login to post a reply

Server time is: 2024-11-27 03:47:09
Your offset time is: 2024-11-27 03:47:09