Project Zomboid

Project Zomboid

Superb Survivors!
My Observations of the Superb NPC AI Code
First of all, please let me praise you for your effort - this is not something anyone sane or normal would do.

If you, as the creator do not care about my opinion, feel free to ignore the post.

I do not claim to be an expert in LUA (as a JS/TS frontend dev myself), but I have observed a few issues.

The mod in its current state is not extensible nor is it well-organized.
Many conditional evaluators are written into a single large function which makes it prone to breaking and a pain in the ass to debug.

My advice is to breakdown the SuperSurvivor.lua into small blocks of code (ideally context-specific). To do that, I'd recommend refactoring the nested for loops and nested condition checks (if-else) into helper functions.

1. Create helper functions for conditional evaluators.
2. Move the debug-functions into a separate folder (or file) if possible, that was a lot more code that I cared to read and didn't provide examples of the "expected return value".
3. DO NOT evaluate multiple conditional inside a single function block, especially when or if your function involve other mods.
3a. You likely have no control over other people's mods, meaning if other mods update or bug out, they will break your mod.

From a quick lookup at stackoverflow, it seems a table map (in place of a switch-case) can be used instead of writing multiple if-else when evaluating a variable value.

https://stackoverflow.com/questions/37447704/what-is-the-alternative-for-switch-statement-in-lua-language

Snippets of issues I saw
https://imgur.com/a/VqtwhVu

If you have a github account with a repo set up, please make this project available - I am sure there are others (myself included) who can contribute and help you develop this directly.
Last edited by {5LINE}Cows with Guns; 25 Apr, 2023 @ 8:53pm
< >
Showing 1-10 of 10 comments
Addendum: Checked the existing GitHub, hasn't been updated for months, making it older than the current workshop item...
AL_TheUndead 26 Apr, 2023 @ 9:55pm 
If you do end up taking up the torch, even briefly, make sure that if you use *any* existing code that you credit Nolan and the Superior Survivors devs. There was a minor bit of drama around it the last time Nolan came back because he ripped all the code from the Superior Survivor devs who had used the Superb Survivors as the base to expand on. I'd hate to see you end up in a similar situation. :spiffo:
Originally posted by AL_TheUndead:
If you do end up taking up the torch, even briefly, make sure that if you use *any* existing code that you credit Nolan and the Superior Survivors devs. There was a minor bit of drama around it the last time Nolan came back because he ripped all the code from the Superior Survivor devs who had used the Superb Survivors as the base to expand on. I'd hate to see you end up in a similar situation. :spiffo:

Yeah... I've looked over parts of the code already...

A few of the errors involved some functions referencing other mods and other codes that looked very different from itself.
Alienslayer2406 26 Apr, 2023 @ 11:06pm 
If you do decide to release your own updates version of the mod, I think it would be wise to get Nolan's permission first. If he took down superior survivors, I imagine he wouldn't be very keen on someone uploading their own version of the mod.

Regardless, thanks for your contribution. It'd be really nice to get a more stable version of this mod.
Last edited by Alienslayer2406; 26 Apr, 2023 @ 11:07pm
Originally posted by Alienslayer2406:
If you do decide to release your own updates version of the mod, I think it would be wise to get Nolan's permission first. If he took down superior survivors, I imagine he wouldn't be very keen on someone uploading their own version of the mod.

Regardless, thanks for your contribution. It'd be really nice to get a more stable version of this mod.

The Indie Stone has a clearly laid out workshop policy in the steam workshop and their own site.
https://projectzomboid.com/blog/modding-policy/

I have no intention of violating their policy.

For now, I have a local copy of the mod code and going through the logic flow.
Alienslayer2406 27 Apr, 2023 @ 4:51am 
Originally posted by {5LINE}Cows with Guns:
Originally posted by Alienslayer2406:
If you do decide to release your own updates version of the mod, I think it would be wise to get Nolan's permission first. If he took down superior survivors, I imagine he wouldn't be very keen on someone uploading their own version of the mod.

Regardless, thanks for your contribution. It'd be really nice to get a more stable version of this mod.

The Indie Stone has a clearly laid out workshop policy in the steam workshop and their own site.
https://projectzomboid.com/blog/modding-policy/

I have no intention of violating their policy.

For now, I have a local copy of the mod code and going through the logic flow.
I wasn't implying you were going to, just thought I'd remind you.

I actually didn't know about the workshop policy, thanks for sharing. I've been thinking about taking up PZ modding myself some day so this is good to know.
nolanritchie  [developer] 4 May, 2023 @ 5:15pm 
thank you for your critique.
I dont think there is anything really incorrect about your observations.
but keep in mind, with a highly integrated mod with code into the 10s of thousands of lines,for a constantly changing beta game, its not hard to find many many areas that could be improved or require improvement at any given point in time.

the only way the mod got to this level of functionality its at is by strictly honouring the "80 20 theorem" . if i tried to be efficient and proper in all the coding, this mod would have never left the ground in the first place.

still this is why there has been many people contribute many improved code improvements from things to simple functions to major systems, many times over the past 13 ish years...

if I had the drive to go and improve the code/mode it would not be hard to find places to do so, its more so a problem of , loosing drive to keep a 13 year old mod going, when base game AI is around the corner...
Alienslayer2406 4 May, 2023 @ 6:34pm 
Originally posted by nolanritchie:
thank you for your critique.
I dont think there is anything really incorrect about your observations.
but keep in mind, with a highly integrated mod with code into the 10s of thousands of lines,for a constantly changing beta game, its not hard to find many many areas that could be improved or require improvement at any given point in time.

the only way the mod got to this level of functionality its at is by strictly honouring the "80 20 theorem" . if i tried to be efficient and proper in all the coding, this mod would have never left the ground in the first place.

still this is why there has been many people contribute many improved code improvements from things to simple functions to major systems, many times over the past 13 ish years...

if I had the drive to go and improve the code/mode it would not be hard to find places to do so, its more so a problem of , loosing drive to keep a 13 year old mod going, when base game AI is around the corner...
If I may ask, are you working on this mod alone or with a team? I feel like more people could help, if you had the drive, of course.
Originally posted by nolanritchie:
thank you for your critique.
I dont think there is anything really incorrect about your observations.
but keep in mind, with a highly integrated mod with code into the 10s of thousands of lines,for a constantly changing beta game, its not hard to find many many areas that could be improved or require improvement at any given point in time.

the only way the mod got to this level of functionality its at is by strictly honouring the "80 20 theorem" . if i tried to be efficient and proper in all the coding, this mod would have never left the ground in the first place.

still this is why there has been many people contribute many improved code improvements from things to simple functions to major systems, many times over the past 13 ish years...

if I had the drive to go and improve the code/mode it would not be hard to find places to do so, its more so a problem of , loosing drive to keep a 13 year old mod going, when base game AI is around the corner...

I see, I have another post seeking permission to "continue" the mod updates if you are OK with it.

My expectation for NPCs / base game AI won't be ready for another year or 2, but I can understand your view.
StonedFrog21 7 May, 2023 @ 1:26pm 
Originally posted by {5LINE}Cows with Guns:
Originally posted by nolanritchie:
thank you for your critique.
I dont think there is anything really incorrect about your observations.
but keep in mind, with a highly integrated mod with code into the 10s of thousands of lines,for a constantly changing beta game, its not hard to find many many areas that could be improved or require improvement at any given point in time.

the only way the mod got to this level of functionality its at is by strictly honouring the "80 20 theorem" . if i tried to be efficient and proper in all the coding, this mod would have never left the ground in the first place.

still this is why there has been many people contribute many improved code improvements from things to simple functions to major systems, many times over the past 13 ish years...

if I had the drive to go and improve the code/mode it would not be hard to find places to do so, its more so a problem of , loosing drive to keep a 13 year old mod going, when base game AI is around the corner...

I see, I have another post seeking permission to "continue" the mod updates if you are OK with it.

My expectation for NPCs / base game AI won't be ready for another year or 2, but I can understand your view.
im just been reading the comments and Nolan is right basic ai is litlerly around the corner next month probably. what ive been hearing is that hes watiting for the basic ai "farm animals and stuch" when that releases. ive been told he will update the mod around that
< >
Showing 1-10 of 10 comments
Per page: 1530 50