Advertisement

Trying to Create an In-Game Bestiary for a Horror Game

Started by July 03, 2019 04:13 AM
6 comments, last by frob 5 years, 5 months ago

A small team of friends and I are trying to create a minimalistic, exploration-based horror game inspired by things like Yume Nikki and LSD Dream Emulator. One of the things we want to include is a bestiary of sorts where players can use the E/interact key to add an NPC in the maps to a bestiary that will be located in the pause menu and will give a bit of flavor text on each creature. Unfortunately, I have spent the past few hours scouring YouTube and gaming forums for tutorials or advice on how to do this, but I have yet to come across anything helpful.

Ideally, the player would just be able to walk up to an NPC, hit E or whatever the interact button is while near it, and have its entry in the bestiary automatically be unlocked in the pause menu. Until the player actually interacts with this NPC, its image in said bestiary would be either a silhouette or a question mark. I immensely appreciate any advice that you can give me! Thank you all in advance!

Creature Designer, Voice Actor, and Game Designer!

The problem seems to have at least two components - interacting with NPCs, and managing the UI element where the NPCs are displayed. Is there any specific part of the problem you're looking for advice on?

Also, what languages and/or development tools (e.g. game engines or libraries) are you using?

[Edit: I see there's a 'C#' tag. Info about engines/libraries/etc. would probably still be useful.]

Advertisement

Like enter the gungeon or spelunky?

I am an indie game developer who enjoys pixel art games.

For interacting with an NPC you need to first lookup any NPCs in your location. This is typically done using a Quad Tree or similar structure so you are cutting down the number of possible matches in the second stept, test if your player matches two criteria on each NPC in the list you got from the tree.

An NPC is a legal target if the player matches

  • Certain distance between the character and the NPC, for example below 2 meters
  • They are facing each other so you know that the player currently wants to interact with exactly that NPC and not the NPC that is located behind him for example

Now you know which NPC to toggle and can use it's class or component whether you are using OOP or ECS stile NPCs to trigger an interaction/ message to be send to the BestiaryManager knowing all those entries or let the NPC send his entry directly. Display it and you are done

14 hours ago, Zakwayda said:

The problem seems to have at least two components - interacting with NPCs, and managing the UI element where the NPCs are displayed. Is there any specific part of the problem you're looking for advice on?

Also, what languages and/or development tools (e.g. game engines or libraries) are you using?

[Edit: I see there's a 'C#' tag. Info about engines/libraries/etc. would probably still be useful.]

I'm using Unity3D so yes, it would be C#. I'm kind of just looking for advice on where to start. I'm a novice when it comes to programming, so I'm not even sure about where to begin.

13 hours ago, Pepsidog said:

Like enter the gungeon or spelunky?

Yes. We just kind of want an in-game bestiary of NPCs the player has encountered, where each entry displays the NPC's sprite and some flavor text.

11 hours ago, Shaarigan said:

For interacting with an NPC you need to first lookup any NPCs in your location. This is typically done using a Quad Tree or similar structure so you are cutting down the number of possible matches in the second stept, test if your player matches two criteria on each NPC in the list you got from the tree.

An NPC is a legal target if the player matches

  • Certain distance between the character and the NPC, for example below 2 meters
  • They are facing each other so you know that the player currently wants to interact with exactly that NPC and not the NPC that is located behind him for example

Now you know which NPC to toggle and can use it's class or component whether you are using OOP or ECS stile NPCs to trigger an interaction/ message to be send to the BestiaryManager knowing all those entries or let the NPC send his entry directly. Display it and you are done

Yeah, I think you lost me unfortunately. I'll do some research on quad trees.

Creature Designer, Voice Actor, and Game Designer!

2 hours ago, lollydipstick said:

Yeah, I think you lost me unfortunately. I'll do some research on quad trees.

Since you're using Unity, you maybe (probably) don't need to worry too much about low-level details like quad trees. For example, you might instead be able to leverage Unity's physics/collision system (triggers, raycasting, etc.) for this. Or, depending on how many NPCs you have, you might be able to get away with a brute-force check, at least initially.

In any case, I'd definitely break it down into sub-problems, as Shaarigan suggests. The interaction part and the UI part are more or less completely unrelated and separate from one another (or at least can be), so you should be able to tackle them as separate problems. Assuming NPC interaction will be needed for other things as well, getting an interaction system up and running seems like a good place to start. Once that's working, you can tackle the UI part (which might be the easier of the two tasks). Lastly, you can certainly do the UI part first if that seems more manageable - you can just enabled/disable the character entries through some other means (e.g. clicking on them or whatever) for testing purposes.

Advertisement

I'd agree on the sub tasks.

First, are you able to pick the character?  The detail on a quadtree is an implementation detail which probably doesn't matter on Unity.  First you've got to be able to actually pick the thing you want to review.

Next, you'll need to have some data on the character.  In Unity the blueprints you use for your characters, NPCs, monsters, etc, might have a behaviour you add with a text field.  Or you might have ID's assigned to each type of creature in your game that can be looked up. Whatever method you go with, you obtain a blob of text associated with the thing.

With that done you know both the thing being selected and can obtain the data to be displayed. The next task is to actually display that message in a way that looks good in your game.

This topic is closed to new replies.

Advertisement