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.

Dark GDK / radar help

Author
Message
Shadow Wolf
16
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 25th Jul 2008 23:06
Does anyone have any ideas on how to make a radar?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Jul 2008 19:41
Either sprites, 3d objects, or 2d Drawing. I hear good things about the sprite method.

Next - you need to literally create a scaled representation of all the radar things that are to show up.... numerically. If your radar is 100 dots accross... and covers 1000 dbpro units of 3d space - then you need to find all things within a 1000 dbpro units of "you" (radar center) and then draw a dot for each "thing in radar range" according to the percentage of the radar realestate.

You should do a code source search for this top to see what I mean.

If you have this 100x100 dot radar, you drop the "Y" component unless you are making a 3d radar - which is basically the same thing... but lets stick to 2d for a moment.

You have 100x100 dot radar with a 1000 dbpro unit range. For simplicity, lets use "dots" and position radar at top left of screen.

Each loop fill the radar with black using the dbBox command - there is a way to make it fill - black is fine.

Now - Lets loop through all your radar'able objects (presumed in an array)

Ok - let's say we have one - a baddie at 450,650,230. Drop the "Y" part so we have
450,230 (x,y respectively)

Now - Our radar is 100x100 dots... Our Max range is 1000 dbpro units. What is our center of the radar position? Its presumable attached to our player - or vehicle whatever... so... thats a moving target too! We are at 610,200,400... forget the Y... We have 610,400 (x,y position we are)

Because our radar has a range of 1000.... that REALLY is 500 dbpro units each direction. So - providing you have found some distance measuring routines (there are tons on this forum and in the DBPRo code snippet area and in posts - easy to port) You loop through your array of baddies or whatever and check that they are first within 500 db-units of the center of the radar... your players position.

Now: subtract
thing.x - player.x (save xresult)
thing.y - player.y (Save yresult)

Your plotting position on our radar 100x100 dot grid is:

dotx = (xresult * 0.01)+50
doty = (yresult * 0.01)+50

Now there is a HUGE chance I got some of this WRONG - as I'm free typing - BUT - I KNOW there is source code for this out here.

All you're trying to do is get the DB DISTANCE for X and for Y away from the player. Then the player is assumed center of radar "100x100". So - We are trying to plot the dot in our 100x100 with regards to this fact. (the +50 thing) The multiply thing is to get a "percentage" more or less - so that if out of the 1000 db unit range - the baddy is 10% of the radar RANGE distance away - then we want to plot a dot 10% away from the center of the little radar screen.

I hope this is at least helpful even if I didn't nail it.
--Jason

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 26th Jul 2008 19:50
It's amazing how helpful you can be.

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Jul 2008 20:07
Thank you Mahoney - always a kind word from you. Note though as reread what I posted - I think you want xresult * 0.1 ... not 0.01. also... I kept saying: Drop the "Y" and then I showed x,y.

what I was strying to say is - we are converting 3d to 2d. So... If you have a position like XYZ = 100,200,300 (just for example) I treat the radar as top top down in this explaination - so I use the X and th Z DB 3dspace coordinate values as my 2d coordinates... So X,Y,Z ... I Drop the "Y" value - which leaves X,Z. Then I use X,Z as my 2d X,Y... I hope this clarifies my ramblings.

--Jason

Shadow Wolf
16
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 31st Jul 2008 21:07
Thanks Jason. When I wrote the post I already understood that I needed to drop the y axis in the 2d radar and the only way I could think of to make a radar was to make the radar a scaled 2d picture representing the x and z axis of the 3d world since the radar is basically a top down and scaled down view of the 3d world. I was wondering however if this scaled down way is the only way to do this.
-thanks

Login to post a reply

Server time is: 2024-09-30 03:27:48
Your offset time is: 2024-09-30 03:27:48