Lag issue when triggering scripts - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Lag issue when triggering scripts (/thread-21614.html) Pages:
1
2
|
Lag issue when triggering scripts - Linus Ågren - 05-25-2013 Hey! I need some hints on how to reduce or remove the lag when the player is triggering scripts. The lag makes the player know they are to expect something, which I do not like hehe. I have not read so much about the map_cache files, but if I were to play through the entire mod, and then save the cache files it creates when releasing the mod, will it make the scripts lag less, or will it just bug out? Thanks! RE: Lag issue when triggering scripts - ExpectedIdentifier - 05-25-2013 (05-25-2013, 06:14 PM)junkfood2121 Wrote: Hey! If you're playing sounds and using particle systems when the event is triggered, you need to preload them when entering the map do this by using something like this: void OnEnter() { PreloadParticleSystem("particle.ps"); PreloadSound("sound"); } RE: Lag issue when triggering scripts - Linus Ågren - 05-26-2013 (05-25-2013, 06:28 PM)sonataarctica Wrote:(05-25-2013, 06:14 PM)junkfood2121 Wrote: Hey! Thanks for the reply! I have always wondered what the preload scripts are useful for. Thanks for clearing that one out for me! Though, the most of the lag comes from enabling / disabling entities. I have made quite a few custom wall / ceiling entities for breaking purposes. RE: Lag issue when triggering scripts - Linus Ågren - 05-29-2013 Bump. Still haven't found any working approaches. RE: Lag issue when triggering scripts - The chaser - 05-29-2013 You can make an extra sound or something falling, like it seemed a cheap scare. Of course, you can say too at the beggining of the story that there are occasional lag-spikes (telling lies and stuff), but... you catched me with this one, junkfood RE: Lag issue when triggering scripts - Adrianis - 05-29-2013 Can we see the script? If you've got a particularly large loop running with a lot of function calls that could cause it, i haven't personally encountered any noticeable lag enabling/disabling entities RE: Lag issue when triggering scripts - Linus Ågren - 05-30-2013 I solved one of the major lag problems. The AutoSave(); caused the lag. However, the problem still remains when making changes with slightly larger entities, such as a roof breaking script seen below: PHP Code: void RoofScare(string &in asParent, string &in asChild, int alState) Is there anyway to preload specific entities or anyway to make it lag less when activating them? RE: Lag issue when triggering scripts - The chaser - 05-30-2013 This might help you: http://wiki.frictionalgames.com/hpl2/amnesia/performance Also, are you sure this lag happens with everyone? The problem might be your computer. RE: Lag issue when triggering scripts - Linus Ågren - 05-30-2013 (05-30-2013, 07:31 PM)The chaser Wrote: This might help you:I have watched the playthroughs people made in the demo, and the lag appears to be there for most of the people, but indeed it has different length on each respective video. I suppose I will release the mod first, and then release a patch if I find a patch. RE: Lag issue when triggering scripts - The chaser - 05-30-2013 Oh, I'm sorry then. You could try to make something different though: Why must everything go together? You can put timers to distribute the falling ceiling, like this: void RoofScare(string &in asParent, string &in asChild, int alState) { SetEntityActive("default_entity_1", false); CreateParticleSystemAtEntity("", "ps_dust_elevator_crash.ps", "Area_BreakDust", false); PlaySoundAtEntity("", "break_wood.snt", "Area_BreakDust", 0.0f, false); AddTimer("", 0.8, "Do"); } void Do (string &in asTimer) { SetEntityActive("default_entity_2", true); SetEntityActive("wooden_board02_*", true); SetEntityActive("wooden_board03_*", true); } |