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
1answer
29 views
0
votes
1answer
85 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 ...
0
votes
1answer
55 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 ...
0
votes
0answers
35 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 ...
0
votes
1answer
127 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 ...
0
votes
1answer
42 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
0
votes
1answer
67 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: ...
1
vote
1answer
65 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 ...
0
votes
1answer
27 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?
0
votes
0answers
29 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 ...
1
vote
0answers
46 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 ...
0
votes
0answers
36 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 ...
3
votes
1answer
74 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-...
2
votes
1answer
76 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 ...
0
votes
0answers
44 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 ...
0
votes
1answer
45 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 ...
-2
votes
1answer
137 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?
0
votes
0answers
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 ...
0
votes
1answer
135 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): ...
0
votes
1answer
22 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 ...
0
votes
1answer
43 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. ...
0
votes
1answer
191 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: ...
0
votes
1answer
16 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 ...
1
vote
0answers
31 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 ...
0
votes
1answer
56 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 ...
0
votes
1answer
77 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 ...
2
votes
2answers
79 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 ...
1
vote
1answer
93 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. ...
0
votes
0answers
43 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 ...
0
votes
1answer
337 views

Scope of 'this' - Cannot read property of undefined in collider and overlap function

I am working on my first 2D game with Phaser 3. I have set up VS Code with a node.js https server and run it to deploy the game on localhost. While the game gets compiled successfully and deployed, I ...
2
votes
1answer
99 views

Is it better design to store event effects within an Entity itself, or within a system?

I'm developing a 2D roguelike with an Entity Component System (ECS) and I've been struggling with this question a lot the past week. For example, let's say you have various effects that occur when an ...
0
votes
0answers
130 views

How to handle various collision effects within an Entity Component System?

Let's say we have three enemies, a bear trap, a fire trap, and a minotaur. When you walk over the bear trap, the game spawns an invisible entity that, upon the player colliding with it, slows the ...
0
votes
1answer
25 views

How to check if a line casted from one point to another point passes through a mesh?

Let's say we have two vectors A and B. Is there a way to use Three.js' Ray or Raycaster classes to cast a line between vector A and vector B and check is it passes through a mesh in the scene? I know ...
0
votes
2answers
505 views

What data structure do I use to store Archetypes in ECS?

I am implementing an ECS with "archetypes" similar to how they are defined in Unity: A unique combination of component types is called an Archetype. For example, a 3D object might have a ...
1
vote
0answers
55 views

How to play multiple sounds at once without reloading data?

I am making an HTML5 game, which involves one audio being played multiple times at once. I searched this issue up and found this: https://stackoverflow.com/questions/25654558/html5-js-play-same-sound-...
1
vote
1answer
210 views

2D moving objects in angle

Im making simple 2D space shooter with use of html5 and JavaScript. The idea is simple, shoot down as many aliens as you can. I made it to the point where I have player which can move and rotate, but ...
1
vote
1answer
46 views

How to add zombie arms to enemies in HTML canvas

I'm making a game with HTML canvas (not WEBGL). I have zombies that go to the center of the screen, but for now they are just circles. I want to give them two arms, like the arms players have in ...
0
votes
1answer
45 views

How to properly overflow 2D coordinates on an overflowing/circular map?

I made a simple Snake game designed for trying Snake bots. I thought the base map functions work, but now I found there is an error. What I need is to properly translate any coordinates outside the ...
1
vote
0answers
68 views

How can I deduce my RPG lags for better performance? [closed]

Okay, so I've started making a game using Khan Academy's Processing JavaScript, and I'm trying to delag it a bit since the framerate is very shaky. So, I've taken the advice of someone, and they told ...
0
votes
1answer
57 views

How do you make html elements not blurry

I was making a html game and all the elements are blurry is there a fix to this? I use css but it makes it blurry Code ...
2
votes
0answers
36 views

Tell if two polygons are colliding

I want to make a function like areColliding which takes two polygons as args. I also want to cover cases like and the dreaded because I am trying to create a ...
0
votes
1answer
40 views

How do I add a roof to a Html Game

I kind of new to making games been doing it for a few months and want to make games in a browser so I took the w3schools game example and I'm trying to add on to the game until I make a recreation of ...
0
votes
1answer
76 views

Is speed and direction generally combined into one vector, or separated into two?

Couldn't find this answered already, surprisingly. For example, for a game (in my case a 2D top-down one), there could be advantages to doing so. For example, whenever you want to change an entity's ...
0
votes
1answer
110 views

How to perform a sliding collision between a square and a circle?

Please point me to the duplicate if this has been asked before. I couldn't find it. Basically, I am creating a 2d top-down game where the player is represented by a circle, and the tiles are ...
0
votes
1answer
80 views

How to decide whether a Buff should be a component or a Buff object in an ECS?

I'm developing a top-down 2D game in Javascript using an Entity-Component-System architecture and I'm struggling with the question of exactly how to implement temporary buffs / permanent passives. For ...
0
votes
2answers
36 views

How to avoid entities flying far away when tabbing out and then tabbing back in?

I'm developing a game which uses a standard Entity-Component-System. Every frame, the PhysicsSystem runs, which, among other things, updates the position of ...
0
votes
0answers
47 views

How to inform pathfinding of solid objects blocking path?

I'm sure this has been asked before, but I couldn't find the thread. Let me know if you can locate the duplicate. So, I have a my level is an array of tiles, where a tile can either be solid or ...
3
votes
1answer
148 views

Why use sprite tile maps on the GPU in WebGL?

I'm trying to figure out the best way of rendering my layered tiled maps with WebGL, and have come across this tutorial several times: https://blog.tojicode.com/2012/07/sprite-tile-maps-on-gpu.html ...
0
votes
1answer
134 views

How to perform right-angle pathfinding?

I'm developing a procedural dungeon generator using pre-built rooms and currently I'm using A* pathing to create corridors to connect one room's door to another room's door. The problem with this is ...
0
votes
1answer
418 views

How can I publish a Python game on itch.io as html?

I'm making a game with Python, using Pygame. I want to publish my game on itch.io so that it's playable in the browser. Is there a way to do this? If so, how?

1
2 3 4 5
28