spirulence / power-department-ld38

A game about powering the people. Ludum Dare 38 Jam entry.
GNU Affero General Public License v3.0
1 stars 1 forks source link

People feeling neutral shouldn't lead to game over #31

Closed caryoscelus closed 7 years ago

caryoscelus commented 7 years ago

Not sure if it's fixed in post-jam version, but it seems to be true for jam.

Perhaps it can be left for hard mode, but i wonder if it's even playable at this point.

spirulence commented 7 years ago

You're right in that it is a very crude happiness mechanic. Right now the situation is:

then

then

then

which essentially means you can have an immediate happiness dip that's not reported causing you to lose.

A crude fix would be to make the 'you lose' threshold lower, like 15 or 20. A more robust fix would be to revamp the whole system to make it more obvious why people are unhappy. What would you suggest?

I've included the relevant code. This is lines 397:436 of app/src/state/Main.ts.

private updateHappiness() {
        this.demand.calculateSatisfaction();
        this.satisfactionHistory.push(this.demand.satisfaction);

        if(this.satisfactionHistory.length > 3){
            this.satisfactionHistory.shift();
        }

        let unconnectedSum = 0;
        for(let satisfaction of this.satisfactionHistory){
            unconnectedSum += satisfaction.unconnected;
        }
        let unconnectedAverage = unconnectedSum/this.satisfactionHistory.length;
        if(this.demand.satisfaction.unconnected < unconnectedAverage){
            this.happiness += 15;
        }

        for(let event of this.lastEvents){
            if(event.outage){
                this.happiness -= 15;
            }
        }

        this.happiness -= Math.floor(this.demand.satisfaction.unreliable / 10);

        this.happiness = this.happiness * 0.75 + 35.0 * 0.25;
        this.happinessHistory.push(this.happiness);
        if(this.happinessHistory.length > 5){
            this.happinessHistory.shift();
        }

        let sum = this.happinessHistory.reduce(function(a, b){return a+b});
        let average = sum / this.happinessHistory.length;
        if(average < 38.0){
            this.gameOver("People were unhappy with you for too long.");
            return true;
        }

        return false;
    }
caryoscelus commented 7 years ago

I would suggest if(average < 38.0 && this.happinessHistory[3] < HAPPINESS_NEUTRAL && this.happinessHistory[4] < HAPPINESS_NEUTRAL) and also show final happiness level on game over screen.

spirulence commented 7 years ago

Great suggestion! Included in 'must-fix-before-judging'.