Namespaces and State Machines?


I have finished the RPG courses and the 3rd person combat course and am now combining the features from both that I want in my game. I am not sure how to handle the namespaces from the RPG class with the state machine. My real life background is in process control and I really like the state machine logic. It fits with what I do every day. But, the namespace concept from the RPG courses make a lot of sense also. I am struggling with how to reconcile both ideas. Any thoughts or advice would be greatly appreciated.

I was rather straightforward when I did the project

namespace RPG.StateMachines

Various components went in areas that made the most sense… Obviously, I stuck with the RPG health component, in RPG.Attributes, the Targeter went in RPG.Combat, and the InputReader went into RPG.InputSystems

That is what I was thinking. I can’t help thinking that I am missing something. The state machine scripts could go in different namespaces based on what they were for, but this seemed needlessly complex. I am probably making this into a bigger problem that it needs.

No, I keep the States and StateMachines in the one namespace. When they access another namespace’s domain, that’s handled in the usings clauses.

In terms of dependencies, nothing that is not a UI class should be using the StateMachines namespace. The one exception to this is IHandleRaycast components which may need to set a special state to stay in place while shopping or dialoguing, for example).

Thanks for the advice. I’m actually starting to feel like I know what need to do to pull this off.

1 Like

That’s my goal!

1 Like

I am amazed at how helpful the namespaces and structure of the RPG course are! Adding a script from the RPG project to the 3rd person project and then looking at the errors as a group based on the using statements makes the whole process less daunting. I just pick a using statement and find all of the lines that have related errors and fix them one by one. Not as bad as my imagination has been making it the last few days. I can’t believe people get paid to have this much fun!

Shhh, don’t tell our bosses!

1 Like

Privacy & Terms