Laika – Post 4

Previous Post:

Laika – Post 3

I’ve added a bunch of things this week. Let’s watch the video and then I’ll tell you what I’ve changed.

I added:

  • A fade effect for when you go between layers
  • NPC characters that walk around inside a boundary
  • Talking with NPC characters

This is a pretty short list, but it contained a lot of work. To get the NPC characters to walk and also interact with the player and the world, I changed the physics layers so that each were able to move separately. Then I put all the NPC characters (just one for now, but pretend there’s more) into a list. I couldn’t put it in the same list as the planet layers because it still needed to be affected by the planet’s gravity. Once that was done, I just used the same fade code for the planets and voila, the fade works! I also had to make a function that constrained the NPC in place. That way it wouldn’t start moving if there was no floor under it. Unfortunately, this means that the NPCs will only be moving if the player is on the same planet layer as them, but I can deal with it later if it becomes a problem.

Next, the dialogue. This took longer than I expected because I wanted to lay the framework for creating all future dialogue choices here. I still need to add player responses, but I think it’s in a good spot to show off.

I created a list called NPC_ID. It contained structs I called DialogueOptions, shown as Element 0. That struct contains a NPC game object, name, and list of strings called DialougeFrames (excuse the typo). I added [TextArea(5, 10)] before the string list to get moderate sized text boxes, and I put [System.Serializable] before the struct to make it show up in the inspector. From here, I’m able to create dialogue frames which can split the conversations into easily manageable chunks.

Next, I have to make a branch for the player responses. The player will get at most two responses per frame, so I’ll need to create a way to not only record all the different dialogue branches, but also to show each one separately. I have the PDF of the tutorial dialogue here:

Level 1 Conversation Tree

You can see that I have divided it up into action areas. This will help me control the flow of the dialogue and gives me a psudo-code of sorts to create the dialogue system. Next time I post I will have dialogue choices and the next two levels documented, which I will show off.

Next Post:

http://zphillipsgames.com/2018/08/01/laika-post-5/