The Name Game: More scripting…

At the very least, this project has been a fun way to brush up on my coding skills. By this week, I’ve used scripts to generate databases for most of my categories. I’ve also written the script below to find matches between my category and theme databases. This is a big step. Finally, after so much frustrating scripting I can use them to count the number of results for category and theme combinations.

Here’s the script:

import fileinput
import os

matches = 0
exact_matches = 0
category_dir = “Categories/Books”
theme_dir = “Themes/Colours”

category_files = []
theme_files = []

def find_txt_files(dir,array): #Look through a directory and add any text files to an array
for files in os.listdir(dir):
if ‘.txt’ in files:
path = os.path.join(dir,files)
array.append(path)

find_txt_files(theme_dir,theme_files) #Builds array of text files in theme directory
find_txt_files(category_dir,category_files) #Builds array of text files in category directory

for c in fileinput.FileInput(category_files):
count = 0
exact = False
for t in fileinput.FileInput(theme_files):
t = t.replace(‘\n’, ”)
c = c.replace(‘\n’, ”)
if t.lower() in c.lower():
if count == 0:
print c,
count += 1
print (‘ (‘ + t + ‘)’),
if t.lower() in c.lower().split():
print (“<–EXACT MATCH”),
exact = True
if count > 0:
print ”
matches += 1
if exact:
exact_matches += 1

print str(matches) + ‘ matches found.’
print str(exact_matches) + ‘ exact results found.’

 

It started off simple: using ‘for’ loops to iterate through two text files, then printing and counting matches.

But, step by step, I realised the script needed to be more sophisticated to give an accurate result. Some of these steps include:

  • Comparing the categories and themes as lowercase, so matches with different cases aren’t missed.
  • Comparing not just a single text file, but all text files in a given folder.
  • Counting matches and exact whole word matches separately. Depending on how people play, they may only count exact matches, e.g. for Actors with Colours in the name, ‘Jack Black’ would be valid, but not F(red)die Prinze Jr.
  • Flagging exact matches when they are printed.
  • Only counting unique matches, so that a title that might different words of the same theme are only counted as one answer, e.g. ‘One Fish, Two Fish, Red Fish, Blue Fish’ contains ‘Red’ and ‘Blue’ but should only be counted as one match.
  • Printing the matches neatly.

Since this search script is now in place, I can start filling out a spreadsheet of categories vs. themes and definitively decide what will make it into the game.

Thanks for reading,
Eugene

The Name Game: Building a database

So there hasn’t been an update in a while. After my post about categories and themes, I’ve tried to lock in the themes before getting any further. And I thought the best way to do that is to build a database. I made a post a couple of weeks ago about how building a database stalled me a bit. Unfortunately, the same thing happened again. It wasn’t entirely fruitless though. In the past three weeks I did a lot of reading on Python and the Python library, Beautiful Soup, and how to use these to scrape data from websites.

Originally I thought I could write a script to search the entire database of IMDB’s movies, TV shows and actors and list them in a text file. But after a short test, this proved to be way too time consuming and give me more data than I needed or could sift through. Luckily I was able to find some user generated lists from IMDB. I hit a speed bump when I found out the reason my script wasn’t working was because IMDB blocks people from scraping their site. I got around this by downloading each of the html pages, which took a bit more time, but not too much. I tossed up between adding the names/titles to a text file or a csv file with other information, such as release year and rating, so I could search for only the most well-known results. I briefly read about the csv Python library, but that was a whole other rabbit hole. I decided to stick with a simple text file for now, and I could revisit csv format later if I need to.

Here’s an example of the Python code I used to save the titles of the movies from the downloaded html files:

from bs4 import BeautifulSoup
import os

dest_file = open(“Movies.txt”, “r+”)
n = 0

for name in os.listdir(“html/”):
src_file = open(“html/” + name, “r+”)
for i in src_file:
if i.startswith(“<td class=\”title\”>”):
first = i.find(“>”,40) + 1
last = i.find(“<“,first)
title = i[first:last]
title2 = str(BeautifulSoup(title,”html.parser”))
for line in dest_file:
newline = line[:-1]
if newline == title2:
exists = True
break
else: exists = False
if exists:
print title2 + ” already exists.”
else:
dest_file.write(title2 + “\n”)
print title2
n += 1

print str(n) + ” items added.”
src_file.close()
dest_file.close()

It’s nothing too fancy. I’m still new to coding so getting the for loops to work correctly took some trial and error. I was also able to add in a loop that checked if the title was already in the text file before adding it. This is actually cruder than the next one, because I wasn’t using Beautiful Soup to search by tag and class.

Here’s what I used to scrape the site, https://www.goodreads.com/list/show/7:

est_file = open(“Books21stC.txt”, “r+”)
p = ‘/list/show/7.Best_Books_of_the_21st_Century?page=67’
loop = True

while loop:
print p
r = urllib.urlopen(‘https://www.goodreads.com&#8217; + p)
soup = BeautifulSoup(r,”html.parser”)
next_url = soup.find(“div”, { “class” : “pagination” }).find(“a”, { “rel” : “next” })

bookTitle = soup.findAll(“a”, { “class” : “bookTitle” })
for i in bookTitle:
name = str(i.find(“span”, { “itemprop” : “name” }))
first = name.find(“>”) + 1
last = name.find(“<“,first)
print name[first:last]

if not hasattr(next_url,’href’):
print ‘\n’ + ‘Reached the last page.’ + ‘\n’
break

print ‘\n’
p = next_url[‘href’]

print ‘Mission Complete!’

This is still a work in progress. I didn’t need to download each page as a .html thankfully. But it took some work to use Beautiful Soup to search for the ‘next page’ link and then loop through that page too, so on and so forth until there was no more ‘next page’ link. I still need to implement the writing to a text file part and checking the text file for duplicates part, but I can easily grab that from the previous script.

I encountered a small caveat with Beautiful Soup. I tried using ‘soup.title.string’ but it had trouble with one title in particular. So I instead searched for the title then put in my own code to remove the tags around it, which is the following part:

for i in bookTitle:
name = str(i.find(“span”, { “itemprop” : “name” }))
first = name.find(“>”) + 1
last = name.find(“<“,first)
print name[first:last]

 

I’ll keep working on building databases so that I can set my themes in place and be confident that players won’t come across any combinations with too few or too many answers. I just need to keep in mind that the databases don’t need to contain every single name/title, but just enough to know that each theme is viable. I plan to do this by creating a spreadsheet with possible answers for all combinations. This will be time consuming, but it means I won’t have to ask myself this question anymore for the rest of the project.

Thanks for reading,
Eugene

The Name Game: Categories and Themes

How will I be deciding on categories and themes?

Categories are quite easy, I’ve already decided on:

Actors/Actresses
Should actors and actresses be separate categories? No, because themes, such as ‘plants’ (Lily, Rose) and ‘minerals’ (Ruby) work well with actresses, but would be too difficult if its just actors.

Movies

TV Shows
Should movies and TV shows be combined into one category? No, both are broad enough to be categories on their own.
What TV shows should be included? Answers like ‘Japanese News’ and ‘Hungarian News’ shouldn’t be allowed, because they would not work with the ‘countries’ theme. But it shouldn’t be restricted just to fictional series. Shows like ‘Bondi Vet’ and ’60 minutes’ make for good answers.

Authors

Books
During a play-test, someone used ‘Cake-making for Dummies’ as an answer. Using ‘[X] for Dummies’ is an easy way out. But I don’t want to restrict the category to only fiction books. Maybe the ‘one answer per franchise’ rule would keep this answer from being exploited. Or I can just leave this to the players to self-moderate.

Recording Artists
Purposely not written as bands or singers so rappers and instrumentalists are included.

Albums/Songs
These two categories are combined because I thought albums on its own would be too difficult, but it should still be included because it can result in some interesting answers. Soundtracks are not allowed, otherwise it just becomes the ‘movie’ category.

Fictional Characters

Other possible categories:
Athletes – Excluded because I wanted to keep the theme to pop culture related.
Video games – Might not be mainstream enough. The target audience is families.

Rejected category ideas:
Sports teams – 
This can’t be included because they are mostly animals and all contain place names.

I will also be including the option for people to add whatever category they like in the paid version. I think this will be a point of difference with other mainstream game apps, as they don’t usually allow users to make additions to the gameplay.

All these categories will be worth one point. Some may be harder than others, but that will vary depending on who is playing (e.g. whether they are more familiar with books or TV shows). Then in an expansion I’ll have an option for more challenging, specific categories, that will be worth more points, e.g. British actors, TV shows from the 70s. Having the categories being worth 1 point also make the game more balanced. This way winning a round of an easy theme is worth 2 point (1 for category + 1 for theme) and a harder theme is worth 3 points (1 for category + 2 for theme), rather than winning the round with the harder theme being worth twice as much. This is so players that don’t get the harder themes are counted out of the game too early.

I don’t want to post all my themes here as that would make my game pretty much redundant.

Instead, here are my thoughts of what will qualify as good themes. This game is not only about having pop culture knowledge, but also about being creative and thinking laterally. The challenge is in having to juggle two concepts at once, thinking of words that fit the theme and your knowledge of that category. The themes should be familiar to everyone to be inclusive, but also offer broad interpretation to invite creativity. Also, getting into arguments with friends as to what is allowed is part of the fun. Though I have to be careful of themes that are too ambiguous which would take the focus away from the actual game.

Numbers is an obvious one as everyone knows what they are. But there are broad range of words to choose from. So everyone can contribute, but it is still challenging.

Places is another one that fits that criteria. A broad range of words to choose from, but still requires some thought and creativity.

Another ongoing challenge is finding themes that will fit with names.

How many themes should I have? I want to have enough themes so that the game has plenty of replayability. This is a high priority. I can’t have users encounter the same category/theme match ups, otherwise it becomes a memory game, trying to remember what was said in previous games. Also, it allows players to prepare for their next game by guessing combinations in advance.

So there are 8 base categories. Assuming most games will have 3 players/teams. And the goal is to reach 10 points (5 rounds of the easiest themes, at least 4 rounds of the harder themes). If its a close game, say Team 1: 10 points, Team 2: 9 points, Team 3: 8 points), that’s a total of 27 points. Most rounds will be worth 2-3 points (most themes will be starts with [A-Z]). So an average game will go through 9 – 14 rounds. Say I want the same group of players to play 50 games without repeated category/theme combinations, total of 700 combinations. That means I would need roughly 87 themes to go with my 8 categories. I’ve been conservative, so let’s go with 80. 26 will be taken by ‘starts with [X]’. So far I’ve thought of 23 miscellaneous categories that have to do with common sense. The ‘rhymes with [X]’ category is good for probably 15 themes at least. ‘Has a word in common with [draw a category]’ adds 8 themes. So that’s a total pf 72. I think if I can come with 7 more miscellaneous themes and make it 16 rhyming themes, that will make 80 themes (though really only 73 cards in the Theme deck). I might make it a neat 75.

Goal for next week is to have my themes set in place.

Thanks for reading.

The Name Game: Project Planning

Last night I intended to post about building a database of movie titles, to test themes against. As a graphic designer I have a limited knowledge of coding, but I have done a short course on Python. However, I overestimated my abilities and wasn’t able to get anywhere. I did some research on using the Beautiful Soup library to write a script to scrape imdb for its movie and tv titles. While I did make a little progress, it wasn’t the best use of my time. And having a script to scrape the entire imdb site would’ve taken I even longer.

So instead, this blog post will be about what I can learn from this experience and how I can better manage my time.

While I still think building a database for each of my categories is important, I think I got too excited about building a clever script. Realistically, if my goal was to check that each combination of category and theme had enough answers there were other ways to do it. And I didn’t have to scrape the entire imdb site, I later found lists of just the 1000 most popular titles, which would have adequate.

To make sure I don’t get side tracked again, here’s a list of the main blog posts I need to hit to make sure I’m progressing steadily:

1. Solidifying the rules
2. Flowchart of the game
3. Flowchart of the entire, including menus
4. Building a list of categories and themes, checking them against a database
5. Researching similar apps
6. Mock ups of screens for UI and UX
7. Working prototype
8. Final designs of screens
9. Animation
10. Further play testing
11. Initial release features
12. Expansion features
13. Marketing strategy
14. Payment model

This is more of a checklist than a schedule. I don’t think I’ll be able to stick to one point per week, but an overall plan of this project’s progression should be a useful tool.

Thanks for reading,
Eugene

The Name Game: Playtest 1

On the weekend I put together a paper prototype of ‘The Name Game” and playtested with a group of friends. We played the following rules:

We played with 4 groups of 2 people each.
I played as judge/mediator/time keeper.
First to 10 points initially, though we kept playing after that.
30 second time limit for each guess.
No shuffle cards.
We were forced to come up with rulings for certain combinations of category and theme.
Repeating someone’s previous guess excludes you from the round.

OBSERVATIONS

Minor changes to cards:
– The ‘Places’ theme should include suburb and continent, in addition to city/state/country. (Manhattan is a suburb, not a city).
– When we played the ‘Places’ theme we also included nationalities, e.g. Roman, American, Tuscan. It seemed silly to allow American, because it contains the word America, but not other nationalities.
– Fictional Character/Contains an animal ruling: The character cannot be the animal that is in the name (to eliminate easy answers such as Mickey Mouse, Daffy Duck, etc.)
– Unit of measure clarification: Includes measures of time, so day, month, year are allowable.
– The ‘Months/Days of the week’ theme should also include seasons.

It was very difficult to keep track of who is the dealer. This definitely needs to be taken care of by the app.

It was very difficult for players to keep track of whether they had hit 10 points or not. This definitely needs to be taken care of by the app.

QUESTIONS

Should the game offer rulings? And how strict should they be?
I feel that some rulings and clarifications are necessary, but part of the fun is arguing among your friends and coming up with house rules.  I think I’ll come up with no more than 3 sentences of rulings/clarifications and hide them behind a ‘Rulings’ button. Stress that these rules are suggestions.

What is the ideal time limit?
In a way any amount of time is balanced. Even if a player waits for the very last second to say their answer and instead uses the rest of the time to think of answers for future rounds, this also gives all their opponents thinking time. But once people caught onto this strategy, the 30 seconds each round felt quite long.

Does ‘contain’ means ‘contains the theme as it is pronounced’ or ‘as it is spelt’?
So does Catherine fit into the animal theme, because it contains ‘Cat’?

Should there be a penalty for repeating an answer from a previous round?
E.g. if Red Hot Chili Peppers was mentioned in the ‘food’ theme, could you also use it for the ‘plant’ theme. This seems to happen primarily with the overlap of foods and plants. This rule seems too specific to these two categories and would eliminate a lot of answers. In the above example would it also exclude that answer from the ‘colours’ theme?

OTHER TAKEAWAYS

A time limit is definitely necessary.
The app should have some audio cue to let the player know they are running out of time. Either beeping or a countdown.
People often needed to be reminded whether it was their turn.
It was difficult for me as the mediator to remember who was still in the round and who’s turn it was to be dealer.There should be some time between a player timing out and the next player starting. Just in case they answered at the last minute and there’s a dispute over whether the guess was valid or not. This happened a couple of times.
It felt necessary to add points to the ‘Author’ and ‘Book’ categories as these were harder to guess, but that was just because of the group we were playing with. This is where a shuffle card would come in handy.
There should be a time limit for a player to decide on the ‘Wild Card’ theme.
A mediator may not be necessary once the app takes care of most of the responsibilities. But would probably still make things easier.

The presentation of the app should:
1. Be clear. i.e. people know who’s dealer, what the category and theme is, who’s turn it is, who’s still in the round, when the game is over, etc.
2. Make players feel the pressure of the time limit.
3. Make players proud to have won a round.

OVERALL

People were willing to play and thought it was a fun idea. One person even asked to keep playing. Overall, the reception was positive and it felt like people were having fun. There were some exciting reactions to clever answers and people felt under pressure, suggesting that they were invested in the game.

I’m very happy with the progress I’ve made on ‘The Name Game”. Investing the time in making a paper prototype and showing it to friends was definitely nerve-wracking. The fear of negative reactions was very real. However, everyone reacted positively to the experience and it felt rewarding to have that pay off after putting in all the time, thought and effort. I look forward to building this into a real game and getting it into the market.

Thanks for reading,
Eugene

Side project: Tentatively titled “The Name Game”

While I originally intended this blog to only be about my TCG project, I can’t help but think of other games. Especially games that would be more accessible for people not familiar with hardcore TCG. This side project, tentatively titled “The Name Game” is a casual game that takes no time to learn and is fun to play with family and friends.

It originated from a simple word game I still play with my partner on occasion. One of us picks a category, usually something pop-culture related (such as movie, song, recording artist) and a theme (such as ‘starts with a B’ or more difficult like ‘contains alliteration’ or ‘contains a place name’). Then we’d go back and forth, naming something that fits both the category and the theme. The first person to miss an answer loses.

For example, ‘Bands that contain alliteration’:

Player One might say: “Backstreet Boys”
Player Two might say: “Alien Ant Farm”
Then it goes back to Player One who might say: “Yeah Yeah Yeahs”Player Two says: “Counting Crows”
By now Player One is out of ideas and admits they can’t think of any more.
To win the round Player Two has to think of one more answer, so that their total answers is more than Player One’s. They say, “Janis Joplin!” and they win the round.

This is a very simple game that anyone could just as easily play without an app, any cards or any equipment whatsover. So my challenge is to turn this concept into something more.

First thoughts

The first logical step was “Where do the categories and themes come from?” The most basic answer is two decks of cards: Categories and Themes. They’re shuffled at the beginning of the game and each round one card from each deck is dealt and read to the players. This naturally lead to the idea that winner of each round claimed the two cards and this would define peoples’ scores. Also, it meant that those cards are taken out of the deck so they aren’t repeated later in the game.

From there it made sense that some themes would be more difficult than others. So I’ll add different point values to each of the cards. The win condition would either be who gets the most points in X number of rounds, or the first to get to X number of points. The latter would be better so that everyone stays in the game until the very end, with a chance to come back from behind.

To keep it fair, players should take turns being the first to guess, or the “dealer”. Otherwise the last person to go in each round is at a disadvantage because its more likely that their answer will be taken by someone else.

It would be good to include some kind of player interaction, such as:
– Each player can re-shuffle either the Category or Theme if they’re stuck and feeling lucky. Restricted to only once per round per player and restricted to only their first guess.
– Each player is dealt X number of Category and X number of Theme cards. Throughout the game they can replace the current Category or Theme with one of their own to give themselves an advantage. Same restrictions would apply as above.

MANIFESTO

Create a game that anyone can play. A game based on pop culture knowledge and lateral thinking, with different levels of difficulty.

RULES

Two decks of cards: Categories and Themes.
Cards have a point value, relative to their difficulty.
The first to reach X number of points wins.
The round starts with the dealer revealing the category and the theme.
The dealer has first go at saying a name that fits the category and the theme to stay in the round.
The player on the dealer’s left goes next. And so on, going clockwise through all the players.
Only on their first guess, the a player can:
Digital version: Shuffle either the category or the theme, then say a name that matches the new category or theme. Players get two category shuffles and two theme shuffles per game.
Physical version: Play a category or theme card from their hand to replace the category or theme that has been dealt. Players get two category cards and two theme cards per game.
This continues until only one player is in the round. That player keeps the cards.
The “dealer” rotates each round. The new dealer is the player to the previous dealer’s left.
Once a player has enough cards to reach the point total they are the winner of the game.

CHALLENGES

Why would people spend money on a game they can just play in their heads or with pieces of paper?
Predefined themes with definite answers, so people don’t have to think of their own.
They would still need some kind of timer for each player’s turn, which would require some kind of peripheral, whether digital or analogue.
They want to support a good idea.

Digital or physical?
Physical (CON):
-More expensive and harder to distribute, especially if its to include some kind of timer.
Physical (PRO):
Although, a nicely designed timer might justify the purchase more.
– More in line with the theme of a family game that anyone can play.

Digital (CON):
– Everything being on one screen restricts some gameplay options.
– Some people enjoy the feel of a physical game over digital.

Digital (PRO):
– Easy to distribute and can be done with a Freemium model.
– Players don’t have to shuffle, deal or keep track of score.
– Timer will be seamlessly integrated.
– Possible to have specific themes for specific categories.

EXTRAS

Games suggest some answers. Weighted towards the most popular movies/bands/etc. Give harder answers if the round went for longer.
Customisable features in the full version:
– Time for each player to guess
Add custom categories or themes
– Use cards of only certain difficulties
– Play most points after X number of rounds
– Change the number of points needed to win
Use only certain categories or themesDownload new themes or categories over time
Extra hard mode with a secondary theme: e.g. Movies that begin with ‘C’ that were released in the 90’s.

Hopefully I’ll have the chance to do some playtesting this weekend and can post an update next week with my findings.

Thanks for reading,
Eugene

What is Frontlines TCG?

Frontlines TCG is the tentative title for a new TCG. I’ve had the idea  for maybe two years, but have only started prototyping in the past month or so. This blog is to help form the pages of notes and scribbles and vague, disconnected concepts into a game worthy of playing and hopefully selling.

A bit about myself: I’ve been a gamer for as long as I can remember, but primarily a console gamer. Having grown up with the original NES, I spent countless hours engrossed in the worlds of Super Mario and Mega Man. When I was in high school the TCG craze was in full swing. Many of my friends were obsessed with Magic: The Gathering, Star Wars TCG and Pokemon TCG. I found the games intriguing, but I wasn’t willing to pour my allowance into the endless abyss of TCG/CCG. Embarrassingly, I only became obsessed with TCG when Yu-Gi-Oh! came out and I was able to invest hours into the Game Boy games without investing hundreds of dollars (also, the show had me hooked). It was then I begin to pick apart the mechanics of YGO, wondering what I would change if I were to make my own TCG. Since then, I’ve dipped my toe into Hearthstone, Magic: The Gathering and Pokemon TCG thanks to their respective apps. I’m also addicted to competitive Pokemon, via Pokemon Showdown, which is actually a game of surprising depth and strategy.

Why make my own TCG?

Every time I let my mind wander, I can’t help but think about different game mechanics, about what makes games like Magic and YGO work or not work, and whether new ideas I come up with might work or not work.

I’ve identified a few things that make a sort of “mission statement” for my TCG. These are points I want to hit to make my game worth playing.

  1. Reduce the emphasis on card advantage
    In the YGO metagame (at least last time I was into the competitive metagame), there is so much emphasis on card advantage. So much so that many cards become redundant if they result in negative card advantage. Similarly, I’ve watched Magic games where the game comes down to whoever top decks the right card first. While it makes sense that having more cards in your hand means more options, which will always be advantageous, I’d like my game to reward players for more than just holding more cards than their opponent.
    So far my ideas have included restricting the number of actions a player can make per turn, so players have to worry less about burning through all their cards. Also, new draw mechanics, other than the standard draw one per turn. Possibly draw up to certain number of cards and discard down to a certain number of cards at the end of the turn.
  2. Focus on card combinations
    The thing I most enjoy about any TCG is stumbling on a combination of cards that add up to more than just the sum of their parts.
  3. Create a variety of strategies based on the ‘position’ of cards
    I remember learning in chess how having just a pawn and a bishop in the correct position, so that they are protecting each other, can be a powerful combination. However, if their positions are reversed, they aren’t nearly as strong. I’d like to emulate something similar in my game. If certain cards had different capabilities just by having them in a certain position on the board, then it would increase the number of strategies exponentially.
  4. Less emphasis on the importance of having the ‘right’ cards in your hand. More emphasis on knowing how to use the cards in your hand to your best advantage (knowing which cards to play, at the right time, in the best ‘position’).
    This ties in the previous three points. I’ve seen some games that are played at quite a fast pace. I’d like mine to be a bit slower, more chess-like, where players have to carefully consider what moves they might make or their opponent might make several turns in the future. My aim is that a good player can think their way of a tough situation, even if they have just a few cards in their hand. So that with careful planning, they can set themselves up to be in a better position, and stage a comeback later on.
  5. A strong theme.
    If the mechanics can be comparable to a real life battle, then it will be easier for players to pick up and more fun.

That’s it for this week. Stay tuned for more updates on Frontlines TCG and also my brief analysis of other games, where I’ll try to breakdown what makes them work.

Thanks for reading,
Eugene