Pathfinding.js in PlayCanvas - javascript

I am making a space game using Playcanvas. I want to add some AI to ships that fly around and shoot. I don't have any idea of how to impliment Pathfinding.js on a 3D space, let alone, using the PlayCanvas Script API as well. Does anyone know how to:
- Implement Pathfinding.js in a 3D Space
- Implement Pathfinding.js into a 3D PlayCanvas World
- Impliment Pathfinding.js into a 3D Object, inside a 3D PlayCanvas World
- Add basic tasks such as follow, attack, run away using Pathfinding.js
I am kind of a noob at Pathfinding.js, even using 2D, so please be exact, if you want to answer.
Thanks to all of you guys who work hard to help noobs like me!
Thanks much,
Noah

Pathfinding.js provides functionality for 2D pathfinding. Note that a fork of Pathfinding.js exists for 3D environments.
Some PlayCanvas projects that use the 2D version of Pathfinding.js do exist. Namely:
Zombie Pac-man (map.js uses Pathfinding.js API)
Last Line of Defense (map.js uses Pathfinding.js API)
Note that both of these projects are based on PlayCanvas' previous scripting system. New projects in PlayCanvas default to a newer (better) scripting system, but generally, the code will be very similar.

Related

How to make 3D animation with Canvas

I have background on Canvas 2D context, but i want to perform a 3D animation like this one, is Three.js library the best choice to do such animation? Can you point me to some useful tutorial or documentation that may help. Thanx in advance.
That's one of the most common choices.
As WebGL enables OpenGL without the need for libraries, you might also do it with just Vanilla JS but that would be harder as WebGL doens't offer much more refinement over the raw and crude OpenGL.
Apart three.js, you could also try GLGE or PhiloGL but as Three.js is the most popular I would recommend to go for it if you have no specific requirement.
Looks like the demo you linked to is using a canvas library called Clay.js. Not one that I've personally heard about until now. For 3d in canvas the most popular one I know of it Three.js as you already mentioned. It has the benefit of supporting webGL as well (browser based openGL variant).
Three.js has limited documentation and some examples but outside of some books you may buy there isn't a lot of hand holding. You basically need to dive in and start coding. Here are some online resources that may help you get started (not necessarily all focused on THREE.js):
http://aerotwist.com/tutorials/getting-started-with-three-js/
http://learningthreejs.com/
http://learningwebgl.com/blog/
To make it easier to work with THREE.js Jérôme Etienne created a project called tQuery which you can think of kinda like jQuery. A wrapper to make it easier to get your hands dirty. Here's a video where he shows how to create a webGL game in 10 minutes.

Temple Run Breakdown

This question is about understanding how a game like temple run might be implemented in HTML with/without using the canvas. I have a vague idea about how swipeLeft, swipeRight
etc. might be implemented. But I am not able to gauge how the environments might be developed.
I am not asking for any help with the code here .I just want to have your opinions about implementing the environment. Is it just one huge sprite? If so, how will the user see random environments in the game each time he spawns?
It is not a single sprite. Assuming we're talking about the same Temple Run, it's a 3D game, probably using OpenGL. The fog effect means the game doesn't have to render objects in the distance. If you want to make a similar game, I suggest you look at one of the fine 3D game platforms available for Android and/or iOS.
You can do 3D games in HTML, and there are libraries that help, but unless you're making a website and not a mobile app, then it's better to do it native.

2D interactive animation engine in HTML5

I'm looking for a simple JavaScript library or framework to create interactive 2D animations in the browser. (Excuse the buzzword in the title, but I'm not set on any particular rendering technology like Canvas or SVG.)
This should make it simple to draw and animate arbitrary (though not very sophisticated) shapes on a canvas screen and allow users to select and move these shapes as objects (kind of like a very basic RTS game engine).
Ideally, the following features should be supported (directly or indirectly; I'd implement it myself if necessary):
panning
zooming
fisheye partial zooming
box selection (selecting multiple objects by drawing a box around them)
Not being familiar with such things yet, I find it tricky to research what's out there (e.g. regarding search terms). Also, I have no illusions about some magical package that doesn't require any effort on my part - indeed, I'd prefer simple and readable libraries so I can learn about the basics by reading the source.
If you like simple libraries, perhaps take a look at GameJS. It claims to be "a thin library on top of the HTML5 canvas element." It's a port of PyGame to JavaScript, which in my experience is a fairly nice abstraction layer that at the same time doesn't overdo it.
If that doesn't cut it, have a look at this list of JS game (and animation) engines.
You probably did make a search and found dozens of js game engines. I will just narrow it down for you. It is impossible to just spit out one single js game engine. Also, you might find some to be more appropriate than others based on the type of game you want to make. So here they are
LimeJS
Impact
Crafty

Javascript game framework or library for board games?

I am trying to build a card game in Javascript. Currently I am using Raphael to draw my graphics, but I'm bad at math, like really bad. I'm wondering if there is a library or framework out there that would allow me to build a card game in Javascript without having to manually figure out the x and y coordinates of every object I want to draw.
You could look into a Javascript Game Engine, depending on your exact requirements you should find one for you.
Usually a game engine include facilities to manage sprites, layers, and scene; handle events; easy animations; redrawing regions, detecting collisions, etc.
Render Engine is an open source game engine that seems pretty good.
Many more are available under a commercial license.
A list of both open source and commercial game engines is available here, with brief descriptions to allow you to quickly find your way (discarding the not-yet-mature engines and choosing based on features or focus).

Is there a water physics engine for javascript?

I want to make a demo using javascript and <canvas>, I was thinking of doing a little moving creature, seen from the top and swimming in a water environment.
Concept "art" :
Is there something I can use to start this project, or do I need to create everything from scratch ?
Here's one demo
http://code.almeros.com/code-examples/water-effect-canvas/
http://rumpetroll.com/ is open source and has the kind of movement you could probably modify to do as you wanted
I'm not sure what exactly do you intend to simulate (or whether I got the conceptual art :) ), but this might be a direction:
processing.js is not a physics engine, but rather a graphics library port to javascript (utilizing canvas) - http://processingjs.org/ .
However, you might find something in their demos that is similiar to what you are trying to create.
One of the original processing library examples has a nice fluid simulation using a particle system, and it runssuccessfully on processing.js - http://processing.org/learning/topics/fluid.html , however the framerate is very poor. You can try it yourself at http://processingjs.org/learning/ide - just copy&paste the code from the example (and prepare for your computer to crawl to a halt).
You can try to adjust the particle numbers (pnum), to improve speed, and play around with other variables.
Sorry I don't know of a library, but I did see a water physics in canvas demo recently:
http://hakim.se/experiments/html5/wave/03/
Maybe you can get some inspiration there...you might be able to accomplish it with a normal JS physics library like Box2DJS.
Just an idea, but you could search for a Java engine and then use GWT to compile it to Javascript.

Categories