Buddski 1 Posted January 17, 2019 Mission file each time it is saved from 3Den editor appears to save a new randomSeed number. In industrial modeling and simulation a random seed can be presented to the simulation software at initialization to ensure the repeatability of the simulation, important during troubleshooting code. My head thinks of it as it initializes the random number generator to present a similar pattern of random generation so that from simulation to simulation you can determine if code is working the same or not. I am working with A3Wasteland mission, adding new sub-missions which are randomly selected from arrays. While i dont see exactly the same sequence of "randomness", across 3 or 4 restarts i am seeing a bias towards missions and mission locations selected "randomly" from the same missions spawn locations, making it feel not too random. Has anyone pushed the randomSeed around to better understand the role it plays in this software? If i delete the randomSeed in mission.sqm the mission seizes at startup. But is there a way to change by code, perhaps in one of the init statements, if so which so that each restart this is a different number? Any thoughts or am i chasing a red herring? Share this post Link to post Share on other sites
killzone_kid 1332 Posted January 17, 2019 Probably used for the weather so that it is the same on all clients who loaded mission in multiplayer Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted January 18, 2019 20 hours ago, Buddski said: Mission file each time it is saved from 3Den editor appears to save a new randomSeed number. In industrial modeling and simulation a random seed can be presented to the simulation software at initialization to ensure the repeatability of the simulation, important during troubleshooting code. My head thinks of it as it initializes the random number generator to present a similar pattern of random generation so that from simulation to simulation you can determine if code is working the same or not. I am working with A3Wasteland mission, adding new sub-missions which are randomly selected from arrays. While i dont see exactly the same sequence of "randomness", across 3 or 4 restarts i am seeing a bias towards missions and mission locations selected "randomly" from the same missions spawn locations, making it feel not too random. Has anyone pushed the randomSeed around to better understand the role it plays in this software? If i delete the randomSeed in mission.sqm the mission seizes at startup. But is there a way to change by code, perhaps in one of the init statements, if so which so that each restart this is a different number? Any thoughts or am i chasing a red herring? Depends on how many missions you want to rotate. If you only have 5 missions and want to play a random mission out of those 5 for 3 or 4 restarts you're absolutely right in seeing a pattern, since the brain is a pattern detection device. Try this: test = ["A","B","C","D","E"]; output = []; for "_i" from 1 to 10 do {output pushBack selectRandom test}; systemchat str output; hint str output; //will print ["E","D","E","A","C","D","E","B","D","C"] //consolidated in order of first occurence: [["E",3],["D",3],["A",1],["C",2],["B",1]] That's bound to happen with a small sample size. Increase the for loop to 100 and see the difference, a more normal distribution on occurrences, the order might still pick the same mission 2-3 times in a row. Better randomize an array of missions to choose from, play through all of them and randomize it again after the last one. Cheers 1 Share this post Link to post Share on other sites
Buddski 1 Posted January 22, 2019 I can try that but the nature of the issue is we have a A3Wasteland server running as a PvE where we are progressively ratcheting up the randomness of ai interactions. Things like mission spawn locations, convoy routes, mission variants, skill levels, crew sizes, rewards etc etc. We are currently resetting server every 24 hours, may be able to get to 48 hours but beyond there i think we are getting smashed by memory leakage. The mission is launching with up to 8 controllers firing across 6 different mission types, but it is the pattern of which missions and what locations that is "feeling" less than random. Might just have to double down on the options...not that hard to do really. Thanks Share this post Link to post Share on other sites
killzone_kid 1332 Posted January 22, 2019 7 hours ago, Buddski said: i think we are getting smashed by memory leakage. Are you using compile a lot? Share this post Link to post Share on other sites
Buddski 1 Posted January 27, 2019 yes, possibly the server compile file is currently running at about 100 mf_compile rows in that file alone. But then this would also be a one off compile rather than continuous compiles i would assume? In mission files there is quite often compile calls for preprocessFileLineNumbers, where basically arrays for selection of random mission waypoints, routes etd are generated i think. Share this post Link to post Share on other sites
Dedmen 2716 Posted January 31, 2019 On 1/27/2019 at 1:33 AM, Buddski said: where basically arrays for selection of random mission waypoints, routes etd are generated i think. That's bad. If you want to generate arrays you should just generate arrays, not generate strings and call compile them to get an array out. That might be the issue, if you are constantly compiling things from strings that constantly change, that's a memory leak. All these strings and the compiled code are kept in memory forever. Share this post Link to post Share on other sites
mrcurry 508 Posted January 31, 2019 2 hours ago, Dedmen said: All these strings and the compiled code are kept in memory forever. Interesting, is this just the case 'cause OP is probably working with global vars and is it just true for compiled code? I've always been under the impression that the game would release any memory no longer referenced by any variable, is that not correct? Sorry for the tangent but I'm really curious. Share this post Link to post Share on other sites
Dedmen 2716 Posted January 31, 2019 50 minutes ago, mrcurry said: Interesting, is this just the case 'cause OP is probably working with global vars and is it just true for compiled code? True for everything. https://feedback.bistudio.com/T135718 50 minutes ago, mrcurry said: would release any memory no longer referenced by any variable, is that not correct? It should yes, if it doesn't that's considered a memory leak 1 Share this post Link to post Share on other sites
Buddski 1 Posted February 1, 2019 Thanks guys, I will have a look at converting some of those compile calls to array defintions. Getting comfortable enough with the code to attempt that type of conversion now 🙂. 1 Share this post Link to post Share on other sites
Dedmen 2716 Posted February 1, 2019 8 hours ago, Buddski said: Thanks guys, I will have a look at converting some of those compile calls to array defintions. Getting comfortable enough with the code to attempt that type of conversion now 🙂. If you REALLY need string->array conversion for whatever reason. Use:https://community.bistudio.com/wiki/parseSimpleArray Share this post Link to post Share on other sites
Buddski 1 Posted May 17, 2019 Dedmen, Looking to start implementing parseSimpleArray in a version of A3Wasteland i have been tinkering with. One example is a list of cities within the game. The current call is cityList = compileFinal preprocessFileLineNumbers "mapConfig\towns.sqf"; From what i read of your other posts, a better way to create the globalVariable cityList would be to use something more like cityList = parseSimpleArray format[["Town_1",400,"Kavala"],["Town_2",300,"Agios Dionysios"],["Town_3",150,"Abdera"],.....etc]; Now the list of towns currently sites in a file, "mapConfig\towns.sqf". The current call to create the cityList array is currently coded in a config.sqf in the root directory for the mission. So trying to understand a mixture of file structures, loading sequences and methods all at the same time: What would be your comments on the changes i propose? modify the towns.sqf from (condensed of course for example) into a new towns.sqf [["Town_1", 400, "Kavala"], ["Town_2", 300, "Agios Dionysios"], ["Town_3", 150, "Abdera"]] new towns.sqf would become the array definition cityList = parseSimpleArray format[["Town_1",400,"Kavala"],["Town_2",300,"Agios Dionysios"],["Town_3",150,"Abdera"],.....etc]; the config.sqf file would now need to "call" or execute the towns.sqf file, BUT what is the call to execute the new towns.sqf file. Am i understanding the mechanics of how this would implement Share this post Link to post Share on other sites
Dedmen 2716 Posted May 18, 2019 On 5/17/2019 at 10:34 PM, Buddski said: rom what i read of your other posts, a better way to create the globalVariable cityList would be to use something more like No ,you are creating an array, and then turning it into a string, just to turn it back into an array, that's nonsense. Just use the array directly and be done with it. Share this post Link to post Share on other sites