Jump to content

What method for adding a mini-map?


Clackdor
 Share

Recommended Posts

I would not recommend that at all. It means that you would be doing extra rendering which isn't necessary.

 

So basically you need to get a 2D image map or alternatively you can go to your scene, go really high and take a screenshot facing down.

 

Now the trick is to only display a section of that map that your character is in. I'm not entirely sure how to do that with just 2D,

 

However, you could make a 3D plane glue it to the camera and set your map as the texture. You would have to move the UV's with code as your player moves. This, however, could be troublesome as Editing UV's on the fly is probably the slowest thing a graphics card can do. That being said if the plane only has 4 vertices maybe it won't be such a problem.

 

I'd prefer it if you could just show a part of a 2D image but I have no idea how to do this. Maybe someone could enlighten me :)

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

You can render the minimap every 1 second or even every 5 seconds, so it doesn't take any FPS. And when it's only like a 128x128 buffer, it renders very fast anyway.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Yeh I guess that would work. However, it depends how you want your mini map to look. I personally like it to not look like the game itself and more like a map. However, that's just my preference.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

The easiest and most powerful way is to make a 3D mesh on which you paint the texture. Then you can also rotate and tilt it like in Crysis HUD.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

The easiest way would be DrawImage.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

You don't need the full image, as it would only take more FPS to render. Just render a 128x128 bitmap, but with DrawImage you can't make it round etc..., so still easier to PaintTexture it on a 3D mesh.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Yes this would be my preference. But how do you only draw part of an image? fill me in if you know

 

It was with reference to an overhead cam and a render to texture.

 

@Mika ... really? where was the stipulation it had to be round? ... oh thats right ..

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

So a 3D mesh, that is parented to the camera so it appear to be on the 2D plane with the rest of the graphics? Then use DrawImage to put any icons or such on there.

 

I can see how you would get item positions and translate them to coordinates on the mesh, but I'm not sure how to render a portion of an image onto the 3D mesh we've created, especially making it move with the character.

Link to comment
Share on other sites

There is at least one library available for editing pictures in C++

 

http://www.imagemagick.org/Magick++/tutorial/Magick++_tutorial.pdf

 

Unfortunately, it seems like the method they use would not be adequate for what would be required as the functions would copy a file, then load to memory, then crop and rotate. Thats a lot to do in a loop.

 

Basically, just need a way to display only a portion of the dds file, whetehr it is painted to a plane or shown with DrawImage();

Link to comment
Share on other sites

What about writing a shader that navigates around the texture? I'd have to learn how to write a shader.... huh.png

 

 

I don't know anything about coding shaders, so I cant advise there or even speculate at any impacts that approach may have, you could always use OpenGL to "scroll" about a loaded image, write your own "DrawImage2" function that would adjust the image origin to a new position then scale the image up and output to the screen. Of course then you'd have to put contraints on that "movement" to prevent going off the "map" and stop unwanted tiling. In Furious Frank I did not bother with a map just an Enemy radar which relied on DrawImage, 3D maths, a spherical coordinate system and some trigonometry.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Assuming you have a big texture which shows your map from above you could go ahead and paint that texture onto a plane.

You can move the texture around on the plane without any shader knowledge. All you have to do is to change the UV

coordinates of your plane's verticies via code. SetVertexTexCoords() is what you need for that.

Changing the texture coordinates like this has a pretty big performance impact, so it should not be used all over the

place, but i think for a minimap this is a good solution.

You can rotate the plane to adjust the map to the players view direction. To get rid of the uglyness of a plane you can draw

a nice round UI element over it, so that no one sees the edges and corners of the plane =)

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

ok, I had a few mins so I based the scroll function off my OpenGL DrawAndRotateImage() function ... seems to work ok.

 

 

A Simple Demo:

 

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

BlitzMax has direct OpenGL support so you can use BlitzMax for direct OpenGL programming. If you want to go that route and I believe you are using c++ then, Masterxilo did a tutorial on the basics which might still be available.

 

What I would recommend as you are just starting out is to use the overhead camera approach with a render to texture routine, this will eliminate a whole host of issues that need to be overcome when using a more complex approach, from tracking to actually making the map image.

 

 

 

EDIT: Yes, Masterxilo's Tutorial is still available:

 

http://www.leadwerks...for-drawing-r19

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Cool. I was planning on getting to this some time myself. I think I'll try both methods and see which one works best XD,

 

i.e. UV edits and the openGL drawing stuff.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...