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 / A radar

Author
Message
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 2nd Oct 2009 17:23
Hello guys

I'm working on a radar for my game, so i wanted to know how to display a part of an image, and hide other parts, like :

Here, i want the part of the image that is inside the circle ( which will be the radar border ) to be shown, and the rest of the image be hidden, so i can rotate / resize / move the map behind the border and still show only what is inside the border ( the border and the map will be in 2 different sprites ).

thanks

SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 3rd Oct 2009 00:09
I suggest Photoshop there are tutorials on how to do what you are asking.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 3rd Oct 2009 00:12
Quote: "I suggest Photoshop there are tutorials on how to do what you are asking. "

Ummm I think he's asking how to code a radar to do that, not just make one in an image editor.

Games are like life, they should never stand still.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 3rd Oct 2009 00:18
You could probably mock something up using the scroll and scale object texture commands on a plane, but I'm not sure about doing a disk without having to get into DarkGDKs 2D image editing commands which are quite slow.

heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 3rd Oct 2009 00:27
maybe make a cylinder and cut off the bottom so you have one face (untriangulated) and then load that model in Dark GDK and texture with a square of the desired area. I hope you understand what I mean but I'm not sure if it would work.

Games are like life, they should never stand still.
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 3rd Oct 2009 01:34
You could try making the image above it, the background or w/e have a transparent area, the shape of a circle. Then set its priority to like 10. Then draw the radar image below it, so that it sticks through the transparent area.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Oct 2009 11:46
@ heyufool: i think that slows the game too much, since ill have to texure it in every loop.
i think you guys are not getting it right, i mean illl have an alpha channeled image which is the radar border. everything is transparent in this image except the border.
then i make a new image which is the map of the level, i dont want the whole map to be shown at the same time. so if you see the pic above, its not going to look like that ofc, so imagine that this image is the screen, and the border is the radar border image, and the background is the map, so when the player moves up for example, the map moves down to show the things that the player can currently see, you get the point? i want only a part of the image to be shown.

i say dark invaders tutorial, which uses dbSetSpriteTextureCoord(), that might work for a sqare radar, i want something like that, but for a circle

Chamill
16
Years of Service
User Offline
Joined: 29th Sep 2008
Location:
Posted: 3rd Oct 2009 14:20
Well it surely is complicated because i've tried making 1 myself and I never succeeded actually xD

But i can be of little help if u want, check this out;

dbCreateBitmap( 1 , width , height ); // This is a square bitmap, lets make that for now
dbPasteImage( ID , 0 , 0 ) / or / dbSprite( Id , 0 , 0 , image );//Place the picture inside the bitmap
dbGetImage( ID , 0 , 0 , 200 , 200 ); // Copies what is inside this area, in this case the image u loaded.
dbDeleteBitmap( 1 );
dbSetCurrentBitmap( 0 ); // Last 2 functions just to avoid sum random bugs.

Ok, what we are doing here is that we put the radar picture inside the bitmap, and then we like "cut" everything inside this bitmap away from everything else. What you could do next is to place this new image somewhere on the screen and paste another box shaped image with a circular hole in the middle. So that the middle would be transparent and you could see the radar through it =)

If you wonder how to move the radar in this case, just apply the image in Negative X , Y depending on where you are on the map

Hope this helps
//Chamillion

You can only get smarter by playing a smarter opponent.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Oct 2009 14:27
Thanks ill try that, but this is a square radar am i right? im really wondering how to make a circle one, if any of you have ever played the game "world of warcraft", you can see that the mini map ( the map on the top-right of the screen ) is a border, and there is an image behind it, the images scrolls along with the player movement, and im pretty sure that it works like that, because when i go to some places which are at the end of the map, i see half the map inside the border, and the other half is empty, which means that the image behind the border is moving, just like the way im looking for

Chamill
16
Years of Service
User Offline
Joined: 29th Sep 2008
Location:
Posted: 3rd Oct 2009 14:50
I believe they didnt use Dark GDK =)

Btw i forgot to mention 1 thing, 1 negative thing actually -.-

The way i used required sum CPU, so DONT use it once in every loop. What we did in my old game was to refresh the map each 0.75 s to save sum CPU, wasnt really helpful actually xDDD

You can only get smarter by playing a smarter opponent.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Oct 2009 14:59 Edited at: 3rd Oct 2009 16:46
ew...in that way it wont help ... because that's helpless, once every 1 second is like a whole new map every second, since im making a flight game, high movement speed

edit: Lol ofc they didnt use DGDK they have like 100 programmer XD

Chamill
16
Years of Service
User Offline
Joined: 29th Sep 2008
Location:
Posted: 3rd Oct 2009 15:54
Ya i see .. Well gl hf then =)

You can only get smarter by playing a smarter opponent.
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 3rd Oct 2009 16:14
I think you may want something like this?

http://www.filefront.com/14647431/RadarThing.rar
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Oct 2009 16:51
exactly, but in your example, the background iscovering the whole screen. and this is my problem, i want it to be a border only.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Oct 2009 21:06 Edited at: 3rd Oct 2009 21:08
So..its not possible?..

EDIT: ill stick with the sqare map for now, but i still want to know how to make a circle one, its 10x better than this ugly square

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 23rd Oct 2009 10:21 Edited at: 23rd Oct 2009 10:23
Hello, again!

So as far as you guys told me, it's impossible to make that kind of radar ( circle ), so i made a square one and got it working, Now i need to make something like this:



So it goes like this:

for (loop for enemies)
if the object is in screen
add a target sprite at dbObjectScreenX/Y()
else if !object in screen
display the blue sprites

How should i display the blue sprites? i dunno how to explain but i think you get my point..the blue object should be pointing to the object's that are not in my screen

thanks for your time.

luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 23rd Oct 2009 15:00 Edited at: 23rd Oct 2009 15:01
Project the object's location onto the bounding sqaure for the screen, something like this:



I'm pretty sure I got this algorithm online somewhere but you just project the coordinate a bit further from onto whatever edge is closest to the screen and then point the sprite in the object's direction.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 23rd Oct 2009 16:01
Your original requested radar cannot be(efficiently) done using images/sprites alone, the best way is to use a 3D object to act as the radar, if done right there should be almost no difference between this and a sprite. To make it scroll properly you need to use 2 sets of UV data, the first set is your original set which you will use to read the transparency data from your mask image. The 2nd set will tell you which part of the map you're currently viewing. So now you basically want to draw the RGB using UV set 1 and texture 1, and the alpha using UV set 0 with texture 0. The easiest way to achieve this is using a shader, and it's about the simplest shader you can possibly make.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 23rd Oct 2009 16:41 Edited at: 23rd Oct 2009 16:49
@luke ill try it, hope it works..may i know what is the structure ( or class ) point? and it would be helpful if you give me a little example on how to use it..so i suppose the point structure is my object's location?



would be great if you tell me what should the unknowns be.

@ dark coder, i did not study HLSL yet, so i doubt i can make that kind of radar atm.

thanks both of!

luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 23rd Oct 2009 19:41
Yeah a point would look like that. But when you rotate, does the "camera" rotate, or does it keep the orientation? If the orientation is kept the same, you just need to check whether an objects x OR y-coord is the same and then the position is the coordinate component within the bounds, and the screen edge closest to the object for the other bound. If neither the x or y coord is within range then you want the arrow in a corner.

The rotatable screen is a different story, and then you would use the projection function after calculating the line segments in the space that make up the screen boundary.

And those 4 unknowns would be the 2 coordinates of the points that make up the edge closest to the object.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 23rd Oct 2009 20:24
What do you mean by when i rotate, when the main ship rotates? if so, the camera does rotate with the ship.

ill upload my game once i fix this little fps problem, so you can understand what i'm trying to get

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 23rd Oct 2009 22:58 Edited at: 23rd Oct 2009 23:00
download link:
http://filebeam.com/2973c3775a1ea712abd2946b30583e98

edit: Sorry for the windowed mode and debug version, i was debugging it and didnt finish the release mode yet

luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 24th Oct 2009 00:07
Ok, I got the impression your game was 2D:

Since you can use the objectScreenX( ) and Y( ) commands, just take the points X and Y of the objects on screen coordinates and do the following.



Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 24th Oct 2009 00:20
thanks alot, ill try that in the morning!

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 24th Oct 2009 09:08
2 more questions:

is there a command like dbPointSprite ( x, y )?

does dbObjectScreenX/Y() return object's screen position even if the object is outside the screen?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 24th Oct 2009 09:42
never mind my last post. i got it working perfectly, after a little search on this board.

thanks alot, everyone!

Login to post a reply

Server time is: 2024-10-01 16:45:21
Your offset time is: 2024-10-01 16:45:21