Npc Generation
generateNpcs

We're finally here. This has been my "elephant in the room" for a while. Time to show them who's boss.
I've been thinking about this for quite some time, couldn't decide on whether the npcs should be generated by the client or the server. No, npcs must be procedurally generated, there's no doubt about that. They can't be just a handful of pre-programmed npcs constantly sitting on the same chairs, eating non-stop. Restaurants need random people walking in and out. With the occasional weirdo who sits in the corner all day and all night with that ONE bottle.
Generating npcs in the client has it's upsides: it's much easier (and quicker) to implement. But it also has downsides: other players in the server wouldn't be able to see the same npcs that you see. I kept imagining this scenario in my mind where a player is excited to finally take the leap and purchase their first restaurant only to be disappointed when they asked their friend: "do you see that funny colourful npc in that chair? He wants a Nasi Lemak. My first official order!" and their friend goes like "nope, I see no funny npc whatsoever."
So, in the server it is.
Server is going to be running a new thread and will be responsible for procedurally generating npcs every now and then. There will be a list of predetermined "delays" and when ran, the thread function will randomly choose a delay from the list. It will then wait/sleep for that many seconds before generating the next npc. The function will loop through the online players and if they are in a business, generate an npc in that business if it has at least 1 available chair.
It will be up to the client then, to decide whether or not to spawn each npc only in the business where the player currently is.
Enough talk, this is going to be a lot of work. But it will be very worth it.
Files
Get Food Court Boss
Food Court Boss
Your charming pixel art restaurant business adventure in vibrant South East Asia.
Status | Prototype |
Author | nomadentity |
Genre | Simulation |
Tags | 2D, Cooking, Indie, Management, Moddable, Multiplayer, Pixel Art, Side Scroller |
Languages | English |
More posts
- Food Court Boss - Lançamento4 days ago
Leave a comment
Log in with itch.io to leave a comment.