lainsce / reganam

[DEPRECATED] Build up your planet's buildings and grow yourself a ecumenopolis of native aliens

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deadlock in gameplay - Crystal too low

Silberling opened this issue · comments

1.0.3

Because of Bug #2 and a issue in the code I can't play further.

update_base_values

if (m_mine_level > 0 || c_mine_level > 0) {
    c_res += ((syc_level + 1) * (1.25 * c_mine_level));
}

Having this code and the bug #2 I am stuck at 42.5 crystal never increasing again.

As stated in #2 the game did not update itself. Even if it did and the player would have upgraded the metal mine within the first ticks, the IF in the code above would result in a multiplication with 0 for crystal leaving it without any addition per tick. Therefore the user is stuck in the game and needs to delete his / her savegame.

Suggestion: Remove the if structure, build a formula generally valid for any level. Especially independent of other resources. You could start with level 1 instead of 0, solving at least this problem.

The outside IF has flaws, too.

What about this:

Set Metal and Crystal to 1 at start, Hydrogen to 0 and use this code:

public bool update_base_values () {
    m_res = (m_res + ((sym_level + 1) * (1.55 * m_mine_level))).clamp(0, m_total);
    c_res = (c_res + ((syc_level + 1) * (1.25 * c_mine_level))).clamp(0, c_total);
    h_res = (h_res + ((syh_level + 1) * (1.10 * h_mine_level))).clamp(0, h_total);
    update_m_value ();
    update_c_value ();
    update_h_value ();
    update_help_tooltips ();
    return true;
}

The return value should be obsolete now.

Note: I am not familiar with vala but it seems correct.

commented

Your code makes sense for Vala, really!

Would you make this into a Pull Request? That way your name gets mentioned in the next update, and your contribution helps every player!

Sure ;-). Give me some time, I've got to work. By tomorrow evening (GMT +2) i might have it ready.

I have implemented the code above and compiled. I see now the crystal and hydrogen values are not changing at all.

I had a look at the code and made small change to it. now it worked perfectly (Well at least as far as I can see). All teh values are now updating. It starts with a base value, and all three start with a base value. Minerals ->101.55, Crystal -> 101.25 and Hydrogen -> 1.10

    public bool update_base_values () {
        if (m_res != m_total && c_res != c_total && h_res != h_total) {
            if (m_mine_level > 0 || c_mine_level > 0) {
                m_res += ((sym_level + 1) * (1.55 * m_mine_level));
                c_res += ((syc_level + 1) * (1.25 * c_mine_level));
                update_m_value ();
                update_c_value ();
                if (h_mine_level < 0) {
                    h_res += ((syh_level + 1) * (1.10 * h_mine_level));
                    update_h_value ();
                    update_help_tooltips ();
                }
                update_help_tooltips ();
            } else {
                m_res += 1.55;
                c_res += 1.25;
                h_res += 1.10;
                update_m_value ();
                update_c_value ();
                update_h_value ();
                update_help_tooltips ();
            }
            return true;
        } else {
            return false;
        }
    }

Only issue I still see is that its quicker to mine by quiting teh application and restarting it again. Also Control + Q does not work

The code I wrote won't work until #2 is also fixed. This does not fix the problem with the automatic ticks, only with crushing your savegame.

The IFs will need to be replaced.

commented

Does this issue persist with your fixes?

I did a rough test and everything worked. New savegame worked and broken savegame gets fixed. Just don't forget to change the timeout back to 10 and remove the test stdout ;-)

commented

Yee, I removed the test and changed it back to 10. So, issue closed.