Making a Minimap

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
X21
Posts: 6
Joined: 2012-01-30, 14:59

Making a Minimap

Postby X21 » 2012-03-21, 16:56

Hi, Ive been studying the engines documentation for answers but I still cannot figure out how to go about making a circular minimap for players that tracks their location and rotation on any map. Any tips?
User avatar
Haimi
Posts: 85
Joined: 2011-11-23, 09:28

Re: Making a Minimap

Postby Haimi » 2012-03-21, 21:10

Hi X21,

I think this is not very complicated. you need an image of your map for the Minimap. You need to create a material in the GUI folder of your mod with that image.
You can get the position of your player, so you will only need to write a Method to get the player Positions into your GUI.
The Position is in HumanPlayerT::State.Origin and is an instance of Vector3dT. So you could map the X and Y coordinates to your minimap sizes. Then you create a GUI Window as Minimap-container and as child element a WindowT Element with your minimap-material as background. The minimap-window must be bigger than the container-element. With the coordinates you can set an offset for the inner minimap-window. If you want I can draw you a little Graphic to show you in Detail what I mean.
Project Status: Code architecture definition
6 Programmers, 1 Photographer, 1 Architect, 1 Game designer
User avatar
Haimi
Posts: 85
Joined: 2011-11-23, 09:28

Re: Making a Minimap

Postby Haimi » 2012-03-21, 21:35

So, i have drawn a little example.

You only see the little piece of the Map your Position is currently on. The Rest is hidden because the map's size exceeds the size of the minimap container. The position of the map window is negative (Window positions are always relative to its parents).
Attachments
image3047.png
Minimap sample
Project Status: Code architecture definition
6 Programmers, 1 Photographer, 1 Architect, 1 Game designer
X21
Posts: 6
Joined: 2012-01-30, 14:59

Re: Making a Minimap

Postby X21 » 2012-04-02, 19:36

Ok, I kinda understand what your saying and I kinda don't. So I need to make a GUI Map to represent the top down view of my map right? Then after that I create a small window that shows the mini maps size and from that mini map container it scrolls the larger map background centered off of the players origin(using HumanPlayerT::State.Origin). After making the method and container I should control it using scripting to attach and display it to the player right?
Correct me if im wrong please because im still learning the game engines source code.

Return to “Coding and Scripting”

Who is online

Users browsing this forum: No registered users and 3 guests