VNPC_Gen: a seed-based, easy to modify random NPC generator

Versatile NPC Generator. Version: V1.0.2_Stable


:wave: Introduction

Hello there! I initially created this module for a specific project, but I decided to expand it and publish it here.

Note: This module only generates NPCs’ appearances!


:rocket: This module is capable of the following:

  • Generating unique NPCs with either a random or manually inputted seed.
  • Easy to modify NPC accessories, hair, body colors, clothing, and faces.
  • Generating NPCs with different genders, faces, clothing, accessories, names, and surnames.
  • Gender discriminators (all accessories can be assigned to only appear for one gender of NPCs or all)

:bulb: Visual examples

How it looks


NPC generation with random face generation off.


NPC generation with random face generation on.


:computer: Code examples

How to generate a simple NPC

Generating a random NPC:

local VNPC_Gen = require(script.Parent.VNPC_Gen) --Require the module

local MyRandomNPC = VNPC_Gen.NewNPC() --Generate a new NPC
MyRandomNPC.Parent = workspace

Generating an NPC with custom parameters (all of them are optional and can be set to nil):

local VNPC_Gen = require(script.Parent.VNPC_Gen)

local MyRandomNPC = VNPC_Gen.NewNPC("Male", 300000, true, false) --Forced gender, custom seed, random faces enabled, exclude repeating seed with other generated NPCs (Won't work if a custom seed was entered) 
MyRandomNPC.Parent = workspace

This will create a male NPC using the seed 300000 and a randomized face.


:comet: Performance

How it performs

I spawned 55 NPCs with a 0.01 wait interval and noticed no lag spikes. However, creating over 60 NPCs may cause visual lag due to Roblox’s handling of Humanoids.


Direct download

VNPC_Gen_V1.0.2_Stable.rbxm (36.6 KB)


If you find any issues or want to suggest something, please reply to this post. :smiley:

29 Likes

what commands or parameters are needed to run it?

1 Like

As of now the module only has one function NewNPC it takes 4 optional parameters that change the way the NPCs are generated.

I recommend you read the documentation inside the module for more info.

1 Like

okie dokie, thanks for the gentle details of what I should do.

2 Likes

New version 1.0.1_Stable

This was mostly just a patch, I recommend updating your code to this version though.
I also added some code examples on the post.

1 Like

This is pretty cool - I will use this! Thanks :smile_cat:

2 Likes

Thanks! Any suggestions you have or issues you find please tell me.

1 Like

this is not really that serious but I noticed your typechecking in .NewNPC can be mistaken by the intellisense as a string, and also scripts with --!strict flag on, will error because they need to input the exact string for each parameters
image
this can be fixed however, by using the string, number, boolean types. and to make them optional, suffix them with ?

function VNPC_Gen.NewNPC(Gender : "optional (string)", CustomSeed : "optional (number)", FacesEnabled : "optional (boolean)", ExcludeRepetitions : "optional (boolean)")

to

function VNPC_Gen.NewNPC(Gender : string?, CustomSeed : number?, FacesEnabled : boolean?, ExcludeRepetitions : boolean?)

this is necessary for --!strict (even though I rarely use it, but theres a lot of people out there) users to use your module

one more thing, the gender string? type can be replaced with a union type so people don’t accidentally misspell (and also the intellisense will suggest the valid genders):

function VNPC_Gen.NewNPC(Gender : ("Male" | "Female")?, CustomSeed : number?, FacesEnabled : boolean?, ExcludeRepetitions : boolean?)

image

1 Like

Thanks!
That completely went over my head when making this.

This will be fixed in the next version.

1 Like

New version 1.0.2_Stable

Once again, this was just a small patch, update to this version if you want to.

Hi, relating to your comments of the top, ’ However, creating over 60 NPCs may cause visual lag due to Roblox’s handling of Humanoids.’ … can you give the low down on what this means?
Thanks

i think you should add furries to the generator !

To put it simply, humanoids lag.

Used this, tweaked it a little bit to use R15 NPCs, really cool stuff!!!

1 Like

Do u know what # of npc using this system would not cause lag ? Like 20 or

My module simply gives npcs clothing and accessories, no scripts are automatically given to npcs.
So, you can probably generate as much as you want without major concerns.

Thank you!
I’m working on hopefully revamping this because this hasn’t been updated in a while
and this module doesn’t really allow for more stuff to be added.

I’m planning on turning this into a full-fleshed plugin with a comprehensive UI, where
you can add your own “races”, style discriminators (certain clothing can only be worn with
other similar clothing), support for R6, R15 and custom rigs.

This plugin will be paid (haven’t decided on a fair price yet), but don’t worry!
As the plugin is updated I will also keep updating the module itself so you can do basically
all the plugin can do but without the UI and tools the plugin will give.