-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any way to use this as an es6 module? #174
Comments
Hi! For the es6 module, that's a great idea and it would be good to support. However noa uses the 3D engine Babylon.js as a peer dependency, and I don't think it publishes prebuilt e6 modules. If I'm wrong about that then I think the same should be doable here (but I haven't looked closely yet). For changing player controls - yes! The engine uses an ECS internally, and handles player inputs/controls/movements by attaching components to the entity For example, here is the default movement component (that applies physics forces for moving/jumping/etc), and here is the engine code that adds that component to the player. So the easiest way to change stuff is to make a copy of the movement component, change whatever, and then do something like: noa.entities.createComponent( myComponentDef )
noa.entities.removeComponent(noa.playerEntity, noa.entities.comps.movement.name)
noa.entities.addComponent(noa.playerEntity, myComponentDef.name) The engine also adds components to do stuff like make the camera follow the player, consume key presses to cause movement, etc., so in general you can change any behavior by removing the default components from the playerEntity and adding new ones. |
Hmm interesting. With that said do you think it would be possible to implement other control methods such as touch, game pad, and vr? As for es6 modules I believe babylonjs cdn files can be used as modules https://www.npmjs.com/package/babylonjs you c read about their cdns at the top of the description. However I may be wrong |
Hi, yes alternate input systems aren't in place at the moment but they'd be relatively straightforward to implement. Feel free to ask any questions! |
Awesome thanks! I'm very interested in expanding noa to be more of a game base(like minetest if you know that project) than a framework for voxel rendering. I might look into making a library on top of noa that allows for some things like universal controls(vr, mobile, controller), multiplayer, mods, etc. Does noa have a discord server or something? |
Would you consider upstream making this movement code noa/src/components/receivesInputs.js Line 49 in d9fe5d1
|
Ooh that's a really good idea. I haven't looked closely at gamepad APIs but if they work as advertised this would be very straightforward to implement. I can't get to this right away, but I'm adding a tracking issue (#175) and I'd like to support it. Or if you want to work on it, I'm happy to answer questions and take PRs. For mobile controls, all the required APIs are there but a game client would need to create its own button overlays or thumb button, etc, and issue its own events. The specifics would change from game to game so I'm not sure if there's anything the engine should do here. But now that I think about it, if there's a UI library somewhere for gamepad-like controls on mobile, supporting that library by default would be a good first step.. |
Awesome to the tracking issue. As for gamepad api it is really simple to implement I may make a pr. One last question would you ever be interested in multiplayer support built into this library? Or maybe as an official separate addon library such as noa-networking? |
Thanks! Yes, the theory is that this engine should be abstract enough that it doesn't know whether it's part of a single player or a multiplayer game. Basically it's a dumb client that renders voxels and entities, but it doesn't know whether you're generating the voxel data and entity locations locally, or receiving them from a server, etc. So there's nothing multiplayer-related in this repo, but the engine tries to do everything necessary to support it. If you check the demo apps in the readme one or two of them support multiplayer, but I don't know a lot about specifically what other libraries they use (or whether they're FOSS). |
Is it possible to use this engine with Vite bundler? The require.context in entities.js seems to be webpack specific and I can't figure out how to properly use this as dependency in a Vite Vue/Svelte project. |
@lknlknim Hi, there is an issue for this that I forgot about - I'll pop over and fix it now. Should be fixed in #develop in a few minutes. Also I'll close this since several topics have been touched, but feel free to open new issues for anything else. |
Basically the title I would love to be able to use this without node and just as a es6 module
Edit:
I'm also curious can i just use the rendering portion of this but set up my own player controller and inputs?
The text was updated successfully, but these errors were encountered: