Progress bar

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Kvasir
Code Contributor
Posts: 22
Joined: November 20th, 2005, 10:52 am

Progress bar

Post by Kvasir »

When browsing the forum I saw there was a thread on showing something earlier during startup and since I was curious about how Wesnoth worked I looked a bit deeper on it. The following patch when applied shows a simple big progress bar during startup. I also think applying something like this during campaign loading would be desireable since slow machines like mine take ages to do that (actually about slightly less than minute).

edit: Removed the patch as it is now outdated
Last edited by Kvasir on March 19th, 2006, 6:17 pm, edited 2 times in total.
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

nice....

could you post it on patches.wesnoth.org after reading the sticky on posting patch in this same forum ? I'll look at it ASAP

thx
Fight key loggers: write some perl using vim
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

Ok, I just looked at your patch on patches. wesnoth.org and yes, it's a step in the right directions.... here are a couple of steps to help


1) better granularity would be nice
2) a line telling what the game is doing would be nice
3) display.cpp seems a good place to put your stuff so it's ok

I didn't commit it because you said in your p.w.o comment that you wanted to work on it some more... so just tell me when you're ready here and it will go in.

thx
Boucman
Fight key loggers: write some perl using vim
Kvasir
Code Contributor
Posts: 22
Joined: November 20th, 2005, 10:52 am

Post by Kvasir »

When reading or verifying the cache it recursively calls an _internal function with as far as I could see no easy way to find out how many times the function will be called. For now I just use a magic number that has been set after logging the amount of function calls and it works fine but that number obviously requires updating after each data set update. So my question is if there is a way to find out how many times the code is going to call this function inside the code?
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

probably not...

you usually use recursivity specifically for that reason...

glad to see this patch is still alive :)
Fight key loggers: write some perl using vim
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Post by Yogibear »

Kvasir wrote:When reading or verifying the cache it recursively calls an _internal function with as far as I could see no easy way to find out how many times the function will be called. For now I just use a magic number that has been set after logging the amount of function calls and it works fine but that number obviously requires updating after each data set update. So my question is if there is a way to find out how many times the code is going to call this function inside the code?
Hmm, shouldn't a static variable inside of that function do this job?
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

no...

the point is to know a priori the number of calls, a static variable would tell you that a posteriori (which can be done recursively in a more elegant way by each level returning the recursion level)
Fight key loggers: write some perl using vim
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

You could store store the value in the highest level of the cache. Than when you are loading the cache, you could use that information. But, as far as determining how deep the rabbit hole goes the first time, you got have to take the red pill.
Kvasir
Code Contributor
Posts: 22
Joined: November 20th, 2005, 10:52 am

Post by Kvasir »

The current version which is on patches.wesnoth.org introduces better granularity during startup. The total percentage to game config loading is fixed which means progress is too slow when there is no cache. It doesn't bother me but if people find it important I can change it.
I also didn't include a logo and the strings are hardcoded in the executable. If there are good ideas about on stuff to add here feel free to propose it.
I also changed the structure, everything is now in two seperate files, I did this mainly to speed up rebuilding (display.hpp is used in many files) but I guess it may also make it easier for others to adapt the code.

The recursive thing was already counted by static variables, the final count is written out on stderr and I manually copied these over as the magic number constants in the code.
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

hmm

apparently you uploaded three time the same patch... could you post a corrected one to patches.wesnoth.org please ?
Fight key loggers: write some perl using vim
Kvasir
Code Contributor
Posts: 22
Joined: November 20th, 2005, 10:52 am

Post by Kvasir »

Sorry for all the reposts, I had made a spelling error in the new patch and always uploaded the old one. I also noticed the patch didn't include the new files so I uploaded them as well..
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

ok, your patch has been commited


thanks a lot for the work you've done, that's great

and sorry for the time it took me to commit it :oops:
Fight key loggers: write some perl using vim
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Post by Yogibear »

Unless i am not mistaken, there is a problem with the patch. binary_wml now has a dependency to loadscreen and this one directly or indirectly needs all the other stuff within wesnoth.

On the other hand, wesnothd (the server app) builds with binary_wml and therefore also "inherits" all those dependencies. This should be fixed or it will become a pain to build wesnothd.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

Yogi Bear wrote:Unless i am not mistaken, there is a problem with the patch. binary_wml now has a dependency to loadscreen and this one directly or indirectly needs all the other stuff within wesnoth.

On the other hand, wesnothd (the server app) builds with binary_wml and therefore also "inherits" all those dependencies. This should be fixed or it will become a pain to build wesnothd.
agreed.
Kvasir
Code Contributor
Posts: 22
Joined: November 20th, 2005, 10:52 am

Post by Kvasir »

Can someone tell me if there is already a preprocessor macro/define I can use to test what is being built? I will gladly add an updated patch with it as soon as either someone can tell me it or after I have found the time to look into it myself.
Post Reply