Hello forum!
Technologies: C++, SFML and Lua.
I'm looking for a pattern or concept that allows the following idea:
A player shall be able, to add new objects to my game.
Example:
New enemy object owns a set of functions and variables that have to be defined in a enemy_name.lua-file.
Every object shall have their own folder to remain structure and store their files in that.
Beside that Lua file, a tile/spritesheet is residing in that folder as well.
Once the game runs, the user shall be able to either
1) Create a custom map.
2) Play a map.
The map creation simply shows all available objects. Once an object is used, it will become a part of that level-file and so on.
The downside is having so many vertex arrays. As one object consumes one vertex arrays, that starts to hurt my FPS from 2000 (1 vertex array) to 100 (40 vertex arrays).
Not sure if 40 vertex arrays are a lot, but 40 objects are not even close to filling my 1280x720 game screen that will become 1920x1080 later on.
I know, measuring in FPS is not the best way to measure performance, but from 2000 down to 100 seems extreme.
So, I thought about merging sheets during runtime. Once a level is loaded, all referenced sheets would be merged and every object would obtain a value on where their texture moved.
Is that an inefficient way? Are there already solutions to this (design patterns, real implementations, ...)?
Usually, huge tilesheets with all needed tiles seem to be the default in 2d. But that would require that my user knows what objects they want to use for the level, edit the huge file (risking breaking everything) and updating references for all their new objects.
Thanks for your time to read my post : )