Inefficient code or a bug or my crappy computer?

stoferb

Prince
Joined
Aug 17, 2011
Messages
309
I'm using the last official patch so it's perhaps it's an issue that is already resolved, but there is a very curious lag regarding specialist. Sometimes it takes forever to reassign specialists, it can take more than 10 seconds to reassign every single specialist, and since reassigning specialists and workers is most often a two step process that doubles the pain. Usually it is very slow in the beginning of a session, then anywhere between 15-minutes to several hours later it suddenly lightens up and the lag is gone. But some sessions the lag never goes away and very rarely it also happens that the lag isn't there in the beginning of a session and it can also return and disappear later seemingly without rhyme or reason. What is going on here?

Another peculiar bug is with the resource overlay that sometimes doesn't work, sometimes only show you some resources and skip others and sometimes work properly. This time it's consistent and I have to reload a game to get a better functioning interface but why should loading the game in the first place be a cointoss with regards to the UI?
 
Not sure about the first, but can help a bit with the second. Instead of reloading, just scroll out far enough and the resource selection will appear in the lower right, replacing the scores. Click on the 'All' and it should fix that issue. It is a known bug, but apparently unresolvable.
 
I'm using the last official patch so it's perhaps it's an issue that is already resolved, but there is a very curious lag regarding specialist. Sometimes it takes forever to reassign specialists, it can take more than 10 seconds to reassign every single specialist, and since reassigning specialists and workers is most often a two step process that doubles the pain. Usually it is very slow in the beginning of a session, then anywhere between 15-minutes to several hours later it suddenly lightens up and the lag is gone. But some sessions the lag never goes away and very rarely it also happens that the lag isn't there in the beginning of a session and it can also return and disappear later seemingly without rhyme or reason. What is going on here?
Interesting. Perhaps you've found a major cause for lag that has gone unseen. I'll have to take some time to analyze that. The AI does this often so it could be a major lag problem for turn times.

No promises on when I can get to it but I'll keep in mind that it's an area of concern.
 
I've always had major lag when reassigning specialists, but it's only while I'm actually changing the assignments, and doesn't appear to persist. Also, it feels like it's more of a graphical lag (recalculating and redrawing the entire city screen) than a processor lag, to me.

Just as an example, say I'm trying to take 20 priests and change them all to engineers. If I unassign one priest, it'll likely lag for 1-2 seconds. If, however, I just rapidly click the - without trying to be precise, it'll lag for maybe 3-4 seconds total. Likewise with reassigning them.
 
I've always had major lag when reassigning specialists, but it's only while I'm actually changing the assignments, and doesn't appear to persist. Also, it feels like it's more of a graphical lag (recalculating and redrawing the entire city screen) than a processor lag, to me.

Just as an example, say I'm trying to take 20 priests and change them all to engineers. If I unassign one priest, it'll likely lag for 1-2 seconds. If, however, I just rapidly click the - without trying to be precise, it'll lag for maybe 3-4 seconds total. Likewise with reassigning them.

Probably something I did when I made it possible to have more specialists.
 
Probably something I did when I made it possible to have more specialists.
I'm not sure when this first started showing up, but it definitely predates the two-column stacked specialist display at least. I remember having the same problem back when it was still showing individual specialists and using the 1/5/20(?) icons for large numbers of specialists.
 
Well, there is always this half a second or so lag for me that starts to show itself later in the game with bigger cities, but that is nothing I'd consider a problem. What is strange is this extra lag of 2-10 seconds that comes and goes mysteriously. Yes it does feel like it has to do with the graphical processing for me too, but why should exactly the same graphical changes tax the processor so differently at different times?

btw, Taxman, thanx for the tip :)
 
Whenever you click on the "-" to reduce the number of specialists in a type, that now spare population needs to be placed somewhere. The Ai is deciding on the best plot for it to go on or if it should become the citizen specialist. This is not done in the python but somewhere in the dll and or the exe.
 
Whenever you click on the "-" to reduce the number of specialists in a type, that now spare population needs to be placed somewhere. The Ai is deciding on the best plot for it to go on or if it should become the citizen specialist. This is not done in the python but somewhere in the dll and or the exe.

That was what I figured the issue was when he brought it up here. It's a shockingly complex evaluation process and there could be some bugs from previous muddling. I'm not happy with this section and the results it tends to get in many ways and there's a few things to adjust there. At some point it'll get an audit and I'll look for ways it may be possible to streamline it as well. This is one delay spot for the AI too since it uses the same coding.
 
Speaking of specialists...when the population grows the game auto-assigns new specialists. I'd love to have a feature to lock out some types of specialists, to prevent pollution of the Great Person Points pool. For example, if I don't want merchant or spy specialists, it would be great to be able to put a lock on those.
 
Whenever you click on the "-" to reduce the number of specialists in a type, that now spare population needs to be placed somewhere. The Ai is deciding on the best plot for it to go on or if it should become the citizen specialist. This is not done in the python but somewhere in the dll and or the exe.
The thing is, I don't think this is the only cause of the delay. I get a similar delay when adding specialists as well. That said, the delay on adding specialists may be the result of the system trying to decide where to take the specialist from. That is, it's taking a while to decide whether to remove a worked plot, or a citizen, or some other specialist.

As far as optimization goes, if it could simply be told to dump unassigned specialists directly to citizens, and to take from citizens first if available, it would probably speed things up considerably.
 
Speaking of specialists...when the population grows the game auto-assigns new specialists. I'd love to have a feature to lock out some types of specialists, to prevent pollution of the Great Person Points pool. For example, if I don't want merchant or spy specialists, it would be great to be able to put a lock on those.

Something that has been on my to do list for awhile now.
 
Something that has been on my to do list for awhile now.

'Our' to-do list. I setup the start of that project in the dll. I'm a little more competent now than I was then. I may need to generate a widget for you to plant on the screen somewhere for that but the actual functions controlling it should probably be in the dll. Easiest that way anyhow I think.

Getting the bandwidth to complete this project is interesting. Maybe as a capoff for this version.
 
The thing is, I don't think this is the only cause of the delay. I get a similar delay when adding specialists as well. That said, the delay on adding specialists may be the result of the system trying to decide where to take the specialist from. That is, it's taking a while to decide whether to remove a worked plot, or a citizen, or some other specialist.

As far as optimization goes, if it could simply be told to dump unassigned specialists directly to citizens, and to take from citizens first if available, it would probably speed things up considerably.

You're probably right about your assertion in that last paragraph. And while that kind of suggested hardcoding is not advised, it might help to cache the best specialist to drop into. I'll figure something out eventually.
 
'Our' to-do list. I setup the start of that project in the dll. I'm a little more competent now than I was then. I may need to generate a widget for you to plant on the screen somewhere for that but the actual functions controlling it should probably be in the dll. Easiest that way anyhow I think.

Getting the bandwidth to complete this project is interesting. Maybe as a capoff for this version.

Widgets are all done in the Python to exe interface. A "x" button near the +/- buttons and an image of the specialist with a red circle with line through it would be enough to represent the functionality on screen.
 
Widgets are all done in the Python to exe interface. A "x" button near the +/- buttons and an image of the specialist with a red circle with line through it would be enough to represent the functionality on screen.

From what I have seen in previous projects, the exe sets up the widget and what it does (usually... I think there are ways to setup widgets in python alone somehow) but python must place the button on the screen.

Is that what you're trying to say basically?

Still looking to get the 'sell building' button on the city screen somewhere too.
 
You're probably right about your assertion in that last paragraph. And while that kind of suggested hardcoding is not advised, it might help to cache the best specialist to drop into. I'll figure something out eventually.
Is it possible to set that up for only the human player, or as a toggle or option somehow? Personally, I can't think of any situations where I'd be manually adjusting specialists while still desiring an automated reassignment of any type.
 
I haven't researched the code on that recently enough to say for sure what can or cannot be easily done. I get your point of course, and agree.
 
From what I have seen in previous projects, the exe sets up the widget and what it does (usually... I think there are ways to setup widgets in python alone somehow) but python must place the button on the screen.

Is that what you're trying to say basically?

Still looking to get the 'sell building' button on the city screen somewhere too.

Yes.

There is no room. Of course we might be able do it on the building list having clicking on the building bringing up a menu or something but I have not done something like that before. Also I lost your icon for that function when I lost my hard drive and back up
 
It's on the SVN in an FPK. I'll have to get the file reference for you again. It's not to sell a particular building so much as to open up the ctrl-A 'sell building' popup. Surely we can find SOMEWHERE for it to go ;) It's VERY small.
 
Top Bottom