Gandi Posted February 24, 2010 Author Share Posted February 24, 2010 I dont really get what you are trying atm.. I was able to read all the models-paths and texture paths from a .sbx file.. then i loaded them all ans stored them in a container. after that i called the LoadScene() which should just create the terrain and place the models.. if i understood it right i dont have to split the file into two parts as: "If a model with the specified filename has already been loaded, it'll return a reference to that to avoid loading assets twice. " and "If a texture with the specified filename has already been loaded, it'll return a reference to that to avoid loading assets twice. " so shouldnt it take the pointers to the already loaded models/textures? Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 24, 2010 Share Posted February 24, 2010 Well my Hydro test scene loads in a few secs .. and it has far more than 0-1 models lol .... but a test scene with only terrain and a heavy grass layer takes 15 to 20 with no models. can the terrain loading be split further like terrain texture vegetation?... What about roads? aren't they built asynchronously? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Niosop Posted February 24, 2010 Share Posted February 24, 2010 Yeah, they're built async, but they're built after LoadScene returns I think, so at that point a progress bar isn't needed. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 24, 2010 Share Posted February 24, 2010 Yeah, they're built async, but they're built after LoadScene returns I think, so at that point a progress bar isn't needed. Maybe a delay is though so you dont enter the level and watch the roadworks lol Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Niosop Posted February 24, 2010 Share Posted February 24, 2010 Lol, true. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
Rick Posted February 24, 2010 Share Posted February 24, 2010 I dont really get what you are trying atm.. I was able to read all the models-paths and texture paths from a .sbx file.. then i loaded them all ans stored them in a container. after that i called the LoadScene() which should just create the terrain and place the models.. If he reads the sbx file maually and loads those models like you did, but then calls LoadScene() on the same sbx file (with it still having all the models in it), it'll load them again which would be the delay. It should be a slightly less delay but a delay non the less. [quote Well my Hydro test scene loads in a few secs .. and it has far more than 0-1 models lol Maybe your CPU is faster than mine, but I have a map and load a few models in code (probably a total of 35 models including terrain with no roads/veg and a couple cursor files) and it takes about 10 seconds, but even as little as 10 seconds with no visual feedback seems like a lifetime to users. I know as I'm staring at the black screen I'm asking why is this taking so long. Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 24, 2010 Share Posted February 24, 2010 I know as I'm staring at the black screen I'm asking why is this taking so long. Well your impatience is not the issue lol ... but just have a screen that says loading ? or update the screen for different sections of loading .. fonts .. scene .. sounds .. textures . whatever .. all takes times and all done seperate ? even add the odd delay in just to move the loading bar lol .. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Rick Posted February 24, 2010 Share Posted February 24, 2010 Why not ask josh to put in an overload function for the LoadScene() where you can pass a blank variable, and it will return what is being loaded to that variable, and then just run check on what that variable is at any given time, then update your load bar accordingly? You've seen the list of wants from us. This would most likely be put low on Josh's list. Aka, would never get put in. but just have a screen that says loading ? or update the screen for different sections of loading .. fonts .. scene .. sounds .. textures . whatever .. all takes times and all done seperate ? even add the odd delay in just to move the loading bar lol .. Yep you could do that also. This would just be a more accurate representation if someone wanted that. Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 24, 2010 Share Posted February 24, 2010 Yep you could do that also. This would just be a more accurate representation if someone wanted that. Well if its just to let those who worry after 10 seconds then a simple function to increment the distance a bar graphic is drawn across the screen could be used liberally during the loading section with a simple integer .. like Loading(10) .. then Loading(20) yada yada .. I did simple test like that a while back in Bmax .. it worked .. a little jerky but you get the picture lol Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Canardia Posted February 24, 2010 Share Posted February 24, 2010 I still think my approach is better. No coding needed, and progress bar moves smoothly and accurately after 1st time game was launched. First time can be overloaded with some "optimizing game settings for best performance" messages (which it actually does). Or you could just use the default timings on 1st run, nobody will notice. Or you could skip the 1st run of the game completely, and get the timings during installation phase. You would just have an additional "optimizing" phase during install. For LCP1 I added a even simpler way to eliminate loading times: Game hides mouse and launches with black screen and a text fades in: "Day 2". When scene is loaded, it slowly fades out and game scene becomes visible. So it's like a movie chapter text which fades in, lasts for a certain time, and then fades out. If the displaying of the text takes too long compared to the amount of text, just add some more text for the user to read. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 24, 2010 Share Posted February 24, 2010 I still think my approach is better. Thats so unlike you to Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Rick Posted February 24, 2010 Share Posted February 24, 2010 like Loading(10) .. then Loading(20) yada yada .. I did simple test like that a while back in Bmax .. it worked .. a little jerky but you get the picture lol The problem is you can't do that with how LoadScene() works today because it's blocking. That's what we are trying to solve. LoadScene() loads everything and you can't update anything like a progress bar even if you are faking it until it comes back and at that point everything is loaded already. You could that with anything you load in code though, yeah. No coding needed Your approach would require multithreading to work. That takes code. LoadScene() doesn't come back until everything is loaded and currently you can't do anything while LoadScene() is being called. So for your approach to work you either have to have multithreading to make a progress bar move while LoadScene() is being called, OR parse out the sbx file. If you are spending the time to parse out the sbx file then you already have the information to make it 100% accurate because you'll know how many models you have to load and the information to load them manually. Quote Link to comment Share on other sites More sharing options...
Canardia Posted February 24, 2010 Share Posted February 24, 2010 Multithreading is just 1 line of code ( _beginthread(func, NULL); ). I meant that you don't have to rewrite the whole LoadScene() function. With multithreading you just need few trivial lines of code, which can't be really counted as code anyway since they just draw a rectangle on screen, it's really more programmer's art than code. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Rick Posted February 24, 2010 Share Posted February 24, 2010 Multithreading is just 1 line of code ( _beginthread(func, NULL); ). I meant that you don't have to rewrite the whole LoadScene() function. With multithreading you just need few trivial lines of code, which can't be really counted as code anyway since they just draw a rectangle on screen, it's really more programmer's arts than code. It's obviously more that that, because the drawing code would need to be done in openGL, since LE commands don't play nice with multithreading. So now a person needs to know openGL which is more code than using LE. Also you assume just drawing lines on the screen is what people want. Most games will display an image and the progress bar on top of that. So now you have to load a texture and draw it all with openGL. If you are going to ignore that fact, then I'll ignore the fact that once this new LoadScene() is written it's equally the same amount of code for someone using it. Define a callback function, and draw your rectangle in it. Done. Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 24, 2010 Share Posted February 24, 2010 all seems a lot of work ... split the sbx .. then write a ProcessScene for the models .. then load the terrain and only the models will be individually incremented on the laoding bar .. terrain will take probably longer , not to mention the time for any textures or extras (sounds fonts ect.) all to have an indication somethings loading Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Rick Posted February 24, 2010 Share Posted February 24, 2010 all seems a lot of work ... split the sbx .. then write a ProcessScene for the models Yeah I wouldn't write a ProcessScene for the models like I originally thought. I would take 1 model out at a time from the original sbx file and put it into a temp file, then just call LoadScene() on that file. Do that for every single model in the original sbx file so LoadScene() still does the work of ProcessScene() and all that stuff. So really the code would just parse out the original sbx file into a temp sbx file 1 model at a time. Pretty easy. Quote Link to comment Share on other sites More sharing options...
TylerH Posted March 6, 2010 Share Posted March 6, 2010 Here is some code I did a few months ago for Jeklynn that was based on Josh's Blitzmax code for Processing a Sandbox scene. It is in no way finished, but it shows you how to parse the SBX format and load some stuff, etc.: .CPP: #include "Game.h" #include "Platform.h" struct EntityInfo { TEntity entity; std::string id; std::string targetid[16]; }; std::list<EntityInfo> infolist; std::map<std::string,TEntity> idmap; void Tokenize(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters = " ") { // Clear the tokens list just incase tokens.clear(); // Skip delimiters at beginning. std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". std::string::size_type pos = str.find_first_of(delimiters, lastPos); while (std::string::npos != pos || std::string::npos != lastPos) { // Found a token, add it to the vector. tokens.push_back(str.substr(lastPos, pos - lastPos)); // Skip delimiters. Note the "not_of" lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" pos = str.find_first_of(delimiters, lastPos); } } std::string Trim(const std::string& str) { size_t start = str.find_first_not_of(" \t\n\r"); if (start == string::npos) { return ""; } size_t end = str.find_last_not_of(" \t\n\r") - start + 1; return str.substr(start, end); } std::string StringToUpper(std::string strToConvert) { for(unsigned int i=0;i<strToConvert.length();i++) { strToConvert[i] = toupper(strToConvert[i]); } return strToConvert; } std::string StringToLower(std::string strToConvert) { for(unsigned int i=0;i<strToConvert.length();i++) { strToConvert[i] = tolower(strToConvert[i]); } return strToConvert; } void SetEntityPositionRotationScale(TEntity entity,std::map<std::string,std::string> map) { std::string s; std::vector<std::string> sarr; s = map["position"]; Tokenize(s, sarr, ","); if (sarr.size() > 2) { PositionEntity(entity, Vec3( atof(sarr[0].c_str()), atof(sarr[1].c_str()), atof(sarr[2].c_str()) ) ); } s = map["rotation"]; Tokenize(s, sarr, ","); if (sarr.size() > 2) { RotateEntity(entity, Vec3( atof(sarr[0].c_str()), atof(sarr[1].c_str()), atof(sarr[2].c_str()) ) ); } s = map["scale"]; Tokenize(s, sarr, ","); if (sarr.size() > 2) { ScaleEntity(entity, Vec3( atof(sarr[0].c_str()), atof(sarr[1].c_str()), atof(sarr[2].c_str()) ) ); } } TEntity CLevelManager::LoadScene(str filename) { std::ifstream stream; EntityInfo info; std::string s; std::string objectname; std::vector<std::string> sarr; std::string sbxversion; stream.open(AbstractPath(filename)); if (!stream) return 0; char buf[2048]; stream.getline(buf, 2048); Tokenize(std::string(buf), sarr, "_"); if (sarr[0] != "SBX") { stream.close(); return 0; } if (sarr[1] != "ASCII") { stream.close(); return 0; } sbxversion = sarr[2]; std::cout << "Parsing ASCII Sandbox Scene: " << filename << " , Version: " << sbxversion << "...\n"; TEntity root = CreatePivot(); TGroup rootgroup = CreateGroup(); while (!stream.eof()) { stream.getline(buf, 2048); s = buf; s = Trim(s); Tokenize(s, sarr, "//"); if (sarr.size() > 1) { s = sarr[0]; } Tokenize(s, sarr, "="); if (sarr.size() > 1) { SetEntityKey(root, (char*)Trim(sarr[0]).c_str(), (char*)Trim(sarr[1]).c_str()); } else { Tokenize(s, sarr, " "); if (sarr.size() > 0) { objectname = StringToLower(sarr[0]); ReadObject(objectname, stream, root, rootgroup); } } } for (std::list<EntityInfo>::iterator it = infolist.begin(); it != infolist.end(); ++it) { for (int n = 0; n < 16; ++n) { if ((*it).targetid[n] != "") { TEntity ent = idmap[(*it).targetid[n]]; if (ent) { SetEntityTarget(info.entity, ent, n); } } } } return root; } TEntity CLevelManager::ReadObject(std::string objectname, std::ifstream &stream, TEntity root, TGroup parentgroup) { TEntity entity; TBody body; TModel model; std::map<std::string,std::string> map; std::vector<std::string> sarr; std::string s; std::vector<TEntity> subobjects; TEntity o; TEntity child; TTerrain terrain; TTexture texture; char buf[2048]; while (!stream.eof()) { stream.getline(buf, 2048); s = Trim(std::string(buf)); Tokenize(s, sarr, "="); if (sarr.size() > 1) { size_t quotepos; while ((quotepos = sarr[1].find("\"")) != std::string::npos) { sarr[1].replace(quotepos, 1, ""); } map[stringToLower(sarr[0])] = sarr[1]; } else { if (s.find("{") != std::string::npos) { Tokenize(s, sarr, ""); if (sarr.size() > 1) { o = ReadObject(StringToLower(sarr[0]), stream, root, parentgroup); if (o) subobjects.push_back(o); } } if (s == "}") break; } } entity = NULL; if (objectname == "group") { } else if (objectname == "model") { std::string path = map["path"]; size_t quotepos; while ((quotepos = path.find("\"")) != std::string::npos) { path.replace(quotepos, 1, ""); } model = LoadModel((char*)(std::string("abstract::") + path).c_str()); if (!model) { AppLog((char*)("Failed to load model \""+path+"\".").c_str(),APPLOG_WARNING); } entity = model; } else if (objectname == "terrain") { } if (entity) { if (root) EntityParent(entity, root, 0); SetEntityPositionRotationScale(entity, map); if (subobjects.size() > 0) { for (std::vector<TEntity>::iterator it = subobjects.begin(); it <= subobjects.end(); ++it) { if ((*it)) EntityParent((*it), entity, 0); } } model = entity; // Lock the keys here ??? for (std::map<std::string,std::string>::iterator it = map.begin(); it != map.end(); ++it) { if ((*it).first.c_str()[0] == 34) { size_t quotepos; std::string k = (*it).first; std::string v = (*it).second; while ((quotepos = k.find("\"")) != std::string::npos) { k.replace(quotepos, 1, ""); } while ((quotepos = v.find("\"")) != std::string::npos) { v.replace(quotepos, 1, ""); } SetEntityKey(entity, (char*)(*it).first.c_str(), (char*)(*it).second.c_str()); } } // Unlock the keys here ??? SetEntityGroup(entity, parentgroup); if (map["id"] != "") { idmap.insert(make_pair(map["id"],entity)); } EntityInfo info; info.entity = entity; for (int n = 0; n < 16; ++n) { info.targetid[n] = map["target" + n]; } infolist.push_back(info); } return entity; } bool CLevelManager::LoadLevel(str sFileName) { m_sLevel = sFileName; return Load(); } unsigned __stdcall LoadLevelFunc( void* pArguments ) { printf( "In second thread...\n" ); Game::Globals:_LevelManager::getInstance()->m_eScene = LoadScene(Game::Globals:_LevelManager::getInstance()->m_sLevel); _endthreadex( 0 ); return 0; } //===================================================================== void CLevelManager::SetupLevel(str sFileName) { m_sLevel = sFileName; } //===================================================================== bool CLevelManager::Load() { if(m_sLevel == "") return false; //LoadScene(m_sLevel); m_eScene = ::LoadScene(m_sLevel); //m_eScene = NULL; //HANDLE hThread; //unsigned threadID; printf( "Creating second thread...\n" ); // Create the second thread. //hThread = (HANDLE)_beginthreadex( NULL, 0, &LoadLevelFunc, NULL, 0, &threadID ); //WaitForSingleObject( hThread, INFINITE ); Collisions(3,2,1); Collisions(2,3,1); Collisions(1,1,1); Collisions(3,1,1); Collisions(2,1,1); Collisions(3,3,1); Collisions(2,2,1); if(m_eScene!=NULL) { std::cout << "Scene Children: " << CountChildren(m_eScene) << "\n"; for(int i = 1; i<=CountChildren(m_eScene); i++) { ProcessEntity(GetChild(m_eScene, i)); } } return m_eScene!=NULL; } //===================================================================== void CLevelManager::ProcessEntity(TEntity eEntity) { str sClass = GetEntityKey(eEntity, "class", ""); str sClassName = GetEntityKey(eEntity, "classname", ""); if (sClass == "Terrain") { EntityShadowMode(eEntity, 1, 1); } //str sName = GetEntityKey(eEntity, "name", ""); //if (sName != "") //{ // SetGlobalObject(sName, eEntity); //} //float intensity = atof(GetEntityKey(eEntity, "intensity", "0.5")); //TVec4 color = StringToVec4(GetEntityKey(eEntity, "color","255 255 255 255"),0," "); //std::cout << sName << " " << GetEntityKey(eEntity, "color","255 255 255 255") << " " << GetEntityKey(eEntity, "intensity","0.5") << "\n"; //EntityColor(eEntity, Vec4(color.X/255.0*intensity,color.Y/255.0*intensity,color.Z/255.0*intensity,color.W/255.0),0); //if (sClass=="Model") //{ //int iCollisionType = atoi(GetEntityKey(eEntity, "collisiontype", "1")); //EntityType(eEntity, iCollisionType, 1); //std::cout << "Model CT: " << iCollisionType << "\n"; //SetBodyStepMode(eEntity, 1); //float fMass = (float)atof(GetEntityKey(eEntity, "mass", "0")); //SetBodyMass(eEntity,fMass); //} /*if(sClassName=="light_point") { TLight eLight = CreatePointLight((float)atof(GetEntityKey(eEntity, "range","100.0"))); PositionEntity(eLight, EntityPosition(eEntity,1),1); RotateEntity(eLight, EntityRotation(eEntity,1),1); } if(sClassName=="light_spot") { TLight eLight = CreateSpotLight((float)atof(GetEntityKey(eEntity, "range","100.0"))); PositionEntity(eLight, EntityPosition(eEntity,1),1); RotateEntity(eLight, EntityRotation(eEntity,1),1); }*/ } //===================================================================== void CLevelManager::CleanUp() { ClearWorld(); } //===================================================================== void CLevelManager::Update() { UpdateFramework(); } //===================================================================== void CLevelManager::Pause(bool bPaused) { //// pause //if (bPaused) // PauseApp(); //// unpause //else // ResumeApp(); m_bPaused = bPaused; } //===================================================================== void CLevelManager::Start() { m_bPaused = false; } //=========== .H: #if _MSC_VER > 1000 #pragma once #endif #ifndef __CLEVELMANAGER_H__ #define __CLEVELMANAGER_H__ #include "Singleton.h" #include "CTime.h" class CLevelManager { private: friend Singleton<CLevelManager>; CLevelManager(){ m_bPaused = true; } ~CLevelManager(){} public: TEntity m_eScene; bool m_bPaused; str m_sLevel; /* Loads a .sbx scene file from the path specified Returns: Success bool */ bool LoadLevel(str sFileName); /* sets the level to be loaded */ void SetupLevel(str sFileName); /* Loads the .sbx scene file that was set with SetupLevel */ bool Load(); TEntity LoadScene(str filename); TEntity ReadObject(std::string objectname, std::ifstream &stream, TEntity root, TGroup parentgroup); void ProcessEntity(TEntity eEntity); /* Deletes the previous scene, ready for another */ void CleanUp(); /* Starts game for this level */ void Start(); /* Updates the scene based on the pause state */ void Update(); /* Pauses or unpasuses the current game */ void Pause(bool bPaused); /* Saves the current game progress to a file */ void SaveState(str sFileName); /* Loads game state from a file Returns: Success bool */ bool LoadState(str sFileName); TEntity GetWorld() {return m_eScene;} bool IsPaused() { return m_bPaused; } }; #endif // __CLEVELMANAGER_H__ Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
VeTaL Posted March 29, 2010 Share Posted March 29, 2010 Just an idea: why not to add to the specification of the *.sbx format (in the second or third string) a parameter, which would show, how many entities are on the map. So, after loading each new entity, we can calculate how many entities remain, so we can know how many % we already load? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
fuego Posted April 30, 2010 Share Posted April 30, 2010 You don't have to put a progress, just put an animation like in the Need for Speed games. You know, a circle is turning around the "loading" text or some fancy shapes are flying through the "loading" text in those games Quote Link to comment Share on other sites More sharing options...
paramecij Posted May 1, 2010 Share Posted May 1, 2010 I agree with Lumooja, it shouldn't be that hard to use multithreading to make a simple animated "turning a circle around" loading screen.. the best way would be to manually process and load a scene, then you can do whatever you want.. and coupled with clever design like Lumooja suggested (loading after texts fades in) one can hide the loading process altogether.. you can pre-load all the common assets during logos/start up sequences or what have you in small batches, then when you do new/load game from the main menu only load the rest.. If you first fade in to a interesting static image or some block of text then do some heavy loading, the user wont even notice while he's busy reading or taking a closer look. Progress bars aren't really needed if you have load times less than 10secs, they are more suited for longer load times so you can more easily judge if you have time to grab another slice of pizza from the kitchen Also for long loading times, some kind of animation is crucial to assure the user the app is running and hasn't hanged.. Even if you have progress bars if they don't update for a while, it might make the user wondering.. so again multi-threading is probably needed here. Because even if you update after every file load, and the files are small and quick to load, there might be a lag due to the file being on external hdd which is put to sleep, dvd disc that has to spin-up, sent over network etc.. I have currently a very long loading time but i just display a static image and play a sound recording of me counting "one model sitting in the scene, two models sitting in the scene...", it works and gets around most of the issues .. yeah i'm lazy like that Quote Link to comment Share on other sites More sharing options...
Flexman Posted May 1, 2010 Share Posted May 1, 2010 I think adding a callback for LoadScene() would be a nice to have, something like "CallBackLoadSceneFlip()" to keep the window alive instead of Windows thinking the app is "not responding". Loading map layers and veg can take a few seconds, long enough to 'grey' a window making a user think it's crashed. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
Canardia Posted May 1, 2010 Share Posted May 1, 2010 I have a progress bar working in my game. It's moves very smoothly from left to right while the game is loading. However, I'm using WinGDI for drawing the progress bar, but I'll try to get it using OpenGL next. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Gandi Posted May 1, 2010 Author Share Posted May 1, 2010 How did you manage it? did you just estimate the time it will take and then move the bar according to that, or do you process the sbx file by yourself? Quote Link to comment Share on other sites More sharing options...
Canardia Posted May 1, 2010 Share Posted May 1, 2010 You don't need to estimate the time, you just take the time it took to load last time. That will be always accurate. You could even skip the progress bar on the very first run (although I prefer to put a bit higher value as initial value, so in worst case the initial run would make the progress bar run to 50% only) and count it as a setup phase of the game. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ 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.