three.js

Artificial intelligence functionality in three.js


Does Three.JS have a function or capability of AI( Artificial intelligence )? Specifically let's say a FPS game. I want enemies to look for me and try to kill me, is it possible in three.js? Do they have a functionality or a system of such?


Solution

  • Webgl

    three.js

    javascript

    I want enemies to look for me and try to kill me

    Yes, three.js is capable of doing this, you just have to write an algorithm using three's classes. Your enemies would be 3d objects, casting rays, intersecting with other objects, etc.

    You would be building a game engine, and you could use three.js as your rendering framework within that engine. Rendering is just one part of it. Think of a 2d shooter, you could make it using a 2d context, but you could also enhance it and make it 2.5d, by working with a 3d context. Everything else can stay the same.

    any webgl engine that might have it ? or is it just not a webgl thing

    Unity probably has everything you can possibly think of. Unity is capable of outputting WebGL, so it could be considered a 'webgl engine'.

    Bablyon.js is more engine like.

    Three Js is the best and most powerfull WebGL 3d engine that has no equal on the market , and its missing out on such an ability

    Three.js isn't exactly a 3d engine. Wikipedia says:

    Three.js is a lightweight cross-browser JavaScript library/API used to create and display animated 3D computer graphics on a Web browser. Three.js uses WebGL.

    so if i need to just draw a car, or a spinning logo, i don't need them to come looking for me, or try to shoot me. I just need them to stay in one place, and rotate.

    For a graphics demo you don't even need this - with a few draw instructions, you could render a full screen quad with a very elaborate pixel shader. Three gives you a ton of options, especially if you consider all the featured examples.

    It works both ways, while you can expand three.js anyway you want, you can strip it down for just a very specific purpose.

    If you need to build an app that needs to do image processing, and feature no '3d' graphics, you could still leverage webgl with three.js.

    You don't need any vector, matrix, ray , geometry classes. If you don't have vector3, you probably cant keep planeGeometry, but you would use bufferGeometry, and manually construct a plane. No transformations need to happen, so no need for matrix classes. You'd use shaders, and textures, and perhaps something like the EffectsComposer.