Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Advice on mini map

Author
Message
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 17th Jun 2019 14:03
Hello Community,

I want to create a mini map. The mini map has the following features: A background, which is the map itself and a cursor, which represents the player. The cursor stays in the center of the background, all the time. The background must move, when the player that I control, moves. I am having trouble with actually moving the background depending on player's position and angle.

Any advice that you can give me regarding this problem? Maybe some of you encountered this problem.

Thank you and have a nice day!
www.alexmatei.com
MadBit
Valued Member
10
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 18th Jun 2019 07:42
Is that what you meant?

I have trouble putting my thoughts into words, so I give you a code snippet.
As a map I copied a image from Google. So I can't publish it here. But you can use any other larger map. In the example it is 2000 x 1294 large.

Only the principle should be shown. So you have to adapt the code to yours.



Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Attachments

Login to view attachments
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 18th Jun 2019 11:16
Hello MadBit,

Nice to see you around, again!

That's exactly what I wanted. However, I am working on a 3D application, so I must ask you some questions in order for me to understand some principles: Is it mandatory to change the resolution on the fly, in real time, like in "draw_minimap()" function?
Also, Setviewzoom and other zooming commands are compatible with 3D scenes?

Thank you very much!
www.alexmatei.com
MadBit
Valued Member
10
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 18th Jun 2019 11:45 Edited at: 18th Jun 2019 11:54
MateiSoft wrote: "Is it mandatory to change the resolution on the fly, in real time, like in "draw_minimap()" function?"


if you mean that line

SetVirtualResolution(GetImageWidth(4), GetImageHeight(4))

then yes it is necessary. Maybe there is another possibility I don't see yet. For testing you can omit the line.
The render output has to be adapted to the size of the image.

Quote: "Also, Setviewzoom and other zooming commands are compatible with 3D scenes?"

i don't know how setviewzoom affects the behavior of the 3D scene.
But you probably need to replace the Render() line with Render2DBack() - ClearDepthbuffer() - Render2DFront().
Otherwise all 3D elements will be rendered into your minimap.

EDIT:
you can also use
drawsprite(1)
drawsprite(3)
instead of
render().
Just tested it.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 18th Jun 2019 12:47 Edited at: 18th Jun 2019 12:49
@matiesoft
I wonder if it would be possible to use like a rear view mirror effect
and get a real time image in the corner of your map something like
https://forum.thegamecreators.com/thread/223547


with some rendering and camera positioning
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
MadBit
Valued Member
10
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 19th Jun 2019 11:09
i rebuilt the minimap. it's probably a little easier to understand now. Without using viewzoom and viewoffset.
In the example you can control with the WASD keys. With PgUp/PgDown zoom the main map and with F1, F2, F3 call the pre-set zoom modes for the minimap.





If you now want to display your 3D environment as minimap. Then you should do it as fubarpk suggests, as described in the thread.

Simply place the camera a few units above your player position with the direction of view to the player. As minimap it is recommended to set an orthogonal view for the camera.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 30th Jun 2019 13:51
Sorry for the long delay. The 3D suggestion, with mirroring, drops the framerate from 60 to 30, on my end... sadly. I have a lot going on in my application. So, still the main solution should be the 2D minimap, which I have some troubles implementing it, but I'll get into that.
www.alexmatei.com
smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 1st Jul 2019 08:40
set a camera above the map adjust its height to where each square occupies 1 pixel or the desired pixels so u will know that each square/quad on the map equals 2-4 pixels ect. then take a snapshot large image. now u have a sprite where for example 2 pixels equals 1 mesh quad/square. just adjust the map based on world coordinates. spritex()*2= val(playerposx()), second alternative would be to make a second camera and load in a low poly terrain bare bones and update the view port from it without much extra rendering. just some ideas im sure theres a dozen ways to do it
A child's dream never dies.





MateiSoft
6
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 1st Jul 2019 10:33
Hi smerf,

As I recall, you cannot create a second camera in AppGameKit, like DBPro. I'll try the other methods.
www.alexmatei.com

Login to post a reply

Server time is: 2019-10-17 13:30:38
Your offset time is: 2019-10-17 13:30:38