Delayed Realisations

41 readers
1 users here now

Did you realize something regarding programming that you should have realized years ago? Then post it here, we don't judge

Rules

  1. Don't be the reason I need to expand this list

founded 5 months ago
MODERATORS
1
 
 

Something that I realized way later than I should.

During some of my Godot development, I've finally hit the debugger tab of the editor while the game was running, saw the "Video RAM" and found something very odd. My 2D game was eating up over 500MB of VRAM, which was way too much for what was on screen. Since the debugger lists all the files currently in memory, I could see how much RAM each file consumed.

My characters were made of several separate files (2 arms, 1 leg, 1 torso, 1 head) and all those files had the same total resolution of ~1000x1000, but different "useful" areas, like 200x200 on the head, 40x100 on each arm. Turns out each goddamn pixel of each file had to be kept in RAM, because, unlike disk space, the game "needs" to be aware of the WHOLE image, because it doesn't know whether RGBA(0,0,0,0) at XY 0,0 is any more or less important than whatever is at XY 120,250.

Yeah, after I cropped the images to only have the area they actually have drawn, VRAM usage dropped to ~200MB (the drawn area was still large)

If anyone ever complains that your game is slow, or that you should optimize how you organize your images, it's very likely you should look into that for better performance.

2
 
 

There are many libraries and frameworks that take the grunt of game dev, without locking you to their specific physics engine, etc.

For example

2D: SFML, Easily create a window and move sprites around, rest is up to you. (C++)

3D: JMonkeyEngine (Based on lwjgl) is basically the same, with 3D rendering instead. It contains tools for physics and collisions, but those are optional. You can do whatever with meshes in 3d space (Java)

I probably should have realized this before fighting with complete game engines (unity, godot) for multiple years even though I prefer doing stuff myself. I find it easier to handle when I've made it myself.

Anyone else know any minimal but feature-rich engines?