Popular Post Amadeus Posted December 10, 2024 Popular Post Report Posted December 10, 2024 SLOWFALL POTION @Dragofer and I have been working on making a slowfall potion that we would like some feedback on. Keep in mind, this will only work if you have the latest dev17234-10914 build installed otherwise TDM will not startup. If you want to put this in an existing FM, simply add the pk4 to the FM folder and type #include "script/slowfall_potion.script" in your tdm_custom_scripts.script file. This slowfall potion has several spawnargs that mappers can customize for their own special use cases: "duration" ---- How long the slowfall effect lasts. Default value is 15s "gravity" ---- Affects the strength of the player's gravity. Default value for slowfall potion is 125 "braking rate" ---- Deceleration rate in units per second squared when the player's falling velocity exceeds the maximum allowed fall velocity. Default value is 150 "max_fall_speed" ---- Maximum velocity a falling player will reach. Default value is 500 "horizontal_velocity_multiplier" ---- How much the player can move forward/backward while falling. Default value is 1.005 "end_sound_lead" --- Lets the end sound start playing this number of seconds before the potion effect ends. Much like the invisibility potion in Kingsal's Volta campaign, this potion has a "potion_end" sound that goes off just a second or before the slowfall effect ends, allowing the player to make any last-second maneuvers before they fall normally. I've included a test map as well, so you can play around with it and fall to your heart's content. Hope you like it! Special thanks to @kingsal for letting us use a custom sound and doing some early testing! slowfall_test.pk4 9 Quote FMs: A Good Neighbor, Eye on the Prize Co-FMs: Seeking Lady Leicester, Written in Stone, The Painter's Wife
datiswous Posted December 10, 2024 Report Posted December 10, 2024 (edited) 2 hours ago, Amadeus said: Keep in mind, this will only work if you have the latest dev17234-10914 build installed. Indeed, if you try to install this with an earlier build (I forgot), tdm refuses to start, until you either remove this potion mod, or upgrade tdm. Edited December 10, 2024 by datiswous 1 Quote
datiswous Posted December 10, 2024 Report Posted December 10, 2024 (edited) Now using the latest tdm build. This fm crashes to desktop (Linux): Spawning entities *** stack smashing detected ***: terminated signal caught: Aborted si_code -6 Trying to exit gracefully.. --------- Game Map Shutdown ---------- ModelGenerator memory: 1 LOD entries with 0 users using 16 bytes. --------- Game Map Shutdown done ----- Shutting down sound hardware idRenderSystem::Shutdown() ...shutting down QGL I18NLocal: Shutdown. ------------ Game Shutdown ----------- ModelGenerator memory: No LOD entries. Shutdown event system -------------------------------------- shutdown terminal support About to exit with code 0 Edited December 10, 2024 by datiswous Quote
joebarnin Posted December 10, 2024 Report Posted December 10, 2024 Great stuff, this will be a lot of fun to play with. Speaking of gravity, is there any way to reverse gravity, so that the player falls up? I experimented a bit with calls to $player1.setGravity with positive numbers in the Z direction, but the results were weird. Kind of seems like the player is turned on his head? Anyway, I wonder if the game engine isn't meant to handle this. It would be nice if it did, for a mission that I'm working on. 1 1 Quote
Amadeus Posted December 10, 2024 Author Report Posted December 10, 2024 23 minutes ago, joebarnin said: Speaking of gravity, is there any way to reverse gravity, so that the player falls up? I experimented a bit with calls to $player1.setGravity with positive numbers in the Z direction, but the results were weird. Kind of seems like the player is turned on his head? Anyway, I wonder if the game engine isn't meant to handle this. It would be nice if it did, for a mission that I'm working on. So I know you can definitely do some weird things like turn the game map upside down (I did this when I was first experimenting with an earlier version of this potion, that was pretty wild) but I don't remember HOW I did that. I'm not too sure about reverse gravity but I'm fairly confident you should be able to do it. Sorry that's not a particularly helpful answer 42 minutes ago, datiswous said: Indeed, if you try to install this with an earlier build (I forgot), tdm refuses to start, until you either remove this potion mod, or upgrade tdm. Yeah, that's because the slowfall script is dependent on script events related to gravity and air movement (setGravity and setAirAccelerate) that were introduced in this latest dev build 1 Quote FMs: A Good Neighbor, Eye on the Prize Co-FMs: Seeking Lady Leicester, Written in Stone, The Painter's Wife
datiswous Posted December 10, 2024 Report Posted December 10, 2024 (edited) Ok but it crashes to desktop, so I'm not sure if it was properly tested. (although I have no clue what the reason is) Edited December 10, 2024 by datiswous Quote
Amadeus Posted December 10, 2024 Author Report Posted December 10, 2024 3 minutes ago, datiswous said: Ok but it crashes to desktop, so I'm not sure if it was properly tested. It hasn't been properly tested, hence this very post asking for testers as for why it crashes on Linux, I have no idea, sorry. I'm not familiar with the linux environment 1 Quote FMs: A Good Neighbor, Eye on the Prize Co-FMs: Seeking Lady Leicester, Written in Stone, The Painter's Wife
Amadeus Posted December 10, 2024 Author Report Posted December 10, 2024 Spawning entities *** stack smashing detected ***: terminated signal caught: Aborted si_code -6 Trying to exit gracefully.. --------- Game Map Shutdown ---------- ModelGenerator memory: 1 LOD entries with 0 users using 16 bytes. --------- Game Map Shutdown done ----- Shutting down sound hardware idRenderSystem::Shutdown() ...shutting down QGL I18NLocal: Shutdown. ------------ Game Shutdown ----------- ModelGenerator memory: No LOD entries. Shutdown event system -------------------------------------- shutdown terminal support About to exit with code 0 @nbohr1more, @stgatilov do you know what would cause a crash like this for Linux? On Windows, everything is seemingly fine, so I'm not really sure how to fix this Quote FMs: A Good Neighbor, Eye on the Prize Co-FMs: Seeking Lady Leicester, Written in Stone, The Painter's Wife
nbohr1more Posted December 10, 2024 Report Posted December 10, 2024 Some sort of buffer overflow. Are you using any parameters that reference "long" floats? Are all your variables lower case or case matched ? ( Linux is case sensitive ) Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
Amadeus Posted December 10, 2024 Author Report Posted December 10, 2024 8 minutes ago, nbohr1more said: Are all your variables lower case or case matched ? ( Linux is case sensitive ) this is the script: Spoiler #ifndef SLOWFALLPOTION #define SLOWFALLPOTION float inUseSlowfall; float endTimeSlowfall; float soundEndTimeSlowfall; float soundEndPlayedSlowfall; object slowfallpotion : player_tools { void inventoryUse(player userEntity, entity frobbedEntity, float buttonState); void physicsLoop(); void soundLoop( entity userEntity ); }; void slowfallpotion::inventoryUse(player userEntity, entity frobbedEntity, float buttonState) { //drink the potion userEntity.changeInvItemCount(getKey("inv_name"), getKey("inv_category"), -1); userEntity.startSoundShader( getKey("snd_swallow"), SND_CHANNEL_VOICE ); //reset timers endTimeSlowfall = sys.getTime() + getFloatKey("duration"); soundEndTimeSlowfall = endTimeSlowfall - abs(getFloatKey("end_sound_lead")); soundEndPlayedSlowfall = 0; // if the player is already slowfalling, there is nothing more to do if (inUseSlowfall) return; else inUseSlowfall = 1; //monitor the player's fall thread physicsLoop(); thread soundLoop( userEntity ); } void slowfallpotion::physicsLoop() { //set up the new gravity and air acceleration properties vector newGrav; newGrav_z = -abs(getFloatKey("gravity")); float maxVel = -abs(getFloatKey("max_fall_speed")); float braking_rate = abs(getFloatKey("braking_rate")); $player1.setGravity(newGrav); $player1.setAirAccelerate( getFloatKey("horizontal_acceleration_multiplier") ); float curr_time = sys.getTime(); float prev_time, delta_time; while (sys.getTime() < endTimeSlowfall) { sys.wait(0.0159); //timekeeping prev_time = curr_time; curr_time = sys.getTime(); delta_time = curr_time - prev_time; //gradually slow the player down if the player is falling and their vertical velocity exceeds the limit if( !$player1.isAirborne() ) continue; vector playerVel = $player1.getLinearVelocity(); if( playerVel_z < maxVel ) { playerVel_z = sys.min( playerVel_z + (braking_rate * delta_time), maxVel ); $player1.setLinearVelocity(playerVel); } } //reset gravity and air acceleration properties when the effect ends newGrav_z = -$world.getFloatKey("gravity"); //default is ('0 0 -1066') $player1.setGravity(newGrav); $player1.setAirAccelerate(1); //default is 1 inUseSlowfall = 0; } void slowfallpotion::soundLoop( entity userEntity ) { //loop designed to be able to play the end sound multiple times, x seconds before the effect ends //in case the player drinks another slow fall potion shortly before the previous one expires while( inUseSlowfall ) { while( !soundEndPlayedSlowfall ) { //wait for the end sound's timer to elapse sys.wait(0.0159); if( sys.getTime() >= soundEndTimeSlowfall ) { userEntity.startSoundShader( getKey("snd_end"), SND_CHANNEL_VOICE2 ); soundEndPlayedSlowfall = 1; } } //sound has played; now wait a frame before checking whether the sound will need to be played again sys.wait(0.0159); } } #endif Quote FMs: A Good Neighbor, Eye on the Prize Co-FMs: Seeking Lady Leicester, Written in Stone, The Painter's Wife
nbohr1more Posted December 10, 2024 Report Posted December 10, 2024 Maybe the gravity value is going out of range when set negative? I'll test out with gdb tonight. Which mission is impacted? 1 Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
Amadeus Posted December 10, 2024 Author Report Posted December 10, 2024 6 minutes ago, nbohr1more said: Which mission is impacted? It's not impacting any existing mission (aside from an unreleased WIP), but I just want wanted to get feedback on the potion itself first. Datiswous was saying that they couldn't even boot up the test map without their game crashing to desktop. I included a pk4 in the OP that has a test map and all of the relevant assets. Thanks for looking into this! Quote FMs: A Good Neighbor, Eye on the Prize Co-FMs: Seeking Lady Leicester, Written in Stone, The Painter's Wife
Dragofer Posted December 10, 2024 Report Posted December 10, 2024 2 hours ago, nbohr1more said: Some sort of buffer overflow. Are you using any parameters that reference "long" floats? Are all your variables lower case or case matched ? ( Linux is case sensitive ) I dont think DoomScript allows you to use any other kinds of floats, and variables always have to be case matched since DoomScript, too, is case sensitive. 1 Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Co-FM: The Painter's Wife | Co-FM: Written in Stone | Co-FM: Seeking Lady Leicester Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide | Dark Ambient Music & Sound Repository
snatcher Posted December 10, 2024 Report Posted December 10, 2024 I love it! Congratulations @Amadeus and Team. Very well done! Looking forward to missions making use of the Slowfall mechanic! Because of other games with similar dynamics my brain is desperately asking: To be able to change direction slightly To reduce momentum by pressing jump (Just sharing first impressions eh, nothing else) 1 Quote
Amadeus Posted December 10, 2024 Author Report Posted December 10, 2024 5 minutes ago, snatcher said: To be able to change direction slightly Glad you're diggin' it, snatcher! As for changing directions, we tried looking at that, but it seems to be a limitation for now. You can hit the Run/Walk key and gain a bit more movement control while your falling, but that's about it. As for reducing momentum.... that's an interesting idea 1 Quote FMs: A Good Neighbor, Eye on the Prize Co-FMs: Seeking Lady Leicester, Written in Stone, The Painter's Wife
thebigh Posted December 10, 2024 Report Posted December 10, 2024 I can confirm that this doesn't work on Linux. I get the error *** stack smashing detected ***: terminated and an immediate CTD. 1 Quote My missions: Stand-alone Duncan Lynch series Down and Out on Newford Road the Factory Heist The Wizard's Treasure A House Call The House of deLisle
snatcher Posted December 10, 2024 Report Posted December 10, 2024 When using the Slowfall a regular jump is way longer than usual. And I think this goes in detriment on when mappers can make the potion available in their maps (shop? half way through? right when required?). A seasoned mapper such as yourself will understand. Perhaps the slowfall effect should apply only after a certain downwards speed is reached? Quote
Dragofer Posted December 10, 2024 Report Posted December 10, 2024 3 hours ago, Amadeus said: Glad you're diggin' it, snatcher! As for changing directions, we tried looking at that, but it seems to be a limitation for now. You can hit the Run/Walk key and gain a bit more movement control while your falling, but that's about it. As for reducing momentum.... that's an interesting idea That was what my latest commit shortly before the test went live was about actually. Core TDM already supports moving towards any direction while falling, but it's very slow so the slowfall potion amplifies your horizontal acceleration by about 5x. That said, something in spoilers for people who have already tried changing direction mid-air: Spoiler While falling, the run key still works and lets you change direction much faster. Did it occur to you to hold down the run key while you were falling (assuming you don't have always-run enabled anyway)? Please feel free to reply in a spoiler. 1 Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Co-FM: The Painter's Wife | Co-FM: Written in Stone | Co-FM: Seeking Lady Leicester Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide | Dark Ambient Music & Sound Repository
Dragofer Posted December 10, 2024 Report Posted December 10, 2024 3 hours ago, snatcher said: When using the Slowfall a regular jump is way longer than usual. And I think this goes in detriment on when mappers can make the potion available in their maps (shop? half way through? right when required?). A seasoned mapper such as yourself will understand. Perhaps the slowfall effect should apply only after a certain downwards speed is reached? Yep, a side-effect of the current implementation is that your horizontal jump distance is significantly longer, even if your vertical jump height is still the same. It kind of makes sense to me that you would be able to cover more distance if you hang in the air for much longer, and I don't think it would feel good for gravity to abruptly change depending on your vertical velocity. But it would be be possible to scale your horizontal acceleration with your vertical velocity, if this is more widely desired. Maybe gravity, too, should scale with velocity in some way. Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Co-FM: The Painter's Wife | Co-FM: Written in Stone | Co-FM: Seeking Lady Leicester Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide | Dark Ambient Music & Sound Repository
nbohr1more Posted December 11, 2024 Report Posted December 11, 2024 Looks like something is causing the collision code to go nuts trying to finish the polygonal windings? @stgatilov Spoiler *** stack smashing detected ***: terminated Thread 1 "thedarkmod.x64" received signal SIGABRT, Aborted. __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44 warning: 44 ./nptl/pthread_kill.c: No such file or directory (gdb) bt #0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44 #1 __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78 #2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89 #3 0x00007ffff764526e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #4 0x00007ffff76288ff in __GI_abort () at ./stdlib/abort.c:79 #5 0x00007ffff76297b6 in __libc_message_impl ( fmt=fmt@entry=0x7ffff77ce765 "*** %s ***: terminated\n") at ../sysdeps/posix/libc_fatal.c:132 #6 0x00007ffff7736c19 in __GI___fortify_fail ( msg=msg@entry=0x7ffff77ce77d "stack smashing detected") at ./debug/fortify_fail.c:24 #7 0x00007ffff7737ea4 in __stack_chk_fail () at ./debug/stack_chk_fail.c:24 #8 0x00000000004ed732 in idCollisionModelManagerLocal::TryMergePolygons ( this=<optimized out>, model=<optimized out>, p1=<optimized out>, p2=0x7488370) at /home/user/darkmod_src/trunk/cm/CollisionModel_load.cpp:1487 #9 0x000000570000005b in ?? () #10 0x00007fffffffa560 in ?? () #11 0x0000000007cbecb0 in ?? () --Type <RET> for more, q to quit, c to continue without paging--RET #12 0x00007fffffffa540 in ?? () #13 0x0000000007ca2580 in ?? () #14 0x0000000007e7fec0 in ?? () #15 0x00000000015fd900 in cm_windingList () #16 0x0000000007cbecb0 in ?? () #17 0x0000000007e7fec0 in ?? () #18 0x00007fffffffa560 in ?? () #19 0x00000000004f0bef in idCollisionModelManagerLocal::MergeTreePolygons ( node=0x6200000067, model=0x6a0000006f, this=0x660000006b) at /home/user/darkmod_src/trunk/cm/CollisionModel_load.cpp:1570 #20 idCollisionModelManagerLocal::FinishModel (this=0x660000006b, model=0x6a0000006f) at /home/user/darkmod_src/trunk/cm/CollisionModel_load.cpp:2966 Backtrace stopped: Cannot access memory at address 0x5a00000067 1 Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
Dragofer Posted December 11, 2024 Report Posted December 11, 2024 20 hours ago, datiswous said: Ok but it crashes to desktop, so I'm not sure if it was properly tested. (although I have no clue what the reason is) Is the crash to desktop when you attempt to launch TDM, when you load the map or when you drink a potion? Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Co-FM: The Painter's Wife | Co-FM: Written in Stone | Co-FM: Seeking Lady Leicester Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide | Dark Ambient Music & Sound Repository
nbohr1more Posted December 11, 2024 Report Posted December 11, 2024 Crashes during mission loading while trying to generate entities. 1 Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
nbohr1more Posted December 11, 2024 Report Posted December 11, 2024 @Amadeus can you find or create a suitable collision mesh for the potion bottle and add: "clipmodel" "models/darkmod/path/to/clipmodel" // etc etc to the slowfall_potion def? 1 Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
stgatilov Posted December 11, 2024 Report Posted December 11, 2024 It is caused by trying to convert render model into collision model for these two models: models/darkmod/nature/skybox/starry2/moon_full.ase models/darkmod/nature/skybox/starry2/moon_full_glow.ase I guess the models are just planar grids. The engine tries to merge all the incident planar quads, and suddenly gets more than 64 edges in total. And there is no protection against it. Windows build is lucky to have some extra space, but Linux build dies. I fixed it in svn rev 10916. Meahwhile, I think you can mark the skyboxes as non-colliding?... 2 1 Quote
nbohr1more Posted December 11, 2024 Report Posted December 11, 2024 Fix confirmed! Thank you! Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
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.