TrainsAreAwesome / cubesgalore

Small voxel thing (not really a game) with infinite terrain on all axises.
MIT License
0 stars 0 forks source link

more VRAM optimisation #3

Open doodleshep14 opened 1 month ago

doodleshep14 commented 1 month ago

i have a potato pc and it doesnt have enough VRam to load it, if possible could you make another repos or release of this game that has been optimised to hell and back, if needed reduce render distance

sorry idk how to add labels

ty for reading

TrainsAreAwesome commented 1 month ago

i think I'm the only one that can add labels. I've optimised VRAM usage by using vertex compression, each block face has four verticies (corners), each vertex uses 4 bytes of VRAM. I've seen around 100MB to 200MB of VRAM usage while using render distance 32 24 32 (and i spawned next to a mountain so there are more block faces to store). main system ram usage is about 1.7GB with this render distance, but as I have a memory leak it will increase over time until it eventually crashes (working on that).

I'm also thinking of adding a memory optimisation that would see if a chunk is just one block type and if so only store one block, but this could be a bit annoying to deal with when you factor in block placing and breaking so I'll implement that first. Wow that was too long.

doodleshep14 commented 1 month ago

cool, if possible could you make it so that the unseen verticies dont get saved in VRam so to optimise VRAM even further, what i mean is that if one verticie isnt visible you could stop it from using VRam, correct me if you cant do this idk how to C. also ye try to fix that RAM memory leak. another thing, could you try make a settings menu or at the very least a config file that is easily changeable in terms of manual file configging once again irdk how to C.

TrainsAreAwesome commented 1 month ago

A settings menu would be a cool idea but what Ill probably do is just have a text file that you go and config as that's probably the easiest thing to do. You set render distance at launch time now so it can be anything you want, you can also have different render distances for each axis (which can look really funny sometimes). The vertices don't take up too much VRAM (around 100 to 300MB for 48 32 48 render distance), but the vertices are all stored in the same buffer and don't store which direction they are facing, and while implementing that could save VRAM, it would make looking around the world really really laggy as you would have to copy things into and delete things from VRAM all the time.