Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by Grant. 02/24/26 22:21
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
5 registered members (TipmyPip, clint000, Grant, chsmac85, Martin_HH), 5,858 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Footsteps from AUM 8 #328423
06/13/10 05:46
06/13/10 05:46
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I use very old, but still the best code snippet to make different sound, depending on the texture under players feet. But I have one question, how to make the same result, but with terrain that has only one texture, but with different surfaces on in? Or with terrain that uses multi texturing? Thank you, if any one need, I can post here translated in to LITE-C script from AUM 8.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Footsteps from AUM 8 [Re: 3run] #328425
06/13/10 06:00
06/13/10 06:00
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Can you show me the lite-c please?

I'll see what I can do...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Footsteps from AUM 8 [Re: EvilSOB] #328426
06/13/10 06:29
06/13/10 06:29
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Here you go:
Code:
// don't forget to include this in the main script
// call texture_scan(); in your player script just before the while loop

SOUND* grass_snd = "grass.wav";
SOUND* stone_snd = "stone.wav";

#define grass 1 // to have some decent names as function arguments
#define stone 2

var step_length = 0;

VECTOR player_pos1;
VECTOR player_pos2;

function texture_sound(sound_type)
{
	// you can have step_length % 3 to double the steps and so on	
	// I choose 6 to make sure that it will divide 1 and 3 (step_length += ...)
	// 6 / 4 = 1.5 seconds between steps
	if ((sound_type == grass) && (step_length % 6 == 0)) // 0, 6
	{
		snd_play (grass_snd, 60, 0); 
	}
	if ((sound_type == stone) && (step_length % 6 == 0)) // 0, 6
	{
		snd_play (stone_snd, 50, 0);
	}
	if (step_length >= 6) {step_length = 0;} 
}

function texture_scan()
{
	while (player == NULL) {wait (1);}
	while (1) 
	{
		vec_set (player_pos1.x, player.x);
		wait(1);
		vec_set (player_pos2.x, player.x);	
		c_trace(my.x, vector(my.x, my.y, my.z - 100), IGNORE_ME + IGNORE_MODELS + IGNORE_PASSABLE + SCAN_TEXTURE);
		if(vec_dist (player_pos1.x, player_pos2.x) != 0)
		{
			if (str_cmpi (tex_name,"grass1"))
			{
				texture_sound(grass);
			}
			else
			{
				texture_sound(stone);
			}			
		}
		step_length += 1 + 2 * key_shift; // add 4 (12 if shift is pressed) to step_length every second
		wait (-1.5); // play with this 
	}
}


Not tested, but should work wink Do not mind IGNORE_MODELS, it will work with models if you delet it, but not with multi terrain...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Footsteps from AUM 8 [Re: 3run] #328429
06/13/10 06:59
06/13/10 06:59
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I havent tested your function at all, but may do later when I have more time...

But I can see this whole detection revolves around the detected skin names.
So it shouldnt be too hard to re-work for multi-texture at least.


BUT, after taking more of a look. It is much more involved with multi-tex surfaces.
Referencing all three multi-texturing skins and extracting pixels at
the contacted UV co-ord, and then getting its alpha...
AND THEN doing the same for the other two skins,
AND THEN picking the highest alpha of all three,
and passing 1,2 or 3 to the sound-player is a lot of work...

So Im hoping you can figure out code for what Ive just said,

or better yet...

Someone else has a better idea!! Mine is hard work...

Sorry dude...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Footsteps from AUM 8 [Re: EvilSOB] #328493
06/13/10 15:32
06/13/10 15:32
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I'm just thinking about detecting of RGB colors(if that is possible). When making multi texture, there is a skin for a terrain, when you use multi texture:



Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Footsteps from AUM 8 [Re: 3run] #330034
06/25/10 01:01
06/25/10 01:01
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Does any one have any ideas? I need some help here.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Footsteps from AUM 8 [Re: 3run] #330039
06/25/10 07:22
06/25/10 07:22
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
You were right about using the multitexture from the terrain.
I haven't tried it, but it shouldn't be too hard:

when you c_trace down from your model,
certain variables in the hit struct get set, which give you information about the contact point.
you can use hit.u1,v1 and hit.u2,v2 to determine on what pixel of the terrain the model is walking.
use thepixel_for_bmap and pixel_to_vec instructions to read the blendmap of the terrain, so you can read the pixel color.
from the pixel color you can determine which footstep sound to make.

I hope this gives enough information.
again: the method is not tested, but it should work.
good luck with implementing it!


Check out the throwing game here: The throwing game
Re: Footsteps from AUM 8 [Re: Roel] #330141
06/25/10 22:05
06/25/10 22:05
Joined: Jul 2007
Posts: 620
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 620
Turkey, Izmir
and sample;
Code:
BMAP* color_bmap="color.bmp"; //colormap of the terrain
function color_scan()
{
	var format,pixel;
	COLOR pixel_color;
	while(1)
	{
		c_trace(camera.x,vector(camera.x,camera.y,camera.z-5000),SCAN_TEXTURE);
		if(HIT_TARGET)
		{
			draw_point3d(hit.x,vector(0,0,255),100,5);
			format = bmap_lock (color_bmap,0);
			pixel = pixel_for_bmap(color_bmap, hit.u1, hit.v1);
			pixel_to_vec (pixel_color, NULL, format, pixel); 
			if(pixel_color.red>100)
			{
				draw_text("RED!",100,10,vector(100,100,255));
			}
			if(pixel_color.green>100)
			{
				draw_text("GREEN!",100,10,vector(100,100,255));
			}
			if(pixel_color.blue>100)
			{
				draw_text("BLUE!",100,10,vector(100,100,255));
			}
			bmap_unlock(color_bmap);
		}
		wait(1);
	}
}



Re: Footsteps from AUM 8 [Re: Emre] #330165
06/26/10 01:01
06/26/10 01:01
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Thank you Emre. I appreciate your help.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

Moderated by  George 

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