Skip to content
Li, Xizhi edited this page Feb 21, 2023 · 4 revisions

ParaCraft SDK Getting Started

NPL Runtime's Raw API provides a native C++ implementation to render blocks/models with opengl/directX. Everything else is up the NPL/lua script. Paracraft SDK is written 100% in NPL script.

If you are not familiar with NPL, please read NPL Guide first

Building Components

In Paracraft, the world is composed of blocks, entities and items.

  • blocks: Block is a template class. i.e. there is only one instance per type in memory. It is more precise to call it block_template, as there are only a few hundreds of them. However, the world is composed of millions of blocks, which are stored in compact format (rather than class instances) in memory for rendering and simulation.
  • 'entities': Entity is usually a movable or more complex object in the scene, such as a mob or player. For every such objects in the worlds, we have a corresponding entity class instance for it. Blocks with complex internal states are usually paired with an entity object, such as command or movie block, etc.
  • items: Items is usually represented by an icon in paracraft. It can be converted to entities or blocks. For every entity and block, there is an item definition for it. so the world can also be thought of comprised of only items. An instance of item is called ItemStack

User inputs (such as mouse and keyboard) is handled by one of the SceneContext.

  • SceneContext: there are three major user input context, PlayContext, EditContext, MovieContext, corresponding to the three major edit mode in Paracraft. Certain tasks or command will temporarily define their own SceneContent.

All modifications to the world is done via command or task

  • command: as a design principle, a command class is written before we add graphic user interface for a given editing function. It usually support undo/redo operations.
  • task: task is derived from command, but it usually has graphical user interface.

All user interface is made by mcml page.

  • mcml: mcml is a HTML/Javascript like markup language for building graphical and interactive windows. Except that it uses NPL as its scripting language.

For programmers, best way to learn is to read code

Source-Code-Overview