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
1 answer
15 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
  • 405
0 votes
0 answers
10 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
56 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
24 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
22 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
45 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
42 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
55 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
55 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
0 answers
28 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
114 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
80 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
46 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
41 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
34 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
24 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
43 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
29 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
22 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
102 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
31 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 on a flat plane. ...
user avatar
0 votes
1 answer
50 views

Trouble using delta in my movement function

...
user avatar
0 votes
1 answer
113 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
165 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
216 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
233 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
87 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
42 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
63 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
45 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
89 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
161 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
248 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
176 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
31 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
49 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
403 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
24 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
67 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
0 votes
1 answer
81 views

How to design a system that allows for custom equations of movement?

I'm developing a top-down shooter and I currently have a PhysicsSystem which operates on TransformComponents. Basically, it ...
user avatar
2 votes
2 answers
89 views

Need help with fixing Optimized Raycasting / Line of Sight algorithm

I'm trying to implement collision detection with raycasting for my 2D javascript game. The game uses equally-sized tiles as its level structure so to optimize collision detecton I'm trying to use a ...
user avatar
1 vote
1 answer
115 views

Should state and behavior be combined for Buffs? Cannot decide between data-driven and OOP approach

I'm writing a 2D roguelike that uses an Entity Component System and I'm having trouble deciding between the traditional OOP approach versus a data-driven approach to implementing buffs and debuffs. ...
user avatar
0 votes
0 answers
67 views

Solution for efficient time-keeping in Javascript games?

I'm developing a real-time browser roguelike using an ECS and currently I'm unsure of how to handle time. As of right now, whenever I need the current time, I just call ...
user avatar

1
2 3 4 5
28