• interested in more? sign up to the newsletter


Ashworld Tech: Creating an open-world part 3

Tweet about this on TwitterShare on RedditShare on Facebook

No open-world is complete, without inhabitants !  Even in such a post-apocalyptic world, there has to be some survivors and interesting people to make the world believable. So enter the NPC’s:

From useless to useful

The first couple of NPC’s I had running around just, basically, ran around. I could track them and assign them a specific line of text when needed for missions, but other than that, they really were just filling to an empty world.

As the game grew, it became apparent that it was pretty easy to lose track of where you had to go for your next mission or find a specific item. So one of the nicest solutions I came up with, was having the NPC’s help you out (often in return for some payment in the shape of scraps).

The many uses of an NPC

When you walk up to an NPC, it will (in most cases) stop and look at you. You can then strike up a conversation, which will trigger a few things in the NPC’s brain.

First it will check to see if there’s a specific item you might be looking for. It does this by looking at the open mission list, and checking any of the missions is requiring an item. If you don’t have that item, the NPC will scan the buildings around it, and see if any of those buildings has such an item in it’s spawn list. If found, it will tell you it can help you find item X for Y amount of scraps. If you accept, you pay her the scraps, and the building with the item is revealed on your map!

If there’s no mission requiring items, the NPC might check if there is a door entity with a myQuestID set. If so, there’s a big chance you might want to visit that building to get your next story mission. So if such a building is found anywhere in the world, the NPC will tell you to “visit X at Y” and show you the location on your map. The X in this case is the name of the door-entity. Random door’s will have “random building” as name, but doors related to a story mission always copy the name of the avatar in the building. So in Gaz’ Garage that door entity would be called “Gaz”, or in the shop mission the door-entity is called “Butch”.

So if there’s no open missions needing items, and there is no un-accepted mission found, the NPC will check if the nearest building (within a specific radius) has any specific level settings like levelDark, levelToxic, or levelSkellynest, etc.

If that’s the case, it will spawn a warning message telling you the “building is too dark for me!” or “oh no, a skelly nest inside, don’t go there!”.

And finally, if all of those checks result in nothing, the NPC will either throw you a random line of text, or a simple “chit-chat” text.

Kids are fun

Besides the main NPC’s, and to make the game even more lively, I decided to try and add some kids to the mix. Kid NPC’s are generated near normal NPC’s, and will link them selves to that entity, following it around when it moves.

Other than that, the kids have no other use (yet)!  Just fun to create it and see if it would work and look nice.. you gotta have fun creating games!

Bookmark the permalink.