Skip to main content

Questions tagged [efficiency]

Filter by
Sorted by
Tagged with
10 votes
2 answers
4k views

Wondering if there is a more efficient way to store level data in my game?

I am trying to remake Super Mario Bros. in JavaScript and I am trying to figure out if there is a more efficient way to create and store the level data. I have created 1-1 and here's what the code ...
Jake Miahn's user avatar
0 votes
0 answers
78 views

Desynchronizing MonoBehavior's "Update" from the overall app or UI Toolkit graphic output rendering in Unity?

Is it possible to desynchronize Application.targetFrameRate and Monobehavior's Update() from the graphics output rendering rate ...
mike's user avatar
  • 481
0 votes
2 answers
1k views

Draw 2D circles/squares efficiently with Unity

I'm doing a lot of 2D simulations using Unity, and I usually instantiate a lot of squares/circles sprite. When the number of sprites reaches 1k or higher, the FPS usually reduces to 10-20, which makes ...
silverfox's user avatar
  • 117
0 votes
1 answer
1k views

More efficient/clean way of programmatically generating and customizing repetitive objects?

I am coding my UI in Unity C# with the UI Toolkit, and as I write more and more my code is getting quite annoying in terms of one particular issue. I find myself repeating many similar lines of code ...
mike's user avatar
  • 481
0 votes
1 answer
2k views

Does setting the alpha of a UI canvas group to 0 stop Unity from wasting resources rendering it? Is this a valid optimization for off screen UI?

I am trying to improve the efficiency of a big UI Scroll View in my Unity app. These Scroll Views tend to be inefficient and can be prone to jittery/stuttering motion if they are taxed. I came across ...
mike's user avatar
  • 481
2 votes
1 answer
2k views

How to re-render the scene only when something changes in Unity?

Does Unity continuously refresh the screen or constantly render 3D objects on screen with each refresh? For example, let's say hypothetically you had a screen where you were just text messaging ...
mike's user avatar
  • 481
3 votes
1 answer
912 views

In a chess simulator, how to efficiently determine checkmate?

I'm working on a small C++ chess simulator game for the first time, and I have a bit of a programming dilemma. I have searched for similar questions on this site and StackOverflow, but can't find a ...
Sciborg's user avatar
  • 594
1 vote
1 answer
108 views

Calculate coordinates of boundaries containing group of objects

I would like to understand how to calculate coordinates of boundaries group of objects as a parallelepiped in 3D game? Let's say for simplicity we have spheres randomly slowly moving in 3d space some ...
Arsenius's user avatar
  • 113
10 votes
4 answers
5k views

Switch statement efficiency in game code

Recently, I was digging into VVVVVVV's source code that was released on GitHub by Terry Cavanagh. I went into the Game.cpp file, and found that it contains an ...
Carmo's user avatar
  • 157
1 vote
0 answers
257 views

Most efficient way to recalculate enemy A* path on the fly?

I'm working on implementing a more robust pathfinding algorithm for the enemies in my top-down shooter game, and I have the A* algorithm working, but now I need to decide when to calculate the path. ...
Darin Beaudreau's user avatar
1 vote
1 answer
5k views

Efficient way to detect when audio clip ends

In Unity, I want to trigger an event when an audio clip finishes playing. Would it be more CPU efficient to keep checking if the audio clip is playing with ...
Jorge Luque's user avatar
1 vote
1 answer
399 views

What's the best practice to use the pbo to upload multi textures?

I have a basic model to upload textures as shown in the following picture. I design this for several reasons: Only the primary thread owns the OpenGL context, so I choose to create buffers, map ...
Sheldon Wang's user avatar
2 votes
1 answer
288 views

How to create a grid of 3d objects without making them actual GameObjects

Very simple question: If I'm going to be generating and placing a lot of 3d objects (in this case cubes), that are not going to be interactive, like no collision, no raycasting intersections etc. ...
Danny F's user avatar
  • 23
0 votes
1 answer
488 views

What is more efficient in Unity recorded animation or Slerp/Lerp?

What is more efficient in Unity recorded animation or Slerp/Lerp? What will be faster? It is obvious that the animation will take a lot more space.
hellomates's user avatar
-1 votes
1 answer
58 views

Battle of the Vectors

When building a Unity2d game, is it better to use Vector3's for waypoints, etc... or to use Vector2's ? The advantage I can see of using a Vector2 is that it is smaller (2 floats vs. 3) and therefore ...
Pliny's user avatar
  • 111
0 votes
1 answer
611 views

Most efficient way to detect and act upon collision (Specific for my 2d game)

Currently, mainly just for fun, I'm working on a 2d game where I have all collide-able blocks (background) assorted into an array when its loading, along with the player put into a different part of ...
Jadon Steinmetz's user avatar
3 votes
0 answers
225 views

Voxel Game - Lag when camera is inside of the terrain

I am making a voxel game in OpenGL and I currently render 8 x 8 chunks to the screen. The first thing I do is generate the map using Simplex Noise and this is done once when the chunk is created. I ...
AtomProgrammer's user avatar
1 vote
1 answer
5k views

Flip x when direction of the movement changed in Unity

What is the easiest and the most efficient way to flip x of the SpriteRenderer when direction of the movement changed in Unity? I use ...
Yaroslav's user avatar
  • 771
2 votes
1 answer
605 views

How can I build a data structure that will persist across saves/loads in GameMaker version 8.1 and earlier?

I wish to build data structures such as trees, linked lists, graphs, stacks, queues, etc. in Game Maker. However, the concept of object in Game Maker Version 8.1 and older does not have a reliable ...
user64742's user avatar
  • 290
1 vote
2 answers
397 views

How to implement combining 2 ingredients to create a product?

In my game, you can combine a variety of ingredients to make a product. For example, you could combine water and dirt to make mud. What I am currently doing to achieve this is by listing each ...
PurpleCurtain's user avatar
0 votes
2 answers
896 views

Efficient Storage of Objects in a 2D Grid

When trying to store data related to objects in my 2d top-down tile based game (specifically, blocks), I realized that I don't have an efficient solution to storing them. I could have, for example, a ...
Zimri Leisher's user avatar
0 votes
2 answers
4k views

Monogames Most efficient way of checking intersections between multiple objects

I've created a top-down shooter with multiple objects such as enemy AI (tanks), walls, power-ups etc. At first I was able to create about 300 AI units which aims to move the player character, checks ...
Rudi Jansen van Vuuren's user avatar
2 votes
3 answers
752 views

What would be an efficient way to check if there is a collision in a 2d game?

As part of my final project of Algorithms and Data Structures, we have to develop an open world game in C++. I already got developed most of the game, but I haven't coded the collisions with the ...
Drako's user avatar
  • 21
0 votes
0 answers
235 views

What's the best way to store tiles' infos in a 2D table?

I need to know what's the less time / memory consuming way to store the infos about each tile in a 2D table. The first thing that came to my mind was creating a table holding the infos, and then ...
user6245072's user avatar
0 votes
2 answers
87 views

Collider Effeciency Question

I'm creating a game where hundreds of rockets with colliders attached are shooting at a player. Should I write my script where: 1: The player script reads the collision from hundreds of rocket ...
Jquist's user avatar
  • 13
3 votes
1 answer
141 views

Should particles check if they are in a region, or regions if particles are in them?

I have around 100 to 200 particles in my game. Then I have 5 to 20 regions (circle-shape) which should count the particles which enter them and add some force to them, so they change their direction. ...
GreenStep's user avatar
0 votes
2 answers
243 views

Efficiently calculating best nearest sphere from a point in 3D space

I have a point in 3D space and a number of spheres (anywhere from 0 to thousands) at random locations in said space. Each sphere has a property that falls off in a smooth gradient from the centre to ...
JamEngulfer's user avatar
0 votes
3 answers
2k views

LibGDX efficient colored rectangle rendering

I'm creating a game in which I renderer around 1000 to 2000 solid colored squares per frame, 90% of which are the same size: ~4 px depending on the dpi. I am looking for the most efficient way to ...
Matthew D. Scholefield's user avatar
0 votes
1 answer
501 views

Generating Formulas for glDrawElements with Tile Grids

glDrawElements can be used to save you from uploading a lot of vertices to the GPU. Many 2D games use tiles, which are rendered in grids. I have done some ...
Lucien's user avatar
  • 1,176
5 votes
1 answer
3k views

Is this the typical approach to modern OpenGL UI & Text rendering, for mobile?

I'm implementing GUI in OpenGL ES 2.0 to fit with my application framework's existing structure. I'd like to have the UI rendering eat as little mobile processing capacity as possible. So to confirm......
Engineer's user avatar
  • 30.1k
3 votes
2 answers
1k views

Implementing a 4x4 Game Board

I struggle with efficiency in code, and I want to start my game off on the right foot. I have a game that I'm making a 4 x 4 map of 'tiles' that a user can build their 'town' on. To keep track of ...
Amagii Discordus Penndragon's user avatar
13 votes
2 answers
4k views

Combining Many Small Colliders into Larger Ones

I am creating a game using a tile-map made of many thousands of grid squares. At the moment, each square has a square collider on it for checking collisions. However, with many thousands of tiny ...
Craig Innes's user avatar
9 votes
2 answers
4k views

What is the most appropriate path-finding solution for a very large proceduraly generated environment?

I have been reading quite a bit in order to make the following choice: which path-finding solution should one implement in a game where the world proceduraly generated, of really large dimensions? ...
Andy Astro's user avatar
0 votes
1 answer
2k views

Most efficient way for nested loop to not repeat a value of parent loop in pair-wise structure (C# or Javascript) [closed]

It's hard to choose the correct title for this question, so let's see if I am able to better convey here what I am in search for. If the title is too far away, suggestions are welcome and I can edit ...
MAnd's user avatar
  • 4,897
0 votes
1 answer
46 views

Trying to make a box move around the screen with the arrow keys [closed]

I have a box and it moves around the screen when the user presses the arrow keys. It seems a bit bulky and awkward though. Any thoughts on how to make it more efficient/less resource intensive? ...
White Raven's user avatar
6 votes
1 answer
14k views

Efficient billboarding sprites in Unity 5

What's the most efficient way to do billboarding sprites in Unity 5? I want to make a forest of sprite trees in 3d space. Those sprites need to face the camera at all times. I am working on VERY ...
K.L.'s user avatar
  • 795
0 votes
1 answer
1k views

Is there a significant amount of overhead when using STL containers instead of plain arrays?

I have read discouraging statements about using plain arrays in c++. Where videogame development is involved we are aiming, as far as I know, at max speed execution. STL containers (such as std::...
roymcclure's user avatar
0 votes
1 answer
44 views

Maximizing efficiency on space distribution

Imagine you have a room X metres long. You have different parts P of diverse lenghts L and importances I. However, the quantity Q of each part is limited and different. You want to fit in as many of ...
AvidScifiReader's user avatar
9 votes
4 answers
17k views

When would a mesh collider be better than primitive colliders

I have been reading through the Unity Manual and have come across some interesting information about mesh colliders and primitive colliders. It got me wondering if using many primitive colliders would ...
Matthew Pigram's user avatar
2 votes
1 answer
438 views

More vertices vs more textures

I'm currently working on a dynamic 'door' creator, and I'm trying to decide which is more efficient. Not much experience with 3D render speeds, so I'm asking before I choose which direction to go ...
Colton's user avatar
  • 202
-1 votes
3 answers
1k views

Most efficient way to do 2d tiles (VBO vs Instancing)

Ok so I am looking at building a game that uses 16*16 tiles, and renders anywhere from 400,000 to 1,000,000 tiles onto the screen at any given time. The tiles will be destroyable . What is the most ...
Nick's user avatar
  • 113
3 votes
1 answer
3k views

Reduce render time for a tiled map in ThreeJS

I'm working on a WebGL game using Three.js, its been a few days and I found my first issue, render time on big maps. The game runs great, there are even some AI mobs that run around randomly like ...
Jesuso Ortiz's user avatar
4 votes
1 answer
5k views

Advance efficient water physics simulation [closed]

Summary: I am looking at creating a large(ish) ocean which multiple ships will be present in doing their own thing. I want the ocean to be a life like as possible but without compromising too much on ...
Nick's user avatar
  • 143
6 votes
3 answers
2k views

When should I load my resources?

I'm making a game, and right now I'm working on the user interface. I'm just wondering when I should be loading my resources. Should I do it in small pieces at a time? Load resources for part 1 of ...
Name's user avatar
  • 440
6 votes
2 answers
8k views

2D Rectangle/Circle Continuous Collision Detection

I'm looking for a fast 2D continuous collision detection algorithm for circles and rotated rects. It needs to determine the time of collision. Both shapes may be moving at high speed, so the ...
MindSeeker's user avatar
1 vote
0 answers
4k views

Drawing and rotating bitmaps (with transparency) efficiently in Android

I just started making a game for Android and I'm already having some issues regarding performance. You can imagine the game as being some kind of Tower Defense game with a top-view, and the enemies ...
Jumbala's user avatar
  • 275
0 votes
1 answer
496 views

Collision Detection: Simulation Inexplicably Slowing Down/How To Efficiently Calculate Extremes In Each Dimension

BACKGROUND: As discussed here: Fast 2D collision detection in an unbounded space I am working on a collision detection algorithm for a simulation. The catch that makes this case unique is that the ...
MindSeeker's user avatar
1 vote
1 answer
2k views

Is it more efficient to store my tile grid as a dictionary or an array?

I've just started making a video game in AS3, and I'm trying to keep the graphics, sound, and actual game state in three completely different spots and sets of classes. That being the case, the ...
Panzercrisis's user avatar
1 vote
1 answer
3k views

Efficient Way to Draw Grids in XNA

So I am working on a game right now, using Monogame as my framework, and it has come time to render my world. My world is made up of a grid (think Terraria but top-down instead of from the side), and ...
sm81095's user avatar
  • 543
6 votes
1 answer
2k views

Android game loop's effect on cpu/battery usage - unexpected results

I will try to keep this question as concise and as readable as I can. I recently came across an odd problem with my Android game that I'm developing. It's an openGL ES 2.0 game and initially I was ...
BungleBonce's user avatar
  • 1,927