Unity Game – Bridge Battle

Hi folks,

So I have a new progression in my “mini-MOBA” series, here.

Previous videos in the series:

In the first video I demonstrated the starter town, avatars, and multiplayer transform sync.  In the second video I took things slightly further and included synchronisation of animations.

In this newest installment I do a few things.  First, I introduce tab targeting.  It is not demonstrated in this video but I can tab between multiple targets ordered by distance.  As part of the targeting procedure I change the appearance of the targeted on the client machine from white to green.  I also display the name of the character.  Finally I display the target’s health in the top right corner of the screen.

Second, I allow for use of the esc key to deselect a target.

Next, I implemented a messenging system (based on the bergzergarcade tutorial #44) on the local client that updated the target’s health bar (and the avatar / prefab’s hp) every time an allowable attack (within 2.5 units, and facing the correct direction) was made on it.  Consequent to this I implemented a secondary messaging system to send the information to the server, and tweaked the server code so that the target’s client would have the updated information for their health bar.  This is demonstrated in the video by my pitched bridge “battle” where as you can see hit points are being decreased over time on the other screen when I make an attack on one client relative to the other.

Finally, I made a hodgepodge attempt at attack animations.  This entailed alteration of the state machine for the thirdpersoncontroller script.  The results were not perfect; the entire animation does not play prior to returning to CharacterState.Idle and the animation synchronisation information has not been transferred.  These are minor matters to be fixed.

Also another bug which is not shown in the video, was that I haven’t altered my code to allow for the logoff or disconnect of another player, which might cause difficulties.  I will deal with this matter prior to the next step in the project, or eventually, anyway.

Learnings from this work were firstly, the DoNotDestroyOnLoad for a gameobject – I found out that all the Start() functions of gameobjects are called even in scenes that have not been loaded yet.  I guess the alternative is to use an Awake() function?!, but I found that one of my gameobjects was being initialised and then being destroyed when I loaded the very scene that it was in! – very frustrating.  But when I found out what object it was (the health bar) the fix was surprisingly easy.

A second learning was the power of the statemachine in terms of driving object behaviour – this is still something I need to become more adept in.

Thirdly, it was very informative to really examine the workings of the server code, in terms of introducing my own messaging functions to implement health synchronisation / modification consequent to a melee attack.

Next on the agenda, after fixing the bugs:

  • fix the attack animations
  • allow for player logoff / dc

These would be:

  • Allow mouseover target skin modification and mouseclick targeting
  • Respawning (destroy playerobject & recreate when appropriate)
  • GameHUD update
  • Implement NPCs as “SpawnNPC” script managed by the server (don’t want multiple copies of same NPC per client instance!)
  • Implement inventory for players
  • Implement “shops” – I probably will not require currency at this stage but just allow them to be storehouses / other inventory screens
  • Allow for player chat (global)

Then, further afield:

  • Allow for conversation with NPCs
  • Monsters
  • Quests
  • Advanced HUD (mini-map in top right hand corner)
  • More trees, buildings, environmental features and places to explore
  • Leveling system
  • Character screen
  • Quest log
  • Inventory screen
  • Stat system
  • Item buff system
  • Basic missile combat
  • Basic magic combat
  • Currency (game) for items from NPCs
  • Cooperation / group adventuring
  • Arena zones only for player-player combat (default atm is global)

And in the very distant future (subject to a great deal of change):

  • Freemium implementation
  • Special effects for magic / melee
  • Special moves (melee eg whirlwind, charge)
  • Special ranged attacks (fireball, lightning, …)
  • Customised key bindings
  • Customised blender models and animations …

Anyway I’ll see how I go with this.  Very early days as yet.  I might well return to the bergzergarcade tutorials if my progress starts to slow considerably.  Alternatively there is something to be said for putting this project on hold, and instead looking again at Google App Engine.  I have a few ideas there that I’d like to investigate further.

Tags: , , , , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: