We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [memory-efficiency]

A way of organizing and storing information so that it occupies as small an amount of memory as possible while still retaining its full usefulness.

Filter by
Sorted by
Tagged with
8
votes
1answer
1k views

Use floats or doubles when writing mobile games

I know for shaders, floats should be used because they are the optimal choice for performance. Doubles are slow and use more memory which isn't ideal for shaders. While floats are less accurate and ...
1
vote
1answer
62 views

Memory tracker allocates while outputting results

I've written a memory tracker for use in my game engine. I based it on this slide in a talk by Nicolai Josuttis. One problem I'm having is that, during reporting, the implicit string conversion and ...
1
vote
0answers
26 views

How to render decoded video that is on GPU memory without copying to CPU

I'm reading this example of ffmpeg hardware decoding: https://github.com/FFmpeg/FFmpeg/blob/release/4.2/doc/examples/hw_decode.c At line 109 it does this: ...
0
votes
1answer
56 views

frame rate drop in html5 game

i have Incorporated gravity mechanics and collision mechanics to my game. the game works fine for some period of time after that i am getting significant amount of frame rate drop.i am doing some ...
0
votes
0answers
14 views

Per-character “known” state (Scaling)

How would you implement a per-character state system in which characters only receive updated information about the world by interacting with other characters or by witnessing events directly? Assume ...
1
vote
2answers
121 views

Unreasonably large memory use with high-res screenshot script

I'm using this piece of code to save renders and I'm saving renders in every frame inside Update(). Code: ...
0
votes
0answers
30 views

How to find the source of a memory leak in a Blockchain + Node.js game

We have been working in a Node.js game, part of a game network, which seems to be working slower and slower as you keep it open, as well as it seems to increase the RAM and CPU usage over time. We ...
1
vote
0answers
37 views

No-duplicate collection without iterator allocation [closed]

Problem I need a collection with non-duplicate values minimising memory allocation during access operations. I am prepared to compromise with a slight decrease of performance to make up for the ...
0
votes
2answers
73 views

Any advantage of having chunks with sizes by the power of two?

With my past experience of having my little game lag because of the size of the world, I have decided that in whatever next project I might choose to create, I will split said world into chunks. Now ...
1
vote
1answer
168 views

Avoiding GC Allocation in Unity UNet API

I'm trying to profile the game using Unity Profiler, I can see in the Hierarchy tab that there's an 18.3 KB correlated to ...
1
vote
1answer
356 views

Unity - SpriteAtlas memory consumption

I'm in the process of optimizing my application memory consumption. To do so, I'm using Unity profiler while connecting to an Android device, which runs a development build of the application. The ...
3
votes
1answer
1k views

Unity3d - Do I need to destroy gameobject AND script?

From proper leak protection do I need to delete both of these or will getting rid of one take care of both? Currently I am destroying the script AND the gameobject ...
1
vote
2answers
156 views

How can I store my 2D map in JAVA?

I'm working on a 2d adventure game where the player can explore a random generated map. It's working perfectly if I set it to be about 3000x1000 blocks (my array is 3000x1000x2), but this is TOO SMALL....
1
vote
1answer
61 views

Avoiding Out-Of-Ram Crashes in unity [closed]

My Players experience crashes on older computers when they enter a scene with a lots of 3d models. Is there anything I can do to avoid this, except deleting those models from the scene?
0
votes
1answer
261 views

How do open world games handle efficiently enemy respawn?

I'm currently working on a 2D open world game loaded in chunks, initially I thought It would be sufficient to spawn entities randomly in a specific "radius" close to the player, and periodically ...
1
vote
1answer
627 views

Memory is not getting freed on Destroy()

Manager script(simple script attached to an empty GameObject on scene) on Start() instantiates 1000 default cubes with rigidbody component added and gravity check ticked. ...
1
vote
0answers
34 views

string[] preallocation to prevent using ToString() and save memory

I have some levels, with enemy waves and two Text components for: Enemies killed, like: "13/57" Waves passed, like: "68" On each enemy kill/new wave, I make a <...
3
votes
0answers
151 views

MeshMemory causing constant spikes

I have a ready-to-launch application, cleaning everything right now. I have these strange spikes on Mesh Memory. The best part of it is that this view below is ...
-1
votes
1answer
53 views

Static variable pre-declaration & memory heap expansion in Unity

When I profile my apps, I make sure that the code like this one: private void Update(){ int count = GetEnemyCount(); } get's converted to this one: ...
1
vote
1answer
366 views

How can I make a custom memory allocation for classes with virtual methods? [closed]

I want to create a custom allocator that stores objects to the heap sequentially. The allocator itself is very simple. It just allocates a big chunk of memory and moves an offset as ...
3
votes
2answers
246 views

Is single/double frame allocator suitable only for POD datas?

Let´s say I have a single frame stack allocator, so I´m using it for allocating memories for my temporary data. ...
30
votes
2answers
3k views

Is A* efficient even when the obstacles are moving?

I'm just starting to learn about path-finding and have been looking into the A* algorithm and my main concern is that it all of the examples I have seen show static obstacles that it computes around. ...
0
votes
1answer
1k views

Unity mobile game generates too much cache

I have built a game I have been working on for Android (Unity). It's a simple game: air hockey. It weights 21mb with all the assets and scripts. After playing for a bit I have noticed that cache of ...
25
votes
1answer
5k views

Why should I always consider creating and using object pools instead of instantiating the new object on the fly?

I have read about this pattern several times (from a best-practices perspective): Memory Allocation: Instead of instantiating the new object on the fly, always consider creating and using object ...
0
votes
1answer
355 views

DirectX11 bind all textures at once?

If my game will use say 100mb of raw memory for textures, would it be a good idea to put all of them in srv array, bind once and leave it for the rest of the program so that I won't have to bind them ...
0
votes
1answer
133 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.
1
vote
0answers
65 views

When should I use auto-managed buffers in LWJGL 3?

LWJGL3 has two methods of creating buffers that I know of: Auto-managed buffers that clean up the buffers automatically using the MemoryStack class, and manually managed buffers that must be manually ...
2
votes
1answer
363 views

Should I avoid constructors/destructors in C++ when using custom allocators?

I'm currently building my first 2D game engine and have reached a point where some large-scale tests have shown that some form of custom memory management would be beneficial (object pools). So I ...
0
votes
1answer
292 views

Efficient Dynamic Memory Management

My world is procedurally generated. As the player moves, chunks behind them are unloaded and chunks in front of them are loaded. Each chunk has a mesh of triangles. At the moment, I create two VBOs ...
2
votes
1answer
476 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 ...
0
votes
0answers
152 views

Unity - change sprites to something that uses less memory

I have a game that uses only silhuette textures, but they take up waay too much memory (360 MB overall and this is a mobile game) so I plan to avoid using sprites with ...
1
vote
0answers
71 views

Memory usage increasing ~10kb every frame [closed]

I am currently developing a game for Android (using the SDK) and have been trying to reduce the memory usage. I have discovered that during each frame, the memory usage increases by about 10kb. The ...
0
votes
1answer
129 views

Best way to add and remove quads in a VBO?

What's the best way to handle adding and removing 2D sprites (quads) in a VBO? I am working on a mobile board game and sometimes game pieces (represented by quads graphically) need to be added to or ...
9
votes
1answer
6k views

Difference in glDrawArrays and glDrawElements

While refreshing my mind on OpenGL ES, I came across glDrawArrays and glDrawElements. I understand how they are used and sort ...
0
votes
1answer
63 views

Is reusing BitmapFonts possible in GDX?

I'm loading multiple labels (100+) with different font types (max 10), but they have different sizes. As I read the code and did the research, it's not possible to 'reuse' the font. For instance, I ...
2
votes
1answer
699 views

Libgdx game crashes on some devices without any Errors / Logs

I'm making a similar game to the talking tom game where a character is animated on the screen and talks back. I have about 100 transparent PNGs for each animation. There are 10 Animations. Each PNG ...
-2
votes
3answers
213 views

How should I store a large number of rooms with objects in them?

Right now I'm using C# in XNA/MonoGame. I'm brainstorming an isometric game that consists of rectangular rooms. The allowed dimensions of each room range from 3x3x3 to 12x12x6. The max volume of each ...
1
vote
1answer
417 views

Game data structure in node.js

I am building a simple turn-based game in node.js using sockets.io. My web experience with node.js has typically involved saving everything to a relational database. I set this up for my game. I am ...
0
votes
0answers
85 views

Unity 2d: Not Destroying enemies - impact on memory

I know pretty much zero about game performance in Unity. I am trying to figure out if I can afford to put this feature in my game: I would like to have the enemies killed to pile up in a sort of heap,...
1
vote
1answer
299 views

One large tileset or multiple tilesets

I'm currently writing a 2d tile scroller for a hobby project and I can't find any resources to give me a clear answer to which is more efficient to do. Each block contains tiles 44 by 24, 32px x ...
3
votes
0answers
563 views

Keeping a mesh entirely at the GPU and changing its vertices there with a ComputeShader (Unity5)

In a Unity game I have an object whose mesh is made of around 10k vertices and I have to make changes to these vertices (position, color, etc) almost every frame. Considering that such object is ...
0
votes
1answer
819 views

CPU and RAM usage in OpenGL too high in Swift

My game is set up so the the display controls the game loop, usual in Cocoa. The callback function calls run() which is this. The thing is, the thread running the ...
0
votes
0answers
145 views

Storage and Lookup of Voxel Chunks

How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory? The problem with a HashMap<Vector3i, Chunk>...
17
votes
1answer
3k views

Any downsides to exporting an audio file at double-speed then have the game engine playback at half-speed?

I want to cut back on my game's file size and music and SFX are taking up a good chunk. If I make a song or sound effect at 120bpm and then apply a tempo and pitch doubling using a DAW or standalone ...
2
votes
1answer
131 views

Performance differences: one empty GameObject with multiple child objects vs. single GameObject formed by pre-merging the former child objects

Imagine a robot game where robots are made of pre-built blocks. Therefore, each block is a separate GameObject, with one mesh each. I am trying to understand the conceptual differences behind the ...
4
votes
1answer
585 views

Efficient vertex buffer memory management?

I am building a voxel engine with a similar mechanism to minecraft(yes, I know...). It works by loading and unloading individual chunks of 16*64*16 cubes each in a square grid around the player. This ...
4
votes
1answer
487 views

Libgdx: how does dispose() work?

My game uses a lot of images, for the over-world, battle screens, chats, etc. I'm really meticulous when it comes to memory management, and I've noticed that even though I dispose every image when I ...
0
votes
1answer
494 views

Libgdx crash on dispose()?

Whenever I try to manually call the dispose method in one of my screen my game just crashes. My dispose looks something like this ...
-2
votes
1answer
732 views

Libgdx incredibly high RAM usage! [closed]

Alright so I'm new to Libgdx and Game programming in general, and I've got a huge problem. If I leave my game on, it will start to eat memory, pretty fast at that, until it reaches a point my PC hasn'...
0
votes
1answer
235 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 ...