need a simple minimap example.

Posted By: jpxtreme

need a simple minimap example. - 12/13/10 11:33

Guys, please help me find a working example for a simple minimap which uses a bitmap. I tried radar.c example but when i try to execute the dot won't move. Any other example? please help me.
Posted By: Varanos5897

Re: need a simple minimap example. - 12/13/10 11:36

Try google earth.Very simple minimap...
Posted By: carla_mariz

Re: need a simple minimap example. - 12/13/10 12:13

lol @Varanos, that wasn't funny...really..

@jpxtreme, we have the same problem.. frown
i've been asking for that about a month ago, but unluckly, no one gives any..
Posted By: jpxtreme

Re: need a simple minimap example. - 12/13/10 13:02

@carla_mariz

hehehe 3d din yung thesis nyo.

@topic

I need a minimap in which a dot will move according tot the direction of the player. A very simple one indeed.
Posted By: 3run

Re: need a simple minimap example. - 12/13/10 15:08

Hey look into the AUM magazines. There was a mini map example. Good luck.
Posted By: carla_mariz

Re: need a simple minimap example. - 12/13/10 23:23

@3run, i've been looking for that at the AUM online.. from 48-95, but its not there. any suggestions?

@jpextreme, hahahaha...tamaaaaaaa!!! laugh
Posted By: jpxtreme

Re: need a simple minimap example. - 12/14/10 06:55

@carla_mariz
I think it's in AUM 27 but it's not in the site anymore.

Anyone have AUM 27, I've read somewhere that there's a minimap example in it.
Posted By: carla_mariz

Re: need a simple minimap example. - 12/14/10 07:26

@jpxtreme,
its still on the site and its available. i found it and it was in wdl format. the sample map is not that good.. tongue

you can find it here.

and if you find another sample map pls do inform me.
i can feel that we are studying @ the same school with the same course.. grin
Posted By: Garrettwademan

Re: need a simple minimap example. - 12/16/10 03:27

Hello all. I believe I can send you in the right direction. Please look at my code below for my minimap and I can explain what I am doing here too.

First, declare your variables:
Code:
BMAP player_pointer = "textures//icon_player.tga";
BMAP map_border = "textures//map_border.tga";
BMAP admin_map = "textures//admin_map.bmp";
BMAP finish_flag = "textures//icon_finish.tga";


-The player pointer is a little dot in a 32BIT TGA file so the portions of the circle are transparent.

-The Map Border is to clean up the window to make it have a solid border like a picture frame

-The admin map is the actual map. I think this image of the map was approx 1000x1000 pixels, but don't hold me to it.

-The finish flag showed a checkered flag of the finish point of the map

Second declare a few panels for the map, border and window
Code:
PANEL pnlMapBorder{
	bmap = map_border;
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	flags = OVERLAY;
}

PANEL pnlPlayerIcon{
	bmap = player_pointer;
	pos_x = 75;
	pos_y = 75;
	layer = 3;
	flags = OVERLAY;
}

PANEL pnlFinishIcon{
	bmap = finish_flag;
	pos_x = 0;
	pos_y = 0;
	layer = 3;
	flags = OVERLAY;
}
PANEL pnlAdminMap{
	pos_x = 0;
	pos_y = 0;
	layer = 0;
	window(0,0,175,175,admin_map,player_map_x,player_map_y);
}


-The map border is going to be second from the bottom, so use the layer of 1

-The player icon is the very top of this map, so make it a layer 3

-The finish icon also is on the top layer, it shows a checkered flag

-Admin map is the very bottom of this panel, it sits under all other layers


Below is my function that runs in a loop the entire time the player is in game or is moving.
Code:
function update_map(){
//SOME CODE
  //Rotate player icon for pointing
  pnlPlayerIcon.angle = my.pan;
 
  //Update position on map for player
   if(player.x <= 14672){
    player_map_y = (420 - ((((my.x + reference_x) / 27800)* 100) * 4.2)) - 150;
   }
   else{
    x_compensation = 75 - (((player.x/12578)) * 75);
    if(player.x < 27250){
     pnlPlayerIcon.pos_y = 75 + x_compensation;
    }
   }
   if(player.y <= 0){
    player_map_x = (((((abs(my.y) + reference_y) / 21000)* 100) * 4.2)) - 55;
   }
   else{
    y_compensation = ((player.y/3000)) * 75;
    if(player.y < 3000){
     pnlPlayerIcon.pos_x = 75 - y_compensation;
    }
   }
//SOME CODE
}



As for the finish flag, you will need to develop code similar to what is above and keep it in the window (even if it is on the border). This minimap is similar to the GTA versions where you find jobs.

Also, you will need to find out how big your map is by tracing the distance from one side to another, it will need to be a rectangle type...this is where I am getting my 278000 and 21000 numbers above. I just used F11 and did a small subtraction to find how big my map was.

Basically, find the size of your minimap in pixesl 1000x1000 or similar, then find out how big your level is. All you need to do now is just do a relational math equation. If your player is physically 67% across the map on the X axis, then your minimap should show 67% moved. Use the numbers to compensate 4.2. You will need to play with some numbers here as you test to compensate the player icon to always be in the center of the minimap...this code will allow your minimap to stop moving if the player gets to the edge of a map, and allow the player icon move freely to be truly at the border texture.

Hope this puts you in the right direction...good luck.

By the way, how would you feel about me writing an official guide to minimaps?
Posted By: Locoweed

Re: need a simple minimap example. - 12/16/10 06:54

Here is a link to a very old .wdl example of minimap and radar example. It used templates for movement and stuff so you have to put it the GStudio7 folder for it to work. I am not going to explain anything about it, but it might help get started. Use arrow keys to move in game. Run the TestMiniMap.wdl for it to work, and no, I am not going to convert to Lite-C at this time, I am too busy at the moment, you will have to do that. 3DGS has changed alot since this was written. array of panels instead of creating a bunch of silly single panels would work now.

http://www.darkdawnstudios.com/3DGS/Radar.rar

Goodluck dude,
Loco
Posted By: carla_mariz

Re: need a simple minimap example. - 12/17/10 01:24

@garretwademan: that would be wonderful! laugh

@Loco: what file should i run here? i tested all scripts and it has an error... btw, im using A7 free and A8 trial.. thanks! laugh
Posted By: jpxtreme

Re: need a simple minimap example. - 12/20/10 12:40

@carla_mariz

nope, we're not in the same school. heheh. our project is 3d car simulation, i need to implement mini map for the user.

what's yours?

btw, the radar script is in cscript and it's not compatible with lite c.
I already have the lite c one but it has a problem.

I found it somewhere in this forum.

http://baddapple.web.officelive.com/Documents/radar.cd.7z

when I run the compiled exe it will run perfectly but if run in sed it will not. Kindly check it if you can solve it please share it to me. heheh.

meri christmas!!!

@loco

kindly check the lite c radar above if it runs properly in your system. I'm using A7 free.

@Garrettwademan

thank you for sharing the logic. It will be great if you have a working one that I can test.
Posted By: Garrettwademan

Re: need a simple minimap example. - 12/24/10 04:31

I do have a working model, but I wrote it for a college student on his project. I got the script file from an email, however I deleted his project from my hard drive. I will need to make a working demo model as the script I have is full of other functions and such (5000 lines).
Posted By: jpxtreme

Re: need a simple minimap example. - 01/26/11 07:21

@Garrettwademan

it would be great if you share a working example that I can study with.

i tried your code but i have a problem making it to work.

the player bmap won't move

and also what values should i put in the following

var player_map_x;
var player_map_y;
var reference_x;
var reference_y;
var x_compensation;
var y_compensation;

please help me. thanks!
Posted By: jpxtreme

Re: need a simple minimap example. - 01/26/11 09:44

sorry double post!
Posted By: carla_mariz

Re: need a simple minimap example. - 01/27/11 21:40

@jpxtreme, sorry i forgot to tell you, your link to radar is working.
i tried it to my project and its really working. grin

try to read the whole code and i think you'll understand the flow.
i guess you have just to put some lines in your code
(yes, not the entire code. grin ).

good luck... ^_^
Posted By: Locoweed

Re: need a simple minimap example. - 01/29/11 09:05

Sorry Carlo, though that would run, but guess not. I don't have time to make it run at the moment.

Actually, after looking, the old code was written for A7 and had silly A7 template code to run, if you put the it in the GStudio7 folder it should run.

Put the Radar folder in the GStudio7 folder and it should run. I never use 3dgs templates, but I guess I did with this.

TestMiniMap.wdl is the file to run.

Hit "M" or "R" key with toggle radar and minimap stuff.

When you hit the M key, there are entities on top of buildings, thats why side view has stuff above.

Use cursor keys to move.

You know, hope it might help, but I guarantee you, nothing is ever easy even with a little minimap and radar example. I should really convert to lite-c some day though.

That is all I got man.

Later,
Loco
Posted By: Garrettwademan

Re: need a simple minimap example. - 02/02/11 05:27

Well, I got a message from jpxtreme asking for my code. I spent a few hours here and rebuilt the project to show my example of a mini-map. I changed 5000 lines to only a few hundred so it was easier to understand. There is so much to explain on this, but I hope you can follow it. The biggest concern is:

- Make your map 1000x1000 pixels, and call it admin_map.bmp
- 255-261 lines of code show the math I am doing, I wrote a few comments and I hope you can follow my crappy comments. It is late and I just had to rework those numbers to make this work right. All I am doing is figuring out how big the playing map is, then comparing that ratio to the 1000x1000 map size. I am using a percentage equation so the numbers are somewhat relational.

In any case, I hope you can understand what I did. I did this more on the fly in a previous version. You can download the working A7 project at:

http://www.garrettwademan.com/3dgs/mini_map.zip
Posted By: Garrettwademan

Re: need a simple minimap example. - 02/02/11 23:38

My code is in C-Script, not litec. The math equation is the same though.
Posted By: jpxtreme

Re: need a simple minimap example. - 02/05/11 07:42

@Garrettwademan

You've answered my request. Wow, I really wasn't expecting this. Thanks for the contribution Garrettwademan. I successfully run your sample minimap and it's working great. This is exactly what I'm looking for. Too bad it's in cscript but I will try my best to convert it to lite c.

Thank you very much for your time and effort. This is surely a big help not only me but for others too.




Posted By: Garrettwademan

Re: need a simple minimap example. - 02/06/11 07:36

Glad to help. Don't focus on my code, focus on the equation and how I did it and it will be cake to rework.
© 2024 lite-C Forums