DEV Community

insthync
insthync

Posted on • Updated on

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.

Map preparation

You can create new scene from menu File -> New Scene

Screenshot_480

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

Screenshot_511

Map scenes must have EventSystem for UI event handling, so you have to add it by menu GameObject -> UI -> Event System

Screenshot_481

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.

Screenshot_482

And don't forget to add it to Scenes In Build

Screenshot_502

After that, you have to create map info for the map scene.

Open Game Database Editor dialog from menu MMORPG KIT -> Game Database

Screenshot_483

Choose your game database

Screenshot_484

Select Map Info section, then click Create

Screenshot_485

Choose kind of map info, for generic maps uses MultiplayerARPG.MapInfo

Screenshot_494

Then save it, I will save it to Assets/Leveling/GameData/Maps, name: 000_Leveling_Test

Screenshot_495

Set created scene to Scene field

Screenshot_496


Create new character

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.

Screenshot_675

Then drag duplicated prefab to Assets/Leveling/Prefabs/PlayerCharacters and rename it to Human.

Screenshot_676

And delete all components except Animator

Screenshot_497

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)

Screenshot_673

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

Screenshot_679

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

03

Then data will be created in selected folder

04

And also added to the game database

05

Then you can press play from 00_Leveling_Init scene to try creating the character

Screenshot_498

You'll noticed it has no animation, so we've to set it animation


Set character animations

Modular RPG Hero 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/PlayerCharacters/Human so I will go to the folder and open prefab

04

Then find attached Playable Character Model component

Screenshot_683

In Default Animations, set following clips

  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/Idle_noWeapon to Default Animations -> Idle State -> Clip.
  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/NormalRun_noWeapon to Default Animations -> Move States -> Forward State -> Clip.
  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/JumpStart_noWeapon to Default Animations -> Jump State -> Clip.
  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/JumpAir_noWeapon to Default Animations -> Fall State -> Clip.
  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/JumpEnd_noWeapon to Default Animations -> Landed State -> Clip.
  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/GetHit_noWeapon to Default Animations -> Hurt State -> Clip.
  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/Die_noWeapon to Default Animations -> Dead State -> Clip.
  • Set Assets/ModularRPGHeroesPolyArt/Animations/NoWeapon/PickUp_noWeapon to Default Animations -> Pickup State -> Clip.

Screenshot_667

Then test it, create new character and move in map scene. (W/A/S/D/SPACE)

Screenshot_503

Character won't be able to play attack animation yet, so let's set it up.


Set character attack animations

Open the character entity prefab again, then in Playable Character Model component, Default Animations -> Right Hand Attack Animations I'll set 2 attack animations

Screenshot_668

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.

Screenshot_505

Screenshot_669

After set the character animation, test it again, now press attack (V) button, it will play attack animations randomly.

Screenshot_507


Extra - I want to change default equipment

You can change default equipment by open character entity prefab, then activate/deactivate meshes as you wish

Screenshot_510

If you use other model packages, it may have difference mesh setup, you may not able to activate/deactivate to change default equipment


Extra - Why character's HP is decreasing

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.

Screenshot_509

Discussion (0)