News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 8th Feb 2011, 06:47 PM   #1
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
Footstep texture integration

I'm fiddling around with a bit of a total conversion for some game you've probably never heard of. I want to use the first unreal engine's per texture footstep sound field to make well, per texture footstep sounds. I found the WalkTexture event, but it doesn't seem to be called in any way that I can grab the texture data from it; I tried.

I had tried this once in what is basically UTPlayer:

Code:
Var sound CurTexStepSound;

event WalkTexture( texture Texture, vector StepLocation, vector StepNormal )
{
CurTexStepSound = Texture.FootStepSound;
}

simulated function FootStepping()
{
	local sound step;
	local float decision;
	
	if(!deathmatchgame(level.game).bGameIsAfoot)
	return;

	if ( FootRegion.Zone.bWaterZone )
	{
		PlaySound(WaterStep, SLOT_Interact, 1, false, 1000.0, 1.0);
		return;
	}

if(CurTexStepSound != none)
step = CurTexStepSound;

else
{
	decision = FRand();
	if ( decision < 0.34 )
		step = Footstep1;
	else if (decision < 0.67 )
		step = Footstep2;
	else
		step = Footstep3;
}
	if ( bIsWalking )
		PlaySound(step, SLOT_Interact, 0.5, false, 400.0, 1.0);
	else 
		PlaySound(step, SLOT_Interact, 2, false, 800.0, 1.0);
}
But that doesn't work, it would seem the event is unimplemented. SO my question would be does anyone have any ideas on how to implement a similar, custom function that can detect the texture you are walking on (and it's footstep sound field)?
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 8th Feb 2011, 08:31 PM   #2
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
They aren't implemented correctly. If you look at the variable ESurfaceTypes in UT2004:
http://www.gopostals.com/ut2k4/
You'll see there are a bunch of default sounds that are used broadly like "EST_Rock, EST_Dirt, EST_Metal, EST_Wood, EST_Plant, EST_Flesh, EST_Ice, EST_Snow, EST_Water, EST_Glass" and then a bunch of custom ones. The engine does a check on the walking texture and adjusts the footsteps sounds to match the surface. UT has none of this. You could force it by mod but I don't easily see any way to do it on pre-existing maps that wouldn't slow everything down with a bunch of checks.

If you were mapping forward, you could make this work but you will have to modify gametype to adjust footstep sounds (I think). Mutator won't get to it.
gopostal is offline   Reply With Quote
Old 8th Feb 2011, 09:52 PM   #3
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
Let's say I could edit nearly anything, Event WalkTexture was supposed to be implemented in walking and swimming states, so if I found a way to check the texture you're walking on in say, FootStepping() would it really be any more memory consuming than the Event WalkTexture would have been?

There has to be a way to check the texture below you, where is the Wormbo signal? :P
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 9th Feb 2011, 02:14 AM   #4
Wail of Suicide
Registered User
 
Join Date: Apr. 11th, 2006
Posts: 740
The Trace() function in UT2004 has an option to return a material - No idea whether this functionality exists in UT though. Worth a look at least.
Wail of Suicide is offline   Reply With Quote
Old 9th Feb 2011, 11:38 AM   #5
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
Doesn't look like UT has it. Since this is a TC, how about coding something into texture?
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 9th Feb 2011, 01:08 PM   #6
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
You could do that but you'd have to subclass existing texture. No matter what, you'll still not get existing maps being able to use this.
gopostal is offline   Reply With Quote
Old 9th Feb 2011, 01:48 PM   #7
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
Not necessarily, let's assume for a moment (just so I can see if what I'm thinking is correct) I could edit texture and not a subclass and it worked fine. Could I use functions like Touch() in texture in a way that it detects if the touch is a pawn and sends FootStepSound to a storage variable in the pawn? Basically, I'm asking do basic functions (touch in this case) behave the same way they do in actors when used in Texture?

Edit:

Well touch is located in actor and unfortunately texture is below object, so what if instead I did something in Pawn, where I use a Touch() function to see if he touched a texture, then if the texture has changed from the last touched one, send the new footstep sound to that same storage variable?

Edit two:

No, Touch will only detect you touching an actor. Maybe I could fix the event walktexture with a bit of code in pawn? Is WalkTexture implemented anywhere where I could look at it and see how it works? Or at least why this one doesn't? Or perhaps would it be possible to script my own Touch function looking something like ObjectTouch(Object O)?
__________________
How to play NAB


Last edited by Rajada; 9th Feb 2011 at 02:51 PM.
Rajada is offline   Reply With Quote
Old 9th Feb 2011, 03:06 PM   #8
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
Don't forget you will also have to replicate this stuff too.
gopostal is offline   Reply With Quote
Old 9th Feb 2011, 03:43 PM   #9
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
Well that's a given but it doesn't help if I don't actually create it first which I am starting to think isn't possible.
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 9th Feb 2011, 04:43 PM   #10
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
It is possible just that it's going to create a lot of overhead. In effect it will be another zoneinfo check, even though it will render as simulated.

Scratch that idea....It can't be simulated or the surrounding players will hear it wrong too. Damn...Yeah I'm starting to think like you that the cost-versus-reward is just too high.
gopostal is offline   Reply With Quote
Old 9th Feb 2011, 05:00 PM   #11
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
The only thing stopping me from figuring this out is the relation between a surface and a pawn. If I could figure out how to relay a touch between them I could figure the rest out easily. I'm not entirely convinced that this isn't possible, I mean, if they were going to use it for WalkTexture, there has to be a way to replicate it.
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 9th Feb 2011, 07:42 PM   #12
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
There is a reason they discarded it and I'll bet you are seeing it now. Some things were cut for bandwidth sake and I'll bet this was one.
gopostal is offline   Reply With Quote
Old 9th Feb 2011, 08:49 PM   #13
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
Though you may be right, the bandwidth back then was less than great. Remember when our modems made screechy noises?
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 9th Feb 2011, 09:03 PM   #14
meowcat
i am a rock, i am an island
 
meowcat's Avatar
 
Join Date: Jun. 7th, 2001
Posts: 763
You don't need to replicate anything. Just have whatever function does the footstepping be simulated and have it called from either the simulated 'tick' or 'timer', or better yet use the existing footstepping function (if it is present in the game you are using) that is called via an animnotify if in third person.

The Infiltration mod for UT had specific footstep sounds and decals for different walking materials. The way they did it (if I recall correctly) was they spawned and kept a reference to a special subclass version of 'decal' that contained all of the information for what decal to spawn based on the material type. For all of their materials used, they assigned a specific stepping sound to that texture's FootstepSound variable. The real trick was that since the decal class natively has a special version of trace (actually 'attachDecal') which returns the texture it hits, each time a footstep sound should be played they set the decal actor where the foot step would be, aimed it at the ground, attached the decal which then provided a reference to the texture, and then figured out from there based on the assigned sound, which actual 'decal' material to use.

The Unreal Fortress mod (I think) also used a modified decal class (player shadow perhaps?) to intermittently collect the ground texture when the shadow was updated. The name of the textures some times had material types in them (eg: SnowyGround_SNOWTEX or something like that) and you could just search the name for the material type to figure out what decal texture/sound to use. As I recall they use the ground texture to give their snipers camouflage (their cloaks took on the floor texture when they went prone).
__________________
"What do you mean it doesn't exist clientside?"
Meowcat's Mods for UT2K4:
Yet Another Real-life Mod: Class-based play, generic realistic weapons, unoriginal gameplay, w/ cheap COD4 knockoff, parkour player moves
TD Vehicles v125: HMMWV, MI4Hound, Black Hawk & AH-6 Helicopters, Motorcycle, IFAV Jeep, Abrams Tank
Jetpacks for UT2k4!

Last edited by meowcat; 9th Feb 2011 at 09:18 PM.
meowcat is offline   Reply With Quote
Old 9th Feb 2011, 11:24 PM   #15
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
This would have been such an amazing solution if this game had decals in its actors, but alas it does not and has none of the special trace functions, sigh.
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 10th Feb 2011, 01:15 AM   #16
Mister_Prophet
.
 
Mister_Prophet's Avatar
 
Join Date: Nov. 3rd, 2001
Location: Long Island
Posts: 4,592
Dunno if it helps, but the UT single player mod Operation Na Pali institutes texture-specific footstep sounds as well.
Mister_Prophet is offline   Reply With Quote
Old 10th Feb 2011, 12:52 PM   #17
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
Well, it probably also uses decals, but I will take a look since I own it.
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 10th Feb 2011, 01:37 PM   #18
Creavion
Registered User
 
Creavion's Avatar
 
Join Date: Aug. 27th, 2005
Location: Germany, Niedersachsen
Posts: 471
Check AS-FOT-Chronoshift, copy the myleveled FootstepSoundManager actor, credit Revelation for HIS script in your maps readme then and done. Works in every gametype, but is supposed NOT work ONLINE.
__________________
My maps:
UT99.org CMP2 Maps (7 total, including bonuspack)
Single Player + Monsterhunt: Antalius (Jungle Setting)
CTF-UTR-Syntra (Standalone UTR Bonus Map)
Creavion is offline   Reply With Quote
Old 10th Feb 2011, 11:47 PM   #19
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
That also uses decals, the game I have never used decals so unless I can cram native functions in somehow (which I have tried) I can't use the decal method.
__________________
How to play NAB

Rajada is offline   Reply With Quote
Old 11th Feb 2011, 02:03 AM   #20
Rajada
Registered User
 
Join Date: Jan. 21st, 2008
Posts: 210
I wonder if this class would help at all...

Code:
class TriggeredTexture extends Triggers;

var() Texture	DestinationTexture;
var() Texture	Textures[10];
var() bool		bTriggerOnceOnly;

var int CurrentTexture;

replication
{
	reliable if( Role==ROLE_Authority )
		CurrentTexture;
}

simulated event PostBeginPlay()
{
	Super.PostBeginPlay();
	CurrentTexture = 0;

	if( ScriptedTexture(DestinationTexture) != None )
		ScriptedTexture(DestinationTexture).NotifyActor = Self;
}

simulated event Destroyed()
{
	if( ScriptedTexture(DestinationTexture) != None && ScriptedTexture(DestinationTexture).NotifyActor == Self)
		ScriptedTexture(DestinationTexture).NotifyActor = None;
	
	Super.Destroyed();
}

event Trigger( Actor Other, Pawn EventInstigator )
{
	if( bTriggerOnceOnly && (Textures[CurrentTexture + 1] == None || CurrentTexture == 9) )
		return;

	CurrentTexture++;
	if( Textures[CurrentTexture] == None || CurrentTexture == 10 )
		CurrentTexture = 0;
}

simulated event RenderTexture( ScriptedTexture Tex )
{
	Tex.DrawTile( 0, 0, Tex.USize, Tex.VSize, 0, 0, Textures[CurrentTexture].USize, Textures[CurrentTexture].VSize, Textures[CurrentTexture], False );
}
This actor grabs a certain texture (scripted texture i believe) and changes it to one of ten others. I wonder if I could use that at all, maybe check if texture location equals player footzone location (really stretching it here, have no idea if it is remotely possible)? I'm just throwing the idea out there, but from what I've tried I don't seem to be able to put any of the functions from decal in as i believe they are defined elsewhere (in dlls/source code?) where I cannot actually access them.
__________________
How to play NAB


Last edited by Rajada; 11th Feb 2011 at 02:05 AM.
Rajada is offline   Reply With Quote
Reply

Tags
footstep, texture

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:53 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer