Skip to content

Instantly share code, notes, and snippets.

@john-science
Last active April 5, 2017 15:58
Show Gist options
  • Save john-science/34ae1add7d13fee9645f554517a08ff8 to your computer and use it in GitHub Desktop.
Save john-science/34ae1add7d13fee9645f554517a08ff8 to your computer and use it in GitHub Desktop.
Why Text-Based Games Rock
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('ggplot')
def main():
# make plot objects
#fig, ax = plt.subplots(figsize=(8, 9), facecolor='white') # 800px-wide version
fig, ax = plt.subplots(figsize=(6.4, 8), facecolor='white') # 640px-wide version
# deal with font
font_b = FontProperties()
font_b.set_weight('bold')
font_i = FontProperties()
font_i.set_style('italic')
# add highly stylized data points
for game in TEXT_GAMES:
ax.scatter([game['cost']], [game['team']], alpha=0.5, edgecolor='none', s=50, c='black')
plt.annotate(game['game'], xy=(game['cost'], game['team']), xytext=game['loc'], color='white',
textcoords='offset points', ha='right', va='bottom', fontproperties=font_b,
bbox=dict(boxstyle='round,pad=0.5', fc='blue', alpha=0.75, ec='none'),
arrowprops=dict(arrowstyle = 'simple', ec="none", alpha=0.5, connectionstyle='arc3,rad=0.1', color='blue'))
for game in BIG_GAMES:
ax.scatter([game['cost']], [game['team']], alpha=0.5, edgecolor='none', s=50, c='black')
plt.annotate(game['game'], xy=(game['cost'], game['team']), xytext=game['loc'], color='white',
textcoords='offset points', ha='right', va='bottom', fontproperties=font_b,
bbox=dict(boxstyle='round,pad=0.5', fc='red', alpha=0.75, ec='none'),
arrowprops=dict(arrowstyle = 'simple', ec="none", alpha=0.5, connectionstyle='arc3,rad=-0.1', color='red'))
# stylize axes
ax.set_yscale('log')
ax.set_xscale('log')
ax.set_xlim(.001, max([g['cost'] for g in BIG_GAMES]) * 1.25)
ax.set_ylim(1, max([g['team'] for g in BIG_GAMES]) * 1.25)
plt.minorticks_off()
plt.title('Why Text-Based Games Rock')
plt.ylabel('Team Size (# People)', fontproperties=font_i)
plt.xlabel('Budget (Millions $)', fontproperties=font_i)
plt.tick_params(top='off', right='off', left='off', bottom='off', pad=0)
ax.set_yticklabels(['0', '1','10','100','1000'])
ax.set_xticklabels(['0', '0', '.01', '0.1', '1', '10', '100'])
plt.show()
# 640 px version
TEXT_GAMES = [{'game': 'Anchorhead', 'team': 1, 'cost': .001, 'loc': (75, 45)},
{'game': 'A Dark Room', 'team': 1, 'cost': .001, 'loc': (90, 25)},
{'game': 'Candy Box', 'team': 1, 'cost': .001, 'loc': (165, 10)},
{'game': 'Discworld MUD', 'team': 30, 'cost': .001, 'loc': (95, -25)},
{'game': 'Dwarf Fortress', 'team': 2, 'cost': .25, 'loc': (20, 20)}, # https://graphtreon.com/creator/bay12games
#{'game': "Hitchhiker's Guide", 'team': 2, 'cost': ?, 'loc': (50, 10)}, # https://en.wikipedia.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy_(video_game)
{'game': 'Rogue', 'team': 3, 'cost': .001, 'loc': (60, -5)},
{'game': 'Seedship', 'team': 7, 'cost': .001, 'loc': (75, 10)}, # http://philome.la/johnayliff/seedship/play
{'game': 'Zork', 'team': 4, 'cost': .001, 'loc': (50, 0)}, # http://gunkies.org/wiki/History_of_Zork http://mentalfloss.com/article/29885/eaten-grue-brief-history-zork
]
BIG_GAMES = [{'game': 'BioShock', 'team': 131, 'cost': 15, 'loc': (-20, 15)}, # http://kotaku.com/how-much-does-it-cost-to-make-a-big-video-game-1501413649 http://www.gamasutra.com/view/feature/132168/postmortem_2k_boston2k_.php?page=4
{'game': 'Braid', 'team': 5, 'cost': 0.2, 'loc': (60, 20)}, # https://en.wikipedia.org/wiki/Braid_%28video_game%29
{'game': 'Brutal Legend', 'team': 83, 'cost': 24, 'loc': (65, 40)}, # http://www.gamasutra.com/view/feature/132696/postmortem_double_fines_brutal_.php?page=6
{'game': 'Call of Duty 2' ,'team': 500, 'cost': 14.5, 'loc': (-20, 5)}, # http://callofduty.wikia.com/wiki/User_blog:Ausir/It_takes_500_people_to_make_Call_of_Duty
#{'game': 'Candy Crush Saga', 'team': ?, 'cost': ?, 'loc': (-20, -20)},
{'game': 'Destiny', 'team': 500, 'cost': 142, 'loc': (-15, 10)}, # http://www.economist.com/blogs/economist-explains/2014/09/economist-explains-15
#{'game': 'Farmville', 'team': ?, 'cost': ?, 'loc': (-20, -20)},
{'game': 'Gears of War', 'team': 90, 'cost': 10, 'loc': (-20, -10)}, # https://motherboard.vice.com/en_us/article/gears-of-war-4-aaa-games-are-hard-so-why-make-them
{'game': 'Gears of War 4', 'team': 330, 'cost': 55, 'loc': (40, -28)}, # https://motherboard.vice.com/en_us/article/gears-of-war-4-aaa-games-are-hard-so-why-make-them
{'game': 'Grand Theft Auto: V', 'team': 1000, 'cost': 272, 'loc': (-215, -15)},
{'game': 'Guild Wars', 'team': 110, 'cost': 25, 'loc': (-40, 0)}, # http://old.seattletimes.com/html/businesstechnology/2002979383_warcraft08.html
{'game': 'Half Life 2', 'team': 300, 'cost': 40, 'loc': (-50, -10)}, # http://kotaku.com/how-much-does-it-cost-to-make-a-big-video-game-1501413649
{'game': 'Pokemon GO', 'team': 70, 'cost': 30, 'loc': (55, -30)}, # http://www.vinereport.com/article/pokemon.go.release.date.gameplay.game.now.has.30m.budget.niantic.excited.to.expand.real.world.gaming.platform/3885.htm https://www.linkedin.com/company/niantic
{'game': 'Star Wars: The Old Republic', 'team': 800, 'cost': 213, 'loc': (-20, 0)}, # https://venturebeat.com/2012/01/20/ea-spent-only-200m-to-make-star-wars-the-old-republic/
{'game': 'World of Warcraft', 'team': 400, 'cost': 51, 'loc': (-30, -5)}, # http://kotaku.com/how-much-does-it-cost-to-make-a-big-video-game-1501413649
]
"""
# 800 px version
TEXT_GAMES = [{'game': 'Anchorhead', 'team': 1, 'cost': .001, 'loc': (100, 55)},
{'game': 'A Dark Room', 'team': 1, 'cost': .001, 'loc': (90, 25)},
{'game': 'Candy Box', 'team': 1, 'cost': .001, 'loc': (170, 10)},
{'game': 'Discworld MUD', 'team': 30, 'cost': .001, 'loc': (100, -30)},
{'game': 'Dwarf Fortress', 'team': 2, 'cost': .25, 'loc': (20, 20)}, # https://graphtreon.com/creator/bay12games
#{'game': "Hitchhiker's Guide", 'team': 2, 'cost': ?, 'loc': (50, 10)}, # https://en.wikipedia.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy_(video_game)
{'game': 'Rogue', 'team': 3, 'cost': .001, 'loc': (60, 0)},
{'game': 'Seedship', 'team': 7, 'cost': .001, 'loc': (80, 10)}, # http://philome.la/johnayliff/seedship/play
{'game': 'Zork', 'team': 4, 'cost': .001, 'loc': (50, 0)}, # http://gunkies.org/wiki/History_of_Zork http://mentalfloss.com/article/29885/eaten-grue-brief-history-zork
]
BIG_GAMES = [{'game': 'BioShock', 'team': 131, 'cost': 15, 'loc': (-20, 15)}, # http://kotaku.com/how-much-does-it-cost-to-make-a-big-video-game-1501413649 http://www.gamasutra.com/view/feature/132168/postmortem_2k_boston2k_.php?page=4
{'game': 'Braid', 'team': 5, 'cost': 0.2, 'loc': (60, 20)}, # https://en.wikipedia.org/wiki/Braid_%28video_game%29
{'game': 'Brutal Legend', 'team': 83, 'cost': 24, 'loc': (75, 45)}, # http://www.gamasutra.com/view/feature/132696/postmortem_double_fines_brutal_.php?page=6
{'game': 'Call of Duty 2' ,'team': 500, 'cost': 14.5, 'loc': (-20, 5)}, # http://callofduty.wikia.com/wiki/User_blog:Ausir/It_takes_500_people_to_make_Call_of_Duty
#{'game': 'Candy Crush Saga', 'team': ?, 'cost': ?, 'loc': (-20, -20)},
{'game': 'Destiny', 'team': 500, 'cost': 142, 'loc': (-20, 5)}, # http://www.economist.com/blogs/economist-explains/2014/09/economist-explains-15
#{'game': 'Farmville', 'team': ?, 'cost': ?, 'loc': (-20, -20)},
{'game': 'Gears of War', 'team': 90, 'cost': 10, 'loc': (-20, -10)}, # https://motherboard.vice.com/en_us/article/gears-of-war-4-aaa-games-are-hard-so-why-make-them
{'game': 'Gears of War 4', 'team': 330, 'cost': 55, 'loc': (60, -30)}, # https://motherboard.vice.com/en_us/article/gears-of-war-4-aaa-games-are-hard-so-why-make-them
{'game': 'Grand Theft Auto: V', 'team': 1000, 'cost': 272, 'loc': (-215, -5)},
{'game': 'Guild Wars', 'team': 110, 'cost': 25, 'loc': (-40, 0)}, # http://old.seattletimes.com/html/businesstechnology/2002979383_warcraft08.html
{'game': 'Half Life 2', 'team': 300, 'cost': 40, 'loc': (-40, -10)}, # http://kotaku.com/how-much-does-it-cost-to-make-a-big-video-game-1501413649
{'game': 'Pokemon GO', 'team': 70, 'cost': 30, 'loc': (75, -30)}, # http://www.vinereport.com/article/pokemon.go.release.date.gameplay.game.now.has.30m.budget.niantic.excited.to.expand.real.world.gaming.platform/3885.htm https://www.linkedin.com/company/niantic
{'game': 'Star Wars: The Old Republic', 'team': 800, 'cost': 213, 'loc': (-20, -5)}, # https://venturebeat.com/2012/01/20/ea-spent-only-200m-to-make-star-wars-the-old-republic/
{'game': 'World of Warcraft', 'team': 400, 'cost': 51, 'loc': (-30, -5)}, # http://kotaku.com/how-much-does-it-cost-to-make-a-big-video-game-1501413649
]
"""
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment