#mod_development
1 messages · Page 250 of 1
Yeesh, must suck to live as that guy
Thankfully these entertaining folks only show up once and a while
I'm happy that I've never got any bad interactions so far on my page
and I've broken my mod a few times when updating stuff
most people I've interacted with were pretty helpful
there are people who don't read descriptions tho
not really a bad interaction, but funny how often it happens
Yeah I don't consider comments like 'mod is broken' to be bad, just unhelpful
It graduates to 'bad' when they choose to just be snarky/rude
On the flip-side, I've had some bugs with the most recent/biggest update to skill recovery journal - unfortunately it has so many sandbox options there were some setups that I didn't account for + other mods didn't play nicely. I had 2-3 whole communities come together to help bug test it.
I still talk to them and have them ping me with collected reports.
same, since I am very busy trying to juggle adding features to mods and other things are a bit hard, but I am glad the small amount of people who subscribed to my mod are not nagging and like "mod not update in 5 days? abandonware!"
the fact that I got away with reworking the backend of my whole mod twice because it was ugly and no complaints is just sheer luck
the Tail Concerto PFP guy is an ass but he has a very good point. People seriously don't appreciate it when you roll out 10 hotfixes a day just because it took 10 additional updates to fix the gamebreaking bugs in the original update. The problem is exacerbated by the fact that Steam forces updates, does not allow selecting the version you want to play, and will not push the updates immediately which makes the users end up with a non-functioning version when you've already pushed the fixed one - so they inevitably make a bug report (or just bitch about it) when you've already fixed everything. I know it's sometimes difficult or even impossible to make sure everything works fine the first time so you just have to bite the bullet and make a hotfix for a hotfix. But people have every right to complain about it, even if they straight up insult you for it. They are very frustrated that their game stopped working for no reason and they have no recourse other than to bite the bullet and uninstall your mod entirely so it won't cause issues with the game.
but chuck says this didn't actually happen
Most of this can be avoided if you do expansive unit testing. But that's hideously time-intensive to set up.
I've unironically had the opposite experience of Chuck, where I pushed a patch that broke next to all my code and nobody reported anything, had to find it out myself when testing through Steam lol
every hill, wrong one every time, crazy.
me too 😭
that one single small last minute change that you really don't need to test...
YES that quite literally defined what happened
That's happened to me too. It depends on the mod, how often its used in a game.
I made a habit of never pressing ctrl+s between testing and pushing.
GameNight has been notoriously hard to test cause people use it for decor. 💀
got rid of a single line of code that was important and updated the readme more, I was like ehh it's mainly docs being updated so I didn't bother to properly code review every change like I usually do
you should set the option where as soon as the editor goes out of focus it saves
'Oh yeah XYZ happens, but we ignore it.' 🥲
I personally mash ctrl+s every single second so I've never had that issue yet
in my mind i still live in the days where programs would just crash every fifteen minutes or so
but this would automate the process of making a change you're not meant to push and have it end up in Steam Workshop even if it straight up breaks everything because tehre's a syntax error which you didn't intend to fix until later
IntelliJ seems to auto save constantly
intended functionality?? if so, wat (and how)
nah, just reflecting on how much more stable computers seem to be now
idk vscode just tells me if there's a syntax error so I never had this problem (im not saying it doesn't happen)
Also @sour island in that interaction, as shitty as it is, you're not being productive either. Ask people to paste the the error from the console.txt log or install ErrorMagnifier mod & try to reproduce it.
i think everyone's ctrl-s habit runs back to a specific event in their past that in some way involves the phrase '6 hours of work'
You mean what I did?
If your takeaway is that guy was 'just frustrated' then you've missed valuable context.
You made a hint at it. But mostly you were just rude to the person complaining about what seems like game-breaking bugs. I know it's not unwarranted given the situation, but still.
There weren't any bugs.
I would ask them straight up to paste the error from console.txt
He was complaining about an update.
Well clearly something went wrong for him to go apeshit to the point that he decided to contact you personally to talk about it.
Well he's blocked, so the point is moot.
You know 99% of people stay completely silent.
I had to learn about 2 major problems about my mods in a casual conversation where people just kinda mentioned them.
I'll receive a more useful report if the bug actually exists from a user who isn't an asshole. 🤷♂️
That is 100% true. HOWEVER. Everyone's frustration is valid.
What I mean by that is there's no need to completely ignore someone just because they aren't nice. By definition, people who experience problems are the same people who get frustrated about it.
Actions have consequences.
Ok so you decided that you will ignore this quote-unquote error report. What is the net benefit exactly? There isn't one. The guy will just get more upset and you didn't improve anyone's experience.
I would've just said sorry I made a bunch of errors slip and I had to hotfix them.
Sometimes, the most important journey is the one within.
I like to think I gave him that inner journey.
Haha no, what you did is told him to fuck off and dress it up in a fancy metahpor😂😂😂
I think the only thing you might've done wrong is give them too much attention.
These are the users that make authors disabled comments.
I understand you completely but I just thing it's poor community management is all. As a dev you have to be the bigger man.
I agree, should have sent him on his inward journey sooner.
Kind of moot, when he stated he was not reporting an issue, and never did fill a bug report.
But I guess I should have been nicer in asking him to make a detailed report.
I'll unblock him, reach out and apologize.
Dude come on, most people can hardly be even bothered to speak to you at all about experiencing any issues, much less filing a bug report properly, especially if they have to go to another site and make an account. Each of those steps individually reduces the number of people willing to do this by a factor of 5-10x.
Weird that he had energy to keep trying to play gotcha, when in most other cases I say file a report on github it ends up there with no problems.
It's as if he wasn't there to be helpful
I agree
Playing gotcha is one of those virtiol feedback loops. It just keeps you going.
Man's greatest enemy lies within.
Once you start antagonizing someone it's virtually impossible to curb this thought process in a reasonable amount of time.
reading the whole thing, you can tell their intentions weren't to solve the issue and make their players happy, it was to whine in the comments about practically nothing
If 'file a detailed report' antagonizing then I'm glad he can't muster the energy to file one.
Yeah, that's extremely obvious, the guy was just there to vent about issues. But like. This does means that there are issues that cause someone this much grief, right?
Would have been painful to try to get a console log. Might have gotten "Why do you need that???"
The issue was that the mod updated.
Solution: nothing.
When someone starts off a comment that is (supposedly) detailing an issue (not what they did here) with high amounts of sarcasm and criticism rather than a simple "Your mod has a bug" (to some lesser extent) than I honestly wouldn't give them much credit
Hehehe, you're still antagonizing the guy.
I suppose you have more experience in this matter.
If the issue weren't repeatable then I'd put in an assumption that they could be just agonising you for no proper reason.
Anyway yeah just copy-pasting the boilerplate of "please find console.txt in that folder, then find crash log, then paste contents" does the job 99% of the time.
✌️
Well if you're mentally unstable enough, anything can get to you. Just look at Twitter...
It could also be that they're misattributing problem to his mod. It happens.
true
I guess I just don't have 10 million people complaining to me all the time about problems in my mods. Only like 5. And I did eventually resolve the issues they had.
It surely helps when the amount of negativity you see directed at you is virtually nil.
So I guess it's not fair to expect makers of actually popular mods to adhere to the same standards.
The proportion of asshats in any comminuty is more or less constant. But bigger community = more asshats.
1% of 100 people is not nearly the same as 1% of 10 000 people.
Hi guys I just start a mod dev. today and triyng create a basic command for game
``-- Komut işleyici fonksiyon
local function onCustomCommand(module, command, player)
if command == "tst" then
print("Work!");
end
end
-- Komutları dinleme
Events.OnServerCommand.Add(onCustomCommand)
-- Müşteri komutları dinleyicisi
local function onClientCommand(module, command, player, args)
if command == "tst" then
print("Work!");
end
end
Events.OnClientCommand.Add(onClientCommand)``
My code is somethink like that but
when try "/tst" on chat its says command unknow
and docs is not enough I think.
those aren't custom console commands, no. They're more like custom network packets. You send them through code manually.
Just the other day someone made a mod to add custom commands though. Let me find it.
sendClientCommand(characterObj, 'module', 'command', args)
sendServerCommand(characterObj, 'module', 'command', args)
thanks
you save my life bro
notloc and coldsteel thanks guys
I have to ask one more question because I am in pain!
I am using /reloadlua "client.lua" or "cliant" or client or "modname" or modname but ITS NOT WORKING
😢
Oh @sour island I remembered I turned off the ping so you might have missed my reply.
So ```lua
Events.OnCreatePlayer.Add(HelicopterSandboxOptions("OnCreatePlayer: "))
is equivalent to
```lua
HelicopterSandboxOptions("OnCreatePlayer: ")
Events.OnCreatePlayer.Add(nil)
if HelicopterSandboxOptions("OnCreatePlayer: ") returns nil. Meanwhile
Events.OnCreatePlayer.Add(HelicopterSandboxOptions)
is passing a pointer to the function as an argument, rather than what it returns.
edit: crossed out "pointer to" because maybe it's not a pointer and maybe I don't know what a pointer is or something :d
So guys, I made a recipe for my mod involving a new coffee feature, which allows you to recover stamina
Is this a good addition?
I need a feedback
Well the important part is that it works. The people who like the idea will install it.
I wouldn't call it realistic or anything. But neither is recovering fatigue from eating tea bags.
Is it live yet? Haha I want to drink coffee to escape zeds.
Yep, i'm alive lol
So thats good to hear
I ill add it :)
This is for the Machines II mod
If coffee can't save me from zeds, what can?
bleach
Locking the door and playing solitaire
Hello again ! Is there an event for when a player use an item ? or even better for when he eat something ?
You can decorate ISEatFoodAction:perform()
idk about better ways
To add onto this, just for the sake of anyone reading as a cool fact: In Lua, all function arguments are passed as value, and all variables are references to the assignment. This is good to know if you come from a lang like C/C++. I am sad we can't do cool pointer stuff in Lua but I don't mind that much.
Example:
local a = 10
local b = a
a = 100
print(string.format("A=%d, B=%d", a, b)) -- A=100, B=10
-- test is a reference to this anonymous func
local test = function(val1, val2)
b = 123
local temp = val1
val1 = val2
val2 = temp
return val1, val2
end
-- Here, params A and B are passed by value
-- You expect A and B to be swapped here, right?? No, it only swapped the values that were copied to the func and ultimately returned.
local v1, v2 = test(a, b)
print(string.format("v1=%d, v2=%d", v1, v2)) -- v1=10, v2=100
print(string.format("A=%d, B=%d", a, b)) -- A=100, B=123
This is the default intuively expected behavior.
Unsavvy people have problems when referenced objects get modified.
Yes, I just figured I'd post it here because some people might not know that and idk
beats reading the manual, I despise it
also IDK about "cool pointer stuff". Outside of nested arrays, constructs like pointer to a pointer to a pointer fall into "pretty cursed" rather than "pretty cool" category.
also is "(%d)":format(100) not valid Lua syntax? I could've sworn I used this in one of my mods and it worked fine, but not in my local lua interpreter
Depends on implementation I guess? I seem to remember it works in LuaJIT, but that is a frankenport of 5.1 with some later version features backported.
True, I like the amount of flexibility it gives though, like you can do nearly anything with pointers and references
Eh I don't feel it. Most of that is just a really backwards way of using arrays.
I mean, in the same way as return 10[myArray]; is a perfectly valid C syntax. Except it's literally backwards.
I did not know that, that's pretty bad lol
I guess I really mean just being able to access and manipulate memory directly, not just pointers and references
When i was in school, I had a professor that was saying "Pointer are really cool. Too cool for you. Don't use pointer"
For when you need to have the ability to corrupt your class instance by writing into an off by one memory location.
yeah I do agree pointers and stuff are pretty unnecessary but I like being able to have so much control (even if the compiler will just optimise it anyway) like being able to pass var by reference or value to a function is super useful
exactlyyy
It's valid if you have parentheses around the string
good to know! especially since i hate typing string.format every single time
I mean yeah but the idea is that string literal like "foo" has metatable "string" so you should be able to just call its functions as if it were class instance.
Yes
well I don't use it that often but still it looks way cleaner
Hang on. Do string literals in kahlua have metatables?
The implementation may not handle it the same, but for the use case described here it effectively does
It's metatable is just this:
__add | function: 0x64ba5c6966b0
__mod | function: 0x64ba5c696710
__idiv | function: 0x64ba5c696770
__unm | function: 0x64ba5c696790
__pow | function: 0x64ba5c696730
__div | function: 0x64ba5c696750
__sub | function: 0x64ba5c6966d0
__index | table: 0x64ba5cf7e760
__mul | function: 0x64ba5c6966f0
I imagine __index is string
so kahlua parser just considers "":format() to be a syntax error
parenthesis make everything better
ya
Or worse in this case, depending on perspective 😅 personally I prefer just passing it in as the first arg without the sugar
in C lua ""'s metatable only contains __index = string
My assumption is that the others exist only to say the operator isn't defined, but that's just an assumption (because I'm unable to check right now)
basically
like __add it says attempt to add string with string
I should clarify I know that those operators don't work lol, I'm saying I imagine that's what those functions are there for
odd design decition to add these explicitly since not having them in the metatable generates the same error
o, makes sense
i guess you can implement _add so you can do "foo" + "bar"
I am not sure why they didn't make string concatenation with __add work the same as .. too
__add = __concat
I don't know their intention, but it's certainly clearer for automatic type conversion
A string concatenated with a number is a string, and that's predictable. No uncertain behavior for +
Not in Kahlua, but what really has potential for cursed code is debug.setmetatable
I feel like the .. operator was added to avoid type coercion, but they had to cave and allow numbers and whatnot to be coerced to strings
but not for nil and booleans
those generate errors if you try to concatenate them
I'm not certain, but I believe it always allowed that
or tables
huh, is number is the only type that's even allowed to be coerced into string?
Maybe since those are the most common other type to need to be included in a string? Dunno
thankfully I just do someNilThing or "nil" and it works for my uses
tostring is glaring at you rn (this made more sense pre-edit)
LOL
that'd make sense yeah. But it makes it feel like the whole .. operator is a half-hearted statement of "Lua has no type coercion! (unless it's numbers to strings in the concat operator)"
It's good that you point it out to use tostring
it still makes sense, imo tostring(someNilThing) would be easier to read than someNilThing or "nil"
I just use the or thing to avoid func call overhead in tick function
if there even is any, maybe im paranoid lol
Eh you know you're not supposed to use concat that way anyhow. There's string.format to display formatted strings.
Depends on what you need it for, really. I use x or y quite a lot (if I know a falsy value isn't valid for x, of course)
another thing I wish Lua had was inline, although there's no preprocessor or compiler(?) but making the memory usage a tiny bit higher for a situation where function call overhead is a TON is so helpful
I have to do it manually, but it really is a pain
normally JIT would take care of that but there's no JIT for Lua in PZ
it would work better if PZ was writtein in C++ since there'd be C objects it could hook into for high performance mode
Fun fact. If you use C structs, LuaJIT can work faster than equivalent C code with -O2
(that's because LuaJIT is equivalent of -O3 -ffast_math)
speaking of fast math. It's absolutely unreal how much this makes a difference for calculation-intensive game logic
if you just move bytes from one class to another it's hardly relevant. But if you actually add and multiply stuff in complicated ways it makes a very big difference
And the whole downside is that it might sometimes be off by 1 least significant bit from IEEE solution
Depending on CPU there might be no difference at all.
But also depending on CPU you might get non-deterministic behavior if you use JIT.
Specifically one issue I encountered is that min and max SSE functions return the first argument if either of them is NaN. Most of the time NaNs have a very beneficial property that they silently propagate so if at any point in your calculation you ended up with a NaN, it'll just carry over all the way to the end of the calculation. But the aforementioned design quirk means that you will get NaN or a valid number depending on which operand passed into it was NaN. And much worse, JIT generated these instructions, it could've flipped operands however it felt was appropriate given the codepath and profiling information it had gathered during current run.
The practical upshot is that you need to actively check against NaNs which adds branching which kills hotloops.
I guess one good property of Kahlua is that it's so slow that none of the usual performance considerations are at all relevant (such as avoiding branching or maximizing cache use), and you just need to take care not to use O(2^n) algorithms
I was wondering what branch/version of Lua we are using, is it Vanilla? I would assume so if we aren't using JIT. Hopefully it is not some kind of ghoul soup with support for C syntax I had to deal with.
it's kahlua
... bruh. :V
a not quite up to standard and very slow java implementation of lua 5.1
Oh well more time to research.
kahlua is a wonky version of C lua implemented in Java, last updates over a decade ago
So it is just 5.1 bindings to Java then?
no, it's a reimplementation
one quirk you might need to be aware of is that modulo operator uses 32 bit integer as intermediate variable for division process, so if in your A % B, A/B would generate integer longer than 32 bits, it will glitch.
this is important because it is implemented in a much slower way than vanilla lua
Just reading the git's description... yeah that's... ugh. Oh god.
beyond that the modulo operator in kahlua mirrors that of java, not Lua
it also doesn't implement all libraries, and some are not implemented fully
it also doesn't have functioning next (despite having functioning pairs)and if you try to obtain it using hacky solutions, it's not gonna work either
it's a mess and we all hate it, but it works and the devs not gonna refactor half the game codebase to switch it out for luaj or anything else that's actually high quality
I was wondering why checking if a list is empty with next was nil, thats why
fun fact: you can get next by calling pairs but the retreived function stops working almost immediately
we love```lua
local foo
for _,v in pairs(t) do
foo = v
break
end
I don't know what to say, well... that sounds fun in most painful way.
xd
it's one of those type 2 fun activities that are actually type 3
Anyway it probably is better that it at least is similar to 5.1 syntax, like in other instances where I meant with Bastardized Lua with added C syntax bs, Devs are considering removing all of it, as said API was only meant for prototyping originally before all that mess was made into modding API. It doesn't help that said Lua core was used for like 2 decades in 2 major versions oof.
it's 5.1 but with a laundry list of bizarre issues
like aforementioned modulo returning complete nonsense if you do 1000*1000*1000*1000 % 2
i always get so tempted to write a lua pre-processor before i remember things like this and stop myself
I mean, I guess you could have custom version of Lua but at this point I would probably take something like Luau since it is actively developed by someone else.
Should've just stuck with tried and true luajit
it's more work upfront on the API side since it's the same raw deal as regular lua
but that thing is close to perfect
i mean sans the fact that hooks don't work on per-line basis, being JIT and all
JIT is not bad at all and great in performance, outside bit-wise operators or rather in it's case functions
it's not like bitwise operators are fast in any case. I mean they're single cycle but you always need so many of them.
Also if you make local cache of the function values, they get inlined.
They aren't, mostly they are useful for fixed-point operations which I had to deal with massively.
And me wanting to preserve a lot of booleans into flags variables, but that was in said Blua rather JIT.
imagine torpedoing game performance to save a few bits of RAM
hehehe
just kidding of course, fixed point is GOAT and it's really a shame that instead of developing strong hardware support for fixed point, we got floating point.
yeah... just few bits... for the 32-bit game that doesn't flush textures from memory, relying on OS to do the work upon game closing...
did the game had PCM sound effects? A few stray silent samples at the ends could've completely eclipsed memory usage of the bit banged booleans savings.
Well, it is SRB2 which is based in Doom Engine.
It is technically custom at this point. Yeah.
it uses a fork of OG Zdoom right?
Nope, Doom Legacy.
Aight. If I remember correctly, SRB2 engine was the first to implement sloped surfaces of any doom engine.
I think it was Zdoom though.... not sure, SRB2 had community build in GL with them.
Anyway bit off topic.
Small question, I was earlier today just playing around with the script for few minutes, and I assume that you cannot write new variables (saved in Lua registry) into player userdata/class?
no, but most objects have a table attached that you can store data in
anything that inherits from IsoObject (which should be basically everything with a presence in the world) has getModData()
I imagine abusing it as storage is not great since it creates and writes back the whole table each time.
Okay I see it in javadocs...
I think some refactor would be needed if that's a case oof.
Doesn't help it is function either.
(it's a function because they didn't implement accessing java fields from lua 🤫)
No I was wrong. It keeps the data in java as kahluatable which means there's no data shoveling going on.
Well I'm assuming anyway. It's hard to tell.
it does, it's just a table, nothing fancy
It's a bit simper since this way you can avoid having to deal with users overriding the table by the field.
doesn't java have a final keyword?
If there's just a getter, you will always get whatever's attached to hte java object and you can't swap it out for other tables.
I seen in SRB2's source it being done through creating metatable and defining it each index in switch statement or if-elseif ladder... at least it was in C written.
Wouldn't imagine it to be done in Java.
java has reflection so it's actually a lot simpler to do stuff like that
in C you can make a giant switch table, which compiles to a single jump.
it's a problem i'm facing with my current c++ project actually 😅
I know how switch statement works, but consider the amount of work if your "class" is bit too classy.
pz does have a couple functions intended for debug that access fields but they're a giant pain to use, they're basically just wrappers around java's reflection stuff
i used those to generate field metatables
I don't get it. I've been implementing C side of Lua scripting and it's nothing special.
In fact there's no need for the If-else ladder.
It is not really, it is really mundane work that's all.
If you define each field manually that's is.
ah well, if you insist on implementing field access through __index then this might be tedious
I wasn't one insisting on it though.
the project I dealt with just implemented getters and setters
https://git.do.srb2.org/STJr/SRB2/-/blob/next/src/lua_mobjlib.c?ref_type=heads I also think this could have been done more easily.
I was trying to help Buryaga with mouse event stuff - anyone know why setXY wouldn't work? It's exposed, but just doesn't do anything lol
i'm facing the issue of exposing things to lua (currently only targeting class functions) automatically without reflection (as cpp has none)
it seems like it might not actually be using the value this sets
might have something to do with it, but it could be entirely unrelated
https://github.com/libgdx/libgdx/issues/7010
From my experience, I only seen C-Lua things exposed manually. Which includes functions, in wrapper like way.
It does. The X and Y coordinates carry all the way to the backbone framework.
s_mouseStateCache.getState().setCursorPosition(var0, Core.getInstance().getOffscreenHeight(0) - 1 - var1);
}
public MouseState getState() {
synchronized(this.m_lock) {
return this.m_states[this.m_stateIndexUsing];
}
}
public void setCursorPosition(int var1, int var2) {
Mouse.setCursorPosition(var1, var2);
} //import org.lwjglx.input.Mouse;```
seems like the only reasonable way, which makes me consider dropping lua support entirely 😭
could you make a macro that simultaneously defines a function and then hooks it up to Lua?
maybe, it'd be unideal to use macros that heavily and i'm unsure exactly how that'd look but i will probably be looking for solutions like that
either that or a python script that glues together C and Lua for you
just include it in the build
yeah, that's the strongest possibility i think - i'd have to do something similar to generate stubs anyway
ey guys! gn, im a dev from brazil, i'm trying to get into modding pz, so i'm looking for general advice on where to start since i never modded a game before. But i also have one specific question:
Previously i made a short python script that i'm using to do automatic backups from my last single player save, i was wondering if when modding/making Luas scripts, we can have acess to the actual saving events of the game to trigger my own scripts, is this possible? what are some useful documentations to read for modding?
Not sure but all the events are listed on a github repo albion made here: https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md
it's super helpful
uhh I don't have much advice but I started modding from https://pzwiki.net/wiki/Modding
I think it's official wiki and it has stuff like item, recipe and model script schemas and all that
i will make you a single item mod for $500
on sale used to be $25,000
You're scaring the fish
Best I can do is $50
ermm $25,000? my bad i meant $2.50 for tiny mod
$10 for medium mod
$49.99 for big mod

(these are not my real rates)
i will think about it
Dumb idea. But what about a pack of nostalgic food of the late 80's and 90's?
Mainly pizza rolls, hot pockets, and Teenage Ninja Turtle Pies.
im trying to upload a different version of goodie remover because the original creator has it as a 90% chance and I wanted to make a 80%/70%/60%/50% version aswell for people with bigger music libraries
but i keep getting this message
as you can see the folder exists on the right side
so whats the problem?
wait i see the problem
nvm
lol
i checked my other mod and i saw its missing some folder structure
all good
<@&671452400221159444>
ty
Heavens to betsy, does anyone here commission mods? I'll pay for a mod written in binary.
the what
the where
Is there any way to force exact server not to use your zomboid mod?
what
I am not sure what you mean. If you don't want a server to use a specific mod, they are the ones who need to remove it from the mod list.
Like, to block an ability for server to use your mod
oh uhh
To force block
im not sure honestly
If you were able to do network stuff like get and post you could implement authentication but that isn't the case so
and even if you were to achieve it in lua, they could easily just remove the checks that prevent it from loading
Uh
remember that all mods are stored in a file, it can easily be accesed, unless you created a new folder or made a registry or something, but i wouldn't be able to tell you how to do that
Trying to block people from using your mod over personal or, worse, political reasons is not the best idea.
Which is to say there are ways you can backdoor your mod and make it deactivate on command, but generally falls under "malware" category.
If you did it purely as a sport or for money, it would be unsavory but merely that. Doing so out of sheer spite or zealotry makes it quite frankly reprehensible.
Just don't want for some people to have an ability to use my work in future if they refused it.
in any case it just wouldn't really work very well
any protections you add they can easily find and remove
Refused what? Terms of sale?
It was made for them for a free, and then the guy asked another one, who did same stuff worse than me, but had no ability to argue cause there was no deal between them.
Anyway I've heard you can make GET requests from within PZ mods which means you can send pretty much whatever info you want to your web server (as long as it's accessible from PZ) and you will be able to receive back server's response and proceed or terminate operation accordingly.
if your mod has a significant lua portion, you can keep it exclusive to a server by loading the lua from the cache folder
You will probably need to very heavily obfuscate the files in order to prevent this backdoor to be easily removable.
if it's server side lua this is pretty much 100% secure, if it's client side lua done properly it at least takes more skill to hijack than most people have
Thought I'd make a post here on a funny project I just worked on: I got Python working in Project Zomboid.
from zombie.ui import UIManager, UIElement, UIFont #type: ignore
from zombie.core.fonts import AngelCodeFont # type: ignore
from com.asledgehammer import Jythoid #type: ignore
class PythonUIElement(UIElement):
def renderText(self, x, y, font, text, red, green, blue, alpha):
# type: (int, int, UIFont | AngelCodeFont, str, float, float, float, float) -> None
if isinstance(font, UIFont):
self.DrawText(font, text, x, y, red, green, blue, alpha)
elif isinstance(font, AngelCodeFont):
font.drawString(x, y, red, green, blue, alpha)
def render(self):
super(PythonUIElement, self).render()
self.renderText(64, 64, UIFont.Cred1, "Hello, Python 2!", 1, 1, 1, 1)
def isMouseOver(self):
return super(PythonUIElement, self).isMouseOver()
# This allows for Kahlua to play with the object like a Java class
Jythoid.expose(PythonUIElement)
def mainmenu_enter():
print('Adding Custom UI..')
element = PythonUIElement()
UIManager.AddUI(element)
Events['OnMainMenuEnter'].add(mainmenu_enter)
I just know, that there's another game that allows you to block IPs from downloading the mod, thought it was something on the side of steam, that allows to do that
nah, steam doesn't have anything like that
Eh
What are you trying to do?
Block an ability to exact server to use mod, while keeping to all others
that's pretty cool, but is there performance gain or increase in API coverage?
Why?
Yes and yes.
cuz you know regular python is super slow
Scroll up a bit, long story
Lua in PZ is slow because it's emulated in a JVM.
python is slower than lua but kahlua specifically is pathetically slow
Yeah but python is the same way.
But I suppose just the fact that it's a competent implementation alone makes it better.
Ideally it would compile python bytecode to Java bytecode, so that it can JIT.
and not have to waste CPU cycles marshaling data
Kahlua is abandonware from like 10 years ago. Jython is way more recent. Kahlua runs on 1.6 JDK technology IIRC.
it does do that
well if it compiles to Java then it's pretty great
Yeah this example is a subclass of UIElement, which is java, not Lua. Lua in PZ wraps Java instances.
The JVM interprets the Python class as a Java class.
The interop is nice here.
neat. How's workshop compatibility?
It's a client-side patch so beyond installing that and running it with an additional argument for the library, good.
so in general, not good. Dang that's a shame.
Well if you consider modding the client as a killer then sure. Make a good enough mod though and a good installer for the patch and people will come.
Workshop mods really must NOT require any action on user part besides pressing "subscribe" otherwise it's gonna be a whole can of worms and people would need to REALLY want your mod in order to put up with all that.
sure, but add multiplayer npcs or something and suddenly everyone has this patch installed and python mods are one click installation
The funny thing is you could add custom Iso objects into the game and NPC logic is doable.
we've been one killer app from a custom mod loader for years, though, and we're still here
Also custom render methods in Java subclasses as python would mean rendering animals is already doable through this method.
something like optifine for PZ could've been it, but no dice
I did do an optimizer mod for build 31.
It forced the game to use a weaker but insanely fast PRNG which chopped a lot of the comp times for map & game code
I really appreciate the work done but at the end of the day it's not enough that it's really cool and advanced, it must also be accessible. It's like car turbos - unless it comes with a turbo from the factory, most people not even gonna bother trying it. Installing a turbo is just too much work for a regular person.
Sure if you think I considered those things to be a goal. I'm not looking for that sort of thing. If people did then that's cool / great.
Again if people like something enough they'll mess around with it.
What I also meant to say is that I would've really used this Python addon if it didn't require users to do anything other than to click subscribe on some workshop mods. Manual installation requirement would pretty much kill any potential userbase for me.
I mean at that point I might as well skip Python and make a Java mod. Would've been the same set of issues.
it's not like he chose for it to need manual installation, that's just how it is if you want api expansion
It's just unforunate, is what it is. I can't make my subscribers jump through hoops - they not gonna do it.
I think for people to mess around with it for more than a few minutes, it would need to be part of vanilla. My experience with such extensions and external libraries meant for everyone is that almost nobody is using them.
Unless it is something that opens up gates like mod loaders in the case of Minecraft but that is already Lua's thing for this game.
i'll probably give it a go when you've got typings done
Well, it is unfortunate, everything about PZ's Lua API is just messy. Would appreciate more consistent experience to Java with Python.
there's a mod i've always wanted to make that isn't possible with the current api
I would switch to Python instantly. But the manual installation is a dealbreaker.
Not for me of course. As a dev I'm used to pretty cursed setup shenanigans.
To my potential users. Vast majority of them will not put up with any of it.
Even something as simple as having to run an .exe can be an extremely huge turnoff.
To common user even settings most of the time are turn off.
We really deal with masses.
To me this would sting particularly badly because I specialize in novelty/niche mods, things people don't value as high as to go out of their way to make it work.
If it was a full 3d renderer? People would bend over backwards just to get it running.
Totally doable. It's so funny that I can write Python 3 typings to get vscode's Pylance extension to show typings for Python 2 code.
class UIManager:
@staticmethod
def AddUI(element: UIElement) -> None: ...
class UIElement:
def DrawText(self, font: UIFont, text: str, x: int, y: int, red: float, green: float, blue: float, alpha: float) -> None: ...
def render(self) -> None: ...
def isMouseOver(self) -> bool: ...
class UIFont:
Small: UIFont
Medium: UIFont
Large: UIFont
Massive: UIFont
MainMenu1: UIFont
MainMenu2: UIFont
Cred1: UIFont
Cred2: UIFont
NewSmall: UIFont
NewMedium: UIFont
NewLarge: UIFont
Code: UIFont
MediumNew: UIFont
AutoNormSmall: UIFont
AutoNormMedium: UIFont
AutoNormLarge: UIFont
Dialogue: UIFont
Intro: UIFont
Handwritten: UIFont
DebugConsole: UIFont
Title: UIFont
A .pyi file in the module path
It's so funny.
You could write mods in TypeScript ya know..
I only really care about performance here.
Well, at that point you could create whole new game. I made 3D (in Hud) renderer actually once in Lua while people were "wow", it alone probably wouldn't stand anyway.
Thing would have to be like redoing whole PZ as 3D game.
Technically I could port it to PZ. Just have to look up the hud library xd
Nevermind that Jython gives access to LWJGL, a 3D rendering environment regardless of how PZ draws its isometry.
Pretty much yeah. 3d renderer alone isn't a big deal. I did it as an exercise once. It by the way had Z-sorting lol, yours seem not to.
I mean some assets can be rougly converted to textures and basic models exist for most stuff.
It doesn't. It is actually for lols extension of my polygon library, which I used for prerenders anyway.
Reminds me of when I sent TIS a utility class I wrote that gives Lua the ability to dynamically assign uniform values in GLSL shaders.
They rejected it however a shader interface for values would seriously be badass.
I feel like the hard part of game modding is the fact that you're modding someone else's game, not making your own. When you're the one making it, all of this is extremely trivial.
I mean then there's DOTA.
I mean, total conversions are a thing. It depends how much the API is closer to something like Unity has, making the game essentially engine.
Which in PZ case, it is very tailored to PZ.
Oh boy the choice to use sprites over 3d models. $5 says the devs originally decided to use sprites because they thought it's gonna be easier to make assets and it'll render faster.
Well at least they eventually made the right call to switch to 3d models, at least for items and characters. Factorio devs decided to double down which caused them all sorts of issues, not the least of which is huge performance problems due to sprite overdraw.
Whoda thunketh if you gonna render 10x the amount of your fullscreen pixels each pass, you gonna run into bandwith limitations?
Depends. GPU rendering is frankly still new to me. Most of my rendering work was pretty much in software rendering where said performance limitations are even more obvious.
my brothers, sisters and all my other siblings I am in need of help with my code, when the mod is enabled I cannot drive, craft or hotkey weapons if someone could spare some time to help me go over my code I'd appriciate 🙏
if you can spare some of your time to help me fix my code please dm me 😄
Keeping code exclusive to one server is doable, the other way around is not really viable - not to mention I'm pretty sure against terms of service.
Just chalk it up as a lesson and move on.
I am really struggling with getting a custom .pack and .tile to appear in the Brush menu. Following Dirks youtube tutorials, I created a custom pack that I placed in my mods texturepacks folder and tile properties I placed in the media folder. I can see them getting loaded in the logs, but when I enable Brush Manager, they aren't there. Any suggestions on how to debug this?
Is it possible to run a check if the local OS' time/date is a weekend?
greetings, what to do if my car dosen't spawn on the map,im pretty sure i did the spawnlist correctly.
try isWeekend = ({[7]=true, [1]=true})[Calendar.getInstance():get(7)]
Note that tying gameplay mechanics to real time is mainly just needlessly frustrating because players don't usually have the free choice of when to play, or to not play.
Best case scenario you make people change OS clock which is needlessly annoying.
I was gonna run it on the server (assuming it'd base it off the server's OS) and therefore do 2x experience gain on weekends
I'm just saying that saturday and sunday specifically are not everyone's free days.
rookie modder here
how hard is it to make whats essentially a crashing meteor event?
where you can find and collect the meteor if you get through the flames and undead the noise attracted
you can do ctrl+f to find text's talking about the subject, the easiest part would be creating the noise and spawning the zombies, a tile that does damage Ive never heard of, neither flames that never go out
flames in general work kinda weirdly since they don't update outside of current cell, which is very small. So not only does it effectively prevents buildings on fire from burning down while you're not looking, it also prevents fire spreading. And of course the flames don't go out.
looking to commission someone to help me code a car in ladder logic
Is FireSpread() every in game tick, minute or 15m?
Hey I'm trying to add a necklace as my first clothing item in a mod and whenever I equip the necklace, I cannot see it and the console repeats this error
ModelInstanceRenderData.init> skinningData is Null, matrixPalette may be invalid
Does anyone know where I may look to fix that?
I never made clothing but did you try with an existing texture ?
I haven't but I'm pretty sure the texture is setup correctly, since it works with the ground item
I think I need to export .x model from blender(I used an online converter) but I cannot find a working .x export addon for blender anywhere
I not a 3D guy so I may not help you with that but i saved this link one day idk if it could help
Hello and Welcome! Here you will find a concise and comprehensive guide and tutorial of making 3D models for Project Zomboid. Currently, this will mainly pertain to custom Clothing creation but may include weapon creation in the future. This will present how to create models from scratch with Ble...
hello
eh
the flames would go out
I just wanted to know if i can spawn in the meteor as a random event, which would prolly be effectivly a 5x5 structure, scorched tiles mostly, active fires (that can go out, it can be a wild fire starter if youre unlucky) at the edges and the
was more worried about if i could do it at all
Yabba dabba doo, I need a commission worked on, willing to pay using totally not suspicious Paypal friends and family. 👍
Hey, is there a way to reload a specific lua file while in game ?
Nevermind i missed the the relaod button in the lua debugger 
last time you said "code in binary" but what does that even mean
001110101011110100001010101100100
d
Clearly, you cant complete my binary commission. I need a real professional. 😞
as I said, do ctlr f and find something about events : like this: https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md
and just read it
What type of comission can't u do friend? From what I understand you're the most skilled programmer here
Or just use it with Umbrella. =)
hey there!
i was wondering which channel i can post in to get help, i'm very new to modding
You're in the right place
do i send the lua file or a screenshot?
Probably both if you have an error you're trying to ask about
At least the screenshot
Display certain events over the player's mistake
I am pretty bad
i'm more confused by the terminology. It's mostly a given that I've no clue what does "binary" (adjective) mean in relation to PZ mods, but it seems like neither does anyone else.
You're typing code to run in a table, which uh, can't be done like that
function ... doesn't run a function, function is used to define a function
(trying to guess what you are doing)
When is your code running ? What is item ?
I see, mostly background in Python and Tkinter
Not sure, I downloaded a 2016 free to modify mod, then tried to understand and apply modifications
2016 oh god
Just look at other current mods on the workshop
That's how I learned lua and modding
Just look at mods that do something similar and reverse engineer how they work
i got two mods that display info over a player's head, but i can't seem to find the right code that i want to use for crafting/disassembling /building, it's nowhere in the folder media
I'm not clear at all about what you're even attempting
I think they want a mod that when you craft or build or disassemble, it shows a halo with the action text above their head.
Based on this code
Hello! im looking to hire a mod developer to make a mod for me, someone who has experience, if you could dm me your prices and other mods youv made that would be great!
For commissions, try on PZ Modding discord https://discord.com/channels/136501320340209664/1125248330595848192
oh there's a pz modding discord? Thanks!
where do we find the link to it?
In that post
How hard is it to make a mod to modify weapon stats for one existing weapon?
Anyone know what I need to add to make the Z key work on modded vehicles?
<@&671452400221159444>
Not particularly. You just make a script file and put in it the same weapon but with edited stats.
Are you trying to say that you want to add text above the player's head when they are in different states? And you want something above their head that says "Crafting" when they're crafting, or "Disassembling" when they're disassembling, or "Building" when they're placing something on the ground?
Exactly yes
you might need to decorate some of these...
function ISPlace3DItemCursor:render(x, y, z, square)function ISBuildCursorMouse:render(x, y, z, square)ISDestroyCursor:render(x, y, z, square)ISBuildActionISCraftActionISDestroyStuffAction
I'm unaware of any fields that tell you when a player is crafting or disassembling or building at that moment, so decorating related actions might be the best hope
This code looks kinda chaotic so I recommend setting this version aside and starting simpler
Programming is not solved all at once. Gotta go step by step. If you want to draw a message over someone's head at all, you have to get that function to work first.
So in debug mode you should learn to use player:setHaloNote() before you try anything further imo
Your code is entirely dependent on using setHaloNote but even that command is not formed correctly
Which leads me to suspect you haven't explicitly tried it in console by itself.
I would launch PZ with the -debug launch option and learn to use the console to figure out how function calls should work before incorporating them into more complicated code.
require 'ISBaseObject'
-- Function to display text over the player's head
function showEventOverHead(player, eventText)
local playerObj = getPlayer(player)if playerObj then local x = playerObj:getX() local y = playerObj:getY() local z = playerObj:getZ() -- Create a new WorldObject for the text local textObject = IsoText:new(eventText, x, y, z + 2) textObject:setFont("font_name") -- Replace with desired font textObject:setColor(1, 1, 1, 1) -- White color textObject:setVisible(true) textObject:setAlpha(1) textObject:setOwner(playerObj) getWorld():addObject(textObject) -- Optional: Remove text after some time Events.EveryOneMinute.Add(function() if textObject then textObject:setVisible(false) -- or remove it from the world end end) endend
-- Hook into the disassembly event
Events.OnDisassemble.Add(function(player, item, success)
if success then
showEventOverHead(player:getPlayerNum(), "Disassembling " .. item:getDisplayName())
end
end)
i got the help of a friend and ai and this is where it got me, it looks much cleaner
still doesn't work for some reason though
because the ai just made all this shit up 😭

AI is a search engine for a search engine.
Google won't understand what you're looking for from regular human language.
ChatGPT will not produce true and correct outputs.
But you can ask chatgpt what are the relevant search keywords given your problem, and from there you can find real answers to your questions.
Sometimes AI will make perfectly right outputs. But there's no way to tell without double-checking all of it yourself. It's a broken clock kind of deal.
lol don't be jealous ChatGPT has access to IsoText
It's just on that next level shit
I wonder what kind of training data led it to believe that "IsoText" is a highly likely sequence of letters
The occurence rate of it in the wild has got to be almost exactly 0% right?
i think it's just made the connection between zomboid and iso
The fact that it has no way to gauge its own factuality is really an issue.
Like, you and me can know if we're recalling something exactly or making a conjecture or outright making things up. The AI - cannot.
Well, it's not correct to imply that AI can recall something exactly or make it up. It's just a really advanced text autocomplete. Does autocomplete has the ability to know facts or make up fake information? No, it just autocompletes text.
And by the way calling ChatGPT "text autocomplete" is not at all reductionist. It's literally how it works. It looks at the chat log and suggests what's the next most likely words* are, and then a sampler algorithm picks one of the options. Rinse, repeat, one word at a time, until another algorithm decides that it's enough. Then it allows user to type. Depending on what system is running the AI, it can even type for you, the feature is usually called "impersonate". Especially if you let it impersonate you after having wrote a bunch, the autocomplete nature of AI becomes really obvious.
- actually tokens. They're usually smaller than whole words but bigger than individual letters. But it's the same idea.
/ blog
AI is just a statistically driven random text generator
if you want to add player text to actions, i'd suggest reviewing LogExtender which decorates a lot of vanilla functions for server logging purposes
you can use the same methods to add player text to certain actions
Does anyone know what the version of Java PZ was built with in development?
I can't tell if it's just the decompiler or if they're actually using Java 9, but some dependancies they use and code in general is deprecated from Java 9 and onward, and also all the case statements are weird like
case 1 -> return 1;
``` instead of
```java
case 1 -> { return 1; }
Aren't those both valid?
Use Java 8 at work, and I think both of those are fine, as long as return val is all thats written.
Apparently not in Java 17 (game was released with a jre17 so I assumed that's what they built it with)
Because cases "can't have a statement as a rule"
"unexpected statement in case, expected is an expression, a block or a throw statement"
does the game saves zombies at all beyond x.y.z coordinate?
You need to mark them as player zombies
I forget the exact value, but you can force it
ok thanks i'll give it a try
isReanimatedPlayer() I think
I figured out it's because the decompiled code was using -> and not : like
// wrong
switch (case) {
case TEST -> return 1;
case DEFAULT -> return 2;
}
// correct
switch (case) {
case TEST: return 1;
case DEFAULT: return 2;
}
// also correct in java 12
return switch (case) {
case TEST -> 1;
case DEFAULT -> 2;
};
I just used a regex pattern to convert all the switches to the middle one! easy peasy
pattern: (^\s*(case\s*[^\s]+|default))(\s*->)(\s*return.*$) replace $1:$4
Oh ok, I have never seen that for switch/cases
Glad you got it sorted though!
Doh, missed the case at the start of your original message. I focused on the -> and thought of lambdas, which is what I described. My bad.
decompiled code is not representative of original source code
it only produces what (ideally) compiles to identical jar
yea ik
it worked, thanks
that's why I asked if anyone knew what java ver they used, because there's deprecated code in there from java 9 so I was just wondering if they chose to keep it that way or not
it's probably the old version
in software development in general it's best to pick a version and stick with it until the heat death of the universe
unless there's a critical bug that you cannot work around and new version fixes it
nvm I think it's actually a dependancy
so they can't really fix it like without meddling with the dependancy
Is there an already-defined way to compile the sources back into playable code? I've been trying to edit the sources for ages but there's all kinds of errors.
I can fix them all but it'll take quite some time and I think there has to be a better way
idk if theres any osrs fans in here but yall should make a mod and add some armour and weapons from it
abysall whip
hello.how do you guyes make mods . do i need to learn a programming language ?
If you just want to add items, no.
oh ok . what if i want to do something else . do i need programming ?
The majority of the logic executed inside a mod is writen in lua. This is a relativly easy language to learn since it is "almost" writed like you would in english. Here is the official free learning book
compile against the source as a library.
I think it's too much effort to do what I wanted to. I ended up just using JProfiler and attaching it to the game's jvm, though with the results, I think I am too inexperienced to optimise anything myself, like with the lighting funcs that are exported from Lighting32.dll and Lighting64.dll, reversing them is a pain lol
<@&671452400221159444>
I feel like there's at least 1 of those a day now, lol.
It'd be cool if TIS open sourced the JNI code.
I don't see why not since they have no competition and it's only help not hurt the game.
i wanted to keep things simple and asked for help from mathmeticians
so this is probably what i'll use for my blackouts mod ramp up option when i get around to improving it
and i believe it has everything i really need
asking mathematicians was a mistake 😂
lerp(low, high, min(1, max(0, i)))
<@&671452400221159444>
Thanks
Does anyone know exactly how fast zombies are walking, in tiles per second?
i made a test rig and it seem to be between 0.54 and 0.93 tile/s with normal walking zombie speed
awesome, thanks!
I made a 15 tiles corridor, spawn some Z on one end and made some noise on the other. So they where walking toward the noise and not randomly wandering
thank you.
i didnt tell them exactly how it was gonna be used and this isnt what they gave me. they helped me conceptually understand breaking down a graph into parts
can you explain what the thing is you sent below that tho? and how does it work
it does the same thing
lerp does the angled slope thing
min and max limit the slope edges (otherwise it's infinite)
i is the nondescript interpolation variable between 0 and 1. You can usually compute it as i = (x - start) / width
tbf at first i asked them for how to make a graph that was exponential until i realized it was impractical to go for that
it's all just the difference between mathematical and programming approach
also i did not know there was something like this! i have been asking around here for maybe a year occasionally seeing what is possible for my mod
well i don't know if PZ has built-in lerp function but Lua has min and max
if it doesnt, how would you go about it?
if not, lerp is just return min * i + max * (1-i)
or you can call them left and right since min and max are technically taken by system library functions
though lua has local variables superceding everything before them
ok
it's math.min/max anyway
math.min and math.max are system defined. But as far as Lua is concerned they have nothing to do with plain min and max
my brain is breaking again
don't worry about it
local function lerp(left, right, i) return left * i + right * (1 - i) end
then when you need the curve you compute it with lerp(low, high, math.min(1, math.max(0, i)))
and you compute the I with i = (x - start) / width
IsoUtils has lerp and a number of other functions.
I'd suggest checking those before reinventing the wheel for math utilities.
i wouldn't call literally a single line "reinventing the wheel"
but with kahlua it would be a valid question to ask which is faster - using lua function or call java function
almost certainly the lua function
because it's kinda hard to tell if kahlua is so slow that even something so tiny is more computation-heavy than the overhead of interfacing with java
no, the java overheard is massively significant
not in a 'kahlua isn't that slow' way but 'kahlua is even slower in another way' way
So using IsoUtils would be slower technically?
most likely
I wouldn't make a statement on that without benchmarking
even with a lua function 99% of the processing time is going to be just from function overhead though
due to Lua -> java -> Lua -- but aren't we talking about thousandths of a ms?
I mean even if I had a really good gauge on the performance of the subsystems, I'd only be 90% likely to be correct, cuz you never know
when it comes to performance we're basically always talking about thousandths of a ms
when we were testing math.max we found that that's over 20 times slower than a lua implementation so it's quite significant for simple functions
no individual basic function is so slow as to singlehandedly cause frame drops. Three times worse performance than 2 microseconds is only 6 microseconds, but this minuscule impact of extra 4 us becomes a big issue when you call this function 1000 times per frame.
but we weren't comparing it to a lua function so that test doesn't represent a speed gain from lua functions over java functions, just raw lua over java functions, i personally suspect the gap between java and lua isn't as big as people generally say and it might just be functions in general
Which would make the issue that it's being called 1000 times per frame, I tend to not worry too much about optimizations unless it's noticeable to the human eye
so what I should use maxValue = a > b and a or b instead of math.max?
yeah
big oof
math.max is *incredibly* slow
could one just overwrite the global math.max to a lua version?
i don't know if that's really much faster
this is such a simple calculation that function overhead becomes proportionally quite significant
Isn't math.max (re-?)implemented in stdlib.lua for kahlua anyway
I think I remember seeing that & being like what the hell is this here for
everything in that file runs like shit i have no idea what it's about
std
it's also responsible for ipairs running so insanely badly
I honestly didn't even want to document the serialize function from that when I was making the kahlua stub
is at least pairs runs fine?
(unless potentially the native ipairs was even worse, but pairs isn't nearly as bad so i doubt that)
Bad decisions were made
pairs is fine
before you branch into another topic, i know next to nothing when it comes to coding. i really need a lot of help when it comes to understanding what im trying to do
good thing I avoid using ipairs out of habit 😅
come back to ask when you run into problems
i usually avoid pairs because in luajit they're slow
ipairs is pointless anyway, but it's nice that i have a stronger reason to tell people not to use it
Good thing we have next, right? Oh, wait
im not on my computer rn as i just woke up, so i just need to understand a few things
pairs is sorta slow but at least it does something unique, ipairs is at best a numeric loop with overhead
is pairs better than having 2 flat tables for keys and values separately? lmao
jesus every day i learn something new about this trash fire
and of course the devs have no uregency to replace it with something of good quality because they write in java, not lua
I'm holding on (perhaps foolishly) to hope that it'll be replaced eventually
Half the player facing code is Lua though
I understand it's not urgent & that's fine but goodness
when microsoft buys it and rewrites in C++ 😂
Microsoft PZ is a truly cursed thought and I'm glad we don't live in that timeline
IDK, Bedrock is doing pretty well. And FWIW Microsoft is the least pozzed of big tech companies.
I'm working on a team that is maintaining two separate versions of the same product (one is newer) and even maintaining parity in that can be a pain. Separate teams would be (read: is) worse
Oh yeah 100%. Bedrock and JE don't even have the 1:1 same gameplay
Anyway I think it's technically possible to mixin into PZ and swap out kahlua for an alternative implementation, perhaps have it glued to LuaJ. But that's a dog and a half.
Can someone give me some advice ? I'm trying to made some UI for my mod but i get an error each time i use my function. What is wrong with it ?
CODE: ||function _UITest() local infoText = "Hello world" local window = ISCollapsableWindow:new(100, 100, 300, 200) window.title = "window" window:addToUIManager() local richText = ISRichTextPanel:new(0, 16, window.width, window.height - 16) richText:setText(infoText) richText:addToUIManager() richText:paginate() window:addChild(richText) end||
LOG: ||ERROR: General , 1721418916060> ExceptionLogger.logException> Exception thrown java.lang.IllegalStateException at UIManager.update line:685. ERROR: General , 1721418916060> DebugLogStream.printException> Stack trace: java.lang.IllegalStateException at zombie.ui.UIManager.update(UIManager.java:685) at zombie.GameWindow.logic(GameWindow.java:262) at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71) at zombie.GameWindow.frameStep(GameWindow.java:765) at zombie.GameWindow.run_ez(GameWindow.java:681) at zombie.GameWindow.mainThread(GameWindow.java:495) at java.base/java.lang.Thread.run(Unknown Source)||
That would be the one Java mod that people would be glad to use.
The error is kind of vague, but you may need to call initialise and/or instantiate on window before calling anything else on it
You're adding richText to both the UI manager and to the window. You should only do the latter
The "illegal state" here is that it's handled by the UI manager (directly) but also has a parent
when using math for a function, is it better to make the calculation on its own function and call it when it is being used?
Yes that was that 🤦♂️ Thank you
it depends, if it's something very simple probably not, if it's more complex and you're going to want to use it in multiple places (or may want to do that in the future) then it's worth splitting into a function
Well that was certainly a read..
What would be the ideal solution for Kahlua? Replacement? Which one?
Isn't it already customized/old/no longer supported?
I would absolutely be the mad man that would try to implement a replacement interp for Kahlua.
all three
yeah, so the ideal solution would probably be to get someone to go in and polish it up
doubt finding a new alternative would be less work
i think it probably would be a lot easier to just replace it
not to mention breaking every mod/knowledge base
it shouldn't break any mods or knowledge bases
I've already done this in the past. The architecture of the LVM and Kahlua itself are dated.
lua is lua
Oh you guys mean the actual interpreting, I thought you meant the whole API for some reason
replacing that would be a good manually installed mod right? better performance?
Honestly the only argument TIS has that is valid for them to use Kahlua is that they already use it and the time spent working on replacement can be time better spent on content.
Business stuffs.
It's very likely discussed over time and is put in a back-log of post-release improvements.
The original author or capsid was aiming to make a more exposed LuaManager - although he really just wanted to make a java loader
but couldn't find anyone willing to write mods in java
He was not pleasant
His idea of solutions for players / new modders is unpleasant. Umbrella is a response to that.
- making java mods would eliminate the whole steamworkshop aspect for the most part - which it's for better or for worse tied to PZ modding
java mods can be hosted on the steam workshop fine
You'd be surprised what can be done with a loader in Lua. =)
I just meant the idea to manually install every mod would be a pita
that's the idea of a mod loader though
But yes if you want to stay in the Workshop realm and keep things comfy for modders and players alike then yes.
manually install a mod loader that automatically loads java mods from the workshop
I think someone wrote a loader
but the capsid guy basically hated Lua and wanted to avoid it all together
I designed and wrote a dynamic Jar plugin framework 10 years ago.
It's amazing how capsid never even contacted me.
Guess he either didn't know me or didn't like my work.
He would have probably found you threatening
he also jumped into modding with out actually playing the game or modding before
idfk, basic mechanics had to be explained
😧
he tried teaching me Java by force too
That's so wild.
not a fun guy
I'm just a silly man poking fun at a sandbox codebase.
i've seen a couple people like that pop up but they unsurprisingly vanish pretty fast
Who would want to learn Java? Do Kotlin or C#.
Java is fine. C# is kind of a worse version of Java.
very early on EHE, he tried making java test suites for vector2, but didn't understand what a vector was, I did research (googling) and tried to explain it to him, and he got upset he wasn't understanding. Said the changes to the test suite were 'wrong' and spent like 30 minutes walking me through gitbash commands to rename/merge commits. 🥲
The day I ditched him EHE made leaps and strides lol
he didn't understand what a vector was...?
You sure he wasn't the first public test of an AI?
Nope, it didn't help vector2 was/is broken
Tried to explain that to him too, and he got really upset
Kept saying to just write the entire mod in java
But yeah, his capsid stuff is good lol
I disagree but more on the concept and approach.
he is the author of pzStorm
Yeah.
I don't even know what that is for, I guess a loader?
I took a brief look at it. It's cool yeah but not something I'd call practical at scale.
he didn't even understand the workshop/mods folder formats
his first draft of capsid required to setup a workflow for each mod 🥲
He sounds like someone who is incredibly talented however also weighed down by their idea of standards or what / what not to do.
Really sad to see so often.
Oh for sure - everything had to be planned dozens of times before you start typing
sounds like severe case of tism enhanced perfectionism
capsid kind of drove me crazy back when people were still using that
the hoops you had to jump through to get it to work
Thank god for Konijima at the time
Seeing people still link it right now with Umbrella around drives me nuts.
That was another quirk of his - really really bad documentation/guides
i'm guessing now it's such a pain because the java stuff was always the priority and the lua stuff was just tagged onto that reluctantly
Don't need to compile your typings when you got the thing on a repo.
gotta respect you for having strong opinions like this while also tooting your own horn 🫡
For those who have the desire to dig deeper into things like what Capsid thought was a worthy journey that's what Candle is. Candle is literally my Capsid typings generator.
Been adding Python typings generation to Candle this past week. <3
still waiting for a workshop-compatible addon that compiles scripts to native code instead of running them through a giant switch-case.
When the Python kids finds out that there's now a way to code mods for PZ in Python and dunks on Lua kids:
https://www.youtube.com/watch?v=g7BMxNVNVYc
Track: Radical Redemption & Yellow Claw - 20.000 Volts
https://www.youtube.com/watch?v=HDthbjVx4I8
Kahlua needs to be trashed.
That's like the only serious take I have in this convo.
don't get me wrong it's all really cool stuff with a lot of practical application, but it's kinda just a matter of personal preference, there isn't an objective winner there, if I were to switch from Lua to Python it would be a sidegrade. If Python support was as simple as clicking "subscribe" on the steam workshop page.
It can be. If you have a installer do the mod patch for you everything else works.
Even checksums.
Even the file overloads.
I'm looking for a practical upgrade, not something that's more to my tastes. If there were a system that adds Rust scripting support to PZ in an extremely transparent fashion, I'd be willing to use even something as scripting-hostile (and in my baseless opinion - disgusting to look at) as Rust.
you don't have to use it if it doesn't suit your needs
Yeah that's kind of the point of having the options.
You find what suits your needs.
It's better to have options.
Modding is the beating heart of supplying options when they canonically don't exist.
It was the same thing if not even more hardcore about this fact in 2003 when I started modding games. =)
Back when most mods were packaged in the same way as viruses attached themselves to PE's.
Was a lot of fun watching mod groups stress that their mod files weren't viruses.
Yeah IDK. As someone who got a modicum of economy & business higher education, I'm looking at this from perspective of finding patrons, not from perspective of selecting the language I like the most.
I'm just here to have fun.
:D
And maybe cook some silly projects in the meantime that sometimes people find useful.
Like I said, I think it's all pretty cool, but the way I see it, it either need to just work, or be the best thing since sliced bread.
Python in particular is kinda like Lua but different but also pretty much the same if you zoom out.
it's not really the language that's important, it's integrated completely differently to how lua is
If you found a way to get it running just by clicking "subscribe" that would be legendary.
it's more of an alternative to java modding than to lua modding
With the added benefit of being a scripting solution.
I still think it's cool that something like this works:
from zombie.ui import UIManager, UIElement, UIFont #type: ignore
from zombie.core.fonts import AngelCodeFont # type: ignore
from com.asledgehammer import Jythoid #type: ignore
class PythonUIElement(UIElement):
def renderText(self, x, y, font, text, red, green, blue, alpha):
# type: (int, int, UIFont | AngelCodeFont, str, float, float, float, float) -> None
if isinstance(font, UIFont):
self.DrawText(font, text, x, y, red, green, blue, alpha)
elif isinstance(font, AngelCodeFont):
font.drawString(x, y, text, red, green, blue, alpha)
def render(self):
super(PythonUIElement, self).render()
self.renderText(64, 64, UIFont.Cred1, "Hello, Python 2!", 1, 1, 1, 1)
def isMouseOver(self):
return super(PythonUIElement, self).isMouseOver()
# This allows for Kahlua to play with the object like a Java class
Jythoid.expose(PythonUIElement)
def mainmenu_enter():
print('Adding Custom UI..')
element = PythonUIElement()
UIManager.AddUI(element)
Events['OnMainMenuEnter'].add(mainmenu_enter) # type: ignore
Even better that the expose method I made makes this something that can be indexed by Kahlua.
This compiles to a runtime class instance in the JVM unlike Kahlua which is even better.
it IS cool. Particularly the part where it compiles to JVM bytecode. But it runs the same problem as modloaders: people need to have it. If one extremely popular mod was using it, then this wouldn't be a problem. But there's basically no way Steam users would manually install anything for a trivial or unpopular mod.
This is an existing problem with Java mods
This is neat. Curious, though: why the #type: ignores?
I'm figuring out how to type out the API and expose it to IntelliSensse in VSCode. It's a scaffolding.
It'll throw yellow warnings.
Gotcha, makes sense
It's a non-source supply of typings which the interp extension Pylance considers a warning.
i hope pycharm likes those typings, they're not the ones i'm used to seeing and even the support for those is a little shakey at times
Unlike capsid's typings, I authored 100% of the generator code and I am agreeable on concept and improvement.
I'm used to the inline typing as well
Which is what the .pyi is using, so I'm assuming the above was just for reference/testing
ah, i didn't inspect that
I don't know the right way to type Python.
Learned all of this in one week.
The fun thing about Python is that there are usually like 5 right ways
no that's Lua
Something something zen of python
in python there's THE PYTHONIC way
Oh, I misremembered apparently: "There should be one-- and preferably only one --obvious way to do it."
which usually looks like something bizarre to people who started off with C or pretty much anything else than Python
there's le_snek and then there's the LE_SCREAMY_SNEK
you know like defining lists is done either by comprehension or by calling list() depending on what kind of data you're putting in it
i looked at hte canonical pythonisms once and decided to not bother with any of that
Yeah I used Python almost exclusively as a young teen & I didn't think at all about whether my code was "pythonic"
Usually more concerned with whether it was functioning correctly
The pythonistas would have my head
as far as C python goes, the correct way to use it is to use anything else (in the form of C libraries) except Python
numpy entered the chat, followed by 20 million other libs
my initial learning was mostly python and i don't think i learned a single bit of pythonic practice, even accidentally
these days i force myself to be good and stick to snake case even though every part of me hates it
when writing python anyway
Eh it's just coding style. Sooner or later you stop caring about it. Like you eventually stop caring about desktop wallpaper and the condition of the downloads folder.
It's the architecture style that actively contributes to bad code maintainability that's hard to live past.
I'll have you know my Desktop and my downloads folder are pristine
I decided to take a screenshot and I had to minimise 5 fullscreen windows of various apps. Just so you have some idea about the way I might make use of the desktop.
i see my desktop once when i turn on my computer
the state of it is of no consequence to me
I also rarely see mine but I just can't bring myself to allow icons to build up there
the whole reason there isn't more junk on my desktop is because wangblows 11 doesn't have desktop in quickbar so i can't easily select desktop files
well i guess i can just add it manually to custom quickbar
I'm cursed because my first 10 years of coding experience is Java.
I'm Java-ic.
Moreso TypeScript-ic
Java is fine. It's a little more obtuse and less flexible than C++ but it's allright.
If your first 10 years were Javascript, then this might've been an issue.
I don't think it's fine haha but that's me.
Well actually I went that direction.
I'd rather be using TS / JS right now for PZ.
I can back up that insanity (with more insanity)
If it ran in JIT then it would be OK. It's really needlessly complicated for the purposes of embedded scripting language API-wise. But for the end user it would be basically the same as using Lua.
Oh man how I love me some object-orient'n.
Like an actual language-defined object framework.
JS objects are effectively the same as Lua objects though.
the differences are pretty technical to the point that one needn't care
I wrote code that shows that.
anyway if you so choose you can use classes in Lua, it works completely fine
it's a whole other subject that OOP has always been a meme and with years it only becomes more obvious, so why would you even do this?
is there an other way than getPlayer():getStats():setPain() to force a pain level ? I can't keep it to the value i want
particularly in the 90s it was such a huge meme that a language that entirely cannot function without classes was created
typescript to lua transpiling is pretty popular
it makes sense for pz to have a solution for it
also if you want to use class objects, you shouldn't even be using functionality like "derive". There should only be "mixin".
This is probably because BodyDamage is constantly updating it. What are you trying to do, keep pain at a certain level?
That was an emulation of the Lua-class implementation TIS uses in their Lua framework.
I've considered writing some code that "lifts" Lua to TypeScript.
I'm trying to increase my pain by a certain amount
What are you doing now? (i.e., I know you're calling setPain, but what does your actual code for it look like?)
player:getStats():setPain(math.min(player:getStats():getPain() + randomPain, 1))```
Pain is from 0 to 100
So it's probably working, but adding very little (assuming severity is also 0-1)
100 is leg-day.
when I learned that some moodles use 0-1 scale and others use 0-100 scale I was like
B R U H
Always a joy to have to just remember which ones are 0-1
i'm more bothered by the fake boredom
i get it that these were written by different people. But geez how hard could it be to follow the same data standard as the guy before you?
Impossible
NIH or bust
Code review is an art that is lost to time
even if i set randomPain to 50. my pain level remain at 0
and the math.min to 100
this guy who makes space videos the other day made a speech about how "we as a society have lost the ability to provide negative feedback" which is why Artemis program went completely off the rails
mistakes and misjudgements accumulate and nobody is allowed to speak up or they get fired for being disruptive
for context Artemis has you launch 6 starships to go to the moon, but Appollo did it in 1 launch, but that's with original musk performance figures (tm) which have been dialed back over time, so now it's more like 20 launches to go to the moon. Given the cost of the thing, it's just not gonna happen.
Review my code poppa
- peppa
Well the starship is also 10 times heavier than the LEM
yeah and fun fact it has less payload to LEO than Atlas 5
starship looked promising but it went so far south that the whole reason it stays afloat is NASA life support
i mean it looked promising to me. The good old grumpy briton thunderfoot thought it was junk from day 1.
Took a look & it turns out it's the thing I said with BodyDamage: if pain doesn't change during an update it's reduced by a fairly significant amount (so, probably going away too quickly to even debug unless you getPain at the same exact time)
A 5k tons rocket for a 10 tons payload to LEO is kinda absurd
applying pain to a specific body part worked fine for me
That's probably best, since the overall pain considers those
Just need to make sure it won't stay the same during an update if you want the pain to stick
I didn't even think about that.
And it is way better since it should be focused on the belly
The gravity is one harsh mistress. Also do recall that they launched the starship to LEO with full tanks, and it didn't even had mass simulator in the bay. It could just barely get itself flying.
im stumped
Hi stumped
i dont understand how to use lerp at all even with your tips coldsteel
i watched a video on youtube so i understand it is returning a value between the two numbers based on the distance marked between them
im gonna mark the same graph i posted before with labels of things that are needed
the curve of the lerp is the acceleration yours values will get toward their end point
if you set up lerp correctly, it will produce the exact results as were shown on your math plot
in fact if you take the equations in that plot and rearrange them, you get lerp
ok so
blue green and black are all values i need to be customizable
percent = lerp(start_percent, peak_percent, math.max(0, math.min(1, (current_day - start_day) / days_from_start_to_peak_blackout)))
if i wanted to print in debug to test with arbitrary numbers do i just put everything starting from 'lerp' in print()
also the start day is the blackout start day
and is this assuming i have a lerp function or is lerp inherent in the code
you need to have lerp defined yes. You can assign it from PZ java code, or you can use the one-liner function.
ok thanks, that helped a lot
you will need to somehow detect current day. It doesn't really matter as long as you use the same time units (days, minutes, millseconds, etc) in all three variables (current day, starting day, and days from start to peak)
i use getGameTime():getNightsSurvived()
that works (but i'm not entirely sure how it works though)
so when i print this lerp, what value is actually being pushed out?
value of % blackout for the current day
it will start at the start % value until the blackout start day, then it will gradually increase to peak % value as additional number of days from start to peak pass, and then it will stay at that value
it seems to be going down instead of up
you can just swap around the % variables
local function lerp(left, right, i) return left * (i-1) + right * i end
nah i just messed up the function definition when typing off the top of my head
ah ok
How did you achieved that ? with getPlayer():getBodyDamage():getBodyParts() ?
specifically i was just editing dynamic traits code
it's returning a negative of my minimum chance when i am before the start day
should i invert it somewhere in the function to fix that?
can you show your code? The relevant parts.
it's just in its own file rn for testing
lol
it should be 1 - i instead of i - 1
yeah
dammit i hate it when my brain makes dumb mistakes like it's chatgpt
it's okay, you helped a lot!
(chatgpt would probably be unlikely to make this particular mistake)
the ramp up feature is something a lot of people have been wanting for a very long time and i kept giving up on it because i was not asking the right questions
only a week ago i started getting hints and realized i was going in the wrong direction
I didn't understand why you wanted to add random blackouts
I just realized that i was thinking that your mod was a vanilla feature lol
xD
Too many mod enabled xD
it should be! but im trying to make the mod as natural and customizable as people expect it to be
right now the way blackouts peak is for it to roll twice when you are two weeks away from the full blackout
Well it seem to work since when i returned to PZ i played roughtly 100h without even realizing it was a mod
:D
i havent changed anything in a while. burryaga has been fixing things and cleaning up my amateur mess but we got it to a spot where it works well enough until i finally decide to add features
1st rule of programming: If it works, don't touch it
i'm 10+ in today just because i delete something yesterday and now nothing work
F
i havent touched this mod (and game) in so long i need to reacquaint myself with everything
I'm a bit extreme, i wasn't satisfied with what i wrote, i decide to rewrite everything
two times xD
and it barely work, i'm pulling my hair since this morning and it's 2AM now
I'm trying to add food intolerances and allergies to the game. I have a system that work well for the food stuff but i I can't get any symptoms to work properly.
ah, i cant help since i dont know much myself
good luck tho!
have you already looked at other mods and seen their approach?
when I will finally figure out how to apply pain consistently, everything will be fine
gl!
Yeah, But I hadn't done lua for 10+ years so I no longer understood anything. And I tried to jump right back into it lol
the blackout start and end functions are the most important functions in this mod, so i really dont wanna mess anything up here
(ofc have a backup)
I should make a commit before messing it up another time
Can you make zombies engage in player animations? I watched Land of the Dead, 100% completed Lab of the Dead, and am about to watch Day of the Dead, so I'm really interested in the idea of a mod incorporating ideas from that—researching, training, etc. zombies.
Wdym by engage in player animations ?
Like reloading a gun, for example.
function itemFields.getFieldAssociatedFunctions(item)
local fields
local movable = instanceof(item, "Moveable") and item
if movable then
fields = fields or {}
fields.worldSprite = "setWorldSprite"
fields.isLight = "setLight"
fields.usesBattery = "setLightUseBattery"
fields.hasBattery = "setLightHasBattery"
fields.lightBulb = "setLightBulbItem"
fields.lightPower = "setLightPower"
fields.lightDelta = "setLightDelta"
fields.lightR = "setLightR"
fields.lightG = "setLightG"
fields.lightB = "setLightB"
end
return fields
end
local fieldFunc = itemFields.getFieldAssociatedFunctions(item)
for field,func in pairs(fieldFunc) do
local value = fields[field]
local associatedFunc = item[func]
if associatedFunc and value then
item[associatedFunc](item, value)
end
end
Would item[associatedFunc](item, value) be equal to item.associatedFunc(item, value)?
assuming I can't recreate : using inline text macros 🤔
Looking into upgrading my shops mod to account for some item's having cosmetic fields
