reepblue Posted October 14, 2023 Share Posted October 14, 2023 Found a new bug with the Save/Load system. I think the brushes are being re-created. This example has a transparent material in the scene, and it gets opaquer after each reload. Load the map, Press F5, and then press F6 to see the results. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Load scene auto scene = LoadMap(world, "Maps/savetest3.ultra"); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_F5)) { //Save the starting scene to a file scene->Save("game.sav"); } //Reload the starting scene when space key is pressed if (window->KeyHit(KEY_F6)) { scene->Reload("game.sav"); } world->Update(); world->Render(framebuffer); } return 0; } SaveTest3.zip Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Solution Josh Posted October 16, 2023 Solution Share Posted October 16, 2023 I think what is probably happening is the brush is getting new faces applied to it, causing the transparent surface to become more opaque each time. I am fixing it so the brush will clear its own geometry before loading from a map. Currently there is no merging / collapsing of brushes when a map is loaded. It's not as important in Ultra as it was in Leadwerks, because draw calls don't slow Ultra down much. I plan to add a Map::Build() command, or add some load flag that controls whether brushes get collapsed. Once that is in, then the original brushes will be gone, so there won't be anything to reload from a game save file. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted October 16, 2023 Author Share Posted October 16, 2023 12 minutes ago, Josh said: Currently there is no merging / collapsing of brushes when a map is loaded. It's not as important in Ultra as it was in Leadwerks, because draw calls don't slow Ultra down much. I plan to add a Map::Build() command, or add some load flag that controls whether brushes get collapsed. Once that is in, then the original brushes will be gone, so there won't be anything to reload from a game save file. Hmm, this does solve my problem of identifying what is level geometry and what is a decorative model. I can just use the As<Brush>() cast. I guess if brush collapsing returns, please put back the public "collapsedbrush" bool or something like you had in Leadwerks. I also want to mention that when I loaded my save file with Map::Load(), I noticed my materials lost their normal maps. These kinds of things are hard to write examples for as it requires a lot of code and assets to showcase the problem. Maybe it's a side effect from the same problem here. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted October 16, 2023 Share Posted October 16, 2023 Static lib is updated now. I have not run your example but I think it is fixed. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.