Thirsty Panther Posted January 29, 2017 Share Posted January 29, 2017 Welcome to the Second Monthly Script Challenge. Each Month I will set a challenge for gifted Leadwerkers to solve. I will provide a map as a starting point. Once you have perfected your script you re-post your map to this thread. At the end of the month I will go through all the entries and judge the winner. I will then place the winning map on the Workshop so others can learn from them. Rules. Entries must be your own work. Entries must be submitted before the end of the month ( February). Any assets you use must be your own or Royalty free. The map that you submit can be used by others for commercial use. Have fun and educate. February Challenge Leadwerks is very good at getting the budding game developer to create their very own FPS. One of the problems with this is that the players footsteps sound like they are walking on concrete regardless of the surface they are actually on. The player runs across grass, sounds like concrete. Runs thru water, sounds like concrete. We need a way for the player footsteps sounds to be altered depending on the surface that they are on. So your challenge for this month is to create a script that plays different sound effects for different surfaces. The map I have provided is very simple. A player with the FPSplayer script attached on a single platform with 5 different surfaces. The first is concrete, then foliage/leaves, metal, water and grass. Your script should play a different sound for each surface. The February Map. The map has various textures from Wild Textures. These are free to use in your own projects even if you don't submit an entry. I had some sound effects but I can't remember whether they are royalty free or not. So I wont post them until I can confirm. In the meantime you will need to find your own sound effects. How you implement your script is up to you. You can alter the FPS player script or add a separate script it is entirely up to you.Remember the winning script should not only solve the problem but should also have comprehensive comments within the script so that new users can learn from your script. The last challenge had 3 fantastic entries and the only way I could split them was on the documentation. So keep that in mind when submitting. Prize I still don't have a prize to give away. So your reward will be admiration of your fellow Leadwerkers and being the second winner of the Monthly Script Challenge. You will join Garficwaffle on the Leadwerks Hall of Fame (OK I just made that up). If any person or company would like to donate or sponsor the Challenge you can contact me on this forum. The last Script challenge had almost 1000 views so sponsoring this challenge would expose your product to many potential customers If you have any ideas or thoughts on the Challenge please feel free to comment. The first challenge was very well received and I have had lots of positive comments. Looking forward to your submissions. 5 Quote Link to comment Share on other sites More sharing options...
Genebris Posted January 29, 2017 Share Posted January 29, 2017 You didn't include textures with a map, but I'll download something else anyway. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted January 29, 2017 Author Share Posted January 29, 2017 Oops sorry I'll fix it later today. It was late when I posted it. Quote Link to comment Share on other sites More sharing options...
Jazz Posted January 30, 2017 Share Posted January 30, 2017 I did this pretty fast so I'm sure others will have a better way to do it, maybe using tables or something. I didn't want to have to rename sounds or material files, just drop the material on and it detects what the sound is automatically. Gravel, snow, dirt, and wood added as well. Using FPSPlayer.lua, in UpDateFootSteps() it calls function GetMaterialSound() which returns the randomized footstep sound for that material to play. Hacked up sounds are from www.freesfx.co.uk and www.freesound.org. Extra textures are from my public domain archives. Original images are not included, only the .tex files. Create a FPS project and extract the archive in the project's main directory. File is 20MB Now if we could just get the material of the terrain... https://www.dropbox.com/s/2bco2wr1dlou4gr/footsteps.zip?dl=0 3 Quote --- Scott Using Windows 7 Ultimate 64 bit/Core I7-2700K @ 4312mhz/24G RAM/Nvidia GTX 1060 Link to comment Share on other sites More sharing options...
Thirsty Panther Posted January 30, 2017 Author Share Posted January 30, 2017 Textures for the Feb17 Map. https://drive.google.com/open?id=0B0LWAip5oVPEVVgxZlItUVBXc2M Note to self. Don't try and post while watching Federer V Nadal and drinking Pale Ale. Quote Link to comment Share on other sites More sharing options...
Genebris Posted January 30, 2017 Share Posted January 30, 2017 I have also used material names to determine sound type, for example, material named "my dark_wood 76" will play "wood" sounds. But my script uses footsteps manager like old animation manager. This way you can use it both for player and NPCs and any other objects. Supports several sounds per material type, 3D sound, can be played from many characters at the same time, only need 3 lines of code to add to your script (import, create, update). Main script: https://gitlab.com/Genebris/MSC-Footsteps/blob/master/Scripts/Footsteps.lua Download project (120 MB): https://gitlab.com/Genebris/MSC-Footsteps/repository/archive.zip?ref=master 5 Quote Link to comment Share on other sites More sharing options...
DooMAGE Posted January 30, 2017 Share Posted January 30, 2017 Awesome solution guys, in my game I was using triggers to change the array of the sounds. (not good) Quote My Leadwerks games! https://ragingmages.itch.io/ Link to comment Share on other sites More sharing options...
Rick Posted January 30, 2017 Share Posted January 30, 2017 Does this work on terrain yet? Quote Link to comment Share on other sites More sharing options...
Jazz Posted January 30, 2017 Share Posted January 30, 2017 Does this work on terrain yet? No Quote --- Scott Using Windows 7 Ultimate 64 bit/Core I7-2700K @ 4312mhz/24G RAM/Nvidia GTX 1060 Link to comment Share on other sites More sharing options...
Thirsty Panther Posted January 31, 2017 Author Share Posted January 31, 2017 Loving the early entries. Gets people to discuss different ideas. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted February 17, 2017 Author Share Posted February 17, 2017 Only 2 weeks left. Has anyone been able to solve Ricks problem? Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted February 24, 2017 Author Share Posted February 24, 2017 Last days. Anyone got a solution for sound depending on the terrain? Quote Link to comment Share on other sites More sharing options...
Einlander Posted February 24, 2017 Share Posted February 24, 2017 You can get the material of a specific layer of the terrain, then from what I am seeing, check the current layers alpha. I would assume the lower the alpha the more intense the texture. it can get complicated ... Terrain.h lua commands: virtual Texture* GetVegetationMap();//lua virtual int CountVegetationLayers();//lua virtual VegetationLayer* GetVegetationLayer(const int index);//lua virtual void SetTextureStageDistance(float distance, float multiplier);//lua virtual void SetLayerAlpha(const int slot, const int x, const int y, const bool alpha);//lua virtual bool GetLayerAlpha(const int slot, const int x, const int y);//lua virtual int GetLayerAtPoint(const int x, const int y);//lua virtual void SetLayerAlpha(const int slot, const float alpha);//lua virtual void SetElevation(const int x, const int y, const float elevation, const bool update);//lua virtual float GetElevation(const float x, const float z);//lua virtual Vec3 GetNormal(const float x, const float z);//lua virtual float GetSlope(const float x, const float z);//lua virtual void SetLayerAlpha(const int slot, const int x, const int y, const float a0, const float a1, const float a2, const float a3);//lua virtual void SetLayerAlpha(const int slot, const int x, const int y, const float alpha);//lua virtual void SetLayerAlpha(const int slot, const float a0, const float a1, const float a2, const float a3);//lua virtual void SetLayerTexture(const int slot, Texture* texture, const int index=0);//lua virtual void SetLayerScale(const int slot, const float x, const float y);//lua virtual Vec2 GetLayerScale(const int slot);//lua virtual Texture* GetLayerTexture(const int slot=0, const int index=0);//lua virtual bool LoadHeightmap(const std::string& path, const float scale=1.0, const int bpp=0);//lua virtual void SetHeight(const int x, const int y, const float height, const bool update=false);//lua virtual float GetHeight(const int x, const int y);//lua virtual void UpdateNormals();//lua virtual bool Pick(const Vec3& p0, const Vec3& p1, PickInfo& pick, const float radius, const bool closest, const bool recursive, const int collisiontype); virtual void SetLayerSlopeConstraints(const int slot, const float minslope, const float maxslope, const float transition);//lua virtual void SetLayerHeightConstraints(const int slot, const float minheight, const float maxheight, const float transition);//lua virtual Vec3 GetLayerSlopeConstraints(const int slot);//lua virtual Vec3 GetLayerHeightConstraints(const int slot);//lua virtual VegetationLayer* AddVegetationLayer();//lua virtual void SetLayerDisplacement(const int slot, const float displacement);//lua virtual float GetLayerDisplacement(const int slot);//lua virtual void SetLayerTextureLookupMode(const int slot, const int mode);//lua virtual int GetLayerTextureLookupMode(const int slot);//lua virtual void SetLayerTextureMappingMode(const int slot, const int mode);//lua virtual int GetLayerTextureMappingMode(const int slot);//lua static Terrain* Create(const int size, const bool editable=false);//lua 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 24, 2017 Share Posted February 24, 2017 I was going to suggest to use GetLayerAtPoint() and then GetLayerTexture() - don't know if it would work, but that's what i would attempt. EDIT -- unfortunately, it appears that GetLayerAtPoint() does not work - which is a shame since GetLayerTexture() does. 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...
Thirsty Panther Posted March 3, 2017 Author Share Posted March 3, 2017 Entries are now closed. This Months winner is Genebris. An early entry that no one could improve upon. Congratulations on a great entry. 2 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.