Comments (10)
Ya my current server uses websockets. It's very simple though. It essentially just relays the player's position to all the other players. But I need to figure out how to represent the world on the server side especially if I want to add AI. I will look into running three.js on the server side. It probably won't be the most efficient solution but at least it would allow some code parity.
Yuka looks really cool for what I'm trying to do. I'm excited to try it!
from yuka.
Actually, if I just use a nav mesh with Yuka could I skip using three entirely?
Yes, at least on the server side. I don't think using three.js
or any other 3D engine is much helpful in addition to Yuka if your focus is just on implementing game logic.
BTW: The API style and math classes are quite similar to three.js
. If you already know three.js
, it should be a bit easier to get familiar with Yuka.
from yuka.
I can confirm that this works now, I just needed to reinstall yuka (maybe the version number should be increased)
Thank you @Mugen87 !
from yuka.
Some context: https://discourse.threejs.org/t/i-need-ideas-on-how-to-add-enemies-in-my-multiplayer-game/11006
Well, Yuka is just a bunch of classes with no rendering dependencies. So it's actually very easy to import Yuka into a node.js application and implement game logic. A very basic setup would look like so:
const YUKA = require( 'yuka' );
const entity = new YUKA.GameEntity();
setInterval( () => {
entity.position.x += 1;
console.log( 'New position:', entity.position );
}, 1000 );
This would update the game entity once per second. However, Yuka does not provide any kind of multiplayer/networking features you would normally find in a game engine. Writing a game server and the respective protocols is very difficult. So this would be a project of its own^^.
If you are interested, I suggest you start with studying how WebRTC and WebSockets work. Maybe you can build something on top of these Web APIs.
from yuka.
Actually, if I just use a nav mesh with Yuka could I skip using three entirely?
from yuka.
Hey @Mugen87 I've hit a snag with running Yuka on my node server. I'm getting this error when I try and load a NavMesh.
ReferenceError: fetch is not defined
at Promise (C:\Users\jack\bowdown\server\node_modules\yuka\build\yuka.js:18666:5)
at new Promise (<anonymous>)
at NavMeshLoader.load (C:\Users\jack\bowdown\server\node_modules\yuka\build\yuka.js:18664:11)
at Object.entities.init (C:\Users\jack\bowdown\server\entities.js:15:12)
I think Fetch is a browser API and doesn't work in node. I'm going to try and see if I can fix this myself (I've never contributed to an open source project and I would like to) But any advice you have would be helpful.
from yuka.
Try it with this npm package:
https://www.npmjs.com/package/node-fetch
We also use it in our unit tests which are executed in a node environment.
from yuka.
node-fetch doesn't seem to allow the use of relative urls. So I would have to also set up a local webserver just to serve the navmesh. I'm looking into other possible approaches. I'm thinking fs.readFile
might be my best bet. But that doesn't return a Promise so it would require some rewriting in Yuka
from yuka.
61f2aaf introduced NavMeshLoader.parse()
. You can now use the API like so:
yuka/test/unit_test/navigation/navmesh/NavMeshLoader.tests.js
Lines 158 to 170 in e729830
I hope this makes the class more usable for you 👍
from yuka.
maybe the version number should be increased
I've actually increased it from 0.1.0
to 0.2.0
.
from yuka.
Related Issues (20)
- WanderBehavior within Navmesh HOT 2
- Efficient way to find an intersection HOT 2
- jsdoc contradiction to code in GameEntity HOT 16
- Steering handling in `Vehicle.update()` ignores `GameEntity.maxTurnRate` HOT 4
- how to judge arriveBehave over HOT 1
- how to set initial mesh HOT 1
- Request: Pathfinding 3D HOT 4
- Yuka and Babylon.js HOT 5
- Building navmesh HOT 2
- Question: Best Practices HOT 2
- Question: NavMesh HOT 8
- Non-terminating while loop HOT 5
- Is there any way to add obstacles dynamically on a 2D grid? HOT 3
- Building with webpack and es6 modules HOT 5
- SteerBehavior - Vehicle facing the wrong direction HOT 3
- How to generate NavMesh automatically? HOT 3
- NavMeshLoader for Typescript throw reference error for fetch HOT 1
- need explanation for this formula HOT 4
- YUKA findPath is not detecting any collisions in Babylon.js HOT 3
- Pursuit Behavor duplicate gltf model HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yuka.