Jab Posted June 4, 2015 Share Posted June 4, 2015 In light of the 32 build and playing various challenges and additions to the game, I noticed some performance issues on my end, due to my aging computer. Fortunately, I found a method to somewhat alleviate some of the processing load of the game through something called a RNG, (Random-Number Generator). This is what gives Project Zomboid a nice randomness in the way things work throughout the game, from lighting, to zombie spawning, to zombie reactions, to the damage you inflict on things. What Project Zomboid uses is a high-level RNG, which not only gives a less predictable output, but also in a more encrypted manner. These kinds of RNGs work best in high-level security password / account management, Gambling game websites, or other needs that require less prediction. What I've learned is that these really high level RNGs, (although less predictable and more true to random), is that they take a lot more to process than your medium or low RNGs. These are costly to performance on realtime calculations if used frequently. I did some research back in build 30 on what RNGs work best in a situation such as a game like Project Zomboid, and have found the XORShift 128 algorithm to hold the most ground when it comes to medium-level RNGs. So I went ahead and replaced the RNG that Project Zomboid uses with an implementation of this RNG. I personally noticed some positive results from this experiment in Build 30. When I experienced performance issues when playing the "Opening Hours" challenge in Build 32, I decided to test it again. I still noticed the same results. For me, it felt like the rendering was smoother, and the world simulation was more fluid, with less jolting. So in light of all of this, I decided to package this very simple modification to the game and allow others to try it out for themselves. Feel free to try this out and tell me what you think. One thing to note Is that there might be simulation differences between this random and the random used in the multiplayer simulation. When I played with this mod on build 30 servers, It was raining for me, when it was not for other players. This may be due to a simple RNG difference. No problem though. If you install this mod, please be sure to copy your 'zombie' folder in your main PZ folder. The mod is JAVA, so this affect the game's direct code, not like LUA. Let me know how this feels. I'd like to see if this improves the performance. I'm curious. P.S. For transparency: Here's the class model I implemented for you tech-savy people who want to see how this algorithm works. It's neat. (This class involves no code from the game directly, so this is not showing, exposing, or infringing on the game's code's rights.) Code: https://raw.githubusercontent.com/JabJabJab/SledgeHammer/master/src/com/badlogic/gdx/math/RandomXS128.java?token=ABAbyfyCPK5t0Cfyrphcw3mYYC4ZTR2nks5VeNfLwA%3D%3D Download: https://dl.dropboxusercontent.com/u/31589881/Zomboid/rngmod.zip Aniketos, Wveth, RichCoconut and 2 others 5 Link to comment Share on other sites More sharing options...
Realmkeeper Posted June 4, 2015 Share Posted June 4, 2015 Let's get technical - it's a PRNG as far as RNGs go. (The P is for pseudo, in any algorithms course you'll lose marks for claiming proper randomness, when it's not) Good stuff on the 'mod' though, it'll be interesting to see how many people feel a performance change with this! RichCoconut and Jab 2 Link to comment Share on other sites More sharing options...
Dragonbahn Posted June 4, 2015 Share Posted June 4, 2015 I haven't really experience any lag with PZ. But with my luck I'll be returning here in a couple of months Link to comment Share on other sites More sharing options...
sweetcandyflip Posted June 5, 2015 Share Posted June 5, 2015 Is the RNG also for the item spawns (Location, Amount)? Link to comment Share on other sites More sharing options...
Jab Posted June 5, 2015 Author Share Posted June 5, 2015 Is the RNG also for the item spawns (Location, Amount)? Anything that uses this random implementation in the entire game, will be using the one I replaced the original one with. I haven't noticed anything beyond multiplayer rain different, (but there may be more.) I would say that this mod is best fit for single-player experience / performance upgrade, because it's all calculated on your end. Link to comment Share on other sites More sharing options...
marcosbruce Posted June 8, 2015 Share Posted June 8, 2015 Thanks bro, my game needed this. Link to comment Share on other sites More sharing options...
Jab Posted February 16, 2016 Author Share Posted February 16, 2016 Noting the lighting issues discussed in the mondoid this week, I have re-tested this mod, and it still works for build 33. I notice a difference in the lighting system. It works smoother for me. Let me know if this mod makes a difference for you. I'm quite curious. (This mod uses a a much faster PRNG than the game, decreasing calculation time in any code that uses random calculation with the currently-used PRNG) Link to comment Share on other sites More sharing options...
curi0 Posted July 1, 2016 Share Posted July 1, 2016 (edited) I seems to work fine on 34.28 (haven't encounter stutter so far) , although I hadn't test it long enough, because it produced lots of repeated errors: ----------------------------------------- STACK TRACE ----------------------------------------- Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@2b321921 function: null -- file: MusicChoices.lua line # 85 function: trigger -- file: SadisticMusicDirector.lua line # 81 function: tick -- file: SadisticMusicDirector.lua line # 11 function: tick -- file: SadisticAIDirector.lua line # 42 function: update -- file: SadisticAIDirector.lua line # 270 function: run -- file: SadisticAIDirector.lua line # 313 Caused by: java.lang.IllegalArgumentException: n must be positive at zombie.core.RandomXS128.nextLong(RandomXS128.java:158) at zombie.core.RandomXS128.nextInt(RandomXS128.java:139) at zombie.core.Rand.Next(Rand.java:29) at zombie.Lua.LuaManager$GlobalObject.ZombRand(LuaManager.java:3240) ... 21 more Edited July 1, 2016 by curi0 Remove unrelated errors Link to comment Share on other sites More sharing options...
Jab Posted July 2, 2016 Author Share Posted July 2, 2016 9 hours ago, curi0 said: I seems to work fine on 34.28 (haven't encounter stutter so far) , although I hadn't test it long enough, because it produced lots of repeated errors: ----------------------------------------- STACK TRACE ----------------------------------------- Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@2b321921 function: null -- file: MusicChoices.lua line # 85 function: trigger -- file: SadisticMusicDirector.lua line # 81 function: tick -- file: SadisticMusicDirector.lua line # 11 function: tick -- file: SadisticAIDirector.lua line # 42 function: update -- file: SadisticAIDirector.lua line # 270 function: run -- file: SadisticAIDirector.lua line # 313 Caused by: java.lang.IllegalArgumentException: n must be positive at zombie.core.RandomXS128.nextLong(RandomXS128.java:158) at zombie.core.RandomXS128.nextInt(RandomXS128.java:139) at zombie.core.Rand.Next(Rand.java:29) at zombie.Lua.LuaManager$GlobalObject.ZombRand(LuaManager.java:3240) ... 21 more Yeah this mod is out of date. I'll need to update. Link to comment Share on other sites More sharing options...
That one guy Posted July 6, 2016 Share Posted July 6, 2016 i made an account just to tell you that this is what my game needed, this mod really makes a difference of performance in my potato laptop, and im really thankfull!!! Jab 1 Link to comment Share on other sites More sharing options...
boybugs18 Posted November 22, 2017 Share Posted November 22, 2017 file not found Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now