PDA

View Full Version : UE1 - UT Footstep texture integration


Rajada
8th Feb 2011, 06:47 PM
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:

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)?

gopostal
8th Feb 2011, 08:31 PM
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.

Rajada
8th Feb 2011, 09:52 PM
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

Wail of Suicide
9th Feb 2011, 02:14 AM
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.

Rajada
9th Feb 2011, 11:38 AM
Doesn't look like UT has it. Since this is a TC, how about coding something into texture?

gopostal
9th Feb 2011, 01:08 PM
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.

Rajada
9th Feb 2011, 01:48 PM
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)?

gopostal
9th Feb 2011, 03:06 PM
Don't forget you will also have to replicate this stuff too.

Rajada
9th Feb 2011, 03:43 PM
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.

gopostal
9th Feb 2011, 04:43 PM
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.

Rajada
9th Feb 2011, 05:00 PM
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.

gopostal
9th Feb 2011, 07:42 PM
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.

Rajada
9th Feb 2011, 08:49 PM
Though you may be right, the bandwidth back then was less than great. Remember when our modems made screechy noises?

meowcat
9th Feb 2011, 09:03 PM
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).

Rajada
9th Feb 2011, 11:24 PM
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.

Mister_Prophet
10th Feb 2011, 01:15 AM
Dunno if it helps, but the UT single player mod Operation Na Pali institutes texture-specific footstep sounds as well.

Rajada
10th Feb 2011, 12:52 PM
Well, it probably also uses decals, but I will take a look since I own it.

Creavion
10th Feb 2011, 01:37 PM
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.

Rajada
10th Feb 2011, 11:47 PM
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.

Rajada
11th Feb 2011, 02:03 AM
I wonder if this class would help at all...

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.

meowcat
11th Feb 2011, 11:13 AM
Which unreal 1 engine game is it that you are working with, and is the source script available for download? From what I can tell your only problem is being able to access what texture you are standing on, everything else can be handled in Uscript.

[edit] Nerf Arena?

Rajada
11th Feb 2011, 12:05 PM
Nerf ArenaBlast, good luck though, the company that made it doesn't even remember it, so I doubt they posted any source code.

VendorX
11th Feb 2011, 12:53 PM
Cheack this: Bitmap/Texture/FootstepSound

PS: you can export script (.uc) yourself, unless you loocking for engine source - that's impossible...

meowcat
11th Feb 2011, 01:34 PM
@VendorX: the problem is not that he can't set the footstep sound for each texture, it's that there is no way to access that information via a texture reference (which texture is being stood on/walked across).

@Rajada: VendorX does have a good suggestion though. You can try to use UCC.exe to export the scripts (if they have not stripped out the text buffers containing the source) or you could download the UT Package Tool by Antonio Cordero, it may be able to decompile the source unrealscript code (it works for a bunch of UEngine games, and says that it supports Nerf Blast Arena). That way you would at least have something to go by in searching for a solution.

VendorX
11th Feb 2011, 01:58 PM
...and for what he needs that information?

In event WalkTexture, texture is not an output...

In FootStepping():
if(!deathmatchgame(level.game).bGameIsAfoot)
-> return;


Rajada, you whont to expand posibility of playing footsteps or engin dont paly any at all?

Ps: that featur is not implemented in U1 and is no way to do that.

Rajada
11th Feb 2011, 03:52 PM
Alright, this is beyond my experience, bear with me and let me ask several questions and make terrible researched assumptions real quick... remember I can define default footsteps, but I wish to detect the texture a pawn is walking on so I can make environment based footstep sounds (IE Snow sounds different than stone when stepped on).

I'm guessing that even if I knew the source code behind WalkTexture() it would be useless because it wouldn't be encode able to UScript and probably isn't even implemented at that.

So that leaves the decal idea. NAB does not contain the decal actor class. If I just copy paste ALL the code from decal to a class in NAB that I added, it cannot compile it because it is 'not a dll' (assuming this has to do with native functions). I'm also going to guess that there is no way to adapt that code to a point where it will compile without removing its functionality that I need.

But the decal really is the only function to contain a function that returns feedback between an actor and a surface texture.

So, can I find another way to get these functions into another game?

Can the class be exported and imported or will that just result in it not being able to find functions (AttatchToSurface or whatever it is called).

Can I crack into these functions and find their base code and create a similar function in an add-on manner?

Is that even legal, or is that kind of code protected?

VendorX
11th Feb 2011, 05:00 PM
Still you don't answer for my question: for what you need this informations?

Update:
Egsist many possibilities to implement sommething what is not implemented. Loock at other games code, maby you can find way out, but i've seen that code and i say 'no chance...'.