General performance improvements #1154
Labels
No Label
#P1 CRITICAL
#P2: HIGH
#P3: elevated
#P4 priority: medium
#P6: low
#Review
annoying
API
bug
code quality
combat
commands
compatibility
configurability
contribution inside
controls
core feature
creative mode
delayed for engine release
documentation
duplicate
enhancement
environment
feature request
gameplay
graphics
ground content conflict
GUI/HUD
help wanted
incomplete feature
invalid / won't fix
items
looking for contributor
mapgen
meta
mineclone2+
Minecraft >= 1.13
Minecraft >= 1.17
missing feature
mobile
mobs
mod support
model needed
multiplayer
Needs adoption
needs discussion
needs engine change
needs more information
needs research
nodes
non-mob entities
performance
player
possible close
redstone
release notes
schematics
Skyblock
sounds
Testing / Retest
tools
translation
unconfirmed
mcl5
mcla
Media missing
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: VoxeLibre/VoxeLibre#1154
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I've been recently hit by a (literally) breaking bug as a combination of Minetest and wpasupplicant (wifi client in Linux). I posted it in the Minetest forum and then GitHub, and I'll report it to the wpasupplicant package maintainers when I'm confident enough that it's actually wpasupplicant's fault and not mine for starting to use enchanted items around the time I updated that package.
While investigating the problem (and still looking into it) I uncovered a number of issues in MineClone 2 as well, and I hope the engine allows for some of the changes required for optimizations.
If anyone wants to help with testing performance-related issues, I highly recommend a slower computer because that's the best tool to easily notice what needs improvement. It also helps a lot to enable the "info" level of logging and have to ability to grep/parse through it from the terminal, considering the logging will become quite noisy.
register_abm
occurences, and report their interval. It will be trickier with AMBs for mobs, at least, but I'll see about it when I get there. If those familiar with the code have a better idea about this, please share it.For now, I changed the water dripping interval from 2 to 4 seconds, just because they're purely decorative. I didn't notice an improvement so far, but once I can check and all the ABMs I might find something else that doesn't alter the gameplay.
Hoppers also check for items every second, so while we can't tweak that, when players build farms and automation, having lots of them will surely impact the performance, like it does in Minecraft. A suggestion here would be to have a small paragraph about performance in the game's README.md.
The mobs need a spawn mob cap. This alone will contribute to better performance because currently we can end up with a large number of mobs, and along with other objects it can create a lot of lag, up to the point the game becomes unplayable or even crashes.
The game needs the ability to "freeze" mobs that are farther than 32m from a player. This is mentioned in the despawning ranges of Minecraft, and it would be a nice performance win for us as well. They're only supposed to be active between 24-32 blocks around players. You can adjust the distances and check the log with my MineClone 2 Spawn Distance Analysis tool.
We need more efficient spawning conditionals, so that the game spends the minimum amount of time while trying to spawn new mobs - see #1145.
For enchanted items we have to find a way to only have data sent back and forth for items involved in actions - see #1144. I have no idea what the engine has in store for game developers, but this is the kind of thing that should be openly discussed with the Minetest developers, to find reliable ways to have and use customized items without killing the bandwidth.
The first thing that comes to mind is: what does the game send to the server and vice-versa? I don't have experience in building multiplayer games, but I think the data exchange for any items should be in the form of player_id, item_id, slot_id, action and target_id - just a few bytes. The attributes of each item are supposed to be on the server, and only changed through legitimate actions, to prevent cheating and needless client-server traffic other than rendering info. Something like this should be supported by the engine and implemented in games if we want proper multiplayer.
That's all I have for now. I'm glad that the performance is targeted for 0.72, and hopefully a few changes in the right places will improve the performance even without the need for engine changes. For the others, we should talk about them and have a clear plan, so we can take it to the Minetest developers.
How?
Usage is at line 39. As far as I can tell:
1 - compile the proxy c code.
2 - get server address and client address.
3 - run <proxy> <server address> <client address>
4 - open minetest and connect to client address.
I hope that helps.
EDIT: I forgot to backslash escape >.< sorry!
Uhm no. The proxy is written in Go.
go get github.com/anon55555/mt
then download the proxy and use
go run proxy.go ...
"client address" is wrong, its the listen address, but i think you meant the correct thing
Its
go run proxy.go dial:port listen:port
dial is the server address / port and listen is the the address / port that the proxy will open - then anybody can connect to this address / port
client addresslisten address@EliasFleckenstein03 Thanks.
@kneekoo unrelated to mineclone2, but I've found that increasing "unload unused server data" can help with entity lag. I tested my changes by driving a boat around in circles:
10 - boats were pretty much unusable.
29 (default) - visible stutter.
60 - minimal stutter.
Tested on a Raspberry Pi 3.
EDIT: related issue:
https://github.com/minetest/minetest/issues/10985
EDIT2: It seems that ABM budget is important too, probably more so than unused server data. ( forgot I changed it until after running into MineClone2/MineClone2#1432 (minetest.conf bug)) I think we should consider overriding the default ABM budget.
Interesting, I only tried it on my Pi 4. :) I have both 3B and 3B+, so I might give it a spin. :D But it looks like it requires more RAM:
My Pi 4 server has 2GB RAM, so it should be fine. I wonder why it would help, considering I get lag even when both me and my friend are stationary (within 10 blocks) for long periods of time, and /clearobjects helps.
The same happened when I tried
192.168.2.122:30000
as proxy. It looks like it's missing some headers/modules/libraries/etc.No, your Go version is too old. You need Go 1.16. You can use
sudo snap install go --channel 1.16/stable
to get the lastest version.Bummer... I don't want to install snap for a test. Maybe I'll give it a shot in Ubuntu 20.10 in a VM.
Nah, you can also get binaries directly from golang.org.
Ok, that was easy. Now I got this:
@EliasFleckenstein03 @ryvnf Take a look at this comment in the Minetest GitHub.
What do you think about it?
I think the particle commands are because of coordinate leak protection or something.
i'm not a python expert but I think I can write very basic script to get started:
collect_abm_intervals.py:
I've placed it in MineClone2/tools and that's why all paths are relative (e.g. ../mods) and the result is:
I don't think it's all and I don't think the script catches all of them, but here is some info and some script.
I think the idea is right.
@EliasFleckenstein03 Here's a thought about item metadata. What if enchanted items get an ID? Their attributes would be stored on both the server and the client, and only send the ID between the client-server.
Of course, on adding/removing enchantments, the item gets synced on the server, and if the item is destroyed, it gets removed from both client and server - all based on ID. This would be much more efficient if possible.
Maybe, but what if the server installs a mod that adds an enchantment and removes another mod that added an enchantment? Ids are a double-edged sword. Also, backwards compatibility. What do we do about old ItemStacks? I'm against this.
mc is a mess with content IDs, I dont think we should recreate this limitation xD
Wait, I'm not sure we're clear on this. The items keep the same data structure on both the server and client. It's just that the client-server would pass the item IDs between them when we use the items, instead of the sending the whole metadata. And whenever an item's properties gets updated, it would have to be replicated on the other side - this prevents inconsistencies.
I'm not sure what you mean by old ItemStacks, considering enchanted items are not supposed to stack. Do you mean stacks that were possible in the development release that I tested and got me high RAM usage?