Git Product home page Git Product logo

netcraft's Issues

Mouse look triggers even when pointer lock inactivated

Follow on to #39 - but instead of on initial load, when a user action causes pointer lock to disable itself:

Click to enable pointer lock, then Cmd-[ or otherwise lose focus, then Cmd-] back to the game. Move your mouse, and mouse look triggers. This is because the game believes the GLFW mouse cursor is still disabled. Possible fix: register for emscripten pointer lock callback https://kripken.github.io/emscripten-site/docs/api_reference/html5.h.html#pointerlock and when it is lost, re-enable the glfw cursor. (or could/should emscripten glfw port consider its cursor "disabled" when pointer lock is lost?)

Try --separate-asm flag to emcc to Avoid memory spikes by separating out asm.js

https://kripken.github.io/emscripten-site/docs/optimizing/Optimizing-Code.html#avoid-memory-spikes-by-separating-out-asm-js says --separate-asm can improve performance / page load times by separating out the asm.js code from other JavaScript, ought to try this.

https://github.com/satoshinm/WebSandboxMC would need updating to serve the separate files, and when deploying on gh-pages, would also need to add this file too.

Investigate possible emscripten bugs

Develop small test cases and possible fixes for emscripten instead of only working-around in this repo.

This is all on emscripten 1.37.0, current latest emsdk.

With workarounds:

Without yet, may require emscripten fixes:

Soft fullscreen removes <body> element so document.body.style causes null deref

Testing on Chrome, press F11 to enter fullscreen, F11 again to exit, then this exception is thrown:

Uncaught TypeError: Cannot read property 'style' of null
at HTMLDocument.restoreOldStyle (craft.js:9026)

because emscripten's soft fullscreen seems to remove all other elements in the html document including <body>, so document.body is null!

screen shot 2017-04-09 at 9 42 10 am

Attempted in #48 to workaround this by doing my own "windowed full" mode, but it stretches the canvas undesirably, so using soft fullscreen in emscripten is desirable but this is probably a bug in its implementation (who removes body from html? bad idea?).

Optimization: warning: emitted code will contain very large numbers of local variables, which is bad for performance (build to JS with -O2 or above to avoid this - make sure to do so both on source files, and during 'linking')

emcc is giving this warning when building with the current options:

cmake -DCMAKE_TOOLCHAIN_FILE=$EMSCRIPTEN/cmake/Modules/Platform/Emscripten.cmake ..
make

warning: emitted code will contain very large numbers of local variables, which is bad for performance (build to JS with -O2 or above to avoid this - make sure to do so both on source files, and during 'linking')

Websocket errors (ECONNREFUSED) should be handled gracefully

When the websocket server cannot be contacted (ECONNREFUSED or some other error), the player is stuck in the dirt (positioned at 0,0.75,0):

screen shot 2017-04-08 at 8 28 22 pm

Instead, the client should gracefully handle this error, report it somehow and don't place the player into dirt.

Standalone package for running serverside + web client

Bundle up the server-side and client into one easy to use and install "package", such as for providing a drop-in web interface to other servers:

  • #19 Improved protocol support, interop with other server software
  • #12 Multiplayer support (connecting to servers) in web version

Time starts out at night, should start at day since it looks better

On a clean startup, the time is -7am (negative time?), which is very dark. This makes it hard to see the beautiful voxels. Instead the default time should be sometime in the day, either early morning or noon.

Especially important since on the web version there is no saving yet, so you see night whenever you reload.

Document the keybindings somewhere

$ grep CRAFT_KEY src/config.h 
#define CRAFT_KEY_FORWARD 'W'
#define CRAFT_KEY_BACKWARD 'S'
#define CRAFT_KEY_LEFT 'A'
#define CRAFT_KEY_RIGHT 'D'
#define CRAFT_KEY_JUMP GLFW_KEY_SPACE
#define CRAFT_KEY_FLY GLFW_KEY_TAB
#define CRAFT_KEY_OBSERVE 'O'
#define CRAFT_KEY_OBSERVE_INSET 'P'
#define CRAFT_KEY_ITEM_NEXT 'E'
#define CRAFT_KEY_ITEM_PREV 'R'
#define CRAFT_KEY_ZOOM GLFW_KEY_LEFT_SHIFT
#define CRAFT_KEY_ORTHO 'F'
#define CRAFT_KEY_CHAT 't'
#define CRAFT_KEY_COMMAND '/'
#define CRAFT_KEY_SIGN '`'

The use of backquote to write in signs is not documented in the readme https://github.com/satoshinm/NetCraft/blob/master/README.md#controls or https://www.michaelfogleman.com/craft/ or anywhere I could find except the code.

Also not in the defines above, but Ctrl-click toggles a block as a light source.

After documenting, keep updated if:

  • #30 Fly toggle should be double-tap space, not tab
  • #9 Keystroke to enter fullscreen mode
  • #5 Zoom key should not be shift

At least document in readme, but ideally also in-game (next: configurable keys).

WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute

The console log shows tons of WebGL errors, track down where these come from and why:

craft.html:1249 Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:6871 WebGL: INVALID_ENUM: disable: invalid capability
craft.js:7409 WebGL: INVALID_VALUE: enableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_VALUE: vertexAttribPointer: index out of range
craft.js:7548 WebGL: INVALID_VALUE: disableVertexAttribArray: index out of range
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:6940 WebGL: INVALID_OPERATION: vertexAttribPointer: no ARRAY_BUFFER is bound and offset is non-zero
craft.js:7354 WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute
craft.js:7708 WebGL: INVALID_ENUM: enable: invalid capability
craft.js:7708 WebGL: too many errors, no more errors will be reported to the console for this context.

Inventory

Implement a simple inventory item system:

  • Inventory slots of items held by player, finite amounts
  • Harvest blocks when broken: adds item of that block to inventory
  • Take blocks when building: removes item of that block from inventory
  • No infinite items, except when in "creative mode" (vs "survival mode")

Chests

Chests to store items in the world (tile entities), and an inventory dialog when right-clicking to manipulate the contents of the chest.

Needs first #18 Inventory, otherwise no purpose since blocks are infinite.

Later, afterwards expanding on this concept: workbench, crafting, recipes...

Allow specifying server to connect to in URL hash/query string

Similar to how the native Craft lets you give the server name/port on the command line, to automatically connect on launch, the web-based version should somehow allow automatically connecting to a given server.

Some ideas: parsing the document location hash (after #) or query string (after ?), interpreting as argv.

Important for sharing connections to servers as web links.

Cmd-` types the ` keystroke to write on signs, instead of doing nothing

When you press Cmd-Backquote on the web-based port, this will switch to different windows within the same browser app, as expected, but the app also receives the backquote as a keystroke. This causes it to enter text typing mode to write some text as a sign, annoying.

The keystroke should be ignored, maybe ignore keys when modifiers (command, shift, control) are pressed, if this is possible? Or what does glfw receive?

Cubic chunks for infinite height/depth

Currently the y coordinate ranges from 0 to 255, and chunks are identified by (p,q). To allow building higher and lower arbitrarily, just as it is possible to build in the X and Z directions arbitrarily, would be nice to change chunks from 32x256x32 to 32x32x32 and add another identifying coordinate (p,q,r), extending the Y dimension as far as X or Z.

WARNING:root:emcc: cannot find library "dl"

Emscripten gives a warning about the library dl missing:

build $ make
Scanning dependencies of target craft
[  5%] Building C object CMakeFiles/craft.dir/src/main.c.o
[ 11%] Linking C executable craft.html
WARNING:root:emcc: cannot find library "dl"

Unknown consequences.

Remove sqlite dependency in emscripten target, slow/large/unnecessary for web

Craft includes in deps/sqlite/sqlite3.c the "sqlite amalgamation" https://www.sqlite.org/amalgamation.html a very large file containing all of SQLite. Used for storing the world on disk, but slow to compile and takes up a lot of space.

There has to be a better way to do this on the web. Could either remove it entirely and rely on servers for persisting changes, or change the backend database to something more web-friendly:

Block-breaking time with block hardness (vs instamine)

Currently blocks break instantly when right-clicked. This is fine for "creative mode", but for an engaging survival experience, blocks should vary in hardness and some take longer to mine, where you have to click and hold to complete the mining process.

Interacts with #8 Repeat rate for left/right click, hold to continuously break/build

Command key still sticks when switching windows, find a workaround

Continuation of #40 Keys stick - glfwGetKey() continues to return GLFW_PRESS even after onblur, loses focus

With the partial fix, this still happens:

  1. Hold down Cmd for some time
  2. Press Tab while Cmd is held down, switching to another window (onblur), and release
  3. Press Cmd-Tab, switching back (onfocus)
  4. Click a block

At step 4, the game acts if Cmd is pressed, so that right-click+Cmd = illuminates a block and left-click+Cmd = right-click. Quite frustrating.

Until a possible emscripten fix (see GH-40), a practical workaround may only be to reassign this Cmd key to not be used for these purposes (swapping and illumination).


Can the definition of 'control' be narrowed? From src/main.c:

void on_key(GLFWwindow *window, int key, int scancode, int action, int mods) {
    int control = mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER);

this includes both Control and Command.

Mouse look triggers even when pointer lock inactive on first load

You can still look around with the mouse by moving it over the canvas, whether or not pointer lock is active. This could be considered a feature (for compatibility for browsers without pointer lock support?), but can also be annoying, moving the camera around when it is not desired. Pressing escape a few times disables this for some reason. Maybe if the browser supports pointer lock, only process mouse events if pointer lock is enabled?

Zoom key should not be shift

Reassign zoom to some key that is not shift. It makes taking screenshots awkward and is unfamiliar.

Shift should instead be crouch/sneak, once available: #4

What key for zoom? Control/Command? Z?

Sound

Play sound effects when things happen: breaking a block, placing a block, walking over a block, etc.

Should be possible to support both web and native through a suitable API. SDL audio APIs via emscripten to Web Audio API (or was Mozilla Audio API?), or OpenAL which "uses Web Audio and has buffer streaming support currently in the master branch.": http://stackoverflow.com/questions/18350537/getting-emscripten-streaming-audio-to-work

And then: music (mp3s streaming?)

Server code running in web browser ("LAN mode"?)

The server code server.py is written in Python, find out how it can be finagled to run in a web browser ala Craft written C compiled using emscripten, so users can host games in the browsers.

Would be more useful after #12 multiplayer support in web, to allow LAN-style parties

Textures configurable at runtime

Allow the block texture sets (and other textures) to be dynamically changed by the user at runtime. "Reskinning" such as by dragging a new texture pack file onto the web client, reloading the GL atlases and redrawing the blocks.

Shift should descend when in flying mode

Space ascends when flying, but there is no opposite control to descend, you have to move the mouse to face downwards then press 'W'. There should be a key to descend directly, probably 'Shift'.

P2P peer-to-peer intercommunication / serverless mesh hosting?

As an alternative or in addition to #12 multiplayer support connecting to servers in web version (websockets), consider some kind of peer-to-peer system where the world state is synced across nodes in a decentralized mesh network fashion instead of having a central server arbitrating truth.

WebRTC looks promising for this purpose: https://en.wikipedia.org/wiki/WebRTC

Maybe the idea is cooler than it sounds. But combined with #14 server code running in web browser, the idea would be you could create a world, have your friend join it seamlessly, and other friends join as well without bothering to setup and maintain or manage a central server in some datacenter somewhere.

Multiplayer support (connecting to servers) in web version

The native version of Craft allows connecting to servers, using TCP sockets. The web version port should support it, too, probably using WebSockets with a specialized (WebSocket-capable) server.

https://en.wikipedia.org/wiki/WebSocket

See https://github.com/fogleman/Craft#multiplayer-1

Multiplayer

Multiplayer mode is implemented using plain-old sockets. A simple, ASCII, line-based protocol is used. Each line is made up of a command code and zero or more comma-separated arguments. The client requests chunks from the server with a simple command: C,p,q,key. “C” means “Chunk” and (p, q) identifies the chunk. The key is used for caching - the server will only send block updates that have been performed since the client last asked for that chunk. Block updates (in realtime or as part of a chunk request) are sent to the client in the format: B,p,q,x,y,z,w. After sending all of the blocks for a requested chunk, the server will send an updated cache key in the format: K,p,q,key. The client will store this key and use it the next time it needs to ask for that chunk. Player positions are sent in the format: P,pid,x,y,z,rx,ry. The pid is the player ID and the rx and ry values indicate the player’s rotation in two different axes. The client interpolates player positions from the past two position updates for smoother animation. The client sends its position to the server at most every 0.1 seconds (less if not moving).

Client-side caching to the sqlite database can be performance intensive when connecting to a server for the first time. For this reason, sqlite writes are performed on a background thread. All writes occur in a transaction for performance. The transaction is committed every 5 seconds as opposed to some logical amount of work completed. A ring / circular buffer is used as a queue for what data is to be written to the database.

In multiplayer mode, players can observe one another in the main view or in a picture-in-picture view. Implementation of the PnP was surprisingly simple - just change the viewport and render the scene again from the other player’s point of view.


websockify mentioned in emscripten-core/emscripten#595 (comment)
https://github.com/novnc/websockify previously wsproxy, "Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service. Implementations in Python, C, Node.js and Ruby."

Keys stick - glfwGetKey() continues to return GLFW_PRESS even after onblur, loses focus

Haven't track down the steps yet, but both the native and web-based clients are affected: sometimes, a key acts as if it is continuously held down, even when it isn't, usually occurs when switching in/out of focus to the app. For example, "A" may be held down and keep moving the player left. Pressing and releasing the key again unsticks it, but shouldn't it losing focus also release all keys?

Add /time command to change/freeze time of day, nighttime/daytime and/or server-side time

Sometimes you want to see better but it is nighttime, all you can do now that I have found is to wait until the time changes. A command such as /time to alter the time would be indeed useful. Possible aliases /time day, /time night, /day, /night, perhaps even an option to freeze time and disable the daylight cycle.


/time 0 to 24, /daylength 0 freezes time at noon

Increase block ID range from 8-bit to 16-bit

The blocks array is 8-bit, supporting up to 256 block types:

// src/item.c
const int blocks[256][6] = {

// src/item.h
extern const int blocks[256][6];

Consider increasing this to 16-bit (for a total of 65536 block types), and testing to ensure elsewhere in the game (save file format, sqlite?) works well with it. Having this many block types may not be necessary yet, but it would be a good idea to plan ahead for future expansion e.g. to support variants of blocks in different orientations fogleman/Craft#116.

native only: error 78: failed to open file for reading Segmentation fault: 11 crash if launched outside of resources directory

If Craft, native version only, is launched and it can't find adjacent texture/shader resource files, it crashes abruptly:

$ ./craft 
error 78: failed to open file for reading
Bus error: 10

Should handle gracefully, but better yet, embed the resources in the executable as to allow relocation (similar to emscript --embed-file, so you don't have to worry about bringing over related files).

Light reading:

http://stackoverflow.com/questions/4158900/embedding-resources-in-executable-using-gcc - bin2c? satoshinm/nanogui@4aa9374

http://stackoverflow.com/questions/72616/embed-data-in-a-c-program

https://www.reddit.com/r/gamedev/comments/1k0tvy/i_need_some_help_with_wrapping_up_my_game_before/

ld -r -b binary

xxd -i file

Sprinting/running by holding tab

Holding down the tab key should enable sprinting or running = walking faster.

Opposite of #4 crouching/sneaking.

After #30 Fly toggle should be double-tap space, not tab update: tab is now available

Entities

Objects of arbitrary 3d models not locked to the world grid, unlike blocks.

  • Spawn entities
  • Object model loading
  • Save/load to disk
  • Physics
  • Behavior ("AI")
  • Mobs

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.