GithubHelp home page GithubHelp logo

Comments (2)

rvandoosselaer avatar rvandoosselaer commented on May 20, 2024

There is a dedicated thread for Blocks at the jMonkeyEngine forum. You can ask all your questions there.

I don't quite understand the question, but I'll try to answer it generally.

It's not a good idea to mix render data and business data together. In JME terms, it would be the same as storing game data on Spatials. If you want to add data to blocks, don't put this data in the Block class. Store the data and link it with the block id.

The Block class is pure data. It has an id, type, shape, ... It contains the bare minimum info so Blocks know how to render this specific block. A block will always render in exactly the same way. Some blocks however have only differences in shapes, or models as you call it.

A wedge block for example, actually has 4 different shapes. One shape facing north, east, south and west. Each shape is represented by a different block object (eg. oak_log-wedge_north, oak_log-wedge_east, ...). You could for example create an object (WedgeBlock), that holds a collection of blocks (Collection<Block> models) containing all the different shapes of a specific type. This way you have sort of a multi-model system.

For handling blocks, there is the Chunk class. A chunk is a way of organising and structuring block data. Internally it has optimizations for block data lookup etc.
A ChunkRepository is used to serialize and deserialize (save and load) block data using protocol buffers.

from blocks.

Igrium avatar Igrium commented on May 20, 2024

That makes sense. Thanks!

from blocks.

Related Issues (20)

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.