Spawning NPCs

It seems to me that the next logical step towards core gameplay is to get the NPC spawning mechanics into place. This post will be dedicated to the initial design of this.

As I said in a previous post, the player will want to find a decent place to start a town. After the place has been decided, the player will then place a Town Center block. What will the block look like? A statue? A small-scale monument? A podium? Maybe some kind of crystal? The problem right now is that I need to be a single block in size, and I’d like it to represent something to gather to. I might be able to write some lore about why people and creatures are drawn to it if it’s a crystal.

I see an orb graphic and a couple of ornate patterns in the Final Fantasy Adventure tilesheet I grabbed. There’s also a nice crystal graphic in the Final Fantasy Mystic Quest graphics set I grabbed. I also grabbed the graphic for the Angel Grail item from Sword of Mana. These are all possible candidates for temporary art. I like the crystal the best out of what I have to use, so I’ll use that for now:

After the Town Center block has been placed, NPCs will start spawning. I don’t want them to literally spawn out of the block, instead I want them to appear at some distance away from it. They will be wanderers, and will be drawn to the Town Center. Right now the world size is only 9x9x9 chunks, and so I can’t be spawning them too far away or they’ll spawn off the blockmap and fall forever. Even if my world size was big  enough, it will be easier to see them spawn if I only have a short spawn radius.

So, I’ll add in some code to spawn 8 NPCs:

I threw in an NPC generation routine in the block placement code that throws in some NPCs in a circle around the block as soon as it’s placed. They won’t all spawn at once, and they won’t all spawn this close. All they do right now is stand there and stare.

They will be spawned in a random direction and distance from the Town Block, and will eventually wander towards it. How often they will they spawn? What conditions will cause a spawn not to happen? Shouldn’t you be able to lead them to the block? Once they make it to the block, then what? These are among the next things I will have to deal with next.


Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: