I’m pretty new to Roblox development, but I’m currently working on a horror game focused around NPCs, but I’m not exactly sure how I should make them. The basic idea is that the game takes place in a store, and I want NPCs that can move around and buy things at shelves, check out, and leave. I have a basic understanding of path finding, but I’m not sure how to code them so that they all move to new places around the store without bumping into each other.
You shouldn’t be trying to make a game with Ai especially if you’re new to the platform in general. my biggest advice is to read up on the pathfinding of Ai BUT more importantly just go learn first.
Now for Ai you would need it to account for other objects which should hopefully be obvious since you don’t want them to collide. What you would probably do is:
Get all objects → calculate path and take account for other objects → execute.
That is the grand scheme of things anyway. There are many different types of Ai pathfinding modules you can find here and you can also use a tool like Behaviour trees to build behaviours of the Ai and can use something like state machines to have them feel a bit more lively and also make decisions on their own.
Sounds like you’re trying to make a system similar to Retail Tycoon 2. As previously said by @thatguybarny1324 said, I would also advise against learning NPCs when you are a beginner. Since most there probably aren’t any NPCs that do what you want in the toolbox, you’d need to make your own.
Knowledge roadmap to your system (prerequisites)
Beginner
- Confident use and navigation of Studio
- Know how to use the Output for debugging
- Variables, tables, if statements, etc (your typical beginner code)
- Logic to create larger programs
Intermediate
- ModuleScripts
- RemoteEvents
- Client-Server Replication
- PathfindingService
At this stage, you can make a decent system. You can find YouTube tutorials on the above. As for collisions, you should probably have them disabled so NPCs can avoid extra performance costs of them making extra calculations to go around other NPCs.
Above and beyond (for maximum efficiency & control)
- OOP (Object Oriented Programming) for each NPC and interactable items like shelves/counters
- Deep understanding of game AI behaviour:
i. State Machines
ii. Utility AI
iii. Behaviour Trees
iv. etc.
So yeah, that is the scale of what you’re trying to achieve. I’m not trying to discourage you from making your dream games, but many would advise to work on small projects, applying what you’ve learned each time and learning more to continue making that game.
Hope this helps!
IMO not really necessary when you can make the thing that interacts with whatever just happen on the server if you wish. This will become an issue if you upscale ofc but for the time being it should be fine and I am not too sure where the remote events come into play apart for the cli-ser replication.
Yeah, pretty similar to Retail Tycoon 2. The game in specific is mostly inspired by Night of the Consumers, if you have ever played that. NOTC has much simpler NPCs that do not actually buy things, which would probably work for my idea but I’m going to start looking at State Machines.
You should make something less complex and more simplistic. I only said as I wanted to help get the idea of what you’re trying to do. Less of an assistance and more of a reality pill.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.