Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Got a really typical use-case here. I have large map made up of hexagons and at any given time only a small section of the map is visible. To provide an overview of the complete map, I want to show a small 2D representation of the map in a corner of the screen.

What is the recommended approach for this in libgdx? Keep in mind the minimap must be updated when the currently visible section changes and when the map is updated.

I've found SpriteBatch(info here), but the warning label on it made me think twice:

A SpriteBatch is a pretty heavy object so you should only ever have one in your program.

I'm not sure I'm supposed to use the one SpriteBatch that I can have on the minimap, and I'm also not sure how to interpret "heavy" in this context.

Another thing to possibly keep in mind is that the minimap will probably be part of a larger UI, is there any way to integrate these two?

share|improve this question

2 Answers 2

Generate the minimap from your primary map data beforehand. As the player explores, copy the pre-generated minimap data onto the 'known area' minimap texture (or, alternatively, erase the blackness from a mask). You simply pan/rotate/crop this texture as needed.

Generating the entire map on the fly tile by tile TWICE (once for your main map, once for your minimap) is excessive. The minimap is so small you rarely need to worry about texture size or memory limitations, so compression-by-tiling is not a necessary task.

share|improve this answer

SpriteBatch allocate Mesh for batching purposes. You can set the size of this Mesh buffer with constructor parameter. Its also create some matrices and couple primitives. Nothing too heavy but warning is just there that people understand that its allocate native resources and its not something that you create every frame.(belive me that is quite often a problem with new comers) It's also create a shader if gles2.0 is used.

Some information related you game and skills would be needed to good answer.

Do you know opengl? Do you use shaders? Do you use fbo's How big portion of screen minimap is covering? is

share|improve this answer
    
I'm an experienced programmer, but relatively new to opengl/3d programming. So far i understood almost everything you said ...What's an FBO? :) –  Bubblewrap Apr 11 '12 at 6:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.