Library for helping mods that use graph networks, like Wired Redstone

Overview

GraphLib

Github Release Status Maven Status

Library for helping mods that use graph networks, like Wired Redstone.

GraphLib and HCTM-Base

This library is based on HCTM-Base by 2xsaiko and is essentially a rewrite of his block-graph-network code in Java with some optimizations. Credit goes to 2xsaiko for designing this system in the first place.

Maintenance Commands

All maintenance commands can be accessed via the \graphlib command.

\graphlib updateblocks <from> <to>

This command updates all block-nodes in a given area. If block-nodes were not saved due to a server crash then it may cause some machines or wires to act strange, not transmitting signals correctly. This command will re-connect those machines.

\graphlib removeemptygraphs

Sometimes a server crash can cause a block-graph to get saved without any block-nodes in it. These empty graphs can clutter up your save file. This command removes these empty graphs.

Depending on GraphLib

GraphLib can be added to a gradle project's dependencies like such:

repositories {
    maven {
        url 'https://kneelawk.com/maven/'
        name 'Kneelawk Maven'
    }
}

dependencies {
    modImplementation("com.kneelawk:graphlib:$graphlibVersion")
    include("com.kneelawk:graphlib:$graphlibVersion")
}

where $graphlibVersion is replaced by GraphLib's latest release version.

Comments
  • Getting Empty Chunks Causes Lag

    Getting Empty Chunks Causes Lag

    The Issue

    Currently, when a chunk that does not exist is requested, the UnloadingRegionBasedStorage will:

    • First, check if the chunk is already loaded and find that it is not. (This is relatively fast.)
    • Then try to load the chunk so that it can be accessed more quickly next time. (This is relatively slow.)
    • Fail to load the chunk because the chunk does not exist.

    Attempting to load the chunk again will go through the same steps, performing the same relatively-expensive file-load and fail.

    Graphs

    The process of getting graphs that do not exist potentially suffers from the same issue.

    Potential Fix

    This could be fixed by, adding chunks that do not exist to some kind of set, so that next time, we don't have to check the filesystem to know that a chunk does not exist.

    It might make sense to remove 'empty' chunks from this set when they would otherwise be 'unloaded', just to free up memory.

    opened by Kneelawk 2
  • [Feature] Get all graphs from a controller

    [Feature] Get all graphs from a controller

    It would be handy to be able to get all graphs from a controller.

    This would allow easier debugging of graphs and potential client-side visualization.

    opened by Kneelawk 1
  • 0.4.x-1.19.3 Add debug rendering for graph nodes

    0.4.x-1.19.3 Add debug rendering for graph nodes

    This PR

    This PR adds debug rendering for graph nodes so that it is easier to tell how nodes are actually connected and debug their usage.

    Screenshots

    2022-12-19_17 48 15

    Associated Issues

    This PR closes #5.

    opened by Kneelawk 0
  • 0.3.x-1.19 Add debug rendering for graph nodes

    0.3.x-1.19 Add debug rendering for graph nodes

    This PR

    This PR adds debug rendering for graph nodes so that it is easier to tell how nodes are actually connected and debug their usage.

    Screenshots

    2022-12-16_14 56 38

    Associated Issues

    This PR closes #5.

    opened by Kneelawk 0
  • Delay node updates to end of server tick

    Delay node updates to end of server tick

    This PR

    This PR delays all node and connection updates until the end of the server tick to allow for update-deduplication and lag-reduction.

    Testing

    This has been tested on the 0.3.x branch in a single-player world where server tick lag is visible as a graph. This change had a notable impact on reducing server tick lag when bundled cables are moved using Create contraptions.

    opened by Kneelawk 0
  • Delay node updates to end of server tick

    Delay node updates to end of server tick

    This PR

    This PR delays all node and connection updates until the end of the server tick to allow for update-deduplication and lag-reduction.

    Testing

    This has been tested in a single-player world where server tick lag is visible as a graph. This change had a notable impact on reducing server tick lag when bundled cables are moved using Create contraptions.

    opened by Kneelawk 0
  • Saving block-graph every 5 Minutes in Server Console

    Saving block-graph every 5 Minutes in Server Console

    The server console is spammed with this every 5 minutes.

    [11:21:19] [Server thread/INFO]: Saving block-graph for 'ServerLevel[rudel_world]'/minecraft:overworld [11:21:19] [Server thread/INFO]: Saving block-graph for 'ServerLevel[rudel_world]'/minecraft:the_nether [11:21:19] [Server thread/INFO]: Saving block-graph for 'ServerLevel[rudel_world]'/minecraft:the_end [11:21:19] [Server thread/INFO]: Saving block-graph for 'ServerLevel[rudel_world]'/ae2:spatial_storage

    https://pastebin.com/WptH4PMD

    opened by Tiegertosch 0
  • [Feature] Graph Debug Rendering

    [Feature] Graph Debug Rendering

    It would be nice to have some kind of debug rendering for graph nodes so you can see what nodes are at a given location and whether they're connecting properly.

    enhancement 
    opened by Kneelawk 0
  • BlockNodeWrappers Should Hold the Id of the Graph They Belong To

    BlockNodeWrappers Should Hold the Id of the Graph They Belong To

    HCTM currently stores the relationship between nodes and their graph as a map in the controller that has to be rebuilt every time something changes.

    Instead, it makes sense that when a BlockNodeWrapper deserializes or is created, it is given the id of the graph it belongs to.

    This does mean that BlockNodeWrappers will not be able to be record classes, but that will be ok.

    opened by Kneelawk 0
  • Use Incrementing Longs for Graph Ids Instead of UUIDs

    Use Incrementing Longs for Graph Ids Instead of UUIDs

    Currently, BlockGraphs use UUIDs for their ids. UUIDs are discouraged from being used for map keys, as their random nature means that the maps have poor cache locality, meaning longer get and contains times.

    On the other hand, FastUtils has a map specifically optimised to use longs as keys. Furthermore, incrementing keys means that many keys will be stored close together, meaning better cache locality.

    The id incrementer can be stored as persistant state on the same world as the block graph controller that's using it.

    opened by Kneelawk 0
  • Multiple Block Graphs

    Multiple Block Graphs

    The Issue

    Currently, all mods' graph data is saved in a single graph. This means that if one mod manages to corrupt the block graph, it ends corrupted for all mods that depend on it. This also just results in an overall messy combination of data.

    Potential Solution

    It would be possible to have GraphLib manage multiple graphs, each with an Identifier key that mods can use to reference their specific graph.

    api 
    opened by Kneelawk 0
  • Server Crashes Cause Graph Corruption

    Server Crashes Cause Graph Corruption

    The Issue

    Currently, if the server crashes, it can shutdown without saving the latest graph and chunk updates. This means then that any wires that relied on these graph connections will no longer be connected correctly when the server is started back up.

    Potential Fix

    A potential fix for this is to switch the simple graph implementation to be being saved every tick, only saving the parts that have been updated since the last save.

    Potential Drawbacks

    If too many changes are made to graphs every tick, this could have significant TPS performance impacts. However, this kind of situation is unlikely.

    However, what might be better is to have multiple BlockGraph implementations, allowing mods that update graphs frequently to choose to save their data only at regular intervals, while allowing mods that update graphs infrequently to save their data after every update, making corruption less likely (#11).

    opened by Kneelawk 2
  • Unclear Which Interfaces a User Should Implement

    Unclear Which Interfaces a User Should Implement

    The Issue

    Currently, most of the interfaces are just thrown in one package. Both the interfaces implemented by GraphLib and the interfaces that GraphLib expects the user to implement are all int the com.kneelawk.graphlib.graph package. This means that someone just looking over the API could be confused about which interfaces they're expected to implement.

    Potential Fix

    A simple fix would just be to move the BlockNode, BlockNodeDecoder, and BlockNodeDiscoverer interfaces to their own package, potentially something like com.kneelawk.graphlib.node. It would also be important to make it clear in the javadoc that these interfaces are expected to be implemented by users.

    API Breaking

    This change would break the existing API and should only be done when updating to the next "major" version (when updating to the next version of Minecraft).

    api 
    opened by Kneelawk 0
  • Avoid Exposing Internal Graph-Node Objects

    Avoid Exposing Internal Graph-Node Objects

    The Issue

    Currently, GraphLib's internal Node objects are exposed in some methods, allowing users to mutate them in ways that GraphLib cannot handle, resulting in invalid graph states.

    Potential Fix

    The best way to fix this is to remove all instances of GraphLib's internal, mutable data structures from the BlockNode API, replacing them with immutable versions that expose the same information, though likely in a more accessible format.

    API Breaking

    This would be an API-breaking change, meaning that it should really only happen during a "major" version increase (i.e. while updating to the next Minecraft version).

    api 
    opened by Kneelawk 2
  • The Simple BlockGraph Implementation is not Thread Safe

    The Simple BlockGraph Implementation is not Thread Safe

    The Issue

    Currently, accessing and mutating a block graph from multiple threads is likely to cause a ConcurrentModificationException or just give inconsistent data. The SimpleBlockGraph, SimpleBlockGraphController, and UnloadingRegionBasedStorage all expect to be used from a single thread only.

    Potential Fix

    It would likely not be too hard to add in some synchronization primitives, to allow for efficient use from multiple threads. This may be something like a RWLock for each internal collection.

    wontfix 
    opened by Kneelawk 1
Releases(v0.4.4+1.19.3)
Owner
Data
I am a student software and electrical engineer. I love making things that make people happy, whether that be art or technology.
Data
java deep learning algorithms and deep neural networks with gpu acceleration

Deep Neural Networks with GPU support Update This is a newer version of the framework, that I developed while working at ExB Research. Currently, you

Ivan Vasilev 1.2k Jan 6, 2023
Graph Algorithms Repository for Coding Minutes Course.

graph-algorithms-for-competitive-coding Graph Algorithms Repository for Coding Minutes Course. This is the repository for Graph Algorithms Course for

Coding Minutes 126 Dec 28, 2022
JUNG: Java Universal Network/Graph Framework

JUNG: The Java Universal Network/Graph Framework JUNG is a software library that provides a common and extensible language for the modeling, analysis,

Joshua O'Madadhain 346 Dec 28, 2022
A little helper to complete homework #4 "Graph planarization" in discrete mathematics at ITMO University in the second semester.

graph_planarization A little helper to complete homework #4 "Graph planarization" in discrete mathematics at ITMO University in the second semester. A

Daria Starikova 9 Dec 8, 2022
This is not the latest version this is almost like 2.0, deobfuscated by OMA.

AresClient-Deobf This is the pvp client, which is closed source, not the open source anarchy one. Ares client devs are so special mentally they though

Pace 3 Aug 3, 2021
Chih-Jen Lin 4.3k Jan 2, 2023
Use this to open hidden activities on MIUI.

miui_hidden_libs Use this to open hidden activities on MIUI. Translate for your language: https://drive.google.com/file/d/1---II4WVVvPIn3cPodTC52VPVG3

ios7jbpro 51 Nov 10, 2022
A powerful, extendable, flexible yet simple to use commands annotation framework.

Lamp Background Building commands has always been a core concept in many applications, and, lots of times, a really boring and cumbersome one to pull

Revxrsal 95 Jan 5, 2023
Easy to use, very low overhead, Java APM

Glowroot Requirements Java 8+ Quick start Download and unzip glowroot-0.14.0-beta.2-dist.zip Add -javaagent:path/to/glowroot.jar to your application's

null 1.1k Dec 14, 2022
Java Statistical Analysis Tool, a Java library for Machine Learning

Java Statistical Analysis Tool JSAT is a library for quickly getting started with Machine Learning problems. It is developed in my free time, and made

null 752 Dec 20, 2022
An Open Source Java Library for the Rubiks Cube!

?? Table of contents Overview What is Cubot? Why would you want it? Documentation Installation Updates ?? Overview A Java library to help you : Virtua

Akshath Raghav 13 Oct 17, 2022
JML - Java Math Library.

JML JML - Java Math Library. JML is a Java Math Library for solving Advanced Mathematical calculations. Disclaimer This project is under heavy develop

Java Math Library 3 Sep 23, 2021
A library to check MIUI autostart permission.

MIUI Autostart A library to check MIUI autostart permission state. Supported versions MIUI 10 (firebase) MIUI 11 (physical device 11.0.9) MIUI 12 (phy

Kumaraswamy B G 31 Jan 2, 2023
Tribuo - A Java machine learning library

Tribuo - A Java prediction library (v4.2) Tribuo is a machine learning library in Java that provides multi-class classification, regression, clusterin

Oracle 1.1k Dec 28, 2022
👄 The most accurate natural language detection library for Java and the JVM, suitable for long and short text alike

Quick Info this library tries to solve language detection of very short words and phrases, even shorter than tweets makes use of both statistical and

Peter M. Stahl 532 Dec 28, 2022
Auto reply app helping you move away from less private messengers like WhatsApp and Facebook Messenger

Watomatic - Auto reply for WhatsApp so you can stop using it Watomatic sends an automated reply to everyone contacting you on WhatsApp. This is especi

Deekshith Allamaneni 335 Dec 28, 2022
Mindustry java mod that adds a redstone-like wire-based logic system, tailored for making circuits.

See Esoterum-Solutions for builds 0.0-1.2 A small Mindustry Java mod that adds a wire-based logic system tailored for building circuits. New content s

null 36 Oct 25, 2022
The loader for mods under Fabric. It provides mod loading facilities and useful abstractions for other mods to use, which is compatible with spigot now

Silk The loader for mods under Fabric. It provides mod loading facilities and useful abstractions for other mods to use, which is compatible with spig

null 1 Oct 1, 2022
A library for creating and editing graph-like diagrams in JavaFX.

Graph Editor A library for creating and editing graph-like diagrams in JavaFX. This project is a fork of tesis-dynaware/graph-editor 1.3.1, which is n

Steffen 125 Jan 1, 2023