BGE Mini Map for 2.72

I’m making a game that needs a mini map, but I couldn’t seem to find any updated tutorials for 2.7. If anyone could direct me to a tutorial or make one yourself that would be great.

Try this one it’s nice and easy you just need a second camera (“mapcam”) with orthographique view named as it is written in the script and a plane playing the script in a second scene :

from bge import logic, texture

scene_main = None
for scene in logic.getSceneList():
if scene.name == “main”:
scene_main = scene
break

mapcam = scene_main.objects[“mapcam”]

cont = logic.getCurrentController()
own = cont.owner

matID = texture.materialID(own, “IMmap”)
map_png = texture.Texture(own, matID)

source = texture.ImageRender(scene_main, mapcam)
source.background = (20, 20, 20, 255)

map_png.source = source

def main():

map_png.refresh(True)

#LE

1 Like

OK, that worked, thanks.

Could you please have a look at one simple question.
I am also doing minimap and with script it should show You-are-here point with current position
the only problem is - the red point is always shown outside of the minimap region, although it is moving correctly.
but it should be on the location of a minimap
what should i add to the simple code?
screenshot attached

code that makes it not that simple :stuck_out_tongue:
look in the resource section and take a minimap from there, or at least look at how they/i have done it.

1 Like

thanks. but what if i dont need rotation, zooming and other icons of objects. just red dot You are here moving on a minimap image correspondingly with moving of a character

here is a blend that has a minimap setup like the one you are showing.

size: 68mb
http://15b.dk/blendfiles/minimap-test.blend

1 Like

Just in case you know - could you suggest how to calculate and save 3D
Euclidean distance travelled?

thanks. that helped.
Just in case you know - could you suggest how to calculate and save 3D
Euclidean distance travelled?

store and count distances.

object_or_position.getDistanceTo(player)

gives you the distance, instead of object you can use worldPosition.
put it in a property, each time you get to a point or something update that property(count it to what is already in there) and set a new object/worldposition. worldposition is best due to you can easily grab the player position to calculate a new distance. if you just have startpoint then use it as object.

1 Like

sorry i did everything exactly as in your script but the miniplayer is out of the range of the map as you see it
could you help to fix it

the script expect a square map, makes the math easier.

1 Like

and another thing, is you minimap rotated the same as you gameworld?

1 Like

thanks. i have just made it square and same effect :frowning:

how can i check the rotation orientation?

i am going to rephrase that.
is the x direction in you game world also the x direction on you mini map (left / right )

1 Like

could you have a look please? it is the last thing i am struggling with for the last 2 month for my diploma. I will mention you in acknowledgement section!

Overlay scene - HUD Screen, Scene scene - Scenebasic
sorry for the size

1 Like

you game world is of center thats why the math get f**ed up.

1 Like

is it easy to fix that? do you mean CTRL/SHIFT + C?

managed to fix that by just moving the global map!
but now the speed of the You-are-here pointer is slow!
and when i change this mapedge.worldPosition.x * 2 or mapedge.worldPosition.y * 2 to 0.5 for example, i have right speed but the pointer is located somewhere in the wrong place then and doesn’t correspond with player current location :frowning:
do you know how to fix that please?
because i dont know your code that much