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?
Minimap
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Minimap
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.
I think you're better off drawing your mini map separately.
Help us help you: attach a .love.
Re: Minimap
Oh, yes, I forgot.
You're right, of course.
But how would go my method? I'm interested in it.
You're right, of course.
But how would go my method? I'm interested in it.
"Docendo discimus" - Lucius Annaeus Seneca
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Minimap
Lol, obviously.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.
@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.
Re: Minimap
There are several ways to do it.Petunien wrote:Oh, yes, I forgot.
You're right, of course.
But how would go my method? I'm interested in 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").
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Minimap
Good point. Thumbs up!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").
Re: Minimap
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.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 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()
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Minimap
If you really do a full-detail minimap, you're probably best off drawing to a canvas, then scaling that down for the minimap.
Re: 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.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.
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.
Re: Minimap
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.
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.
- Attachments
-
- Minimap.love
- (1.1 KiB) Downloaded 179 times
"Docendo discimus" - Lucius Annaeus Seneca
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 3 guests