Search the Community
Showing results for tags 'nullengine'.
-
Hi, I wanted to just ask if something is possible before putting in the work and finding out it isn't - Can I use the null engine to generate screenshots with full color? the only reason i am questioning if it is possible is because when i read this, i saw this line - With textureSize, you can define the size of all textures (which will be all black) used by the NullEngine. so does this mean if it is possible to produce a screenshot, will it just be a black image? many thanks, John.
- 2 replies
-
- nullengine
- screenshots
-
(and 1 more)
Tagged with:
-
How does one load a *.obj in NullEngine? const BABYLON = require('babylonjs') require('babylonjs-loaders') // mutates something globally global.XMLHttpRequest = require('xhr2').XMLHttpRequest ... BABYLON.SceneLoader.LoadAssetContainer("./", "cubio.obj", scene, function (container) { console.log('CONTAINER', container) container.addAllToScene() }) Error: ...\node_modules\xhr2\lib\xhr2.js:206 throw new NetworkError("Unsupported protocol " + this._url.protocol); Do I need to do something to xhr2 to teach it about obj?
-
I'm attempting to use NullEngine in node.js as a component of the server side simulation for a multiplayer game. When using *just* NullEngine + nengi.js (a multiplayer engine) mesh intersection and rays work great. I can get somewhere in the realm of 50-150 ccu (that's players, not NPCs). The performance is really awesome. Now I'm trying to get some more advanced physics in place. However when I attempt to include OimoJSPlugin on the serverside I get " TypeError: Cannot read property 'World' of undefined " const BABYLON = require('babylonjs') let engine = new BABYLON.NullEngine() let scene = new BABYLON.Scene(engine) let camera = new BABYLON.ArcRotateCamera('Camera', 0, 0.8, 100, BABYLON.Vector3.Zero(), scene) scene.enablePhysics(null, new BABYLON.OimoJSPlugin()) That last line there is the one that throws the error. Any idea what I'm doing wrong? I also get a warning that 'oimo' module cannot be found (related, I presume?). I setup babylon via `npm install babylonjs` (as opposed to downloading something) and the version is 3.2.0. Thanks for reading! And BJS + NullEngine is a dream come true!
- 5 replies
-
- nullengine
- physics
-
(and 3 more)
Tagged with:
-
What are some options for creating terrain from heightmaps via NullEngine? I'm trying to create a serverside terrain for collision checks in a multiplayer game. The main issue is that Mesh.CreateGroundFromHeightMap involves loading an image and going through pixel data via canvas, none of which exists in node. Some ideas: Expose canvas + image api on the server: https://github.com/Automattic/node-canvas can provide Image and Canvas to NullEngine, though I've written a server side image processor recently that uses this tech and while it does work it isn't entirely straight forward because quite a few extra things need installed before it all works. I'm not sure how many babylon nullengine features use canvas/image, if its just this one then I doubt this route is worth it. Just loading the image in node: a small patch function that detects if we're in node and loads an image and gets its pixels using regular node fs. I'm not 100% sure how to do this but it sounds possible. This would kinda fork the logic inside of Mesh.CreateGroundFromHeightMap unless it was exposed in a new way. Go straight to the heightmap data and skip the images: https://doc.babylonjs.com/api/classes/babylon.vertexdata#creategroundfromheightmap - this does assume pixel data (UInt8 array of RGB? RGBA?) but has no dependency on canvas as far as I can tell. I don't understand the colorFilter (0.3, 0.59, 0.11) though, so someone would have to explain it to me. In my case I actually generated my heightmaps in node to begin with, and then saved them as images purely as a visual tool to see how the maps would look. I happen to be using these debug images and loading them into babylon because it works automagically! I could certain just skip all this and save them in some other format, like a 1D array of UInt8s (though in this scenario it would be ideal to skip RGBA and just have raw height data). I could probably add this to babylon by following the existing example if this is a feature people want. Once again I'm a total 3D noob, so if there is a much more trivial solution please let me know :D. I'm also willing to contribute, but I just don't want to make the wrong contribution.
- 3 replies
-
- creategroundfromheightmap
- terrain
-
(and 2 more)
Tagged with:
-
Hi, Tried to unit test my util function that involves Vector3.Project and it returns Vector3 with infinity in it. Doing something wrong? var engine = new NullEngine(); var scene = new Scene(engine); var camera = new ArcRotateCamera("camera", 0, 0, 0, Vector3.Zero(), scene); scene.render(); var pos = Vector3.Project( new Vector(0.5, 0.5, 0.5), Matrix.Identity(), scene.getTransformMatrix(), scene.activeCamera.viewport.toGlobal( engine.getRenderWidth(), engine.getRenderHeight(), ); // pos is Vector3 { x: Infinity, y: NaN, z: -Infinity } Using: 3.1.1 babylon
-
Hi, when I dispose null engine after unit test get error; // before unit test var engine = new NullEngine(); var scene = new Scene(engine); // after unit test is executed engine.dispose(); TypeError: Cannot read property 'deleteProgram' of undefined at NullEngine.Object.<anonymous>.Engine._deleteProgram (node_modules/babylonjs/dist/preview release/babylon.max.js:9898:26) at NullEngine.Object.<anonymous>.Engine.releaseEffects (node_modules/babylonjs/dist/preview release/babylon.max.js:11840:22) at NullEngine.Object.<anonymous>.Engine.dispose (node_modules/babylonjs/dist/preview release/babylon.max.js:11874:18) Using: 3.1.1 babylon
-
Hi, is it by design that NullEngine.getHardwareScalingLevel returns undefined? var engine = new NullEngine(); var scene = new Scene(engine); engine.getHardwareScalingLevel() //returns undefined Using: 3.1.1 babylon
-
Hello! I've been diligently working on my game, and recently came upon the recently released BabylonJS v3.1 ... and I am super excited about NullEngine! My game is multiplayer client/server; the server component is Node.js running ActionHero v18 (and of course the client is running BabylonJS!). Taking a look at the documentation and accompanying example for NullEngine, it seems it does not run 100% out of the box. However... I've been able to get everything up and running under Node 8.9.3 with a combination of mock-browser, EventEmitter, xhr2 and sheer luck // assume this file is saved as mock-browser.js 'use strict'; const EventEmitter = require('events'); class ProgressEvent extends EventEmitter {} module.exports = { setupMockBrowser: () => { const MockBrowser = require('mock-browser').mocks.MockBrowser; const AbstractBrowser = require('mock-browser').delegates.AbstractBrowser; let window = MockBrowser.createWindow(); let opts = { window }; let browser = new AbstractBrowser( opts ); global.window = window; global.navigator = browser.getNavigator(); global.document = browser.getDocument(); global.XMLHttpRequest = require('xhr2').XMLHttpRequest; global.ProgressEvent = ProgressEvent; } }; To use this, it is as simple as: require('./mock-browser').setupMockBrowser(); I'm curious to know a few things: 1) Since the game supports multiple users interacting in different areas (e.g. multiple "rooms", multiple users per room, users can only interact with others in the same room) it makes sense to me to manage these "virtual player namespaces" separately, as one BabylonJS Scene per "room". Does this sound like a good way to divide up the game? Are there software limitations of managing multiple scenes simultaneously? 2) Since the game-server has many other responsibilities (database saves, websocket clients, periodic tasks via a task-runner) it seems wisest to manage the client-side-equivalent of the "render loop" in a periodic task, which would be responsible for updating objects' positions based on velocity, testing collision, and issuing events (via websockets) to game clients based on movement updates/positioning rather than the typical engine.renderLoop(). I don't need the updates to be real-time, but do need them to occur 'quickly enough' (e.g. every 100ms) that my game-server can keep up with the number of objects per-scene. Does managing my own engine.render() seem sane? (Now that I write this out I feel that updates and rendering are unrelated. I guess we'll see...) 3) For geometry collision, I'd like to have "proximity" and "actual" collision-testing; perhaps BoundingSphere for quickest/optimal proximity-testing, and BoundingBox derived from a mesh for actual collision. Good idea? Terrible? I'd love to hear the community's thoughts, and thanks for the amazing NullEngine update!
-
Hey! I'm using NullEngine on a server to check for certain conditions in a physics-enabled scene (using deterministic lockstep). As a simple example, I'm trying to find the specific step ID where a specific ball's y position falls below 0. My question is this: how should I set up the engine/scene/etc. in order to run these server-side simulations at the highest possible fps? Keep in mind that I want to be able to derive a list of step IDs on the server that correspond with specific events (re: ball.position.y < 0), and then have that same exact scene play in a browser with the same exact events matching the same exact step IDs.
- 2 replies
-
- nullengine
- physics
-
(and 2 more)
Tagged with: