Skip to content

Commit

Permalink
Revises everything into a form tsc can build type declarations out of
Browse files Browse the repository at this point in the history
Also new API doc generations system using `typedoc`
Additional breaking change:
 * `Engine` is now a named export
 * `noa.setBlock` `getBlock` `addBlock` no longer accept array params
  • Loading branch information
fenomas committed Jun 1, 2021
1 parent c6717c8 commit c00b5c3
Show file tree
Hide file tree
Showing 115 changed files with 17,291 additions and 5,392 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {
"root": true,
"extends": "eslint:recommended",
"extends": [
"eslint:recommended",
],
plugins: [
"jsdoc",
],
"env": {
"node": true,
"browser": true,
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
npm-debug.log
node_modules
*-error.log
/.vs
ignore/
13 changes: 5 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
{
"search.exclude": {
"**/node_modules": true,
"docs/**/bundle.js": true,
"docs/**/babylon.js": true
"docs": true,
"dist": true,
"node_modules": true,
"types": true,
"ignore": true,
},
"editor.detectIndentation": true,

"editor.defaultFormatter": "HookyQR.beautify",

"eslint.enable": true,
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
// "javascript.format.enable": false,
}
46 changes: 27 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,65 @@ An experimental voxel game engine.

Some projects using `noa`:
* [Minecraft Classic](https://classic.minecraft.net/) - official game from Mojang (I'm as surprised as you are)
* [CityCraft.io](https://citycraft.io/) - multiplayer voxel cities
* [VoxelSrv](https://github.com/Patbox/voxelsrv) - a voxel game inspired by Minecraft
* [CityCraft.io](https://citycraft.io/) - multiplayer voxel cities
* [noa-examples](https://github.com/andyhall/noa-examples) - starter repo with minimal hello-world and testbed games


----

## Usage

The easiest way to start building a game with `noa` is to clone the [examples](https://github.com/andyhall/noa-examples) repo and start hacking on the code there. The comments in the `hello-world` example source walk through how to instantiate the engine, define world geometry, and so forth.
The easiest way to start building a game with `noa` is to clone the
[examples](https://github.com/andyhall/noa-examples) repo and start hacking
on the code there. The comments in the `hello-world` example source walk
through how to instantiate the engine, define world geometry, and so forth.

Note also that the examples repo shows the intended way to import noa's
peer depenencies, configure webpack, and so on.

To hack on the `noa` engine itself, you'll want to clone this repo alongside your game content, and make the latter depend on the former with a local file dependency (i.e. `file:../noa` in `package.json`). Note however that webpack is picky about this - see the [examples readme](https://github.com/andyhall/noa-examples) for details.


## Size

Built in production mode, `noa` is around ~160kb unzipped and its peer dependency `babylon.js` is ~900kb. When bundled together and zipped they total ~250kb.
The engine is around **250kb** when built in production mode and zipped.
Uncompressed, `noa` is ~160kb its peer dependency `babylon.js` is ~900kb.


## Docs

See the [API reference](doc/API.md) for an overview of engine classes and methods.
Docs are evolving though, some details are only documented in source comments.
Documentation PRs are welcome!
See the [API reference](http://andyhall.github.io/noa/API/)
for engine classes and methods.
Documentation PRs are welcome! See the source for details, API docs
are generated automatically via `npm run docs`.


## Status, contributing, etc.

This library is under active development and contributions are welcome!
**Please submit any PRs against the `develop` branch**, and for nontrivial new
features it's probably best to open a discussion issue first.
This engine is under active development and contributions are welcome.
Please open a discussion issue before submitting large changes.
**PRs should be sent against the `develop` branch!**

For code style/formatting, the repo includes config files for [eslint](https://eslint.org/) and [js-beautify](https://github.com/beautify-web/js-beautify), which are both dev dependencies. Personally, I edit in VSCode with the [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension, and use the built-in autoformatter. If you send PRs, please try to be sorta-kinda consistent with what's already there.
Code style/formatting are set up with config files and dev dependencies,
if you use VSCode most of it should work automatically. If you send PRs,
please try to be sorta-kinda consistent with what's already there.



## Change logs

See [history.md](doc/history.md) for changes and migration info from each version.
See [history.md](docs/history.md) for changes and migration for each version.

Recent changes:

* `v0.30`:
* many performance optimizations
* Engine now a named class, use `import {Engine} from 'noa-engine'`
* many performance and size optimizations
* now generates proper type declarations and API references!
* can now configure separate vert/horiz values for chunk load distance
* core option `tickRate` is now in **ticks per second**, not ms per tick
* adds initial option `stickyFullscreen`
* adds `noa.tickRate` - read only
* adds `noa.maxRenderRate` - read/write, set to `0` for no cap
* adds `noa.rendering.renderOnResize`
* more specific babylon imports, for better tree-shaking
* adds several init options, e.g. `maxRenderRate`, `stickyFullscreen`
* block APIs `noa.setBlock`, `getBlock`, etc. no longer take array params, pass in `x, y, z` instead
* `v0.29`:
* maximum voxel ID is now `65535`
* adds option `worldGenWhilePaused`
Expand All @@ -64,7 +72,7 @@ Recent changes:
* `v0.28`:
* improves swapping between world data sets (see `noa.worldName`).
* Removes duplicated voxel padding in each chunk (this means world generation no longer needs to be deterministic!)
* `v0.27`: adds world origin rebasing - see [positions.md](doc/positions.md)
* `v0.27`: adds world origin rebasing - see [positions.md](docs/positions.md)


----
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions dist/src/components/collideTerrain.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function _default(noa: any): {
name: string;
order: number;
state: {
callback: any;
};
onAdd: (eid: any, state: any) => void;
onRemove: (eid: any, state: any) => void;
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function _default(noa: any): {
order: number;
state: {
cutoff: number;
_showing: boolean;
_showing: any;
};
onAdd: any;
onRemove: any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
export default function _default(
noa: any
): {
export default function _default(noa: any): {
name: string;
order: number;
state: {
entity: number;
offset: any;
onTargetMissing: any;
};
onAdd: (eid: number, state: any) => void;
onAdd: (eid: any, state: any) => void;
onRemove: any;
system: (dt: any, states: any) => void;
renderSystem: (dt: any, states: any) => void;
Expand Down
8 changes: 3 additions & 5 deletions types/components/mesh.d.ts → dist/src/components/mesh.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
export default function _default(
noa: any
): {
export default function _default(noa: any): {
name: string;
order: number;
state: {
mesh: any;
offset: any;
};
onAdd: (eid: number, state: any) => void;
onRemove: (eid: number, state: any) => void;
onAdd: (eid: any, state: any) => void;
onRemove: (eid: any, state: any) => void;
renderSystem: (dt: any, states: any) => void;
};
39 changes: 39 additions & 0 deletions dist/src/components/movement.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* State object of the `movement` component
* @class
*/
export function MovementState(): void;
export class MovementState {
heading: number;
running: boolean;
jumping: boolean;
maxSpeed: number;
moveForce: number;
responsiveness: number;
runningFriction: number;
standingFriction: number;
airMoveMult: number;
jumpImpulse: number;
jumpForce: number;
jumpTime: number;
airJumps: number;
_jumpCount: number;
_currjumptime: number;
_isJumping: boolean;
}
/**
* Movement component. State stores settings like jump height, etc.,
* as well as current state (running, jumping, heading angle).
* Processor checks state and applies movement/friction/jump forces
* to the entity's physics body.
* @param {import('..').Engine} noa
* @internal
*/
export default function _default(noa: import('..').Engine): {
name: string;
order: number;
state: MovementState;
onAdd: any;
onRemove: any;
system: (dt: any, states: any) => void;
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
export default function _default(
noa: any
): {
export default function _default(noa: any): {
name: string;
order: number;
state: {
body: number;
body: any;
};
onAdd: (entid: number, state: any) => void;
onRemove: (entid: number, state: any) => void;
onAdd: (entID: any, state: any) => void;
onRemove: (entID: any, state: any) => void;
system: (dt: any, states: any) => void;
renderSystem: (dt: any, states: any) => void;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export default function _default(
noa: any
): {
export default function _default(noa: any): {
name: string;
order: number;
state: {
Expand All @@ -11,7 +9,7 @@ export default function _default(
_renderPosition: any;
_extents: any;
};
onAdd: (eid: number, state: any) => void;
onAdd: (eid: any, state: any) => void;
onRemove: any;
system: (dt: any, states: any) => void;
};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
export default function _default(
noa: any,
dist: any
): {
export default function _default(noa: any, dist: any): {
name: string;
order: number;
state: {
size: number;
_mesh: any;
};
onAdd: (eid: number, state: any) => void;
onRemove: (eid: number, state: any) => void;
onAdd: (eid: any, state: any) => void;
onRemove: (eid: any, state: any) => void;
system: (dt: any, states: any) => void;
renderSystem: (dt: any, states: any) => void;
};
File renamed without changes.
Loading

0 comments on commit c00b5c3

Please sign in to comment.