DesignWnd bugs

For topics that do not fit in another sub-forum.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

DesignWnd bugs

#1 Post by vincele »

Bug 1 :

If you start a new game then go into DesignWnd, and choose the Monster tab, you'll have a bunch of monsters to look at.
Save that game, load that saved game, go back to monster tab in DesignWnd, nothing is there...

Bug 2 :

Some monsters have a description that has LinkText markers, but the CUIEdit control that is used in the DesignWnd is not LinkText-aware, so some descriptions looks like in the following screenshot:

Image
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12755
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: DesignWnd bugs

#2 Post by Geoff the Medio »

vincele wrote:Some monsters have a description that has LinkText markers, but the CUIEdit control that is used in the DesignWnd is not LinkText-aware, so some descriptions looks like in the following screenshot:
That's not really a bug... the point of that edit box is to be able to edit the description, which means editing the raw text of it. If you want to see the linkified version of the description, don't hide the pedia window from the design screen.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: DesignWnd bugs

#3 Post by vincele »

OK, for bug 2, any idea of what's wrong with #1 ?
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: DesignWnd bugs

#4 Post by Dilvish »

vincele wrote:any idea of what's wrong with #1 ?
That's a maze of twisty little passages, that one is. One issue was just that the monster tab was not having its Populate method called after a game load. That can be fixed by adding a line to DesignWnd::Sanitize():

Code: Select all

void DesignWnd::Sanitize() {
    m_base_selector->Reset();
    m_main_panel->Sanitize();
}
But that's just a small part of the issue. For a new game, the python create universe code gives all the empires knowledge of all premade designs, including the monster designs, and those get serialized into that initial universe, and it works just fine. Somewhere along the savegame path, though, those apparently get filtered out -- the universe winds up with zero monster designs known to the empire. I haven't been able to figure out where that is happening.

Now, the monster designs are still accessible from the PreDefinedShipDesignManager, but the DesignWnd panels are all set up to only work with design_ids that they can retrieve from the universe. If you made alternates to work with design names if it can't retrieve a design for the id, then it could work. Here is a little chunk of code to get you going if you want to pursue it.

Code: Select all

void BasesListBox::PopulateWithMonsters() {
    ScopedTimer scoped_timer("BasesListBox::PopulateWithMonsters");

    const Universe& universe = GetUniverse();

    // remove preexisting rows
    Clear();
    const GG::Pt row_size = ListRowSize();
    int count = 0;

    const PredefinedShipDesignManager& ship_design_mgr = GetPredefinedShipDesignManager();
    for ( PredefinedShipDesignManager::iterator it = ship_design_mgr.begin_monsters(); it != ship_design_mgr.end_monsters(); ++it) {
        const ShipDesign* d = it->second;
        int design_id = d->ID();
        count ++;
        DebugLogger() << "PopulateWithMonsters found monster design " << it->first << " with ID " << d->ID();
        if (const ShipDesign* ship_design = GetShipDesign(d->ID())) {
            DebugLogger() << "\t... retrieved fine.";
            design_id = d->ID();
        } else if (const ShipDesign* generic_design = universe.GetGenericShipDesign(it->first)) {
            DebugLogger() << "\t... using generic.";
            design_id = generic_design->ID();
        }

        CompletedDesignListBoxRow* row = new CompletedDesignListBoxRow(row_size.x, row_size.y, design_id);
        Insert(row);
        row->Resize(row_size);
    }
    DebugLogger() << "PopulateWithMonsters found " << count << " monster designs in the universe";
}
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12755
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: DesignWnd bugs

#5 Post by Geoff the Medio »

Dilvish wrote:Somewhere along the savegame path, though, [empire monster design info] apparently get filtered out -- the universe winds up with zero monster designs known to the empire. I haven't been able to figure out where that is happening.
Possibly in Universe::GetShipDesignsToSerialize...

Code: Select all

        // add generic monster ship designs so they always appear in players' pedias
        for (ShipDesignMap::const_iterator it = m_ship_designs.begin(); it != m_ship_designs.end(); ++it) {
            ShipDesign* design = it->second;
            if (design->IsMonster() && design->DesignedByEmpire() == ALL_EMPIRES)
                designs_to_serialize[design->ID()] = design;
        }
Maybe the monster designs don't have their m_is_monster flag set for some reason?

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: DesignWnd bugs

#6 Post by Dilvish »

Geoff the Medio wrote:Possibly in Universe::GetShipDesignsToSerialize...Maybe the monster designs don't have their m_is_monster flag set for some reason?
I looked at that, but it seems fine, and the first time through the information gets serialized just fine and sent over to the empires, and they deserialize the m_monster flag just fine, that's how it shows up in the DesignWnd Monster tab at first. I think it must be somewhere in the file load process that they are getting stripped, but I just dont see where.

Here's a thought-- in PredefinedShipDesignManager::PredefinedShipDesignManager() it parses the predefined files and apparently makes new designs from them, so there would have been some sense to taking steps to ensuring that with a file load the designs didn't just get all doubled up. Someone perhaps did that by stripping them out of a loaded universe, but they forgot to re-grant knowledge of these designs to the empires (needed since the newly parsed designs will have new IDs). It's a plausible story, but it doesn't seem to help me actually locate the problem.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: DesignWnd bugs

#7 Post by vincele »

Another bit of information. In a new game you can see all monsters, if you save/reload now you'll see none, but if you have met an actual monster on the map, this one will show up after the reload...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
biza
Space Squid
Posts: 67
Joined: Wed May 29, 2013 6:48 pm

Re: DesignWnd bugs

#8 Post by biza »

Maybe it is not a bug, but when you click on redundant button it hides only redundant weapons. Not redundant scanners, shields, engines and others...

Cheers!

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: DesignWnd bugs

#9 Post by MatGB »

biza wrote:Maybe it is not a bug, but when you click on redundant button it hides only redundant weapons. Not redundant scanners, shields, engines and others...

Cheers!
They're not necessarily redundant, they're cheaper and or less build time, etc. I've never really gone through and looked at what else should be tagged in that way, Geoff did all the weapons when he added the feature but left the rest for someone else to sort, if necessary, and I'm not 100% sure it is.

Certainly not for engines.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12755
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: DesignWnd bugs

#10 Post by Geoff the Medio »

MatGB wrote:...Geoff ... added the feature...
I don't think that was me... (although I could be wrong...?)

User avatar
biza
Space Squid
Posts: 67
Joined: Wed May 29, 2013 6:48 pm

Re: DesignWnd bugs

#11 Post by biza »

Thank you for answer, but if you go with that logic then you do not need that button at all :). I almost always use most advanced tech available, and when not it is easy to untoggle that feature.

Anyway it is not important, just idea if it could be done for new version.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: DesignWnd bugs

#12 Post by Dilvish »

MatGB wrote:They're not necessarily redundant, they're cheaper and or less build time, etc. I've never really gone through and looked at what else should be tagged in that way, Geoff did all the weapons when he added the feature but left the rest for someone else to sort, if necessary, and I'm not 100% sure it is.
Geoff's the one who added the 'Redundant' button to toggle the filtering, but I'm the one who did the actual filtering code.

Like you noted, first part is uperseded by a second part only if the first is weaker, and the second one takes no longer to build, or is not more expensive. The only current parts that could get filtered are Weapons (everything else was blocked from filtering by longer build times or greater cost), and at the time the code was written lots of other part types like shields, detectors, etc., didn't have their capacity available to check, so a decision was made to only apply the filtering to Weapons. That might also have been motivated by the fact that some of the other part types may have additional location requirements, which either weren't as readily exposed back then, or I simply was unfamiliar with them, so it just added up to multiple reasons not to cover them.

Now that Capacity works for the other part types, I just changed it so that the redundancy filtering will get applied to all part types. But with default redundancy check settings, weapons are still the only ones whose current characteristics would cause them to get filtered. Note that since BioTerminators and BioSpores are distinguished only by an effect, not Capacity, the latter does not filter out the former even though they are both the same cost and time.

I'm about to post a further update to the redundancy checking that would make it customizable via default/customizations/common_user_customizations.txt. That way you could have it set so that, for example, Zortrium armor suppressed Standard, or even that N-Dimensional Engines suppressed Improved Engine Couplings.

biza wrote:Thank you for answer, but if you go with that logic then you do not need that button at all :)
We started out without the button, and many people were confused and complained. It's much easier to understand the filtering if you can turn it on and off with the button rather than only see the end results.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: DesignWnd bugs

#13 Post by MatGB »

I remembered the button being added, the filtering was I think before I got involved, not that it really matters. I do think that the redundant toggle/button should default the other way, so that outdated stuff isn't shown by default, the perpetual questions from new players about why their new plasma 1 isn't showing up in design when they've got laser4 should be lessened by its very existence, I hope but I always forget to turn it on again.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: DesignWnd bugs

#14 Post by Dilvish »

MatGB wrote:I do think that the redundant toggle/button should default the other way, so that outdated stuff isn't shown by default, the perpetual questions from new players about why their new plasma 1 isn't showing up in design when they've got laser4 should be lessened by its very existence, I hope but I always forget to turn it on again.
I agree, there are probably many many more people playing who understand it fine and for whom always having to change it is a pointless hassle, than there are folks who can't figure it out as part of a reasonable learning experience.

Or, perhaps we could make it save its state like a lot of windows do now? So that once you turn it off, it just stays off, game after game, unless you turn it back on again. Could anyone volunteer to code that up?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply