Showing posts with label scores. Show all posts
Showing posts with label scores. Show all posts

Thursday, September 10, 2020

Exponential = dangerous

Note: This post was initially written in 2013, right after the release of Pacifism. For some reason I never published it. It's still relevant today, so here it is seven years later.

In PP2's pacifism mode, you can blow up enemies with bombs. I wanted to encourage people to take risks and not just blow up all the bombs they see, so I decided to give players an incentive to explode large amounts of enemies at the same time. To do that, I crafted a formula that gave players bonuses that exponentially grew along the number of simultaneous kills:

x=number of enemies killed.  f(x)=the bonus for x enemies killed.

I made sure that the exponential grew slowly: even if a player managed to be twice as good as me and destroy twice as many enemies as me (200), they would only make around 55000 points, which is high but not absurdly so.
Once I was pleased with the feeling of the game, I released it and waited for the scores to come in.
As the high scores started coming in, I got to see the replays of people playing the game mode for the very first time and figuring out how to play. That was really cool.
Quickly though, you could see in the replays the players getting better and better. 

And eventually, some players realized that by using the fastest ship, you could simply circle around the level dodging the bombs for a minute with the enemies never catching up with you. When they did blow a bomb, several hundreds enemies would explode resulting in bonuses of hundred of millions of points.


Eventually what had to happen happened, and people started scoring more than 2 billion points, which is a bad thing when you store your scores in 32 bit signed integers.

The lessons I learned:
  • Use 64 bit integers for scores.
  • Put a cap to exponential scores, or at least be very careful. You never know what the player are going to.
  • Be ready to reset the scores and prevent people with old version of the game to send "bad" scores.
  • Replays are so useful, it's ridiculous. Without them, I would have had no idea what the players were doing, and I probably would have assumed they were cheating and sending fake scores.

Monday, October 26, 2009

PewPew 1.2 is out!

And the scores are pouring in... can you guess when did Apple publish the update?
So far, I've used 0.6% of the maximum CPU load (and 0% of the bandwidth), so I should be OK!

Sunday, October 25, 2009

URL time

PewPew 1.2 should be accepted anytime now, so the scores are going to start to pour in... luckily I have just completed PewPew's website:

The most important features are the score board and the forum. I made the score board myself in python, and found the code for the forum here. The forum is pretty cool, because it allows you to post with your Google account, or without login at all.

Everything is hosted on the Google App Engine, so if the traffic stays under a limit, I will never have to pay for the servers, and the website will stay up and running for ever.
According to my estimations, I can handle 100 000 score submissions per day without paying for additional bandwidth. Since "only" 50 000 people have installed PewPew, I should be fine.
I have no idea what to expect regarding the CPU utilization, but I have cached a lot of database calls, so I should be OK.
At worse, I might have to pay 1 or 2$ per day during the first week; after the first week, the traffic should decrease significantly.

Unexpected Gotchas in Making a Game Deterministic

When aiming for a fully deterministic program, it is common knowledge that you have to deterministically seed your random number generators,...