I like to get all unpleasant work out of the way first – but I allowed myself a little fun task this week: A Game Name Generator!
For my game Game Tower I need a bit of code that randomly generates game names for the virtual games the player creates.
This was probably the most fun task of all the work so far!
Pattern Matching
I went for a simple pattern matching system. The generator picks a pattern at random from a long list and then replaces the placeholder wildcards with random words from others lists.
Here are a few examples of such patterns:
<name> and the <noun>
<noun> Tycoon
The generator would take such a pattern and replace the wildcards with words from a list of pre-approved words. The wildcard determines which words match – there a nouns, verbs, names and plural forms of nouns. When all wildcards are replaced it spits out the finished game name, for example:
Jesse and the Unicorn
Waldo and the Zombie
My Mom and the Warlock
Zombie Tycoon
It’s soo much fun!
I added the name generator to my debug menu (see Dev Update #9) so I can test it out and generate new game names when I feel like it. It works great and I find myself adding new words or patterns to my database every few days, because it is simply that much fun.
Good ideas come … while in bed.
All patterns and words are kept inside my trusted Google Spreadsheet. I have a macro that can convert them into a string list quickly, so I can get it into my code fast. I can access the spreadsheet from anywhere – and this has already paid off.
Like all coders (I assume) I have a lot of good ideas in bed. When I have a fun idea for a new pattern or a noun to add to the list. I can just reach for my phone and punch it in.
More updates and screenshots from the game in progress coming up soon!