Code Monkey home page Code Monkey logo

Comments (10)

fenomas avatar fenomas commented on June 1, 2024 2

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..

from noa.

fenomas avatar fenomas commented on June 1, 2024 1

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 noa.playerEntity. So changing things just means removing the default components and adding different ones.

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.

from noa.

fenomas avatar fenomas commented on June 1, 2024 1

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).

from noa.

Vixeliz avatar Vixeliz commented on June 1, 2024

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

from noa.

fenomas avatar fenomas commented on June 1, 2024

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!

from noa.

Vixeliz avatar Vixeliz commented on June 1, 2024

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?

from noa.

Vixeliz avatar Vixeliz commented on June 1, 2024

Would you consider upstream making this movement code

var fb = inputs.forward ? (inputs.backward ? 0 : 1) : (inputs.backward ? -1 : 0)
based off of a value from 0 to 1 for analog control? It might be a good start if you are interested in controls for more platforms

from noa.

Vixeliz avatar Vixeliz commented on June 1, 2024

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?

from noa.

lknlknim avatar lknlknim commented on June 1, 2024

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.
Temporarily using it in Webpack Vue project but the HMR is slow.

from noa.

fenomas avatar fenomas commented on June 1, 2024

@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.

from noa.

Related Issues (20)

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.