13
Create game with MMORPG KIT-Part 2-Map and first Character
In this part, I will create empty scene which has a floor for character movement testing and the first character.
You can create new scene from menu File -> New Scene
Delete Main Camera
, because it will instantiate gameplay camera prefab as main character when player enter map scene, it should not have more than one main camera in the map scene
Map scenes must have EventSystem
for UI event handling, so you have to add it by menu GameObject -> UI -> Event System
I will create this scene for character movement testing only, so I will just add a cube and set its scale to [100, 1, 100], position is [0, -0.5, 0]
Then save the scene, I've set it name to 000_Leveling_Test
, saved it to Assets/Leveling/Scenes/Maps
.
And don't forget to add it to Scenes In Build
After that, you have to create map info for the map scene.
Open Game Database Editor
dialog from menu MMORPG KIT -> Game Database
Choose your game database
Select Map Info
section, then click Create
Choose kind of map info, for generic maps uses MultiplayerARPG.MapInfo
Then save it, I will save it to Assets/Leveling/GameData/Maps
, name: 000_Leveling_Test
Set created scene to Scene
field
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 Modular RPG Hero Polyart package
I will prepare character model prefab based on ForExternalAnimations
prefab which located in Assets/ModularRPGHeroesPolyArt/Prefabs/CharacterBaseForExternalAnimations
, duplicate it by select it, press CTRL+D
.
Then drag duplicated prefab to Assets/Leveling/Prefabs/PlayerCharacters and rename it to Human
.
And delete all components except Animator
Now a new character model preparation is done, next I'm going to create new player character entity based on this character model.
Open the dialog from menu MMORPG KIT -> Character Entity Creator (3D)
Then I will set filename to Human
, set Character entity type
to Player Character Entity
, set Entity movement type
to Character Controller
, 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/PlayerCharacters/Human
Then data will be created in selected folder
And also added to the game database
Then you can press play from 00_Leveling_Init
scene to try creating the character
You'll noticed it has no animation, so we've to set it animation
To set character's animations, you have to open the character entity prefab. For this character, I've saved it to Assets/Leveling/GameData/PlayerCharacters/Human
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/ModularRPGHeroesPolyArt/Animations/NoWeapon/Idle_noWeapon
toDefault Animations -> Idle State -> Clip
. - Set
Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/NormalRun_noWeapon
toDefault Animations -> Move States -> Forward State -> Clip
. - Set
Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/JumpStart_noWeapon
toDefault Animations -> Jump State -> Clip
. - Set
Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/JumpAir_noWeapon
toDefault Animations -> Fall State -> Clip
. - Set
Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/JumpEnd_noWeapon
toDefault Animations -> Landed State -> Clip
. - Set
Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/GetHit_noWeapon
toDefault Animations -> Hurt State -> Clip
. - Set
Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/Die_noWeapon
toDefault Animations -> Dead State -> Clip
. - Set
Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/PickUp_noWeapon
toDefault Animations -> Pickup State -> Clip
.
Then test it, create new character and move in map scene. (W/A/S/D/SPACE)
Character won't be able to play attack animation yet, so let's set it up.
Open the character entity prefab again, then in Playable Character Model
component, Default Animations -> Right Hand Attack Animations
I'll set 2 attack animations
Then the important settings other than State -> Clip
is Trigger Duration Rates
which is rate of Clip
's duration at when it should hit enemy, you can find it from animation clip previewing.
For example NormalAttack01_SingleTwohandSword
clip, the character will swinged and should hit at 50%, so I will set Trigger Duration Rates
to 0.5
.
After set the character animation, test it again, now press attack (V) button, it will play attack animations randomly.
You can change default equipment by open character entity prefab, then activate/deactivate meshes as you wish
If you use other model packages, it may have difference mesh setup, you may not able to activate/deactivate to change default equipment
You may found that character's HP is decreasing and doubt why it's happening. It's because of gameplay rule, its default settings was set to decrease character's HP while character is hungry, you can change the settings to not decrease character's HP.
13