Replies: 1 comment 2 replies
|
What could "blocks of interest" be defined as? |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Easy way for modders to check for entities/blocks efficiently.
Goals
Non Goals
WorldworksMotivation
I was working on a mod and the netities checking for blocks and players in their surroundings caused huge lag.
Description
An API for querying things in the game
Worldfast.Implementation
Entities and blocks of interest are tracked. When something checks for the presence of a block or entity, the game checks for presences of such things and the found objects are returned. A spatial data structure like an octree (R-Trees are also an option, although they are hard to implement) or a fast collision detection algorithm (stream and scan) can be used to store the tracked entities (and blocks). Blocks could also be stored as ids in an in-memory only array for lookup.
This should prevent lag spikes drastically, as querying blocks now takes a huge amount of time, especially if it's done multiple times a second by entities.
Dependencies
No
References
Guidelines
All reactions