GameDevStory 2. Heroes Never Die!

Today I developed damage and respawn system. the quote, “Heroes Never Die”, just flashed on me while I think ‘respawn’.

100 HP, 20 Damage. After Destroy, Respawn with 1 second delay

Work process

Before I started my task, I made work process. Here it is.

  • Add HP property in character
  • Handle bullet collision reducing HP
  • Respawn character when they lost all HP

Why did I? Because there are many benefits making work process.

First, I can foresee what should I do. It could sound unnecessary but I think it is very important. Sometimes we waste the time taking a job which is needed to undo. Work is direction. Without any direction on working, we could get lost on forest of tasks.

Second, I can make a goal and finally I can feel a sense of accomplishment when I finish that. Without a goal, there are only continuous things to do in front of me even if I finished any tasks. Not fun, only stressful situation. So, It could be better making a goal and feel a sense of accomplishment. It’s kind of gamification. Gamification means making something like a game. Sense of accomplishment is one of the important elements of the games. Let’s think that work is game. How wonderful is it? Making a game is the same with making a fun, so it also should be good to feel fun during developing games.

So, Let’s go to check out how I did.

1. Add HP property in character

I simply added HP property in character class. So simple.

2. Handle bullet collision reducing HP

There is ‘Hit’ event handler in bullet already. I checked the object that collide with bullet has ‘character’ tag. In true condition I dispatched ‘OnDamaged’ event on character, and destroyed that bullet.

3. Respawn character when they lost all HP

Subtract damage from HP

When character is damaged, I easily discount the HP. When the HP become equal or lower than 0, I destroy character and notify that to player controller.

Call ‘On Character Destoryed’ to Player Controller before destory character.

I control the character in the character class, not in the player controller, so there are nothing special things to do when the ‘On Character Destroyed’ event is dispatched in player controller. I again pass that event to Game Mode.

The reason why I just pass it to Game Mode is to separate responsibility. In UE4, Game Mode has the responsibility of below criteria;

  • The number of players and spectators present, as well as the maximum number of players and spectators allowed.
  • How players enter the game, which can include rules for selecting spawn locations and other spawn/respawn behavior.
  • Whether or not the game can be paused, and how pausing the game is handled.
  • Transitions between levels, including whether or not the game should start in cinematic mode.

I spawn new character in Game Mode, and let player controller possess that character.

Respawning character on Game Mode

The important thing is making that logic run on server only, because the server is the only one who we can believe. who knows that some clients hack the system?

Unfortunately I have no idea what the next step is. I might have to set up the task list with milestones. Yes, I didn’t because this project, at now, is just making previous game project once again in UE4. Hmm… Anyway I need task lists and milestones..!

I’m looking for a job in Canada. Please check my Linked profile and contact me (