As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [javascript]

"JavaScript (sometimes abbreviated JS) is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles." From Wikipedia. http://en.wikipedia.org/wiki/JavaScript

Filter by
Sorted by
Tagged with
1 vote
1 answer
514 views

Do you need to know JavaScript to make games with RPG Maker?

Do I have to know how to code in JavaScript to make good games in RPG Maker MZ? I'm asking cause I know you don't really have to code in RPG Maker. I already tried some programming languages, so I ...
Inerzja's user avatar
  • 11
0 votes
0 answers
11 views

Mixamo -> Blender -> BabylonJS empty scene

I am following this tutorial on babylon.js and managed to export a .babylon file, but when I load it with: ...
Purefan's user avatar
  • 101
1 vote
0 answers
29 views

steering behaviors collision avoidance: vehicle shaking before arrive at destination

I have made a test sketch of collision avoidance using javascript, as you can see right here. I want the vehicle to move to the clicked location, avoiding obstacles on the way. It is working, but not ...
Ricardinho's user avatar
0 votes
0 answers
23 views

Player Jumping inconsistent and bugged

I am having a lot of different issues while coding player jumping for my game. Sometimes when the player hits the jump key the jump is delayed and/or doesn't jump to the heigh it usually does. I am ...
cs6413110's user avatar
1 vote
1 answer
60 views

How to draw/calculate a parabolic arch to hit stationary target in Javascript

First off I must admit I'm really not good at math and am trying to learn but have had a hard time finding examples someone like myself can follow. I'm trying to figure out how to draw and calculate ...
cluelessgamedev's user avatar
0 votes
0 answers
59 views

How can i rotate an object based on the finger position?

I am using Lens Studio to build an AR effect and trying to use the position of the hand tracker fingertip to make a cube rotate. For example, as I move my finger on the x-axis the cube rotates in the ...
Harry's user avatar
  • 141
1 vote
2 answers
94 views

How to publish WebXR game on Quest or Steam stores?

I would like to develop a simple and small game for WebXR so that Quest, Index, etc. can play it. I would eventually like to be able to put it on the Quest store and Steam. Is there a way to publish a ...
Imperial A's user avatar
0 votes
1 answer
40 views

Adding requestAnimationFrame in isometric Tile grid Code is not working

Hi There this is my first Post on gamedev, and i hope everyone understand what i want :) First of all my Code is an very Personal Version from one Github Isometric Map. I Tryd now 2 Days to Add the ...
Tobias B.'s user avatar
1 vote
1 answer
53 views

How to instantly break method call?

I'm making 2d Mobile game using JavaScript. I have method that controls every character (Dumb AI) on battleground. It using recursion to call another action. I want to add debuff system and had little ...
Jakub Dobrzeniecki's user avatar
0 votes
1 answer
31 views

Why is this code keeping the listener which should be removed instead?

I am having some issues figuring out why this code still lets btn_1 call the function setstate3(). There is a function ...
subtlefly's user avatar
0 votes
1 answer
14 views

why does my button lose the changed cursor and mouseover behaviour as soon as I attach a class to my file?

Using adobe animate cc - exporting to HTML5 and coding in JS (or at least trying to) If I just hit cntrl+enter in adobe animate the button works as expected. If I run the app from a web server using ...
subtlefly's user avatar
0 votes
2 answers
250 views

How to create global function for all .JSLIB files?

I can't understand how to work with .jslib files. I don't understand the syntax of this type of file. Also I couldn't find any easy explanation of it The problem ...
EzioMercer's user avatar
0 votes
0 answers
57 views

How can I seamlessly loop a video (webm since it has transparencies) in javascript canvas?

I am trying to play a video from beginning to 10 seconds, then loop the video from second 3 to 10 untill a key "c" is pressed. if it is pressed once, play the video from where it is ...
KonMos's user avatar
  • 11
0 votes
0 answers
45 views

How to distribute values in a grid based system

Context: I'm working on a simple environmental simulation in Javascript. I created some simple plants that grow, reproduce, and pass along their traits to their offspring. The simulation was pretty ...
Joe Poppins's user avatar
0 votes
1 answer
100 views

How to stop player when they hit an axis aligned bounding box?

I'm in the process of creating a game using electron and HTML5. It's going to be a pretty basic story-based platformer, but I'm ...
Tyler Selden's user avatar
0 votes
0 answers
34 views

How do i get this web app to use the up joystick button as an input

There is this reaction time test app that calculates the reaction time from the time you press a button, it works with the joystick buttons except for the directional buttons, this is the app: https://...
Amine Messai's user avatar
1 vote
1 answer
126 views

Randomly distribute damage among allies

Let's say I have regiments of varying sizes, 500, 1000, 4000 troops. I want to distribute 1000 troops worth of losses to them so that in aggregate they lose 1000 troops. I want to do it as a ...
Harry's user avatar
  • 167
0 votes
0 answers
61 views

How to create a basic strategic AI?

I started creating a Vue3 version of the classic Sid Meier game Colonization. I have the basic player mechanics in place and even created a map editor. So I have 3 of the 4X in place: Explore, Expand ...
Thomas's user avatar
  • 101
1 vote
1 answer
241 views

How can I protect against a cheater changing variables on the client?

I built a multiplayer fighting game with impactjs, socket.io and nodejs and faced with "change variables hack" (I want to call it like this). All my current logic with jump, running, shoot ...
李白 puer's user avatar
0 votes
1 answer
98 views

How to spread circles evenly around a point?

In my game there's a part where a bunch of circles need to evenly spread around a point. Like in this demo below: ...
Ryan Peschel's user avatar
1 vote
1 answer
266 views

Algorithm for taking the shortest path between two XY coordinates

I am making a simple game in Phaser (but the library doesn't really matter). I have an enemy that is moving towards the player on a 2 dimensional grid. I have written some code that makes the enemy ...
yesman's user avatar
  • 113
0 votes
1 answer
128 views

Invisible sprites with requestAnimationFrame

I'm trying to animate a sprite sheet. I have a single image, and multiple objects of the same type but drawn at different locations on the canvas. What I'm trying to do is have each object move with ...
polendina's user avatar
0 votes
0 answers
59 views

Octree build time crashes page for complex mesh

Using the standard three.js FPS example of octree implementation with a more advanced mesh, crashes the page on load. My first idea is to write a few functions to save the octee data to a file, then ...
Yeets's user avatar
  • 101
0 votes
1 answer
58 views

How do I go about creating images, which are units with traits?

Lets say there are 5 units, displayed as images on an html5-canvas. Each image (unit) has a different size. For the game I need to know the size of that unit, and also it's middle point. How and where ...
23rfew's user avatar
  • 1
0 votes
1 answer
126 views

How to send a JS game using a Discord bot?

I have made a JavaScript game. Now I want to make a Discord bot that embeds it in a message, so a reader can click on the embed to play the game inside the chat. Something similar to this Snake game. ...
amazing mustard's user avatar
0 votes
1 answer
157 views

Efficient calculation of billboard sprite transformations

I'm currently adding a billboard mode to animated sprites and static sprites in my 3D engine. The code below works fine, but I want to know if a more optimized solution exists. I've heard about ...
Ra1jin's user avatar
  • 3
0 votes
1 answer
51 views

Remove 2D images from layer where overlapping layers hide them completely

I'm creating a 2d game (engine written in JavaScript) with layers system. I would like to have some post process to optimize the images and the layers. If there is too many images in one layer it ...
TreantBG's user avatar
  • 147
0 votes
0 answers
67 views

Streaming animation data via WebSockets

I have a 3D character model and I am streaming animation frames from a server to the client via a WebSocket (I am using three.js). I need some advice on how to correctly integrate the streaming data ...
ali's user avatar
  • 1
0 votes
0 answers
97 views

How can I fix this wall jittering in capsule to octree collision?

In the three.js example for a first person game https://threejs.org/examples/?q=game#games_fps you should notice that at the corners it gets stuck, seemingly because it collides with one side, then ...
B''H Bi'ezras -- Boruch Hashem's user avatar
0 votes
0 answers
117 views

Game networking with physics different client and server languages

We are currently having only "turn based" multiplayer games in our party game lobby system. Now we considered to add realtime multiplayer games as well, for example golf in 3D. Our current ...
HodorKing's user avatar
0 votes
1 answer
122 views

Multiplayer game - Player position updates transmission pattern

I'm building a very basic 3D multiplayer game using Three.js and Socket.io where all the player does is move in an environment. Considering there will be ~ 100 players in a single room and all data ...
bhachawl2298's user avatar
0 votes
0 answers
165 views

How do I respond to AABB collisions?

I'm coding a physics engine in Javascript. Forces, Gravity, Friction, AABBs are taken care of. Now, the big question: how do I respond to AABB collisions? Right now, when an object collides, it prints ...
Andrey's user avatar
  • 1
1 vote
1 answer
46 views

How should I share the states amongst all the executions of a Behaviour Tree triggered from all ticks?

I'm still learning about Behaviour Trees and my understanding of the "blackboard" is essentially a state object. When passing the state object through the ticks to the function calls (which ...
xenon's user avatar
  • 427
0 votes
1 answer
83 views

Creating a Game in Three.js do i share camera, scene objects?

Im creating a game with React and Three.js and vanilla Javascript, i have several clases, representing objects in the game, do i need to create a camera, scene, renderer for each class or i simply ...
Jorge Carretero's user avatar
1 vote
0 answers
176 views

Aircraft simulation

Trying to get a "semi" realistic aircraft simulator. I'm pulling my hair out because I just can't get the math right. I'm not looking for super realistic but want to at least get some ...
K2xL's user avatar
  • 111
0 votes
1 answer
61 views

JS 2D top down movement doesn't act as expected

I realise this is very similar to other 2D movement questions already posted but cant find a solution that fits the behaviour I'm looking for, so I'm posting in the hope that someone more ...
Gavin Hunt's user avatar
1 vote
0 answers
414 views

How to make an update loop in a Node.js game server

I'm making a multiplayer game with a Node.js server, and I'm searching for how to write the game loop. I'm currently using a setinterval every 15ms, but someone ...
Wild Royal's user avatar
0 votes
3 answers
189 views

How to prevent a huge backlog of physics calculations from freezing browser when tabbing out of browser game?

I'm developing a browser game and am using the timestep implementation from the famous Fix your timestep! article. It works perfectly, but there is one problem. If you tab out of the tab and then come ...
Ryan Peschel's user avatar
0 votes
1 answer
201 views

Struggling with breadth first search for hex grid

I cant seem to get breadth first search right. Ive gone through redblobs implementation guides of hex grids and have that all figured out but pathfinding is proving to be difficult. So I have a search ...
cwahlfeldt's user avatar
0 votes
1 answer
232 views

How to make a cubemap image with perlin noise?

Recently I just finished a program which makes a plane image using perlin noise. Now I want to make that image a cubemap image. This because I want to apply it to a planet (which was made from a cube)...
nicolas osorio bustos's user avatar
1 vote
1 answer
379 views

Besides 3d, why would I need to use a canvas instead of using plain css and html?

Purely speaking for the use of 2d. First off, redrawing the canvas on every frame seems quite inefficient. Even when you can create multiple to not redraw everything etc. CSS animations to move ...
rewfsdv's user avatar
  • 13
0 votes
2 answers
150 views

How to efficiently do one-to-many collision checks?

Scenario: 4 players, each can have from 1 to 100 pawns. I want to be able to efficiently check if Player 1's pawns collides with Player 2, 3, and 4. Currently I have an AABB check, done first on ...
Ardi's user avatar
  • 15
-1 votes
2 answers
91 views

How to interpolate angular data properly

I have been trying to interpolate raw angular data in degree (for a flow map grid) but any attempt fails because there is always two path, and I can't figure out how to interpolate on the shorter one ...
user29244's user avatar
  • 327
0 votes
0 answers
82 views

Three.js Animate Text error geometry.faces

In this three.js Text example they animate text, i am trying to implement it on React/Three.js but i got the error TypeError: can't access property "length", geometry.faces is undefined in ...
Jorge Carretero's user avatar
0 votes
1 answer
204 views

Alternative to redrawing the background canvas for camera movements?

I have multiple canvases placed on top of each other for different layers (background, game objects, foreground). I was expecting this to allow me to have the background and foreground update at a ...
Batash's user avatar
  • 3
0 votes
1 answer
217 views

How to add a texture inside a specific area in a canvas in javascript?

How could I draw a texture between the bottom of the canvas and below the green line, in javascript? I dynamically add coordinates in a canvas, then draw lines between these points. EDIT : Solution: ...
Leo_xfh's user avatar
  • 11
1 vote
0 answers
415 views

What is causing my touchstart event to end while I'm still touching the screen, and how can I fix that?

What I'm trying to do: I'm trying to add touch controls to games created with the html canvas and JavaScript so that they can be used on mobile / tablet devices. The controls should simply move a ...
Fishbite's user avatar
0 votes
0 answers
50 views

Right Axis warps on 3D planet's equator

I am using JavaScript and WebGL for a game which rotates a spaceship around a 3D planet. Below is the code for rotating a sphere spaceship and sphere planet. I looked over your camera code and now it ...
Jon White's user avatar
0 votes
1 answer
273 views

Trouble using delta in my movement function

...
Buckets's user avatar
0 votes
1 answer
139 views

Interpolate colors between vertex in a plane

So I have this plane generated with two different Perlin noises. It has mainly 3 regions, divided by color. I want to smooth out the lines, to create a "gradient" so there are no abrupt ...
alon's user avatar
  • 5

1
2 3 4 5
28