Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Any Optimization Tips When Writing Thousands of Models to Static Buffer?

A topic by WideWorldGames created Apr 15, 2024 Views: 97 Replies: 2
Viewing posts 1 to 3

My game rooms can have up to a few thousand models, which, to my understanding, shouldn't be a problem for the Fauxton engine. When writing to the static buffer, performance sits around 10-12fps for 30+ seconds every time you enter a new room.  Once the static buffer is loaded, game performance returns to normal. For a game with small rooms, that amount of loading would become a QOL problem very quickly.

It seems like most of the performance issues are being caused by the many iterations of buffer_write() - around 80-90% of the time taken to reach full 60fps is spent on buffer_write(). Is this normal and unavoidable given the amount of sprites I have in my room?

Thanks in advance.

Hey! Yes, saving vertex buffers after they are initially written and loading only those VBuffs would save an enormous amount of time. GML is not the fastest Lagrange to read/write with so you may want to implement a caching system yourself using the static buffers that you could easily load using buffer_load() and vertex_create_buffer_from_buffer()

(2 edits)

Thanks for the response! I'm a bit of a beginner to buffers so I'm trying to understand - is this to say if I have 1000 instances of the same tree, I really only need to create the model (write the VBuffs) once and then create a system that can save and load this information on each subsequent iteration of the tree? I guess I'm asking how certain videos of this system can handle so many models at once without spending an initial 1+ minute on loading each room.

Any tips on where to get started would be really appreciated!

Edit: Also, oddly, when I change the models to 2d billboarded sprites, the game's slowdown is still very significant due to calling so many iterations of matrix_build each frame. Is this normal? I feel like I might be doing something wrong that's causing all this slowdown