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.

DarkBASIC Discussion / hiding objecst when not in screen

Author
Message
agentblob
22
Years of Service
User Offline
Joined: 28th Feb 2003
Location:
Posted: 23rd Mar 2003 00:34
how can i hide any objects that cant be seen, ive got a wall(static object) and behind this wall is four eneamys, but when i look at the wall the fps goes down by about 20, can i make it so when the eneamys are hidden behind a wall they dont exist(ie not slowing down the frame rate?)
thanks
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 23rd Mar 2003 00:51
there is a command "object in screen" or something like that...but i think yuo have 2 similar command... but see that in the help..
Danmatsuma
22
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 23rd Mar 2003 02:31 Edited at: 29th Mar 2003 16:06
Here you go:


But you also need to turn on static occlusion


ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
Duncanla
22
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 25th Mar 2003 02:51
Or, a really simple way would be to just hide any objects outside of the camera range. Not the most efficient, but it's enough for some games.
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 26th Mar 2003 01:36
i have the same post about this theres some objects in my game that slow down my character when i walk in their direction and it shows greatly,i also have fog set on to a distance of 1500 so i figure since the camera cant see them due to the fog hide them untill i get in a close range
Danmatsuma
22
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 29th Mar 2003 16:09
You could alter that little snippet I posted above to do that.

For those who don't know, the function goes after the main loop, and you call the function somewhere near the end of the loop, preferably after any camera statements

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
GameKit
22
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 30th Mar 2003 05:59
for a=# to #
if object in screen(a)=1 and object visible(a)=0 then show object a
if object in screen(a)=0 and object visible(a)=1 then hide object a
next a

this is about the same as Danmatsumo's code but i hope it helps anyways...

Anyone Can Destroy...But Few Can Create...
Dave J
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Mar 2003 09:57
Remember to exclude certain objects you may have from that function, i.e. GUI planes and collision boxes for your camera, etc. etc. Otherwise some things may start appearing/dissapearing that you don't want to. =)

"Computers are useless they can only give you answers."
Danmatsuma
22
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 30th Mar 2003 10:58
Collision boxes are unnaffected by the hide object command, and you can number your gui objects higher than the max_objects in the function I posted.
But whatever code you use, make sure you check that the object you're trying to hide exists first, or you'll get an error message

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
AsriCE
22
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Brunei
Posted: 30th Mar 2003 13:10
DB treats all 3D objects like spheres, which means that a cube, a cone, a cylinder etc has a bounding sphere surrounding it. So using the Object In Screen() command will not be as accurate as what you're expecting except for sphere-like objects. This goes to collision as well, DB uses a sphere collision on its collision commands.

Asri CE Crew

Anak Brunei!
Dave J
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Mar 2003 15:03
Uhh, can't you set the collision? I.e. "Set Object Collision to Polygon" would change that sphere stuff.

"Computers are useless they can only give you answers."
AsriCE
22
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Brunei
Posted: 31st Mar 2003 07:07
Oh, I forgot about that one. Thanks for reminding.

Asri CE Crew

Anak Brunei!
Robin
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location: United Kingdom
Posted: 1st Apr 2003 17:54
you can set all the objects which you do not want to move around ie. the wall etc. to static objects using the command:

make static object objectnumber,1

do this to all you objects and the ,1 at the end turns on static occlusion which should not draw any objects which are not visible, ie behind other objects.

http://www.thegameszone.has.it

Login to post a reply

Server time is: 2025-05-16 02:39:47
Your offset time is: 2025-05-16 02:39:47