Random Names

BlitzMax Forums/BlitzMax Programming/Random Names

mothmanbr(Posted 2009) [#1]
I plan to implement a random name generator in my game. So far I'm thinking about saving all names to a text file, reading them in the game and putting them in an array.

I can't think of anything better, but I fear it may take too long to load in case the list is long. (I've never worked much with files)

On a sidenote, is there a list of english names and surnames anywhere that I can download, in a nice formatted way for easy reading in the game?

Thanks.


plash(Posted 2009) [#2]
I can't think of anything better, but I fear it may take too long to load in case the list is long. (I've never worked much with files)
How long? If your not getting into several megabytes it should be fine. I don't know if holding a large bucket of names in an array is an excellent idea though.. You may want to add others later, so unless your list has a 'name count' line somewhere you would have to go back to the code to update the array size.

On a sidenote, is there a list of english names and surnames anywhere that I can download, in a nice formatted way for easy reading in the game?
Google is your friend.


Craig(Posted 2009) [#3]
You can Google and find 2000 census data for the US. The files they have not only have the names but they also have their frequency. I've used this before with great results.

Btw, I load them once, store them in an array and you're good to go. It's really not a huge list (I think about 18,000 surnames with a max of 15 chars each). That sounds like a lot, but really isn't when it comes to memory.


SpaceAce(Posted 2009) [#4]
Your list(s) would have to be awfully long before you start having speed issues, unless you are planing to open and load the file over and over again. Like Craig said, you can load and hold a substantial list of strings without too much of a penalty. If you're really worried about it, create a giant array of names, shuffle it once, then truncate or slice it to 1,000, 500, or however many items you may actually need.

SpaceAce


Ginger Tea(Posted 2009) [#5]
also your local address book gives out oodles of last names, ok its paper based and not online (probably a digital version exists as like the census data) i used a manchester one years ago when thinking of last names for people (and a book of babies first names for, well first names)
if english/american you can get away with alsorts of names, but id invest in the effort to find russian/polish/oriental etc types of names, nothing worse than finding out your macho russian warrior is actually called their equivelant of sarah
and iir japanese classmates refer to each other via their last names, as do other countries eg sadam hussain's last name was sadam and not his first