Game Development Community

dev|Pro Game Development Curriculum

Super simple script based name generator + Air Ace bomber

by Thomas \"Man of Ice\" Lund · 01/22/2007 (2:48 pm) · 10 comments

I wrote this yesterday as I was in need of AI pilot names for our game Air Ace Online www.airaceonline.com

Its so super simple that it hurts, but works fine for my usage. So why not share it with you.

The basis is to use a list of first names and combine randomly with a list of surnames.

For Air Ace in version 1 we have British and German pilots, so I fetched a little list of those.

To get some good names I went to
en.wikipedia.org/wiki/Surnames
and
en.wikipedia.org/wiki/First_name

In the bottom they have lists for common names for various countries.

Then I fixed this little code snippet and thats it. Enjoy!

// Random Name Generator
// Made by Thomas Lund
//
// Creates a random name from name lists
// per team/country

function NameGenerator::getRandomTeamName(%team)
{
	return NameGenerator::getFirstName(%team) SPC NameGenerator::getSurName(%team);		
}

$NameDB::UK_first = "James Benjamin Joshua Ryan John Patrick Samuel William Jack Thomas Daniel Matthew Jacob Ethan Ronald Michael Richard Jonathan Joseph Oliver Harry Charlie Sean Jack Conor Adam James Daniel Luke Michael Aaron Jack Matthew Adam James Ryan Joshua Conor Ben Daniel Dylan Lewis Jack Callum James Ryan Cameron Kyle Jamie Daniel Matthew Peter";
$NameDB::GE_first = "Alexander Maximilian Leon Lukas Lucas Luca Paul Jonas Felix Tim David Jens Joachim Johan Heinrich Hugo Hubert Xaver Wilmar Wolfgang Waldmar Uwe Udo Ulrich Theo Thorsten Sven Sigfried Rubens Rudi Niklas Otto Max Manfred Leopold Guido Gunther Friedrich Fritz Frank Frans Eckard Erich Diedrich Dietrich Diether Bernard Bodo Aldo Arnold August Arne";

function NameGenerator::getFirstName(%team)
{
	if (%team $= "UK") {
		%index = getRandom(0, getWordCount($NameDB::UK_first)-1);
		return getWord($NameDB::UK_first, %index);
		
	} else if (%team $= "GE") {
		%index = getRandom(0, getWordCount($NameDB::GE_first)-1);
		return getWord($NameDB::GE_first, %index);

	} else {
		error("Get first name - unknown team " @ %team);
		return "Unknown";
	}
}

$NameDB::UK_sur = "Anderson Brown Byrne Campbell Clark Davies Doyle Edwards Evans Gallagher Green Hall Harris Hughes Jackson Johnson Jones Kelly Kennedy Lewis Lynch Macdonald Martin McCarthy Mitchell Moore Morison Morris Murphy Murray O'Brien O'Connor O'Doherty O'Neill O'Reilly O'Sullivan Patel Paterson Quinn Reid Roberts Ross Ryan Scott Smith Stewart Taylor Thomas Thomson Walker Walsh Watson White Williams Wilson Wright Young";
$NameDB::GE_sur = "Altenstein Altmann Bach Becker Berger Brand Denke Dunkel Eisner Engels Feuerbach Fischer Fuchs Geissler Grass Hahn Hankel Heilmann Hoffmann Huber Hueber Jost Kirchner Klein Krause List Lorenz Mann Meyer Moltke Mueller Obenauer Reich Reuter Sachs Schanze Schindler Schmidt Schneider Schulze Simmel Sommer Spitz Thiele Volkmann Wagner Weber";
function NameGenerator::getSurName(%team)
{
	if (%team $= "UK") {
		%index = getRandom(0, getWordCount($NameDB::UK_sur)-1);
		return getWord($NameDB::UK_sur, %index);
		
	} else if (%team $= "GE") {
		%index = getRandom(0, getWordCount($NameDB::GE_sur)-1);
		return getWord($NameDB::GE_sur, %index);

	} else {
		error("Get first name - unknown team " @ %team);
		return "Unknown";
	}
}


Edit - damn. Almost forgot rule #1. No blog without images.

So hopefully Phil didnt post this one yet.

We recently got this baby into the engine - B17. First a render shot, and then a shot from ingame (glass material still being worked upon)

airaceonline.arcadersplanet.com/screenshots/b17-2.jpg
img101.imageshack.us/img101/6485/b173xe3.png

Edit 2

Ahh what the hell. Here is a little movie I made yesterday too. The first shot at the bomber AI controlled:

airaceonline.arcadersplanet.com/movies/AIBomberTest1.wmv

I was going to save that one for a different blog, but in the end I dont have much time currently. So feel free to read more about the AI here:

www.airacepilots.com/viewtopic.php?t=244

#1
01/22/2007 (3:10 pm)
Awesome. BTW the glass, you should be able to just make it transparent with a shader material no?
#2
01/22/2007 (4:13 pm)
Very cool video. Are you going to have the bomber break up instead of just puffing out of existence?
#3
01/22/2007 (4:13 pm)
Sweet stuff!
#4
01/22/2007 (4:56 pm)
Looking awesome! Cant wait to play it!
#5
01/22/2007 (5:08 pm)
Frank: yeah, the bomber shape debris isnt defined yet.. of course it'll have damage smoke trails too, but we didnt put that in yet..
#6
01/22/2007 (9:27 pm)
Oh my wooord.... it's so pretty!
Awesome work guys!

EDIT: Hope you guys (1. or GG) are planning on adding Antialiasing later (1. to TSE)
EDIT: Reading your forums, I notice you do talk about Antialiasing not working everywhere.
#7
01/22/2007 (11:13 pm)
Thanks guys. Was originally going to post this as a resource, but couldnt find a way to do that anymore. Seems to be disabled, or hidden away. *shrugs* So thats why it suddenly turned into a semi-blog

@Vashner - yes. We do have glass on the canopy of the spitfire, so it should be possible. Having some trouble with the environment mappings though. Solvable - once Phil does it ;-) *poke* *poke*

@Frank - as Phil says, yeah. We want to have nice large explosions when you hit the planes. Possibly with debris falling off. And once you kill it, we need a real debris shape. Just hasnt happened yet.

@James - no AA support yet. I spend an hour or so trying to force my AA settings onto TGEA, but it just totally ignored my nvidia settings. The bomber image is also taken on Phils sucky machine in 800x600 ;-) On a real machine (*pokes Phil even harder*) it looks much better with the texture too.

(Phil has already ordered a new machine to take better screenshots. So you will have to excuse him, hehehehe)
#8
01/23/2007 (8:51 am)
Man this is looking so good. I can't wait to play and shoot down those pretty bombers. heh heh heh.
#9
01/23/2007 (2:35 pm)
Let me bend your ear on this question. Not too off topic. On aircraft models, are any protected IP property? Like F35 etc. Can you model them and use them in a game royalty free?

I figure the older aircraft models are not an issue. I was thinking about doing some F35, F16 block 50, 60's, Mig 27 etc.
www.airforce-technology.com/projects/jsf/images/img2s.jpg
#10
09/20/2008 (9:17 am)
Your game looks great, but both sites listed are down. What's the story?