Jump to content

Vandeanson

Member
  • Content Count

    758
  • Joined

  • Last visited

  • Medals

Everything posted by Vandeanson

  1. Hiho Gentlemen, for the past weeks I have been looking into improving the FPS impact my Vandeanson's Apocalypse mod has on missions. What does the mod do? (all the below happens server side only, fyi) 1. []spawn "Position finder function": find well suiting locations to spawn sites of interest (small sized composition of structures, things and AI, e.g. a banditcamp) based on a random players location 2. []spawn "Site spawner function":mark that location (as set in #1.) and starts "waituntil {code to check for condition}" with condition that ANY player gets close to the site 3. create the site, enable dynamic simulation, start despawn timer 4.a [] "spawn hideobjectglobal function" that will hide the objects of a site once no player is near that site, but the despawn timer (item. 5 below) has not run out yet 4.b [] "spawn un-hideobjectglobal function" that will UNhide the objects of a site if a player is near again 5. wait for despawn timer to run out (minimum up-time of a site) 6. start "waituntil {code to check for condition}" with condition that no player is near the site 7. delete the site/AI 8. start at #1. I hope its somehow recognizable, that this should allow for a dynamic environement, with least possible performance impact due to the "waituntil" gating. Sites are only up if really needed e.g. a player is nearby to actually see the site. If the sites and AI are spawned, dynamic simulation is enabled. The performance gains compared to previous versions (where assets where spawned in and FPS was only saved by dyn. simulation) are already quite considerable. The performance saving actions happen through distance checks, waituntil, dynamic simulation, hideobjectglobal and despawn of sites that are no longer needed (e.g. noone within 4k meters proxy) However, the question that is bugging me currently is about the performance impact of having multiple (possibly 100+) waituntil and spawn threads up sametime. waituntil: the mod spawns about 10 type of sites, each sites may be spawned up to 10 times. Each creates an own "waituntil" thread. I seem to understand that these waituntils are continuisly eating up performance until the "condition" is met. Until then, the condition is checked every frame. In my case, these are way to many "check" iterations than needed. A check every 5 seconds is fine as well. Hence I changed the waituntil to waituntil {sleep 5; ...code..}; Question: am I correct that this shold have a "considerable" positive impact on performance of waituntil usage? I got this from forum posts so it should atleast have some hand and feets. [] spawns: most functions need to be spawned in a separate thread, I can not use "call" as the calling script can not be halted until the function returns true and since suspension (waituntil) is not allowed for called functions. Where i can use "call", i do that. Hence, in additiona to a lot of waituntils, I also have multiple spawn threads run more or less complex code sametime. I believe that if i put in sleep timers between each bulk of complex code that should help with performance (e.g. first all bandit camps are spawned, then the next site may start to spawn in). Question: this, if the sleep timers are set right, should put additional ease on cpu. Correct? Also, if I place small sleep timers throughtout spawned code, I should ease possible stutters/lags when spawning stuff. I could also add condition checks (uff, more waituntils) between major functions spawns, that only return true once the previous site/code bulk is done. I hope it is somehow understandable what I am trying to do and what the challenges are that I am worried about. A playable test version of the mod can be found here FYI: (it does not include ALL of the performance saving actions yet, but it should give you a fair picture). Why this post? I would like to understand if: - my thought process is correct - if the issues I am looking into are actual issues worth looking into - if more experienced people would take a similar approach or if I am missing knowledge and the issue could be taken on in better ways. The changes I made already show positive results, but I am sure that there are things that I dont know yet. The above conclusions are based on the last 2 years of coding various projects and reading up various topics online (KK's blog, forum posts, code optimisation guides...) I have no professional coding background, hence I might lack basic knowledge. End of wall of text. I appreciate any feedback, input, source of information and so on that I can get;) Thanks! Cheers VD
  2. Set this first line to private instead of further down, so the content of _a is recognized throughout the script. That might help later on:)
  3. Vandeanson

    count magazine left

    The / seems wrong here, that should be >> i believe. That might prevent your script from working. With regards to your for.. Do code, i dont understand what you want to do there sorry:( but that might just be due to a lack of knowledge on my end.
  4. @sarogahtyp Thanks you, i didnt know about breakTo, should come in handy:) Maybe this was the reason why i put the isflatempty check separately, not sure tho, it was quite late:) Will gladly take over your method and test it!
  5. Oooh sweet, now i get it! Thanks!
  6. @Dedmen I thought about your initial comment again,about _spawnpos causing a problem if no player is found with _allplayers. If there are no players, the code defining _spawnpos and the isflatempty checks are skipped, or that is the intention. Instead it will loop, check for players again and do that until there is a player spawned in. Then it creates a _spawnpos based on such players position and will check if that position returns true with isflatempty. It also appears to me that _spawnPos is overwritten with a position before its ever used later in the code. So its default value should not matter, right? I might oversee something here, not sure what though. Cheers Vd
  7. Did this for a while now and found it quite informative. Really glad you told me about it, gave me a better overview of whats going on and helped with some issues. It also made me integrate parts of externslized functions (IED spawn, AI spawn, Loot spawn,....) back into the main spawners. This way i can have separate functions for these things but i could avoid having separate cleanup code/waituntils. Hence for each spawner script, previously, 5-6 active scripts where in a loop/on hold which is now reduced to 2 per sitespawn.
  8. Oh, i guess defining private _spawnPos = [] ; Instead of... ="" ; by default would fix that.
  9. Thanks, i didnt realize that! Ok will check, that would indeed be nice! No worries, i took that to heart. I am defining these early in the code, for example: Private _allplayers = "" ; So much more convenient to code with private:) You only want to check if atleast one? You can use findIf then and not have to iterate the whole array with count Ok will check. I forgot i could check for >= 0 or maybe != -1 with findif, to find out if it has found a matching player. Thanks!
  10. Fyi: I was made aware of a logic error when using foreach. This results in distance checks from site/AI to any player before despawn of a site/AI not working as intended, meaning that sites or AI (when dead) could sometimes despawn in front of you. @zagr this was causing the AI deletion issue you noticed, fyi. I got a fix for that now. Generally after a first round of optimization, i got quite good critique and feedback in the forums that helped me reconsider coding desicions and initiated another round of optimization and even rewriting of basic scripts of the mod. I am basically fixing the template of the dynamic spawn/idle/despawn/respawn system and can apply these optimizations to all features. Progressing slowly due to restricted "me-time" but changes are quite impactfull and i am looking forward to playtest and finally release the update:) Cheers Vd
  11. Vandeanson's Apocalypse - the Mod: A "plug and play" mod that will spawn various sites and AI, fully randomly placed that will be dynamically de and respawning for ongoing survival action! NOTE: This is not a MISSION. This is a dynamic site and event spawner, that runs on top of any mission that you start while the mod is active. It spawns in sites based on player position, terrain and your settings (to change settings, you must edit your mission in Eden Editor - > Settings - > Addon Options). Never again will it be pointless, dull and boring to run around in armas beautiful forrests, just because all the loot and action is stuck in cities and other remains of civilisation! My mod will spawn in bandit camps to raid, small survivor hideouts to find and loot in the deepest forest, crashed helicopters that should definitely be searched before other survivors get there, ferocious packs of wild dogs that will jump you in the dark or animals to hunt for survival. Find a tame horse as a compagnion and tie it up next to your homebase while setting up barricades and boobie traps to fend off attacks against your newly claimed home. Zombies just got deadlier with the infection feature. When getting hit, you might catch a deadly infection that will drain your stamina and lifeforce over time. Stack up on anti virus pills to cure yourself! You will never rest easy, knowing that your steps may be watched from far and the moment you get too comfortable at a place, bandits pick up your trace and hunt you down! VANDEANSONS APOCALYPSE (STEAM DOWNLOAD) INSTALLATION: 1. Subscribe to the mod and activate it and CBA_A3 in the A3 launcher Whenever you start any mission (self made or from steam) , the mod will start to spawn in sites according to the default settings. 2. to adjust VA settings, open the mission you want to edit, or create a new one in Eden Editor, go to Settings -> Addon Options -> select the "VDA" options to see what you can change (there are a lot of options for customisation) 3. NOTE: the plane spawner requires you to place the following markers by default, else the planes spawn in the debug zone: "VD_PlaneMrkr_1,VD_PlaneMrkr_2,VD_PlaneMrkr_3,VD_PlaneMrkr_4". You may add or remove markers. 4. if you play on maps like chernarus, cover the empty terrain with large area markers and name them. enter the area markers name into the field under "VDA -1- General Settings" to blacklist that area from landsite spawns. 5. similar for shipwrecks and boats (cover inland lakes with additional area markers) so the shipwrecks and boats wont spawn in lakes inland. 6. Place your player and play. (Place the gamemaster module to check if the mod is working as ZEUS) FEATURES : - random and automatic position finder for all features. No marker placement needed (see INSTALLATION gor exceptions) - sites de and respawn after a adjustable time and while no player is close - Bandit Camps - Hideouts - Shipwrecks - Crashsites - Tradercamp (custom weapon attachment trader, custom trader for ravage respawn tent backpacks, all ravage traders) - AI Patrols - Animal Spawner (Goats & Sheep, can be gutted and eaten with the Ravage mod) - Spawners for Boats, Planes, Helicopters - Medical Sites - Zombie Infection Script for the RAVAGE mod (change the zombie parent if you want this to apply to other zombie mods) - JBDOG feral dog spawner - DBO Horses spawner (you need to subscribe to this mod separately, if you wish to use the spawn feature) - No Rest! spawner (checks if player stays at a place for too long, if so, might spawn AI hunters ) - loot spawns at all sites - Max Joiners melee weapon mod is automatically included in the loot economy and player equipper. AIs wont spawn with melee weapons however. This requires the max_melee weapons mod. No dependency is created. GENERAL: - dynamic simulation is enabled for all spawned AI and structures. Simulation is enabled based on your view distance settings minus fog, plus scoped view distance to save FPS - automated loot arrays based on active mods (e.g. CUP, RHS,... will be integrated into the features) - option to blacklist items from loot arrays - option to exclude Arma 3 Vanilla and DLC items from loot table - option to exclude various mod sub content (e. g. CUP Uniforms, or IFA3 Backpacks...) - adjustable AI equipper (or option to use Ravage Equipper) - adjustable player equipper (or option to use Ravage Equipper) - CBA_A3 Settings to tune features in Editor while making a mission - possibility to add blacklist area markers for land sites (e.g. Bandit Camps) and coastal sites (e.g. shipwreck and boats) - adjustable spawn ranges and despawn timers - MP compatible to my best knowledge, please report any issues - the default currency is the ravage money, fyi. Without ravage mod active, it will just not spawn without error - adjust the amount of sites/features that at spawn to your needs or disable specific features if you dont like it - plane spawner: the only feature that requires you to place markers, check the CBA3 settings for it. 4 markers are pre defined, you may add as many as you want and place such markers at airfields. All placed markers will be a potential spawn position for planes - This mod creates NO dependency! UPCOMING/PLANNED FEATURES: I have quite a bunch of ideas for new features and plan to improve and extend the mod going forward, no ETA gor such features however. AI Spawner: - AIscavengers that move from house to house in a city and then return to a hideout z nearby to drop off loot, then go back to scavenging - AI spawner in case players spend a lot of time at the e same place (e.g. Looting a city) - chance for AI groups in any feature to be military grade geared, rather than random low quality survivor gear - some sort of simple basebuilding, crafting and ressource gathering feature - a mission generator - optional loot economy (to fill buildings with loot) - option to include heroes survive - option to include zombies & demons (e.g. A ambient Z spawner) - fake underground sites such as bunkers or caves TO DO'S: - not all arrays are automated (automated means, items or structures of active mods are put into category for use in my script) - automate heli, plane, heliwreck, boat arrays based on active mods - automate inventory items REQUIREMENTS : Note that this mod requires CBA3. CUP Terrain Core is also recommended, as some structures from it are used. There is no dependency however. Ravage has been the inspiration for the mod and this mod is made with Ravage in mind. There is however no dependency, you can use the mod with our without Ravage. THANKS: Thanks to all the great guys on the BI forum for their help and advise. With special thanks to George Floros GR, Johnnyboy, Mr H., HazJ, Larrow, pierremgi, Haleks, Grumpyoldman, Gunter Severloh, the Ravage folks, all followers of my topic thread and anyone i might have forgotten right now. HELP TO IMPROVE: Please subscribe, rate and let me know any issue that might occur, I would appreciate receiving any feedback that helps me improve the mod. Cheers VD
  12. Just for testing, it will be a longer delay in the final script.
  13. tried to further slim down the PosCheck: and the despawn/spawn checks in the spawner: and replaced the logic error with foreach - using count now. thanks for pointing that out @Dedmen, players reported a bug that I can now fix with that change. didn't realize that foreach is working that way.
  14. Vandeanson

    Ravage

    @haleks Note that i mean the dammaged one, not handledammage;) this addEventHandler ["Dammaged", { params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"]; }];
  15. Vandeanson

    Ravage

    😁 Will try that EH too, atleast using the projectile as filter seems to be faster. Thanks!
  16. Vandeanson

    Ravage

    Also, note that (atleast when using the dammaged EH) one strike by a Z might be registered multiple times, and hence is triggered multiple times. Your infection effect (maybe damage over time loop) would be triggered multiple times, if you dont manage this. Not sure if that fact also applies to haleks version. Cheers Vd
  17. Vandeanson

    Ravage

    Ah yeah i thought so.. Hmm i forgot what i used... Try !isKindOf "zombie" This searches also the subtypes of config entries. I think != or !isEqual is looking for exactly the same object
  18. Vandeanson

    Ravage

    My infection script works with dammaged EH applied to all players and AI, i am still happy with it and can recommend this EH for such script. this addEventHandler ["Dammaged", { params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"]; }]; If (_shooter != "zombie") exitwith {} ; .... Your code here.... "zombie" (or maybe "zombies") is the config parent for ravage zombies class
  19. Vandeanson

    Ravage

    I use dammaged or hit eventhandlers for that, and filter out non zombie attackers before starting the script triggered by the eventhandler https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Hit There should be atleast a hit eventhandler already in the zombie module of ravage. Else i have an example that I can send you once i get to my pc.
  20. Vandeanson

    Ravage

    We all have these moments of mental meltdown 🙂
  21. Vandeanson

    Ravage

    R.I.P. haleks graphics card, it has served us all well. Scripting around ravage has been a cheap hobby for me so far, if ravage needs some sponsoring i ll invest some into these countless hours still to come 😉
  22. Vandeanson

    Ravage

    I believe its just: SystemChat str _this; As long as "camanbase" is the only parameter that is passed into the code from the eventhandler.
  23. Vandeanson

    count magazine left

    Aaah nice! Those damn brackets get me every time:)
  24. Vandeanson

    count magazine left

    Ok.. hm then it will be a bit of a guessing game for me until i get to a pc:) I am not very solid with checking for false conditions like the below.. Try this, else i will figure it out later tonight and send it to you. currentMagazine player == "" & & ! (getArray (configFile >> "CfgWeapons" >> currentweapon player >> "magazines") in magazines player)
×