DEV Community


Posted on

Create game with MMORPG KIT-Part 3-Map's navmesh and first monster

In this part, I will setup map's navmesh to make monsters able to move (and also make player's character able to move by point click controlling) and create first monster character

Create map's nav mesh

Open map scene (000_Leveling_Test) first, because we are going to create nav mesh for this map.

Then open Navigation window from menu Window -> AI -> Navigation.


Then in Navigation window, select Object tab, select sources for nav mesh creation, in this scene has only one mesh (because we made this scene just for testing). It is Floor, select it and tick on Navigation Static


Then select Bake tab click Bake button, and nav mesh will be created, save the scene, and... done!.


Create new monster

You can create new character easily by Character Entity Creator dialog

Before you use this tool, you have to prepare character model prefab

I will uses characters from RPG Monster Wave Polyart

My first monster that I am going to create is Slime.

So I will prepare Slime character model prefab by duplicate Slime prefab from Assets/RPG Monster Wave Polyart/Prefabs/PolyartDefault by select it, press CTRL+D.


Then drag duplicated prefab to Assets/Leveling/Prefabs/MonsterCharacters and rename it to Slime.


And delete all components except Animator.


Now a new character model preparation is done, next I'm going to create new monster character entity based on this character model.

Open the dialog from menu MMORPG KIT -> Character Entity Creator (3D)


Then I will set filename to Slime, set Character entity type to Monster Character Entity, set Entity movement type to Nav Mesh, Select game database which created for this project (It is LevelingGameDb which was created in first part) and set FBX to prepared character model prefab


After set data in the dialog, press Create button, then it will shows folder choosing dialog, select folder which you want to save, Mine will be saved to Assets/Leveling/GameData/MonsterCharacters/Slime


Then data will be created in selected folder


And also added to the game database


Set character animations

RPG Monster Wave Polyart
have an animations for characters, so I will show how to set character's animations by use animations from the package.

To set character's animations, you have to open the character entity prefab. For this character, I've saved it to Assets/Leveling/GameData/MonsterCharacters/Slime so I will go to the folder and open prefab


Then find attached Playable Character Model component


In Default Animations, set following clips

  • Set Assets/RPG Monster Wave Polyart/Animations/Slime/IdleNormal_Slime_Anim to Default Animations -> Idle State -> Clip.
  • Set Assets/RPG Monster Wave Polyart/Animations/Slime/Run_Slime_Anim to Default Animations -> Move States -> Forward State -> Clip.
  • Set Assets/RPG Monster Wave Polyart/Animations/Slime/GetHit_Slime_Anim to Default Animations -> Hurt State -> Clip.
  • Set Assets/RPG Monster Wave Polyart/Animations/Slime/Die_Slime_Anim to Default Animations -> Dead State -> Clip.


In Default Animations -> Right Hand Attack Animations set 2 attack animations by uses clip from Assets/RPG Monster Wave Polyart/Animations/Slime/Attack01_Slime_Anim and Assets/RPG Monster Wave Polyart/Animations/Slime/Attack02_Slime_Anim


Now, your character is ready to use, let's add it to the game map.

Add monster to the map

There are 2 ways to add monster to the map.

First, drag a prefab to the map scene, that is it.

Second, create game object and attach Monster Spawn Area component


Set Slime character entity prefab to Monster Spawn Area component -> Prefab field


Set random level and spawning amount as you wish, I will set spawning amount to 10 so when start game it will spawn 10 of Smiles

Then test the game, you will see 10 Slimes spawned.


Extra - Why I can't attack monster

You can't attack monster which created by Character Entity Creator because it has no collider attached yet, you can attach any collider to the prefab but you have to set it as trigger collider.

For the Slime, I will attach box collider.


Then save the prefab, test the game again, you will be able to click on monster to attack.

Extra - Why monster not moving or do anything when I attack it

It is because there is no monster activity component attached to the Slime yet, you have to attach Monster Activity Component to the Slime prefab.


Discussion (0)