longor1996 / tcge Goto Github PK
View Code? Open in Web Editor NEWA game-engine for block-shaped (discrete) voxels, written in rust.
License: MIT License
A game-engine for block-shaped (discrete) voxels, written in rust.
License: MIT License
All items listed here are the minimum required, to force implementation of all major systems and their respective subsystems. Forgetting an item may cause irreparable architectural errors.
GUI:
Items:
core:items/wrench
: Changes properties of blocks and actors.core:items/spaxel
: Can mine all block-types.core:items/vbrush
: Sculpt blocks & terrain.Blocks:
core:blocks/fluid/air
: Most basic fluid.core:blocks/fluid/void
: Most basic fluid.core:blocks/fluid/water
: Most basic fluid.core:blocks/bedrock
: Unbreakable opaque boundary block (dark texture).core:blocks/skyrock
: Unbreakable opaque boundary block (bright texture).core:blocks/barrier
: Unbreakable invisible boundary block.core:blocks/trigger
: Triggers things if touched by actors.core:blocks/command
: Executes a command when triggered.Actors:
core:actors/freecam
: A simple floating camera.core:actors/walkcam
: A simple walking camera (to test physics).core:actors/box
: An axis-aligned box.core:actors/point
: A point.core:actors/block
: A block as movable actor.core:actors/items
: A stack of items as actor.This document is a work in progress, as the architecture is still being 'invented'.
Progress:
The backbone represents and manages the architecture and internal structure of the entire engine. Instantiation of all systems and modules (except the game's mainloop) happens trough it.
It is constructed in the form of a tree of named nodes, which can be queried and monitored trough paths or accessed directly by their unique ID. The user-interface (be it a client window or server console) creates a Lens
that is is a pointer into the tree; the movement of this pointer causes node-components to either load or unload.
At the moment the engine starts, the users lens 'walks' from nothing (
) to the root (/
) of the tree, causing the loading process to begin, constructing the actual user-interface and eventually showing the main-menu. The entire UI thus consists of (potentially dynamic) links between the various nodes.
Nodes are what the backbone is made of. They consist of a unique identifier, a name, and usually have a parent (mostly the root-node of the tree), all together creating a tree of nodes.
A node has the following basic structure:
struct Node {
id: usize,
name: String,
parent: Optional<usize>,
}
A lens is a stringly-named pointer into the node tree, capable of moving around within it and receiving and acting upon events fired into the node tree.
The position of a lens in the node-tree is represented as a path from the root of the tree to the bottom.
There are two different representations for the path of a lens: A list of node ID's and a string.
Changes to the path can only happen when the lens receives an update and returns a State::Moving
(instaed of a State:Idle
) with a new path to go to.
While the lens is moving, it can only receive passive events.
The syntax for the path of a lens can be expressed as the following EBNF:
path: entry || item ('/' item)*
entry: '/' | './' | '../'
item: word
word: [a-z A-Z][a-z A-Z 0-9 -]*
All nodes and lenses can send events to other nodes and lenses in the tree. Events are sort-of temporary lenses that, during their short lifetime, go trough a set of phases. The phases of an event are thusly defined:
CAPTURE
-Phase: The event has been fired from a node or lens, and walks trough the tree, node by node, until it reaches it's target. If it can't reach it's target, due to the event being caught or cancelled, it can immediately go into the BUBBLE
phase.ACTION
-Phase: The event has reached it's target and is being processed by its event handler. After the action has been completed, the event will optionally enter the BUBBLE
phase.BUBBLE
-Phase: The event walks back, trough the tree, to the node or lens that fired it, evaluating any event-handlers flagged for the bubbling-phase.What's it good for? For globally managing the state of the engine in a consistent, concurrent and safe, but still dynamic, manner. It is a 'one time' investment similar to URL-rewriting in a web-server.
Due to the backbone owning the application/process/engine-structure, managing memory and instance lifetimes also becomes easier to deal with.
Loading of Block-Models needs to take care of texture-loading, -packing, -blitting and mip-mapping.
Potential issues:
Implement a extremely basic camera system.
The camera system is intended only for rendering a 3D-Scene to a 2D-Viewport.
fn renderToTarget(scene, camera, viewport);
struct Scene; // the things to render
trait Camera; // projection and camera transform
struct Viewport; // width, height, render-target
Later changes might include...
This means:
half
-crate instead.The way the backbone currently handles borrowing, by making use of mem::transmute
, is inherently unsafe+unsound, and thus not ok.
It should be possible to rewrite all unsafe uses with Cell/RefCell, without incurring any performance penalty, nor changing the API too much, but making things much safer.
Implement a writer for the .cdml
-format, given the format and data-structures defined in /docs/cdml.ebnf, preferably in the same module as the parser.
Implement developer tools that can observe both the engine's state and assets in semi-realtime.
This requires that a secondary window be opened, rendered and closed on demand.
Implement a proper Gameloop with fixed ticks and variable limited frames.
Keep in mind that the engine is intended to be multithreaded.
Implement the pallet-based block-Storage system.
Provide efficient functions for:
The block-storage does not:
Future work:
1
, the volume can be exactly 0 bytes.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.