NoitaMP
NoitaMP copied to clipboard
If you do it quick'n'dirty, your code quality will suffer!
Yoo, dependency hell led me to use lua globals. Guess what?! Performance sucks so much!
I try to do a quick test comparing performance and continue on reworling code, if performance increases.
My tasks
- [ ] Draft task
- [ ] update contributer file afterwards
- [ ] https://github.com/octo-org/octo-repo/issues/45
Create the branch based on #67
LuaJIT profiler works!
It's findings:
from frame 2060: 73% | local encodedBase64 = self.base64.encode(self.np.SerializeEntity(entityId))
but still as you guys mentioned:
67% | local exists = os.rename(absolutePath, absolutePath) and true or false
it all the time above 60%
Fix constructor dependency injection!
Worth testing passing dependencies as parameters on functions?
Best would be to have locals in init.lua and then passing those to classes, like: class:new()
then class:requireDependencies(...)
per class. When there is any foo
is nil, then extend function above. Otherwise it will be p.i.t.a. maintaining it..
~~Get rid of EntityCache?! It was used in the past for old serialization?!~~
Nope! It is also used to check, if an entity somehow changed and needs to be synced. But worth improving it. Gut feeling tells me, cache clean up, isn't 100% reliable.
Debug setting for multiple instances to avoid unecessary resource/performance usage. Save pid in file. New settings file.
Edit: Double checked yesterday, looks fine for now!
Chop of NULL
byte from NoitaPatcher serialized binary string, when adding to VSC, like NoitaPatcherUtils:prepareForVSC(binaryString)
, which returns the modified string. Otherwise we cannot store it in VSC, but we need the NULL
byte for Deserialization.
Chop of
NULL
byte from NoitaPatcher serialized binary string, when adding to VSC, likeNoitaPatcherUtils:prepareForVSC(binaryString)
, which returns the modified string. Otherwise we cannot store it in VSC, but we need theNULL
byte for Deserialization.
I am not able to do this and won't do it. If there is any contributer interested in go for it, but it's waste of time. Base64_ffi is fast enough.
Add toggle setting for pprint and pformat. It's executed each frame and is not necessary, when log level is off
.
Add checks before sending wrong network data. Some mandatory tables are nil now and then. Leads to wrong assumptions.
If an entity was serialized and sent to anyone and then it got deserialized, it can happen, that the deserialized entity is the same as on the other peer. Sounds awesome? Yes and no. When Minä got synced, it's a huge problem.
Therefore double check when an entity was deserialized and a similiar one was found, whether nuids are matching, if not check the owner and guid are the same, if not create a new entity and do not reuse existing entities.
Chop of
NULL
byte from NoitaPatcher serialized binary string, when adding to VSC, likeNoitaPatcherUtils:prepareForVSC(binaryString)
, which returns the modified string. Otherwise we cannot store it in VSC, but we need theNULL
byte for Deserialization.I am not able to do this and won't do it. If there is any contributer interested in go for it, but it's waste of time. Base64_ffi is fast enough.
Maybe @aaptel can help me with this? We can have a discord call, when you are free!
Wise double checking this?
Assign package.loaded["Classname"] = nil
when the class was loaded, to make it free for garbage collections.
Chop of
NULL
byte from NoitaPatcher serialized binary string, when adding to VSC, likeNoitaPatcherUtils:prepareForVSC(binaryString)
, which returns the modified string. Otherwise we cannot store it in VSC, but we need theNULL
byte for Deserialization.I am not able to do this and won't do it. If there is any contributer interested in go for it, but it's waste of time. Base64_ffi is fast enough.
Maybe @aaptel can help me with this? We can have a discord call, when you are free!
I'm missing a lot of context here. I don't see prepareForVSC in NoitaPatcherUtils.lua
White- instead of blacklisting entities.