Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/08/26 22:41
Stooq now requires an API key
by VHX. 06/08/26 20:14
ZorroGPT
by TipmyPip. 06/06/26 12:36
Zorro 3.01 recoded MMI function issue
by TipmyPip. 06/04/26 05:44
SGT_FW
by Aku_Aku. 05/31/26 11:05
Issues resuming trades on Demo account
by Martin_HH. 05/22/26 13:31
XTB
by pr0logic. 05/18/26 12:27
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 3,688 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Seraphinang, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How is this done ? Track map #422921
05/20/13 11:44
05/20/13 11:44
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
I am currently still toying with an other small workshop demo.
Now looking at other fun kart games i noticed the map shown
where you see the racers move over.



Has anyone an idea how this is done ? how to create the white
line that represents the track and show the racers on it ?


Here is what i have so far and still working on laugh
A lot to do yet but it will be a fun little demo for noobs like me laugh


http://www.youtube.com/watch?v=Tj--5bcNX7g&feature=youtu.be


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: How is this done ? Track map [Re: Realspawn] #422923
05/20/13 13:48
05/20/13 13:48
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
I would create the minimap bmap into a bmap_process, but needles are created exactly for this grin

Code:
#include <acknex.h>

VECTOR vecTemp;
ANGLE  angTemp;
PANEL *panMinimap;
BMAP *bmpMinimap, *bmpCar;
var needleIndex = 3;

action actCar ()
{
	pan_setneedle ( panMinimap, 0, 256, 256, bmpCar, 16, 16, 90, 0, 360, my->skill1 );
	var myIndex = needleIndex;
	needleIndex += 1;
	
	while (1)
	{
		vec_diff ( &vecTemp, camera->x, my->x );
		vec_normalize ( &vecTemp, 3 * time_step );
		vec_add ( &my->x, &vecTemp );
		
		vec_to_angle ( &angTemp, &vecTemp );
		my->pan = angTemp.pan;
		
		vecTemp.x = ( camera->x - my->x ) * panMinimap->skill_y;
		vecTemp.y = -( camera->y - my->y ) * panMinimap->skill_y;
		my->skill1 = ang ( my->pan - camera->pan );
		vec_rotate ( &vecTemp, vector ( 90-panMinimap->skill_x, 0, 0 ) );
		
		pan_setneedle ( panMinimap, myIndex, 256+vecTemp.x, 256+vecTemp.y, bmpCar, 16, 16, 90, 0, 360, my->skill1 );
		
		wait(1);
	}
}

function main ()
{
	video_mode = 10;
	fps_max = 30;
	wait(1);
	
	bmpMinimap = bmap_create ( "minimap.tga" );
	bmpCar = bmap_create ( "player.tga" );
	panMinimap = pan_create ( "flags=SHOW;", 1 );
	pan_setneedle ( panMinimap, 0, 256, 256, bmpMinimap, 256, 256, 90, 0, 360, panMinimap->skill_x );
	pan_setneedle ( panMinimap, 0, 256, 256, bmpCar, 16, 16, 90, 0, 360, camera->skill_x );
	panMinimap->bmap = bmap_createblack ( 512, 512, 24 );
	panMinimap->target_map = bmap_createblack ( 512, 512, 24 );
	
	PANEL *panMap = pan_create ( "flags=SHOW", 1 );
	panMap->bmap = panMinimap->target_map;
	
	level_load ( "ground.mdl" );
	camera->z = 20;
	c_setminmax ( level_ent );
	panMinimap->skill_y = bmap_width ( bmpMinimap ) / ( level_ent->max_x * 2 ) ;
	
	int i = 0;
	for ( ; i<10; i++ )
		ent_create ( SPHERE_MDL, vector(random(1024)-512, random(1024)-512, 10 ), actCar );
	
	while ( !key_esc )
	{
		proc_mode = PROC_EARLY;
		
		camera->pan -= mickey.x * 0.2;
		
		vec_set ( &vecTemp, vector (key_cuu-key_cud, key_cul-key_cur, 0) );
		vec_normalize ( &vecTemp, 10*time_step );
		vec_rotate ( &vecTemp, vector(camera->pan,0,0) );
		vec_add ( &camera->x, &vecTemp );
		
		panMinimap->skill_x = -camera.pan;
		
		vecTemp.x = camera->x * panMinimap->skill_y;
		vecTemp.y = -camera->y * panMinimap->skill_y;
		
		pan_setneedle ( panMinimap, 1, 256, 256, bmpMinimap, 256+vecTemp.x, 256+vecTemp.y, 90, 0, 360, panMinimap->skill_x );
		
		wait(1);
	}
	
	sys_exit ( NULL );
}



DOWNLOAD (code & resources)

Last edited by txesmi; 05/20/13 14:06. Reason: link added
Re: How is this done ? Track map [Re: txesmi] #422925
05/20/13 14:28
05/20/13 14:28
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
Thank you for this demo laugh

i will give it a try to see if i can use it in my project laugh
puzzling time


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: How is this done ? Track map [Re: Realspawn] #422936
05/21/13 07:42
05/21/13 07:42
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
I will try to explain what is done into that code.

I create the panels in run time in the first steps of main 'funtion':

Code:
bmpMinimap = bmap_create ( "minimap.tga" );
bmpCar = bmap_create ( "player.tga" );
panMinimap = pan_create ( "flags=SHOW;", 1 );
pan_setneedle ( panMinimap, 0, 256, 256, bmpMinimap, 256, 256, 90, 0, 360, panMinimap->skill_x );
pan_setneedle ( panMinimap, 0, 256, 256, bmpCar, 16, 16, 90, 0, 360, camera->skill_x );
panMinimap->bmap = bmap_createblack ( 512, 512, 24 );
panMinimap->target_map = bmap_createblack ( 512, 512, 24 );
	
PANEL *panMap = pan_create ( "flags=SHOW", 1 );
panMap->bmap = panMinimap->target_map;



There are two panels. 'panMiniMap' is used to contain all the needles used for the minimap and is rendered over its 'render_target'. 'panMap' is just used to show the main panel 'render_target'. I did it this way becuase the needle member of a panel is also rendered out of the bounds of the panel when it gets out of it, and this way just the part inside its panel bounds will be shown.

Initially, 'panMinimap' has two needles: the first one is the map itself, and the second is the player icon. I used 'panMinimap->skill_x' for the needle orientation. I set 'panMinimap->skill_y' as the proportion between the minimap bitmap size and the level size in order to compute the needle pivot:

Code:
panMinimap->skill_y = bmap_width ( bmpMinimap ) / ( level_ent->max_x * 2 ) ;
...
while ( !key_esc )
   ...
   proc_mode = PROC_EARLY;
   ...
   panMinimap->skill_x = -camera.pan;
   vecTemp.x = camera->x * panMinimap->skill_y;
   vecTemp.y = -camera->y * panMinimap->skill_y;
  pan_setneedle ( panMinimap, 1, 256, 256, bmpMinimap, 256+vecTemp.x, 256+vecTemp.y, 90, 0, 360, panMinimap->skill_x );



I used 'proc_mode = PROC_EARLY' in order to ensure that the panel skills are computed first, so all other needles have the actual frames 'skill_x' and 'skill_y' values updated at their computation time.

The needle angle allocated in 'skill_x'
Code:
panMinimap->skill_x = -camera.pan;



is the negative of the players 'pan', because the screen (and panels) coordinate system is clockwise while the world coordinate system is counterclockwise.

With this issue in mind the Y coordinate of the offset of the background has to be computed same:

Code:
vecTemp.x = camera->x * panMinimap->skill_y;
vecTemp.y = -camera->y * panMinimap->skill_y; // inverse Y, so convert to counterclockwise coordinate system.



And finally inside 'main' we need to update the needle pivot position:

Code:
pan_setneedle ( panMinimap, 1, 256, 256, bmpMinimap, 256+vecTemp.x, 256+vecTemp.y, 90, 0, 360, panMinimap->skill_x );



With this few lines of code we have a minimap that rotates with the camera pan, and computes its offset with the camera position.

The enemies icons are created into the first lines of the entity action:

Code:
var needleIndex = 3;

action actCar ()
{
   pan_setneedle ( panMinimap, 0, 256, 256, bmpCar, 16, 16, 90, 0, 360, my->skill1 );
   var myIndex = needleIndex;
   needleIndex += 1;
   ...



I used a global int to store the amount of needles, so we know the actual enemys' needle to further computations by this count i inside the action while loop:

Code:
pan_setneedle ( panMinimap, myIndex, 256+vecTemp.x, 256+vecTemp.y, bmpCar, 16, 16, 90, 0, 360, my->skill1 );



The enemies icon needles are rotated from its center, so the only things to compute is the offset (vecTemp) from the player and its orientation (my->skill1).

Code:
vecTemp.x = ( camera->x - my->x ) * panMinimap->skill_y;
vecTemp.y = -( camera->y - my->y ) * panMinimap->skill_y; // inverse!
vec_rotate ( &vecTemp, vector ( 90-panMinimap->skill_x, 0, 0 ) );
my->skill1 = ang ( my->pan - camera->pan );



The offset vector (vecTemp) is rotated by '90-panMinimap->skill_x' because the icons are looking to the right (X positive), and in the minimap they look up.

The angle of the enemies icon (my->skill1) is the difference to the players orientation because the minimap is already oriented with the player.

that's all folks!

I hope it helps wink
Salud!

Re: How is this done ? Track map [Re: txesmi] #422945
05/21/13 09:32
05/21/13 09:32
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
What I'd use:

Render the map into an image and use this image as map in the game.

This should be faster. If you want to I can try wether it actually works or not.


POTATO-MAN saves the day! - Random
Re: How is this done ? Track map [Re: Kartoffel] #422961
05/21/13 15:38
05/21/13 15:38
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
How does that work ?

rendering the map into an image ?


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: How is this done ? Track map [Re: Realspawn] #422963
05/21/13 16:04
05/21/13 16:04
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
racing games usually have some additional data structure available that contains the path of the track because features like ai cars, shortcut detection,... need this.

for a map i simply would use this data structure and draw it onto the screen or onto a bitmap.

Re: How is this done ? Track map [Re: ventilator] #422965
05/21/13 16:39
05/21/13 16:39
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
What I'm talking about is a pre-rendered image.

This is what comes out when using my method:



(there are 2 additional, simple steps in gimp because bmap_process doesn't support alpha channels.)

Last edited by Kartoffel; 05/21/13 16:50.

POTATO-MAN saves the day! - Random
Re: How is this done ? Track map [Re: Kartoffel] #422966
05/21/13 16:52
05/21/13 16:52
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
and what is that method ? laugh I see what you created but how ?
is it exactly a bmap of the track made in wed ?


Last edited by Realspawn; 05/21/13 16:52.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: How is this done ? Track map [Re: Realspawn] #422967
05/21/13 16:56
05/21/13 16:56
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
i used some shaders and put the camera with the isomteric-flag above the track.
But only the track has to be visible for this.


POTATO-MAN saves the day! - Random

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1