awgsknite Posted December 3, 2015 Share Posted December 3, 2015 I'm getting tired of these concrete footsteps sounds when walking on terrain and snow,etc..They all sound the same on all surfaces. It doesn't make the game playable. How does one go about this idea of different footstep sounds ? I did a search here on the forums that didn't give a good answer. I read one post where it said maybe use triggered zones and another post saying use raycasting. What one is best ? Raycasting would just use the picking code in the player.lua and just make an if statement there to see what material it is ? or how ? Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
Rick Posted December 3, 2015 Share Posted December 3, 2015 raycast would be easier on your map creation stream but on the terrain I don't think there is a way to determine different types of materials (grass, gravel, blacktop, leaves,etc). you could make a grassy gravel footprint if just on "terrain" (which you can tell) to try and cover ALL terrain noises under 1 sound, and then switching to models of floors which you can get the material on and be more precise. Triggers would give you much more control over this but more work by making all these triggers all over the place. It would clutter up your map. But, yes you would raycast down, maybe once every few ms (not every frame as it's not needed and raycasts have a higher cost in processing I believe). 1 Quote Link to comment Share on other sites More sharing options...
awgsknite Posted December 3, 2015 Author Share Posted December 3, 2015 ok so how do I go about making the code that says if the player steps on terrain ? if TT ? if GetTexture ? or what is that code ? Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
Rick Posted December 3, 2015 Share Posted December 3, 2015 Pick downward from the player position every few ms with http://www.leadwerks.com/werkspace/page/api-reference/_/world/worldpick-r502 When you get the entity picked I think you can try the following to tell if it's the terrain or not if entity:GetClass()==Object.TerrainClass then If it's just a model (I don't think csg will work for this idea) then you can get the material attached to it and tell what it is and change footstep sounds based on that with: http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitygetmaterial-r127 I don't have time to show you the exact code on all of this but this should get you started. Note that you'll need to play around with the collision type parameter used in the picking to avoid picking the player itself. Your starting pick should be a little above the players y position and then down a certain range in hope to collide with whatever the player is on. You can make this picking collision something that won't collide with the players collision type but will with other collision types (essentially passing thru the player since you don't want to pick them). There is a chart that shows these collision types and their responses here: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/collision-r778 The collision type you specify will be checked against the entities in the world's collision type and the responses in the link above is what happens. So if in the chart the collision is None, then it'll pass thru it and won't register. I'm not 100% sure what the terrain collision type is. Maybe Scene? Play around with those settings and experiment. Use System:Print() to help you debug things (it'll show up in the console window). If you are new to the engine or new to programming expect this to have some pain points while you figure it out. Don't get frustrated. That's just the nature of game development. Try these things and keep the things you are trying to do isolated so if you have issues you can ask specific questions about that small chunk of code that you may have problems with. Good luck 1 Quote Link to comment Share on other sites More sharing options...
awgsknite Posted December 3, 2015 Author Share Posted December 3, 2015 Thanks ! Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
reepblue Posted December 3, 2015 Share Posted December 3, 2015 For the record, CSG will work unless you use entity:GetClass()==Object.ModelClass exclusively. I'd also would have it compare the sounds with the materials home folder (ex: Snow/mysnowmaterial.mat) so any future materials will work automatically. You can check this with the FileSystem. I plan on doing something similar myself, so just sharing what my plans are with you. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Rick Posted December 3, 2015 Share Posted December 3, 2015 I didn't think CSG came back as an entity that you could call GetMaterial() on unless it has mass or a script attached to it which turns it into an entity. Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 3, 2015 Share Posted December 3, 2015 Me neither, but I tested it, and it works. Brushes are still objects, but not entities. local p0 = self.entity:GetPosition(true) local p1 = Transform:Point(0,-1.0,0,self.entity,nil) ---3.84 if self.entity.world:Pick(p0,p1, pickinfo, 0, true, Collision.LineOfSight ) then if pickinfo.surface~=nil then local pickedmaterial = pickinfo.surface:GetMaterial() if pickedmaterial~=nil then local surfacemat = (FileSystem:StripDir(pickedmaterial:GetPath())) if IsDevMode() then System:Print(surfacemat) end if surfacemat == "mymaterial.mat" then System:Print("It works!") end end end end 3 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Rick Posted December 4, 2015 Share Posted December 4, 2015 Will that FileSystem command work in sandbox mode? Guessing no but haven't tested. If not that might be something for the OP to consider since they are new to LE. Might not be able to use the game launcher with that command if that's the intention of the OP. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 4, 2015 Share Posted December 4, 2015 Will that FileSystem command work in sandbox mode? Guessing no but haven't tested. If not that might be something for the OP to consider since they are new to LE. Might not be able to use the game launcher with that command if that's the intention of the OP. FileSystem is a Leadwerks class so it will work in sandbox mode. The sandbox mode prevents the inherent lua modules like IO, OS, or file from working. My guess is that it doesn't load these packages/modules if in sandbox mode. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 4, 2015 Share Posted December 4, 2015 I thought we couldn't read/write files, even from FileSystem, in sandbox mode? I though all IO was disabled in that mode? I hear you on the lua packages not being loaded but I thought the LE FileSystem stuff was also effected. I guess if I find time I could test. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 4, 2015 Share Posted December 4, 2015 You can read but you can't write files when its enabled. Only certain commands of FileSystem will not work when sandbox mode is enabled - writing files, creating files/directories, copying files/directories, deleting files/directories... all for obvious reasons. But just reading files and directory paths is still allowed. Hence why reepblue's code with FileSystem:StripDir() will work with sandbox enabled. 3 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
awgsknite Posted December 4, 2015 Author Share Posted December 4, 2015 Thanks all ! I ended up using simple triggers 'cos it's much easier for me and as I heard that raycasting is performance heavy anyways. but i guess i'll have to use raycasting for the footprint decals Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
Thirsty Panther Posted December 4, 2015 Share Posted December 4, 2015 I know that Beo6 was working on this exact topic for the defunct LP3. I'm not sure how far he got but it might be worth giving him a PM. 1 Quote Link to comment Share on other sites More sharing options...
awgsknite Posted December 4, 2015 Author Share Posted December 4, 2015 Thanks Thirsty ! i just sent a PM sent to him Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
beo6 Posted December 4, 2015 Share Posted December 4, 2015 I guess there was a bit of misunderstanding. I had worked with the file reading stuff for the Leadwerks Player for the text loading of the notes script i have in the Steam workshop. Not on the footstep sounds. Or what are you guys talking now about? Sorry that i can't help a lot with footstep sounds. When i got to that problem in my small map i just added a collision box. But as already said. depending on the amount etc. it could clutter up the map. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted December 5, 2015 Share Posted December 5, 2015 Sorry Beo6 I could have sworn that was one of the ideas floating around LCP3. Maybe I had too many beers since then Quote Link to comment Share on other sites More sharing options...
awgsknite Posted December 8, 2015 Author Share Posted December 8, 2015 np anyways 'cos I got the footstep sounds now ! Now I'm working on placing footprints on terrain. Real tuff it is still to get the proper code for that one ! Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
Dralel Posted January 2, 2016 Share Posted January 2, 2016 Hey, can you post how you got the footsteps working? I'm having some trouble with this myself. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.