|
Hints and Tips
General
-
Save and backup often! Even better use Version Control like Subversion or Perforce!
-
Always backup projects before importing any updates in Unity! Again, use version control!
-
Playmaker tool windows can be docked and added to tabs to create a custom layout.
-
Save your Playmaker layout using Unity's custom Layouts dropdown.
-
Playmaker works great on a second monitor!
Designing State Machines
-
Describe:
-
Use the FSM description field to describe the desired behaviour of the state machine.
-
Describing the behaviour in words helps clarify the problem and reveal design problems early.
-
Rough out:
-
Sketch out the states and transitions in the Graph View to reveal design flaws early.
-
Think visually, a messy looking flow might be unnecessarily complicated.
-
Tell a story:
-
Add Debug Log actions to each state and Alt-click through the running state machine to check that it tells the right story.
-
Read the story back and make sure it works before spending a lot of time implementing Actions.
-
Divide and conquer:
-
Multiple smaller FSMs that talk to each other are often more manageable than larger FSMs.
-
Smaller self contained state machines also tend to be more re-usable across scenes and projects.
-
Standardize:
-
Standardize event names so it’s easier to send events between FSMs.
-
For example, decide if switches use "activate" or "turnOn" - it doesn't matter what you pick, but pick one and stick with it until you really need another event.
-
Standardizing events also makes state machines more re-usable.
-
Animation events:
-
State transitions are often tied to animation transitions, so use animation events to coordinate animations and behaviours.
-
Switchboards:
-
Switchboard states with a global transition are a common pattern to reduce clutter.
-
The switchboard state evaluates the current situation and instantly chooses another state - that’s all it does. You can call it with the global transition whenever you need to re-evaluate.
-
Spread the load:
-
Remember you can transition through multiple states in a single update, so you can spread logic across states.
-
Spreading decisions across multiple states, each making a simple decision, makes it easier to author complex branching behaviours.
-
Iterate:
-
Game development IS iteration!
Using the Scene Hierarchy
-
Use the scene hierarchy to help solve problems. The right scene organization can make hard problems a lot easier to solve.
-
Build as much "smarts" into the scene as possible (triggers, waypoints, collisions...). There's no cheating in game A.I. - it's not real artificial intelligence, it's entertainment!
-
Parent related objects under a common object to make it easy to iterate through them using Get Child, or Get Child Num.
-
Use trigger volumes and Trigger Event as much as possible - it's a robust solution to many problems. Think about sensors and zones etc.
|
|