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 / Radar Set Object 1,0,1 Problem

Author
Message
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 21st May 2008 05:48
Hi All,

I am finding that on some of the newer computers the set command is not working properly. Let me explain first what I am doing and why. I start with a black circle for the back of a radar unit (on a HUD display), say at position 0,0,10. Then I have various ship icons on top of this black radar at positions x,y,5. So far so good, but to avoid the rather ugly presentation of these units simply disapearing completely off the radar once they exceed a certain distance from the center of the black circle, I created another plain at position 0,0,1. This plain has a black circle on the inside and a grey perimter circle on the outside. By doing the Set object 1,0,1 command I had hoped the black part of this object would become transparent so that the ship icons could be seen provided they dont go beyond the grey part of the circle. The advantage of positioning the circle object nearer to the camera than the ship icons is that the grey part of the circle gradually covers over the icons as they increase in distance from the center of the object. Hope I havent lost anyone so far.

Now the above approach worked fine on both my laptop and desktop at home but not the newer computers at work and I am 100% sure this is due to the "set object command 1,0,1" not working or, for some reason the newer computers thinking the black part of image being textured onto the plain is not rgb(0,0,0). Maybe newer computers have extra detail of (0.1,0.1,0.1) or something. Goodness knows. Now 2 questions:

i) has anyone else experienced this problem and if so is there a fix?
ii) if not, then is there another way of achieving the effect I'm after of icons gradually disapearing from the radar, rather than an all or nothing approach. Note that by "gradually disappearing" I do not mean fading away, but rather that as they approach and extend beyond the grey perimeter of the radar, that this perimeter covers over them. (ps I then have a routine that says Once completely obscured by the perimeter, hide object).

Cheers
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st May 2008 08:18 Edited at: 21st May 2008 08:20
Sounds like you are doing it right, (assuming that 'set object command 1,0,1' is a typo as it needs a minimum of 4 parameters).

The only thing I can think of off the top of my head regarding transparency issues is the difference between using 16 bit and 32 bit screen modes in your program as they affect your object's transparency.

Having said that, if you are sure that the black actually is true black (0,0,0) then the bit depth shouldn't have any effect.

So, if you aren't already doing so, try using Set Display Mode Width, Height, 32.

If all else fails, use a sprite or image in the same way as you are using the second plain to mask out the parts of the 3D view you want to hide.

TDK_Man

Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 21st May 2008 08:44
Thanks TDK, good to hear at least I'm on the right track (and yes set obj was just a typo). I already was setting display mode as 32 but will investigate a sprite/image approach. Its just bizarre that the method works ok on my home computers but not my work one (or in fact my brother's one).
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st May 2008 08:55
This works:



TDK_Man

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st May 2008 10:29
If you're using a computer at work, they might not invest in the highest quality graphics cards because they may not need it. Or the display settings are not optimized for texture handling. The computer at work may noy have alpha blending capability. It's probably rare this day and age but see what:

Return Value=ALPHABLENDING AVAILABLE()

gives you.

Enjoy your day.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 23rd May 2008 09:32
Thanks TDK and Latch!!

Will check this out over the weekend.

Without your considerable assistance this game would never have left the ground.

Cheers,
Stig Design Stig Magne
19
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 29th May 2008 01:08
if i don`t remember right the code is right like this
-set object objnr,Wireframe,trans,cul
-3options or more try Press [F1]Key to se what can do

Stig Design (Free Games,Sources,Textures,Photo`s)
Lisence Free at http://StigDesign.piczo.com
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 10th Jun 2008 06:46
@Stig, Thanks but the issue is not knowing what the set command does but why it isnt doing what its supposed to do.

@Latch I have now checked, and alpha blending() is a 1 on the problem pcs. Your code works perfectly, and is exactly what I was trying to do. The only issue I have was the fact the radar image I imported was quite detailed - I spent a bit of time doing it in Paint Shop Pro, whereas I suspect that recreating a sprite/bitmap image in DBC is always going to be fairly rudimentary in terms of detail (please note that this is not at all a criticism of your code, which I understand was just trying to show how to overcome the issue - and it does).

Do you have any ideas how to overcome this or do I simply need to persevere with creating the desired level of sophistication via a bitmap in the actual code?

I've attached an image of the radar (bottom right of screen) so you can see what it looks like.

Cheers,

Chas

Attachments

Login to view attachments
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Jun 2008 11:08
Quote: "Your code works perfectly, and is exactly what I was trying to do."


I'm not sure what code you are referring to. Maybe you mean TDK's code snippet?

Quote: "Do you have any ideas how to overcome this or do I simply need to persevere with creating the desired level of sophistication via a bitmap in the actual code?"


Though I think you are still referring to TDK's code I could suggest a direction:

A simple fix, for the outside gray ring, don't use a plain. If you have any 3d modeling programs, create a ring with an open center (like an O). You can then use as detailed a radar as you want because the center will be open (to see the ships) and the edges will obscure anything under them.

Enjoy your day.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 11th Jun 2008 02:15
Ah of course, how silly of me. The only issue downside might be the 3D object will consume more resources but if i keep it low poly hopefully it will do the trick.

And yes, sorry I meant TDK's code snippet!

Login to post a reply

Server time is: 2025-06-06 00:10:25
Your offset time is: 2025-06-06 00:10:25