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
0 votes
0 answers
39 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 ...
user avatar
0 votes
1 answer
48 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 ...
user avatar
0 votes
0 answers
57 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 ...
user avatar
  • 1
0 votes
0 answers
33 views

How to hide unused quads in quadtree that are not close to the camera?

This is my Quadtree implementation in threejs. It works fine when the camera passes some threshold and the quads need to be created. The problem is how can I hide the quads that are not needed anymore ...
user avatar
1 vote
1 answer
28 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 ...
user avatar
  • 417
0 votes
1 answer
37 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 ...
user avatar
1 vote
0 answers
68 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 ...
user avatar
  • 111
0 votes
0 answers
27 views

How can I run Javascript + WASM on game consoles?

Is there a way to run Javascript and WASM on game consoles or platforms that don't support JIT? I see V8 as a good option except that its JIT-less mode doesn't support WASM as far as I know.
user avatar
0 votes
1 answer
26 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 ...
user avatar
0 votes
0 answers
82 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 ...
user avatar
0 votes
0 answers
44 views

How to render the border of a collection of many overlapping radii on the surface of a sphere

I am developing a 3D game with THREE.js where all players are represented as points on the surface a sphere. The player A can move on the surface of the sphere within a radius of X meters. If another ...
user avatar
  • 1
0 votes
3 answers
69 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 ...
user avatar
0 votes
1 answer
67 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 ...
user avatar
0 votes
1 answer
65 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)...
user avatar
1 vote
1 answer
124 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 ...
user avatar
  • 13
0 votes
2 answers
89 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 ...
user avatar
  • 15
-1 votes
2 answers
49 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 ...
user avatar
  • 197
0 votes
0 answers
46 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 ...
user avatar
0 votes
0 answers
59 views

Issue with Steam Web API

So, I have been working on this for several hours, but so far it doesn't look like there's going to be a solution. ...
user avatar
0 votes
0 answers
29 views

How to set boundary for 3D objects in Javascript

[EDIT] Found the answer, solution in comment I have this 3d first person game made with Js/css. I have to set boundaries or clipping to the map as the character moves around the 3d object, I only need ...
user avatar
0 votes
1 answer
60 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 ...
user avatar
  • 3
0 votes
1 answer
36 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: ...
user avatar
  • 11
0 votes
0 answers
25 views

Javascript Game Collision Shaking

I have a problem with collision shaking. The problem doesn't come from the collision, but from client side (sometime the it's smooth and sometimes not). Here is a video to show it : https://www....
user avatar
1 vote
0 answers
130 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 ...
user avatar
0 votes
0 answers
44 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 ...
user avatar
0 votes
1 answer
68 views

Trouble using delta in my movement function

...
user avatar
0 votes
1 answer
118 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 ...
user avatar
  • 5
0 votes
1 answer
194 views

Assign biomes to areas with a Voronoi noise function

I've created this terrain based on a Voronoi noise function: This is how it looks without the elevation: I want to assign biomes to the polygons following certain rules and use the slope on the ...
user avatar
  • 5
0 votes
0 answers
39 views

How should I modify my terrain according to the biome? [duplicate]

I have this terrain I generated using Perlin Noise layers whose colors are applied based on the height of the vertex, just for reference before I am done being clear about how I will implement the ...
user avatar
  • 5
0 votes
1 answer
273 views

How to calculate item drop rate?

I am developing an RPG that will be played in the browser, so far the development is going very well. However, I reached a point in the project where I'm "stuck" because I can't find a good ...
user avatar
  • 197
0 votes
1 answer
309 views

find one meter to scale in earth heightmap

I have a heightmap that scales from 0 to 255. the map is only for elevation (discluding water and ice) what would be the appropriate way to calculate the scale of one meter? heightmap below
user avatar
0 votes
1 answer
71 views

Why does my enemy go the other way when the player moves more than a few pixels away from (0, 0)?

My enemy initially goes to the player when the game starts, but when the player moves away from its starting position, it goes away. Code: ...
user avatar
1 vote
1 answer
90 views

Cannot properly get 2D top-down tile-based collisions

I am using HTML, CSS, and plain JavaScript for a 2D top-down tile-based simulation. I am trying to do collisions in which, for example, if I move up and hit the ceiling collision tile, I cannot ...
user avatar
  • 35
0 votes
1 answer
49 views

Technology behind retrogames.cc video games

What is the technology used in embedding the games on the retrogames.cc site? I managed to see an HTML tag, but I don't know how they are inserted, are they simulators of real games?
user avatar
  • 101
0 votes
0 answers
30 views

Hashing images like CDs for Monster Rancher style randomizations

I have been kicking around an idea for creating a web based game where they can upload images in order to create random monsters/items. This I thought was most similar to how monster rancher ...
user avatar
1 vote
0 answers
67 views

Jittery entity Interpolation when tick-rate exceeds framerate

In my current game implementation, our game servers send data to the clients only 10 times per second (~every 100ms). However, due to recent changes, we are now expected to change the server tick-rate ...
user avatar
0 votes
0 answers
47 views

In-game computation of heat maps OR pre-computed floyd warshall algorithms for AI path problems

I am working on a project, in developing a simple game. We need to have bots that shoot, ram, flee and chase other bots/players. Currently, I pre-compute my Floyd warshall algorithm so it is ...
user avatar
3 votes
1 answer
92 views

Storing stateful function-based actions in a JSON

System: My game uses an "ECS + event queue" architecture where every tick, various events change the state of JSON-able data. Plain JS objects. Problem: I want to be able to save the game-...
user avatar
3 votes
1 answer
193 views

Entity Component System - How to detect what entity to update

everyone. I'm kinda new to game dev, I saw the idea of the ESC system and I'm inlove with it. I wanted to integrate something like that in my game, so I started rewriting my code. . I have a ...
user avatar
0 votes
0 answers
54 views

How to make sure that I get the same result in a multiplayer game if the server is not authoritative?

I am making a simple 2 player browser game, where there's a rotating entity which jumps from one square to another on mouse click. Server is on NodeJS. To determine which square to jump into, I used ...
user avatar
  • 15
0 votes
1 answer
52 views

How to get the up direction given a point and rotation

TLDR: I'm asking for the direction of the up vector of an entity that can rotate in JavaScript that has a x, y, and ...
user avatar
-2 votes
1 answer
293 views

How do I port a game made with Scratch, Pygame, or JavaScript to the Switch?

I've been making my own games in many different languages (mainly Scratch, Python 3 with Pygame, and JavaScript), but, so far, none of them have been ported to the Nintendo Switch. How can I do this?
user avatar
0 votes
0 answers
8 views

Converting single number to tileatlas coordinates [duplicate]

I'm trying to make a 2d tilemap based platformer, but I don't know how to convert single numbers to a tilemap coordinate. Imagine a map: map = [[10, 12, 24],[12, 14, 5],[13, 011, 19]] (numbers are ...
user avatar
0 votes
1 answer
196 views

How to prevent blurry pixel art when the camera is following a character?

I'm developing a top-down pixel-art game and previously I was having the camera follow the player like this in the camera's update function (called every frame): ...
user avatar
0 votes
1 answer
33 views

gl.drawArrays() not rendering whole mesh

I have a mesh that is generated using the marching cubes algorithm that is drawn using gl.drawArrays(), however the whole mesh isn't rendered, only part of it. I checked if the count I was specifiying ...
user avatar
0 votes
1 answer
59 views

3D AxisAngle spins at 180 degrees

I am using the Axis Angle technique on objects so that they are oriented away from a planet surface like in Super Mario Galaxy. I am using two unit vectors [0,1,0] and a normal vector from the planet. ...
user avatar
0 votes
1 answer
468 views

How to rotate an image around its center point in a JavaScript canvas?

I have this function to get the rotation angle from my sprite and a target: ...
user avatar
0 votes
1 answer
25 views

using javascript canvas.context.scale resets custom font

I am making a HTML5 game using javascript with canvas. I am implementing a custom font adding @font-face style tag to header in the .html file, then if I set ...
user avatar
1 vote
0 answers
33 views

How can I make this motion collide against a wall

EDIT I've actually commented out the motion in my code and adapted it to try reproduce this post.After a chat with @DMGregory he told me to use velocity reflection but as you can see in the following ...
user avatar
  • 123
0 votes
1 answer
68 views

How to check whether the user completed their missions?

I am working on a coding/gaming application. I am currently stuck in the daily missions part. So, the user receives some missions each day, such as solving a problem, following another user, or ...
user avatar

1
2 3 4 5
28