1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

UE1 - UT Footstep texture integration

Discussion in 'Programming' started by Rajada, Feb 8, 2011.

  1. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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)?
     
  2. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    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.
     
  3. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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
     
  4. Wail of Suicide

    Wail of Suicide Member

    Joined:
    Apr 11, 2006
    Messages:
    738
    Likes Received:
    0
    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.
     
  5. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    Doesn't look like UT has it. Since this is a TC, how about coding something into texture?
     
  6. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    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.
     
  7. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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)?
     
    Last edited: Feb 9, 2011
  8. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    Don't forget you will also have to replicate this stuff too.
     
  9. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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.
     
  10. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    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.
     
  11. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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.
     
  12. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    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.
     
  13. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    Though you may be right, the bandwidth back then was less than great. Remember when our modems made screechy noises?
     
  14. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    774
    Likes Received:
    1
    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).
     
    Last edited: Feb 9, 2011
  15. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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.
     
  16. Mister_Prophet

    Mister_Prophet .

    Joined:
    Nov 3, 2001
    Messages:
    4,598
    Likes Received:
    2
    Dunno if it helps, but the UT single player mod Operation Na Pali institutes texture-specific footstep sounds as well.
     
  17. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    Well, it probably also uses decals, but I will take a look since I own it.
     
  18. Creavion

    Creavion New Member

    Joined:
    Aug 27, 2005
    Messages:
    471
    Likes Received:
    0
    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.
     
  19. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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.
     
  20. Rajada

    Rajada Member

    Joined:
    Jan 21, 2008
    Messages:
    213
    Likes Received:
    0
    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.
     
    Last edited: Feb 11, 2011

Share This Page