Global stats at end of game

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
iBrandad
Newbie
Posts: 7
Joined: Sun Sep 02, 2018 5:57 pm
Contact:

Global stats at end of game

#1 Post by iBrandad »

Is it possible to get a percentage stats of how many players chose certain choices in your game? Like a Telltale game sort of deal. At the end of my game I wanna have a stats screen that says like "you and 54% of players did this" you know what I mean?

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Global stats at end of game

#2 Post by drKlauz »

You can either add $choices_done["choice_431_a"]=True to menu choice or rework choice screen so it updated automatically. Then periodically sync choices_done with your server stats.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Global stats at end of game

#3 Post by drKlauz »

Copy from PM, in case anyone will have similar need it in future.

You need some dictionary in which you store choices player have made.
Such dictionary must be created at start label, so it can track current game.
When player select option you update dictionary.
Then periodically or at game end, you send this dictionary to server where you combine it with other players data.
At game end you request average data from server and compare it with current game choices dictionary and show player results.

Code: Select all

menu:
  "What should I do first?"
  "Fly!":
    $game_choices["fly_or_fireball"]=True # or 1 or "Fly"
    "I'm flying."
  "Fireballs!":
    $game_choices["fly_or_fireball"]=False # or 2 or "Fireballs"
    "I have fireballs."
I wouldn't recommend sending every choice made to server, as it could distort statistics, better send only after game is finished, right before or along with request for global statistics.
Plus you may include to sent data some game id, generated at start of game random number, so you don't include same game statistics multiple times if player reloaded.
Tricky part will be communicating with server without lagging game.
For server i recommend https://pythonanywhere.com - it's free and simple to use.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

Roxie
Regular
Posts: 71
Joined: Sat Aug 13, 2011 9:07 pm
Projects: Assess K, Mizuchi
Organization: Aikasa Collective, Altabe Studio
itch: aikasacolle
Location: Southern California
Contact:

Re: Global stats at end of game

#4 Post by Roxie »

This might be an old thread, but thought it might be worth mentioning for future searches:
viewtopic.php?f=4&t=39864#p424833
ImageImage
Assess K (VN Adventure Game) LSF Thread | Mizuchi (GxG VN) LSF Thread | Honest Critique
[Proofreader, Beta-Tester]
Razz Art Visual - Starlight Vega [Co-writer]
Roseverte - Cafe-0, Duplicity, East Tower, How to Take Off Your Mask; Bakufu - Love Sniper
Zeiva Inc. - Train of Afterlife, OASE, X-Note, Area-X, Voices from the Sea, Natural - Beyond Nature, Dragon Essence, Anicon - Cat

Post Reply

Who is online

Users browsing this forum: No registered users