Minimap

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Minimap

Post by Petunien »

Hi,

I wonder how to make a minimap, just of curiosity.

In my theorie, all we have to do is to "capture" the objects on the screen, scale them and draw them again in a little rectangle in the lower left corner or so.

Or how would that go?

;)
"Docendo discimus" - Lucius Annaeus Seneca
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Minimap

Post by Robin »

You could do that, but isn't a mini map usually more symbolic than that? For example, drawing a little blue square instead of a fully drawn guy?

I think you're better off drawing your mini map separately.
Help us help you: attach a .love.
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Minimap

Post by Petunien »

Oh, yes, I forgot.

You're right, of course.

But how would go my method? I'm interested in it. :)
"Docendo discimus" - Lucius Annaeus Seneca
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Minimap

Post by Roland_Yonaba »

Robin wrote:You could do that, but isn't a mini map usually more symbolic than that? For example, drawing a little blue square instead of a fully drawn guy?
I think you're better off drawing your mini map separately.
Lol, obviously.

@Petunien:
I remember the old days, while I was working on a RTS.
I paused the project, since I was missing spare time. I might eventually be back on it.
Take a look inside the last attachment, there is a fully working example of minimap (look inside Scripts/map.lua file).
Hope that will help.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Minimap

Post by coffee »

Petunien wrote:Oh, yes, I forgot.

You're right, of course.

But how would go my method? I'm interested in it. :)
There are several ways to do it.
If mini-map is really only resize of "realmap" you should use same code as used in big map of course.
If as Robin suggest you replace graphic tile for other more geometric thing you could do another separate piece of code.
I personally would prefer use same piece of code and make an internal switch to display whatever I wanted with for example map:draw("normal") or even only map:draw() and map:draw("mini").
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Minimap

Post by Roland_Yonaba »

coffee wrote:
Petunien wrote:Oh, yes, I forgot.
I personally would prefer use same piece of code and make an internal switch to display whatever I wanted with for example map:draw("normal") or even only map:draw() and map:draw("mini").
Good point. Thumbs up!
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: Minimap

Post by ljdp »

coffee wrote: There are several ways to do it.
If mini-map is really only resize of "realmap" you should use same code as used in big map of course.
If as Robin suggest you replace graphic tile for other more geometric thing you could do another separate piece of code.
I personally would prefer use same piece of code and make an internal switch to display whatever I wanted with for example map:draw("normal") or even only map:draw() and map:draw("mini").
I'd be wary of this approach. Yes you could use love.graphics.translate and love.graphics.scale to redraw the map, but you're drawing everything twice which could be slow unless you have some checks in place to see if in object is outside of the minimap's view rectangle.

I would prefer having two classes for each renderable object, say TankRenderer and TankMinimapRenderer then you would have MapRenderer and MinimapRenderer

Code: Select all

mapRenderer:render()
minimapRenderer:render()
Then your code becomes easier if you want to change your minimap rendering logic later on.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Minimap

Post by bartbes »

If you really do a full-detail minimap, you're probably best off drawing to a canvas, then scaling that down for the minimap.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Minimap

Post by Lafolie »

bartbes wrote:If you really do a full-detail minimap, you're probably best off drawing to a canvas, then scaling that down for the minimap.
Oppositely, if you are making something with less fidelity you can just read the map data and display it using smaller graphics and then scale the movements any 'markers' such as unit positions for display on the map. Kind of like rendering parts of the game a second time, but much smaller.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Minimap

Post by Petunien »

Hello hello again,

thank you all for the answers, very useful!

@Roland_Yonaba
I'll have a look on it. Thank you. Why do you not update your game to 0.8.0, so it's playable?
Much work? :)

Regarding the minimap.
I made one in the scale 1:5.
Ok, basically you can place 20px rectangles and they will be drawn also in the minimap in the lower left corner.

My question: Is there a better way (more "efficient", smaller, future-proof...) to do that, what I did in the attached *.love?

Thank you again. :D
Attachments
Minimap.love
(1.1 KiB) Downloaded 179 times
"Docendo discimus" - Lucius Annaeus Seneca
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest