• Creating Optimized Escalators
    25 replies, posted
In my map TTT_Nuclear_Power I have fully functioning escalators: [t]http://i207.photobucket.com/albums/bb15/matt2468rv/2015-05-28_00002.jpg~original[/t] They work extremely well but I believe they are a contributing factor for some servers experiencing lag in that area of the map. Right now, every step spawned is a func_tracktrain, which to my understanding is a networked entity (or edict). I'd like to replace the escalator system with something more optimized that doesn't cause any load on a server. Does anyone have any ideas? Would it work to model all of the escalator steps in Blender and create a looping animation for the steps moving one step length? And then I could make them non-solid and use an invisible func_conveyor to actually move the player? Is there a better way to approach this?
[QUOTE=Matt2468rv;52670936] Would it work to model all of the escalator steps in Blender and create a looping animation for the steps moving one step length? And then I could make them non-solid and use an invisible func_conveyor to actually move the player? [/QUOTE] This is in fact the best way to do it. However, I don't know if func_conveyor can replicate the movement in an acceptable way. [editline]11th September 2017[/editline] [QUOTE=Matt2468rv;52670936] Right now, every step spawned is a func_tracktrain[/QUOTE] Holy cow, Im surprised this doesn't crash on load. I can definitely see how this causes performance problems
[QUOTE=Grenade Man;52671034]This is in fact the best way to do it. However, I don't know if func_conveyor can replicate the movement in an acceptable way. [editline]11th September 2017[/editline] Holy cow, Im surprised this doesn't crash on load. I can definitely see how this causes performance problems[/QUOTE] func_conveyor can actually move players in an acceptable way. Right now I have them on the escalator "belt railings" so if a player stands on the railings they will move at the same rate as the steps. However func_conveyors don't move anything other than players. I've had some luck with trigger_vphysics_motion as the other half of it to move physics objects though, so I think I could get it done that way. And yeah, the load on the server actually wasn't an issue at all in the B2 version of the map. I think it's when I added a lot more other content in V3 that it finally started to run into some performance issues. Time to optimize!
Animated model + func_conveyor + trigger_vphysics_motion?
[QUOTE=oskutin;52673812]Animated model + func_conveyor + trigger_vphysics_motion?[/QUOTE] Yeah, I think that's the route I'm going to have to take. The other alternatives would be changing it to a simple conveyor belt scrolling texture or just making the steps stationary, but I don't want to do either of those things. I don't have too much experience with modeling in Blender but it should be a fun challenge and I'm sure I could figure it out.
Is it in any way possible for the animated model to be solid and have a collision that carries the player up? Or as I suspect, is that outside the realm of the Source Engine's capabilities?
[QUOTE=Matt2468rv;52674260]Is it in any way possible for the animated model to be solid and have a collision that carries the player up? Or as I suspect, is that outside the realm of the Source Engine's capabilities?[/QUOTE] I don't think so, atleast that would explain why all of L4D2s Rescue Vehicles are non-solid
[QUOTE=Matt2468rv;52674260]Is it in any way possible for the animated model to be solid and have a collision that carries the player up? Or as I suspect, is that outside the realm of the Source Engine's capabilities?[/QUOTE] Yes this is very much possible although frustrating... It worked out perfectly some time but didn't some other time for no apparent reason. You can add me on steam if you want. Searching for "KingPommes" should do
[QUOTE=KingPommes;52674360]Yes this is very much possible although frustrating... It worked out perfectly some time but didn't some other time for no apparent reason. You can add me on steam if you want. Searching for "KingPommes" should do[/QUOTE] Bit off-topic but you do remember there is a button below your name that leads directly to your profile right?
[QUOTE=Matt2468rv;52674260]Is it in any way possible for the animated model to be solid and have a collision that carries the player up? Or as I suspect, is that outside the realm of the Source Engine's capabilities?[/QUOTE] This isn't actually how animated models with collisions are supposed to be used. It can lead to numerous instances of people getting stuck etc. For example, in the lab scene in HL2 with Lamar, the npc doesn't actually knock the cans and monitors over, those are faked with phys_explosion entities.
I'm going the route of making a custom model and using a func_conveyor + trigger_vphysics_motion. I don't think any other way would work properly, like you guys have said. This is my first creation in Blender, but through a lot of trial and error, I managed to get a fully animated escalator model working with the same texture and dimensions as in the map, so it should look more or less the exact same: [t]http://i207.photobucket.com/albums/bb15/matt2468rv/MF_Escalator_Blender_Capture_01.png~original[/t] Now I just need to figure out how to export it to the Source Engine. :p
[QUOTE=Matt2468rv;52679774]I'm going the route of making a custom model and using a func_conveyor + trigger_vphysics_motion. I don't think any other way would work properly, like you guys have said. This is my first creation in Blender, but through a lot of trial and error, I managed to get a fully animated escalator model working with the same texture and dimensions as in the map, so it should look more or less the exact same: [t]http://i207.photobucket.com/albums/bb15/matt2468rv/MF_Escalator_Blender_Capture_01.png~original[/t] Now I just need to figure out how to export it to the Source Engine. :p[/QUOTE] [url]http://steamreview.org/BlenderSourceTools/[/url] As for physics collision, you can attach a collision object to an animated bone, [URL="https://s.gvid.me/s/2017/09/14/animatedcollision.webm"]and I don't have problems with the player colliding with them[/URL]. [URL]https://developer.valvesoftware.com/wiki/$collisionjoints[/URL]
I think that wouldn't solve his problem regarding performance and edict count, but yeah, thats a good way to do it.
[QUOTE=Grenade Man;52680293]I think that wouldn't solve his problem regarding performance and edict count, but yeah, thats a good way to do it.[/QUOTE] I think you can do one collision mesh per bone, so that's up to 32 of them per model. Granted, the escalator has more steps than 32, but 2-3 models with animations is better than 64-94 full on tracktrains I'd think.
That's pretty interesting. The way my model is set up though, I'm not sure how well it would work doing it that way? My model only consists of two bones - one that moves the lower and top flat sections straight forward and one that moves the whole angled section up. The animation is only a few frames since it moves one step length and loops the animation over and over, which seems to be the most optimized way to do it.
[QUOTE=Matt2468rv;52680766]That's pretty interesting. The way my model is set up though, I'm not sure how well it would work doing it that way? My model only consists of two bones - one that moves the lower and top flat sections straight forward and one that moves the whole angled section up. The animation is only a few frames since it moves one step length and loops the animation over and over, which seems to be the most optimized way to do it.[/QUOTE] In that case an animated collision model isn't really suitable. I highly recommend against it anyways as it's a huge pain to setup [I](a detailed guide on how to get it to work consistently would be amazing)[/I]
I've thought about this topic for some time and think there's a third way that could work, but it would be difficult to tweak to work right because the trains in Source sometimes don't quite move exactly where they should or have little breaks at their path nodes. If you had managed to get it working with brush entities for a bunch of steps, you could animate the bottom and the top in detail, and for the middle use a bigger brush entity encompassing many steps and either - have it move by a step and then teleport back - or have two of those and let one drop "into" the escalator while the other one pops out in the right moment, making it a seamless illusion too One pitfall would be to get the lighting right, but that could probably be arranged with a different light origin and very homogeneous illumination there.
[QUOTE=Matt2468rv;52680766]That's pretty interesting. The way my model is set up though, I'm not sure how well it would work doing it that way? My model only consists of two bones - one that moves the lower and top flat sections straight forward and one that moves the whole angled section up. The animation is only a few frames since it moves one step length and loops the animation over and over, which seems to be the most optimized way to do it.[/QUOTE] You'd basically animate all the bones at the same time. You'd probably want to break the top and bottom landings off into their own model with its own unique animation. I don't see a reason why it's not possible. It's more complicated than just having a for-show model with a conveyor+vphysmotion, but it might be an idea to explore.
Is a slope escalator instead of a step escalator an acceptable alternative?
[QUOTE=coolcat99;52686616]Is a slope escalator instead of a step escalator an acceptable alternative?[/QUOTE] Might look odd for human use. Usually a slope escalator is used for moving luggage or items.
[QUOTE=Shrinker42;52681520]I've thought about this topic for some time and think there's a third way that could work, but it would be difficult to tweak to work right because the trains in Source sometimes don't quite move exactly where they should or have little breaks at their path nodes. If you had managed to get it working with brush entities for a bunch of steps, you could animate the bottom and the top in detail, and for the middle use a bigger brush entity encompassing many steps and either - have it move by a step and then teleport back - or have two of those and let one drop "into" the escalator while the other one pops out in the right moment, making it a seamless illusion too One pitfall would be to get the lighting right, but that could probably be arranged with a different light origin and very homogeneous illumination there.[/QUOTE] I see what you mean but I'd rather refrain from using func_tracktrains at all. In my experience, tracktrains have always been a little buggy for anything that needs precision. [QUOTE=glitchvid;52682035]You'd basically animate all the bones at the same time. You'd probably want to break the top and bottom landings off into their own model with its own unique animation. I don't see a reason why it's not possible. It's more complicated than just having a for-show model with a conveyor+vphysmotion, but it might be an idea to explore.[/QUOTE] We'll see how things go using a func_conveyor and trigger_vphysics_motion but if that doesn't get things working the way I want, then yeah maybe that would be something to explore! [QUOTE=coolcat99;52686616]Is a slope escalator instead of a step escalator an acceptable alternative?[/QUOTE] I thought about it but no. It would look too strange and if I changed it players would consider it a downgrade - they seem to like having working escalators. My aim is for the difference not to be noticeable between versions.
Well I got it in-game and it looks great. Actually it looks even better than before since it receives proper lighting. Here's a test: [t]http://i207.photobucket.com/albums/bb15/matt2468rv/20170916235113_1.jpg~original[/t] However I'm having an issue with the animation. I posted in the modeling section if any of you might be able to help out: [URL]https://facepunch.com/showthread.php?t=1578926[/URL]
The level around your model there is pretty.
Success! [t]http://i207.photobucket.com/albums/bb15/matt2468rv/20170917234213_1.jpg~original[/t] The animation is working seamlessly now and the escalator looks the same (if not better due to proper lighting) as a model. A func_conveyor moves players in the exact same way as before so I doubt most players will even notice that anything has changed. However, I can't get trigger_vphysics_motion to move physics objects in a natural way. I might just skip it, honestly. Props just slide down the escalator now, but really that's not a huge detail in the grand scheme of things when I gain so much in terms of optimization. The "in" value in "net_graph" was around 2400 before (yikes), and now it's down to 200. That is a HUGE difference, and the map is pretty much optimized in every way I can think of now. No more lag or crashes! Thanks for all of your help guys! This was truly a great learning experience for me in terms of modeling, too.
Would you share how you fixed the animation problems, for future reference? Anyhow, Im gland you went that extra mile to make your map better for the end user. Great job, can't wait to get the newest version of your map!
[QUOTE=Grenade Man;52703316]Would you share how you fixed the animation problems, for future reference? Anyhow, Im gland you went that extra mile to make your map better for the end user. Great job, can't wait to get the newest version of your map![/QUOTE] Thank you! For the animation I modeled the steps in Blender and animated them to move one full step length. To get it to actually loop properly in the Source engine without a "jump" when the loop restarts, I had to use the "snap" and "realtime" parameters in the compile QC file. Big thanks to the modeling section for helping me figure out this issue. Here's my QC: [CODE]$modelname "Matt2468rvModels/tttnp_escalator_01.mdl" $body mybody "reference.smd" $cdmaterials "models/Matt2468rvModels" $scale 1 $sequence idle "reference.smd" loop fps 1 $sequence "up" "up.smd" snap fps 24 realtime $sequence "down" "down.smd" snap fps 24 realtime[/CODE]
Sorry, you need to Log In to post a reply to this thread.