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.

3 Dimensional Chat / Why does it get so slow ? >>> urgent

Author
Message
Cameldude
17
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 21st Jan 2003 18:45
I'm creating some kind of a 3D shooter in DB, but my biggest problem is that everytime an object needs to be moved, the game slows down too much...
Can someone help me with this ?
indi
17
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 21st Jan 2003 18:55
firstly what are your system specs

CPU
ram
vidcard
operating sys


secondly what method are u using to acheive movement

are u using a move command or an incremental placement with a timer?
Maybe its a lot less complex than these ideas so tell us more about your environment and code.

Cameldude
17
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 21st Jan 2003 21:50
I found the main reason why it got so slow. In my cycle, I constantly made an object point to me, and than move it towards me. When I removed the line which made the object point to me, it became a lot faster. (altough I'd still like it to go a little faster).
This is my PC:
P4
1,5 Ghz
128 RIMM
NVIDIA TNT2 32Mb Ram
Win XP Home

I also have problems with the textures on my walls (plain objects). There are stripes moving all over them when I play my game...

PS I'm using the demo

indi
17
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 22nd Jan 2003 02:23
ok u have a good system but your video card is letting u down a bit.

I have a tnt2m64 also and I used the detonator drivers in the latest form to make it more stable.

Could u post a snippet of code, if its too long or senstive dont worry.

The essence to a good healthy speed is the reduction of calls in the main loop.

Imagine u had 100 objects colliding with each other.

Only when two objects get close is when u would want to check for collision instead of it being activated.
You can achieve this effect with a distance function made by archimedes or pythagorus, who knows that kinda both had the same approach.

anyway a distance function helps reduce the amount of collision checks per loop which reduces commands to be executed and saves space for other goodies.

there are tonnes of distance forumulas around the boards if u want 2d or 3d.

indi
17
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 22nd Jan 2003 02:24
typo

instead of it being activated.
=
instead of it being always activated.

Shadow Robert
17
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 22nd Jan 2003 18:47
make sure your Sync is higher than 40 to be smoother, and that your movement values arn't too small.

apart from that, unfortunately DarkBasic either uses complete the graphics card or processor (and due to some tests i've run in the past the former is most likely)

so unfortunately slow speeds are to be expected on non-hardware accelerated cards

Anata aru kowagaru no watashi!
Kangaroo2
17
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 22nd Jan 2003 22:56
From tests I have Run your suspicions are correct Vegeta, it uses the graphics card much more than the processor. A 2Ghz Machine with 1Gig of RAM but onboard 32Mb Shared, non 3d accelerated graphics literally chugs along!

Kangaroo2
17
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 22nd Jan 2003 22:57
And by chugs I mean 10-20 fps - on a 2Ghz machine! lol

(Damn I wish there was an edit button)

indi
17
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Cameldude
17
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 23rd Jan 2003 18:04
This is my code (partly in Dutch - excuse me for that)

dispX=800:dispY=600:colordepth=16

set display mode dispX,dispY,colordepth
hide mouse: autocam off
set camera range 1,750
set global collision on
set mipmap mode 1
enable static occlusion
set normalization on

mousesens#=1.5
posx#=250
posy#=2.5
posz#=250
stapvooruit# = 7
camerahoekx = 0
camerahoeky = 0
camhoogte# = 20
scorphoogte = 0
muurhoogte=40

load image "floor.bmp",1
load image "muur.bmp",2
load image "crosshair.bmp",3
load sound "fire.wav",1
load object "c:\test\walk.X",50

rem wandelaar
position object 50,20,scorphoogte,25
yrotate object 50,270
loop object 50,1,24
scale object 50,14,14,14

rem Grond matrix maken
make matrix 1,500,500,30,30
prepare matrix texture 1,1,1,1

rem backdrop en fog
color backdrop rgb(0,0,0):backdrop on
fog distance 400:fog on

rem cylinder maken
make object cylinder 100,10
position object 100,250,2.5,250
s#=object size x(100)/2
make object collision box 100, 245, 0, 245, 255, 10, 255, 0
set object collision to boxes 100
hide object 100

rem kogelstrook maken
make object plain 99,sqrt(250000),0.1
position object 99,250,50,230
xrotate object 99,90

rem muren maken
rem muren maken >>> buitenrand
for i = 1 to 4:make object plain i,505,muurhoogte:next i
yrotate object 1,0
position object 1,250,muurhoogte/2,500
make static object 1
make static collision box 0,0,500,500,muurhoogte,500
yrotate object 2,90
position object 2,500,muurhoogte/2,250
make static object 2
make static collision box 500,0,0,500,muurhoogte,500
yrotate object 3,180
position object 3,250,muurhoogte/2,0
make static object 3
make static collision box 0,0,0,500,muurhoogte,0
yrotate object 4,270
position object 4,0,muurhoogte/2,250
make static object 4
make static collision box 0,0,0,0,muurhoogte,500
rem muren maken >>> binnenmuren
make object plain 5,401,muurhoogte
position object 5,250,muurhoogte/2,450
make static object 5
make static collision box 50,0,448,450,muurhoogte,452

make object plain 6,401,muurhoogte
yrotate object 6,90
position object 6,50,muurhoogte/2,250
make static object 6
make static collision box 48,0,50,52,muurhoogte,450

make object plain 7,401,muurhoogte
yrotate object 7,90
position object 7,450,muurhoogte/2,250
make static object 7
make static collision box 448,0,50,452,muurhoogte,450

draw to front
sprite 1,dispX/2,dispY/2,3
rem Loop
autocam on
do

oldposx#=object position x(100)
oldposy#=object position y(100)
oldposz#=object position z(100)

if upkey() = 1 then move object 100,stapvooruit#/2: stepagain=1
if downkey() = 1 then move object 100,stapvooruit#*(-1)

if mousemovex() > 0 then inc camerahoekx,mousemovex()*mousesens#:if camerahoekx > 360 then dec camerahoekx,360
if mousemovex() < 0 then inc camerahoekx,mousemovex()*mousesens#:if camerahoekx < 0 then inc camerahoekx,360
rem if mousemovey() > 0 then inc camerahoeky,mousemovey():if camerahoeky > 360 then dec camerahoeky,360
rem if mousemovey() < 0 then inc camerahoeky,mousemovey():if camerahoeky < 0 then inc camerahoeky,360
yrotate object 100,camerahoekx

if mouseclick()=1
play sound 1
position object 99,posx#,posy#+camhoogte#*0.75,posz#
yrotate object 99, camerahoekx+90
move object 99,sqrt(250000)/2
endif

posx#=object position x(100)
posy#=object position y(100)
posz#=object position z(100)

rem Handle sliding collision for player object with other objects
if object collision(100,0)>0
dec posx#,get object collision x()
dec posz#,get object collision z()
endif

rem Ensure camera stays out of static collision boxes
if get static collision hit(oldposx#-s#,oldposy#-s#,oldposz#-s#,oldposx#+s#,oldposy#+s#,oldposz#+s#,posx#-s#,posy#-s#,posz#-s#,posx#+s#,posy#+s#,posz#+s#)=1
dec posx#,get static collision x()
dec posz#,get static collision z()
endif
position object 100,posx#,posy#,posz#


rem tweede stap
if stepagain=1 then move object 100,stapvooruit#/2: stepagain=0
set camera to follow posx#,posy#,posz#,camerahoekx,1,camhoogte#,1,1

rem wandelaar bewegen
move object 50,-1
walkx=object position x(50)
if walkx<10 or walkx>490 then yrotate object 50,90

sync
loop

Cameldude
17
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 23rd Jan 2003 18:06
It's a whole lot, I know...
Worked about two weeks on that

Cameldude
17
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 23rd Jan 2003 18:08
And that plain object #99 is just something I was trying out, don't mention that

Login to post a reply

Server time is: 2020-08-06 08:30:44
Your offset time is: 2020-08-06 08:30:44