Git Product home page Git Product logo

chunx's Introduction

chunx's People

Contributors

bitbrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chunx's Issues

Avoid outbounding targets

It's currently possible to add entities to a single chunk which bounds doesn't match to the entitiy.

For instance: Chunk has bounds of 200,200 | 400, 400

Now it shouldn't be possible to add an entity at position 900,900, because this point is outside of the chunk.

Create chunk handler

Create a handler in order to handle chunks. Furthermore, ChunkSaver and ChunkLoader have to be moved to the new handler.

Implement retainAll() in ConcurrentMatrixList

Write a proper implementation of the method retainAll in ConcurrentMatrixList:

@Override
public boolean retainAll(Collection<?> objects) {
    // TODO: Implement retainAll
    return false;
}

NullPointerException with concurrency

When using a ConcurrentChunkSystem instance, a NullPointerException rises sometimes. Even the iterator which provides single chunks shouldn't return null objects.

Targets spawn at wrong position

When a target moves outside the cache it's gonna be unloaded. After re-visiting the chunk, it spawns at a wrong position. Sometimes, it doesn't spawn at all.

Extract MovementDetector

Currently you have to define your own movement detector instance in a class. To save work time, it should be done by the ChunkSystem itself, by invoking the detector.

Problem: the detector must be updated on some kind of update() method. That's the reason why it's currently not handled by chunx itself.

NullPointerException in CachedChunkHandler

There rises often a NullPointerException in the onMove() method. Caused by a null reference of a chunk.

This null reference occurs because there is no chunk at the calculated index. Therefore, the index is calculated wrongly.

Cache doesn't align on center correctly

When changing the dimensions of a chunk in the configuration file, the chunk system doesn't align correctly on the new center position.

The problem occurs exactly when the x and y index of the cache size differs.

Create basic framework structure

Create a basic framework structure (interfaces only) to prepare basic implementation.

The framework itself looks something like this:

class-diagram

Bad file descriptor when moving too fast in the cache

java.io.IOException: Bad file descriptor is thrown when moving too fast in different directions, because a chunk is saved which is currently loaded and vise versa:

java.io.IOException: Bad file descriptor
    at java.io.FileOutputStream.writeBytes(Native Method)
    at java.io.FileOutputStream.write(FileOutputStream.java:297)
    at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1870)
    at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1779)
    at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1283)
    at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1228)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1424)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
    at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1570)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:350)
    at de.myreality.chunx.io.SimpleChunkSaver.save(SimpleChunkSaver.java:94)
    at de.myreality.chunx.caching.CachedChunkHandler.saveChunk(CachedChunkHandler.java:174)
    at de.myreality.chunx.caching.CachedChunkHandler.unloadChunk(CachedChunkHandler.java:192)
    at de.myreality.chunx.caching.CachedChunkHandler.unloadChunks(CachedChunkHandler.java:203)
    at de.myreality.chunx.caching.CachedChunkHandler.handleChunks(CachedChunkHandler.java:114)
    at de.myreality.chunx.caching.SimpleCachedChunkSystem.update(SimpleCachedChunkSystem.java:97)

Move outer targets to pre cache

When a target moved outside of the current chunk system, move it back to the outest chunk in the pre cache of the chunk system. Afterwards remove the target from the content provider and add it to the chunk.

For this purpose, a vector v is created between the last and the new position of the object. Afterwards the object is moved back to the border of the cache:

principle

By doing so, it's ensured that moveable entities never leave their path but still staying in the chunk system. If the chunk unloads and loads again later, the target will appear and continue moving, as always.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.