🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Creating a Node System and Understanding Inheritance in Playmaker

Published January 02, 2023
Advertisement

For Player movement, I had no idea how to move the camera (player) from one point to another. I did some research, and found some cool ideas to grasp the concept. Thanks to “Board To Bits Games” excellent tutorials on Youtube, I was able to get the core understanding on how to approach this. https://youtu.be/76z3LvGfuCk?list=PL5KbKbJ6Gf9-rgPHoW8QXn-ZfYQlieSAL

In short, A NODE would be a GameObject that can be interacted with. I made a list of the types of Nodes I would be requiring. Turns out for now, I need a Hotspot node and a puzzle node. I would need another node that can change the ‘Scene’ and may be one more node to define ‘Items’.

Therefore when a Node is clicked upon, depending on the type of node, it would behave accordingly. So I needed some sort of OOP class inheritance here.

To achieve this I created a base Node game object that simply detects clicks. Then for Hotspot I added another game object under it called ‘InfoHotspot’. Similarly, I added another game objectInfo_Item’ to define it as an Item and so on.

To implement this in Playmaker, an FSM (Finite State Machine) on a Node looks for these ‘Info’ game object. Whatever Info it finds, it treats it accordingly. It was strange and took me a while to figure this out as I do not know if there is a direct way to achieve inheritance in Playmaker because of the way FSMs work. So this ‘Info’ pattern is acting like a proxy inheritance system and suits my purpose, and it seems it will be easier to debug. Further, I can add an FSM on each of these Info GameObjects and define their corresponding behavior. Therefore, the base Node is defining the common attributes while Info is defining unique attributes.

Additionally, as described in the video tutorials by “Board To Bits Games” I also have a CameraPosition game object attached under the nodes which need them, so that the camera would move to a pre-defined position. Now when a hotspot is clicked - as defined in it's InfoHotspot, the camera would Tween to the CameraPosition (transform). Similarly an Item gets picked up because as it's behavior is entirely different from that of a Hotspot.

The Node system is very crucial and acts like a backbone to the mechanics for this type of game.

For now, I am happy with the results, and would keep updating this Node system as required.

Previous Entry Introduction
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement