‘Lord of Dominion’ Postmortem: A practise of game design

In my last semester in Entertainment Technology Center, I took the course Game Design Fundamentals from Stone Librande. It was a great class where we learned theories and methods of developing different parts of a game such as the balance system, the reward system, levels and so on through practice of analyzing existing games and designing/redesigning small part of the systems of boardgame. The final assignment is to design a boardgame which can be introduced and finished in 15 to 20 minutes from scratch individually. Milestones of the assignment were split throughout the semester so that we can build the game step by step based on what we currently learned from the course. This article is going to talk about how I made Lord of Dominion, a 2-player strategy boardgame, as my final project. However, there are limitations due to the requirements and the fact that it is a boardgame, which prevents me from implementing some more complicated features. Therefore, recently, I’m converting and polishing it into a Unity version in my spare time.

Continue reading

Animation synchronization with soundtrack in Unity

Sometimes we might need to play the animations together with a separate soundtrack in Unity. However, animations and the soundtrack may be out of sync due to frame drop or other performance problems even we start playing them in the same frame. A simple but not efficient solution is to force the animation to play the exact frame as the soundtrack ever frame. Below is a code example.

Continue reading

Rigidbody.Constraints in Unity

We all know that physics affects the sense of reality greatly in VR development. As a developer, I always hope to make the physical behaviors of the virtual experience the same as the reality as far as possible. However, I met a problem several days ago. I created a vase with some roses in it, and they are separated Game Objects. However, during the playtest, roses in the vase “jumped out” strangely when I tried to lift the vase. I checked and rebuilt the colliders on the vase and the roses carefully, set the Collision Detection on the Rigidbody to be Continuous Dynamic, tried to bond the roses on the vase as its children, but all of them failed to erase the bug completely. However, my intuition told me that the problem must be related to the physical system, therefore must has something to do with the Rigidbody component.

Continue reading

A known, postponed Unity bug: Tab Button

Issue Tracker: https://issuetracker.unity3d.com/issues/pressing-tab-key-does-not-navigate-between-input-controls?_ga=1.166523063.801547011.1462557649

Bug Description

I was trying to implement a function when the Tab button was pressed. However, the function only responds for the first time. After the player presses Tab once, ALL hotkeys in the game being unresponsive. The only way to bring back hotkeys’ functions is to use the cursor click in the game. It happens for GetKey, GetKeyDown and GetButtonDown.

Noticed that the problem only occurs under editor mode and development builds. It disappears in release builds (none-development builds).

I’ve also checked EditorWindow.focusedWindow and EventSystem.current.currentSelectedGameObject. They are all correct when the problem occurs.

The bug has been marked as a “Postponed Issue” by the Unity folks, where “Postponed Issue” means:

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.

 

Limit Max Width of a Layout Component in Unity

Original post of the problem: http://forum.unity3d.com/threads/limit-max-width-of-layout-component.316625/

Demand

A textbox with a child text component. The textbox width would increase with the length of the text up to this maximum value at which point the width would be fixed forcing the text to wrap to the next line now increasing the height of the button.

A common needed of UI. I was surprised that Unity didn’t have max width for their vertical layout component so far… But never mind, using combinations of vertical and horizontal layouts could achieve what we want.

Continue reading

Bitfields for multiple flags in Unity

Demand

Supposed we’re going to develop a shooting game. Characters in our game have several flags such as IsMoving, IsShooting, IsLoading, IsHiding… All these behaviors might happen simultaneously (or, of course, individually), say, the character can shoot while moving, can load his gun while hiding. How are we going to set these flags?

The simplest way might be allocating bools for them respectively. However, bools in C# are stored as ints and the compiler might not be able to combines/consolidates them. So if there’re 16 bools, that’s an allocation of 16 ints – wasteful. In addition, if one of those combinations (eg. IsMoving + IsShooting) are frequently used, the codes might be burden.

Following are some tips for such situation.

Continue reading

[Quote] C#中的委托和事件

委托 和 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件对很多接触C#时间不长的人来说并不容易。它们就像是一道槛儿,过了这个槛的人,觉得真是太容易了,而没有过去的人每次见到委托和事件就觉得心里别(biè)得慌,混身不自在。本文中,我将通过两个范例由浅入深地讲述什么是委托、为什么要使用委托、事件的由来、.Net Framework中的委托和事件、委托和事件对Observer设计模式的意义,对它们的中间代码也做了讨论。

Continue reading