Controlling NPC movement

NPCs can walk around the virtual world as the players. The movement is controlled in server-side extension.

Controlling NPC to walk in predefined path

Some NPCs' movement is fixed to a predefined path. For these NPCs, we can dispatch the path directly without path finding algorithm. In the following example, we will repeatedly control the NPC to walk between two points.

As we treat the NPC as a normal player in the logic, we will use the same walking mechanism from the player. The NPC will dispatch a public message with specific walking path to other players in the same room. Every client will then move the NPC according to the path. We have an npcLoop function in server-side extension. We will put the NPC movement logic ...

Get Flash Multiplayer Virtual Worlds now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.