The tag has no usage guidance.

learn more… | top users | synonyms

16
votes
3answers
4k views

Does allocating and freeing a huge chunk of memory at startup “clean up memory”?

The book Game Coding Complete, Fourth Edition, chapter 5 (Game Initialization and Shutdown), section Checking Memory contains this interesting code sample: bool CheckMemory(const DWORDLONG ...
16
votes
2answers
917 views

How do you prepare for out of memory conditions?

This can be easy for games with well defined scope, but the question is about sandbox games, where the player is allowed to create and build anything. Possible techniques: Use memory pools with ...
15
votes
5answers
1k views

Why is chunk size often a power of two?

There are many Minecraft clones out there and I am working on my own implementation. A principle of terrain rendering is tiling the whole world in fixed size chunks to reduce the effort of localized ...
10
votes
2answers
2k views

Why is custom memory management needed for assets?

Pretty much all resources relating to game programming, especially 3D open-world games, talk about how you have to constantly be unloading and reloading assets to and from disk, system memory, and ...
9
votes
3answers
3k views

CPU - GPU memory data flow [closed]

I'm a newbie graphics programmer and I've been wondering recently - how does model data (meshes and materials) flow from application (CPU memory) to graphics card (GPU memory?)? Say I have a static ...
6
votes
5answers
2k views

How to make blocks like “redstone” working in a minecraft-like game when the chunks are not loaded

I'm working on a 2D minecraft-like game, I use chunks to save my world and each chunk has 128*128 blocks in it. And infinite chunks can create an infinite world. Memory should never be infinite and ...
6
votes
2answers
302 views

Should a game clean up after itself when exiting? [closed]

Should a game/engine clean up after itself(close windows, shut down renderers, close files, free memory) when its closed? The OS should do that anyway, and usually in a faster way. I guess most ...
6
votes
1answer
752 views

Why do mesh classes still contain vertex arrays if VBO's exist?

I find I'm a bit confused about the practical use of resource management in combination with memory not tied to the CPU. Correct resource management is often recommended in game tutorials, books and ...
6
votes
1answer
1k views

MMORPG game map in-memory storage techniques

For 2-3 years I've been interested into MMO development. I'm browsing some emulators source codes and open source projects. Usually I'm checking how the game server stores data about the 2D map. ...
4
votes
1answer
604 views

Should I be concerned about assets being accessed by dumping VRAM?

I have heard many people tell me that a user can dump the VRAM on their GPU and get all the images in my game. Including all "Streamed" images. This includes most of my Menu graphics. How would a ...
4
votes
1answer
598 views

Do OpenGL buffers overflow to CPU memory?

This is a question about OpenGL buffers and memory. My game world is mid-sized, one contiguous space, unchanging, and only partially visible from any position. Will modern OpenGL overflow buffers ...
4
votes
2answers
2k views

Vertex buffers - interleaved or separate? [closed]

Interleaved - all vertex data (position, normal, texcoord...) kept in 1 vertex buffer, separate - each vertex attribute is kept in a separate vertex buffer (1 for positions, 1 for normals...). I know ...
4
votes
1answer
133 views

RAM usage unusually high, but CPU usage relatively low

I've created a relatively simple game using libgdx, but the RAM usage when I start up the game on my Android device is roughly 600-700 mb, but the CPU usage is only about ~0.05%. I've downloaded a ...
4
votes
2answers
1k views

What is the range of RAM consumption for the typical 3D character in a video game?

What is the average number of KB in memory for a 3D character? Granted, this will obviously be biased based on what game we're talking about. However, I am less interested in actual size in KB, and ...
3
votes
2answers
871 views

Memory Leak in SharpDX

one Thing I found out: Windows 7 produces a memory leak while using certain methods to access rendertargets. Why doesn't Windows 8 leak at this method? public class Game : SharpDX.Toolkit.Game { ...
3
votes
2answers
200 views

Spritesheet filesize gets huge after compiling

I have a 14x2 spritesheet which has 125 Kb in raw .png. But as soon as I compile that to .xnb, it mutates to 4 MB. So my question is: Why is that? And how can I fix that?
3
votes
2answers
146 views

Circular Method Calls

The title may be a little wrong for what I am asking, but that was the closest I could think of. My problem is I am making a game that includes a World class and a WorldObject class. the World class ...
3
votes
1answer
110 views

Is keeping all my game art in a static class wasting memory?

When I make games, I generally create a static class called Art that has static fields to track all content in the game. For example public static class Art { public static SpriteFont ...
3
votes
1answer
307 views

glBufferData consuming system memory

I am memory profiling my game in Visual Studio and about 60% of memory usage is happening from calls to glBufferData(). I may be missing something but should this consume GPU memory instead of system ...
3
votes
1answer
240 views

Do SpriteBuilder's Smart Sprite Sheet need to be loaded to memory?

When I create an Smart Sprite Sheet Folder using SpriteBuilder and publish it, must I load that SpriteSheet into memory "FrameCache" with code or does SpriteBuilder do this automatically (so I just ...
2
votes
2answers
2k views

std::map for storing static const Objects

I am making a game similar to Minecraft, and I am trying to fine a way to keep a map of Block objects sorted by their id. This is almost identical to the way that Minecraft does it, in that they ...
2
votes
1answer
220 views

How to load up many images without using too much memory

When writing games, I am aware that images take up a lot of space. If one has a large graphical game, they don't want problems with memory, or to give players the message "Go buy a better computer to ...
2
votes
1answer
63 views

Java - Loading background music into memory

I am currently developing a game with Java, with a soundtrack consisting of ten tracks in .ogg format, 1-2 MB in size each. To be able to switch between these tracks quickly and easily in the game, ...
2
votes
1answer
125 views

When does the memory transfer from CPU to GPU happen when creating a buffer?

I just finished my first DirectX 11 program. But I have several questions on memory transfer between CPU and GPU. In my program, I create a vertex buffer first: bool InitializeGeometry() { ...
2
votes
2answers
123 views

Destroying object from object method

My game uses an entity manager and entities to represent everything including the player, enemes, items, ..everything in the game. In my engine it's the responsibility of every entity to update ...
2
votes
0answers
82 views

SDL2 SDL_CreateTexture returns pointer to existing texture

I have an initialized renderer in SDL2 that works fine. I create some textures from images using SDL_CreateTextureFromSurface and store them in a vector. Afterwards, I create an empty texture so as ...
2
votes
1answer
160 views

How can I ensure a Unity game continues to run in RAM, even if the disk it loaded from is removed?

I'd like to make a game with Unity, put the build with all the data on a USB key, plug it in another Windows computer, and run the game from the USB drive, then remove the USB drive, but keep the game ...
2
votes
0answers
462 views

Find References In Scene of scriptable object unity asset shows incorrect results

I'm trying to work out why my game is loading a large sprite atlas that I don't think it should be. The snapshot view of the profiler shows that the atlas is loaded. The references pane shows that ...
1
vote
1answer
44 views

About HLSL array packing policy

This is not a question but a confirmation if I'm correct about the behavior of HLSL arrays. I'm working with a standard lighting vertex shader, HLSL plus C++, DirectX11.1 API. For storing my lights ...
1
vote
1answer
90 views

Method of handling audio and memory in game

I've started coding a new game project and I've implemented Ogre for the graphics rendering and begun thinking about the audio side of things. I was considering using the SFML audio component for ...
1
vote
2answers
73 views

How can I minimise memory thrashing when doing vector math in JavaScript or ActionScript?

Please note that a similar question has been asked before in the context of C#. Say I'm building a 3D game in Javascript or Actionscript, and doing a lot of 3D vector math. In current libraries, ...
1
vote
1answer
70 views

How do I destroy a SDL_Finger pointer?

Hello I'm using SDL with C++ and I got this code: void handleEvents() { SDL_Finger* finger = SDL_GetTouchFinger(SDL_GetTouchDevice(0), 0); } I do not know what SDL does inside the GetTouch ...
1
vote
1answer
83 views

Why loading ~250mb of compressed texture data spills Out of memory error on Windows

I am making SDL2/OpenGL 2D game for Windows with a lot of pre-rendered sprites. When testing on my laptop I got SDL_Surface creation failed: out of memory error during loading assets. Windows' ...
1
vote
1answer
152 views

Can I use memcpy() with XMMATRIX?

I.e. can I do this: XMMATRIX dxMat; Matrix myMat; std::memcpy(&myMat, &dxMat, sizeof(XMMATRIX)); std::memcpy(&dxMat, &myMat, sizeof(XMMATRIX)); Matrix is my own class which contains ...
1
vote
1answer
50 views

Will function-local objects affect my performance over time?

This is a very simple question. Let's say my render loop runs at 60Hz, in each call to render(), I draw all my game's buildings, characters and scenery to make the current frame ready. Each of these ...
1
vote
1answer
593 views

Why doesn't RGB565 lead to a smaller memory footprint on Android?

I'm using LibGDX for my game. I'm loading 9 bitmaps into memory at once using the AssetManager, about 512x512 pixels each on average. TextureParameter texParam = new TextureParameter(); ...
1
vote
1answer
124 views

Floating point memory usage on gpu

My question is simple: how much memory on GPU does one floating point value takes? I guess it is 4 bytes, but I'm not sure. So for example is it true that vec4, which holds 4 floats, each 4 bytes ...
1
vote
0answers
66 views

Memory leak with glfwSetWindowTitle? [closed]

I am using GLFW for a game, and I have a function which allows me to set the window title. // PROBLEM WITH INCREASING MEMORY USAGE void WindowSystem::setTitle( const string & title ) ...
1
vote
0answers
27 views

Animated Typing Memory Usage with Immutable Strings

Right now I'm programming a game that has an animated typing effect typically seen in older 1980's and 90's role-playing games. An example can be seen here. The typing effect is generated by taking a ...
1
vote
2answers
156 views

Smallest, most memory-efficient way to have tiles? (C++/OpenGL)

I need to have tiles in my game, just 16x16 images, there would be hundreds (or even thousands) that make up a level. Of course it's not viable to have thousands of memory-hog normal entities, but ...
1
vote
1answer
385 views

Techniques for managing vertex buffer memory

I'm learning OpenGL and I haven't seen any advice on managing vertex buffers in all of the tutorials I've read. The basic problem is that I have some memory allocated as a buffer B in which I'm going ...
0
votes
1answer
108 views

Is there a reason to keep maps in memory?

I've noticed for a long time that games (mostly FPSes) do not unload the map when the user has finished with it (aka, disconnecting from servers, server changing maps). The result of this is that the ...
0
votes
1answer
46 views

Segmentation fault on reallocation of memory but why? [closed]

I have been learning to code in C from this amazing resource http://c.learncodethehardway.org/book/ I am on exercise 17. Basically creating your own simple database using Malloc. I modified the ...
0
votes
1answer
261 views

Memory-leak around SDL_FreeSurface

When I call my tile engine function, the amount of memory my program uses begins to spike at about 80 - 90 megabytes per second. The memory use continues to go up until the program crashes. The ...
0
votes
1answer
241 views

An API independent way of managing video memory?

I'm developing a game. The game architecture is very modular. I have a "Graphics Engine", which uses either a Direct3D or OpenGL renderer. However the user does not have access to the renderers ...
0
votes
1answer
587 views

Unity: why game app on Android takes up much more memory than Unity Profiler reports?

We are profiling a game app on Android 4.4.2 device via Unity’s ADB profiling. We have set up ADB profiling following the official guide: http://docs.unity3d.com/Manual/Profiler.html The ADB ...
0
votes
2answers
236 views

Efficient UI for RTS units

I was wondering how I should approach the runtime changes on the game UI when selecting different types of units in a RTS. For example, in Starcraft, each unit type has its own portrait, attributes, ...
0
votes
1answer
223 views

Why does Unity save textures in bitmap format for APKs and IPAs?

Why does Unity save graphic resources in Android apks and iOS ipas in a bitmap format(width*height*bpp)? I want to save my resources in a small apk, but instead of 1mb for an image Unity stores 11mb ...
0
votes
1answer
2k views

Need help in tracking down memory leak in Unity standalone game

I'm experiencing a memory leak in my Unity game. If the game sits idly (no new game objects are being created in the scene), Windows Task Manager will show the memory of the .exe slowly rising. I've ...
0
votes
0answers
19 views

Discrepancy with Profiler.GetTotalAllocatedMemory() in Unity

I'm trying to calculate the memory usage of different parts of my game without using a Profiler. I have several textures loaded, and I get their memory consumption like this: ...