An experiment

As a solo developer, I usually do the proof of gameplay first, then design iteration, then art finalization. Now I am doing an experiment: Concept art goes first before gameplay, without figuring out what gameplay I want to do, I’d like to add some visuals into the early design process, something like “what type of gameplay may be fit for this character ?” “what type of gameplay can be put into this environment?”

Besides, I have some rough ideas about some systems that I want to try. These systems are not gameplay systems so they can be something behind the scenes.

Overall, it will be a story-driven fantasy experience, can’t tell much at this moment.

A major blocker

I am losing focus when trying to add gameplay to my story/design, basically, the story is there, the emotion flow is there, but the gameplay is super vague, I used ‘gameplay ability 1’ to represent what players can learn from this level, used ‘experience 1’ to represent what players can feel at the moment I ‘design’ it to be. However, they are not actual gameplay or experience, they are just something strong or weak that I imagined or ‘designed’, it’s not like Mario’s ‘jump is fun’, it’s like saying this movie is emotional.

The whole story/emotion is created based on feelings, which is not stable, to me. When I wrote it down, I had a strong feeling that it’s a powerful experience, however, after a few days working on other stuff, the feelings is not that strong anymore. This is not only about my game, also it applies to other emotional games/movies experience, which makes me think of one thing: I need to build up the momentum through the gameplay, which is fucking hard. I can’t change the emotion all the time, it’s sitting there waiting for a good gameplay to enhance it, and it’s also my methodology to make this game.

Thinking again about how journey achieved this, I feel that either I have to simplify my story to match a simple gameplay or to have richer medium (CG, music, cutscene, VO, Text) to push the emotion to a point where I want. The balance is very important, Journey did a good job to balance the potion. And I really don’t want to compromise, but how to get the same result in a cheaper way? This is a big question. Fuck it I am going to play some games.

Some thoughts about the new Zelda game

So I kind of finished the new Zelda game: played half of the dungeons, beat all the bosses, collected all the memories, so that’s it. Overall it’s a good game, the only thing I want to complain is the balance between those bosses, I definitely enjoyed more in the elephant boss than the other three and the feeling of final boss kind of lacks of some epic sense. It’s a 9/10 to me, and I don’t like the climbing part even I got some rewards after I reached the peak.

Still worth 50ish dollars but I bought a switch with it, I feel like I may not play that many switch games then : /

The other good thing is that it gives me a lot of inspirations about gameplay and game progression pace, will think more about it later.

幽默,好玩,与惊喜

我在跟我的好室友看了两天的friends后,试图找出幽默与好玩之间的联系。

答案是惊喜。

惊喜一直是游戏设计中的一个不可忽略的部分,并非一定做到大惊大喜的跌宕剧情,画面音乐,以及游戏性的惊喜都是可以涉足的点,特别是在玩家习惯了一段稳定的游戏体验后,引入惊喜会给平稳的线条加入一段波动,波动如水,泛起涟漪,提升玩家对游戏的整体好感,提高沉浸体验。

有的惊喜如同一时的灵感花火,有的则有迹可循,或者说有“套路”

用几个大家熟知游戏举例子:

刺客信条的死前遗言;(剧情)

节奏地牢的怪物设计和节奏设定;(游戏性)

风之旅人的滑沙;(画面/音乐)

生化危机7的追逐设计;(游戏性)

一旦引入这些精心设计的桥段,游戏体验大大增强。

回到friends,很多幽默的桥段是由”误解”,”双关”,”谐音”等等手法来实现的,当然也少不了装傻卖萌,共同点是语言或者表演上的幽默多多少少是带惊喜的成分的,没错就是抖包袱。

游戏设计怎么设计包袱来给玩家带来惊喜呢?

听说你抽了个SSR?

Need a brain printer

I am trying to write down what the game may look like or feel like in my mind, sometimes they are plots/dialogs which seem easy, but for those character emotions, color tones and object/environment, I can’t write them down. For those things that can’t be described in a way that represents what I ‘see’ in my head, I have to draw them. Now the first choke point I have is that I don’t have enough drawing skills. I occasionally draw random interesting things but I never practice it, which I am regretting a little bit now. Another solution is involving an artist into the development, which may not be so called ‘development’ because it’s in so early stage and is so experimental. Also, there is an extra communication cost which can be a potential problem. I really hope someone invented a printer can print thoughts and imaginations.

So I am going to do more digital painting and keep refining my documents until I feel that I can deliver my idea to others precisely enough by what I have written or drawn.

At the same time, I am thinking of some basic gameplay moments which match the emotion curves. I am trying to keep it very simple and intuitive, for example, movements that represent freedom/fast/smooth vs restrained/slow/crippled, interactions with friendly/happy NPCs vs hostile/angry enemies, gaining progression vs losing progression, collecting secrets/items vs losing them. Or just environment/music. These are very basic elements that give positive or negative feelings. I am imagining to use them to construct a combined feeling.

It may totally be a failure, who knows.

Make it fun or make it powerful

I always believed that ‘gameplay first’, fun is the most important part of a game. I love every second when I was playing Crypt of the NecroDancer, a great game.
I never questioned this principle, until now I am starting a new project, I am going to do it in a different way. Journey is my inspiration, which leads me to an experiment that I want to make a powerful game instead of a fun game. Not saying it won’t be fun, but it will be focusing more on being powerful than fun, like Journey, bringing very very powerful experience through the gameplay.

Following the GDC talk ‘design journey’, I start to draw out the emotion curves, separate different acts and levels to represent those emotion changes, add plots to those highs and lows. Most interesting thing is, I don’t have any gameplay yet:D
It’s a slow progress because I don’t have any experience on this, I am not a writer, not a good story teller, not a filmmaker, not an artist, not a good designer, but I still can try to make the game.

I will keep writing my thoughts during the development, to record, to review and to share my adventure with others.

State machine, GOAP and Behavior tree

Recently I implemented a simple behavior tree based on the article http://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_trees_for_AI_How_they_work.php. I made a GOAP (goal-oriented action planing) when I was at guildhall and worked on state machines for my current company. Thinking through what they are, I want to write down some thoughts:

State machines
I was working on Dungeon Defenders Eternity / Dungeon Defender II as a gameplay programmer. AIs in these two games are not super complicated, in most time, are implemented by finite state machines. When designers wrote done the design docs for bosses or enemies, I never felt like ‘this will be a complex state machine’, BTW, they are code driven. Generally speaking, a tower defense game’s enemies are usually killed in 5s, or may be less. To make players feel good, we made at most 80 enemies running towards the core in the same map, which is awesome and asks for fast AI iterations. I think the focus of the gameplay is more on the layout of the map, the combination of enemies, player’s actions and the most important part: loots. State machine is not perfect but good enough for most of the cases.

GOAP
To me GOAP is like a path finding on an action graph that is dynamically generated. Start with A, to achieve Z, GOAP helps to figure out which path is the best : A-B-C-Z or A-D-E-Z. The only thing worried my is how fast it can generate the path, because when there are many nodes, there are millions ways to achieve the goal, if adding too many limitations to/between those nodes, is it still a good idea to use GOAP or maybe other methods are better? I don’t have real world experience to say yes or no, hope I can figure it out latter.

Behavior tree
First of all, it’s fun to play with. I started with a GOAP project, removed all the GOAP codes, left the astar pathing for movement, then worked on the ‘tree’. Behavior tree is a tree, but not a binary tree. Trees are fun.
What behavior tree can do ? A lot. Check out the tree I made:

Behavior tree diagram

Green blocks are sequence, orange blocks are invert decorator, blue blocks are leaves.
This is a ‘priority tree’, which will tick the children from left to right, skip those unavailable leaves and move forward. Whenever it reaches an available child, it will stop this iteration (because of inverter)
I made a simple blackboard to share data between the nodes in the same tree, for example: set target will write one entry on the blackboard, move to target will read that entry.
Also blackboard can be modified outside the tree, which provides more flexibilities.

That’s it, by using these leaves/decorator nodes/composite nodes, an AI bot is able to figure out where to move to and interact with resource/items.

Comparing to GOAP, this behavior tree doesn’t have the ‘weight’ concept which means it doesn’t know whether or not its action is the best one, however, it doesn’t have to generate action graph which requires more computations. Generally speaking, AI is always case by case and customized for gameplay, pick whatever fits the game most.

All of these are code driven, which is Ok for prototyping or experimenting, however if you want to use it in the production, data-driven behavior tree probably is a must.

Build a Patching System using Unity’s AssetBundle and ScriptableObject

Once your Unity game released on Apple store or Google play, it takes long time to re-release the new version.

How about having a patching system inside your game ! This is what I did:

Some Backgrounds:

Asset bundle is something that you can take from the internet (, cache them) and load into your game. You can use it to replace the current assets or add new assets (think of DLCs).

Versioning asset bundle is another fancy feature that unity can do to make sure it won’t try to download the same asset bundle again and again. If you use Unity 5.3 you will get another fancy thing called Asset Manifest, which contains all the asset bundles Hash values (versioning) and dependents which makes it more powerful.

Step 1:
When to download asset bundles ?

When I tell clients to do so! To do this I made a node.js http server running, which simply responds to the requests for game update info. Like this:

Inside the updateInfo, I had a server ver integer and an asset bundle downloading url, both of them can be used to determine what to do on the client. In this case, do nothing because we already updated.

Step 2:
What shall we download first?

Manifest! (which is an asset bundle too) contains every other asset bundles and hash values, we can download (and cache) assets during the gameplay or just at the very beginning, as long as after Manifest.

Step 3:
How could the game know there is a new version of asset A, instead of loading the default asset A ?

I used a ScriptableObject called AssetsTable to track all the asset bundle names / asset names. Also I had a DefaultAssetsTable to track existing shipped assets. SO, whenever I want to load an asset, let’s say ‘Open a MenuScene’, I will look into the AssetsTable to see if there is a new version of Menu Scene. Read the asset bundle name and asset name if found one (you can load the scene from bundles using these names), otherwise I will read the scene from the DefaultAssetsTable and open it. The same way we can read an object prefab from AssetsTable or from DefaultAssetsTable. Pretty simple, the only thing you need to do is –> Download the AssetsTable after Manifest but before everything else!

Extra Step:
Tell the client that you have to update your game through Apple store or google play.
Do this if asset bundles can’t solve your patching problem, which usually means you want to release a major update instead of adding some DLCs.

Simpler description:

Client ==Request update game==> Server service
Client <==game update info== Server service
Client ==download(cache) Manifest==> Server storage
Client ==download(cache) AssetsTable==> Server storage

Then:
Client read AssetsTable to figure out whether or not load assets from an asset bundle or load from shipped game assets.

Build back-end services on AWS using DynamoDB, Lambda etc.

Recently I was working on a mobile game prototype which requires saving player data on the server side. I pick Amazon AWS as back-end to prototype some ideas:

  1. Server side binary data saving.
  2. Asynchronous requests from client and transfer data through response.

I was thinking to use S3 service to store the actually data file but considering the complexity of the save file, I want to give DynamoDB service a try. (It just has some hero info + inventory)

Also the Lambda service is new to me so I will try to learn some node.js and program the back-end functions.

This is what I did on the server side in the last few days:

I made some lambda functions like NewMatch / EndMatch to modify a DynamoDB table called Matches, which contains a MatchId and gameplay data. I assume that this table will be modified whenever player creates a new match and after the match, player will request EndMatch function to generate some rewards. Things go well, the flow works but the speed is slow 🙁 Probably because the setting I use for these two lambda functions are too low.

I made another function called CreateNewProfile to initialize a new player’s data by using Google’s Flatbuffers. The reason I want to use Flatbuffers is that I’d like to save the player data into one attribute of an item in the Players table, and also be able to transfer the data from server to client. When client received the data, de-serialize the binary to grab the actual player data. Creating the data using Flatbuffers is easy. Read the data from table and convert to something that can be transferred through Json structure is tricky. In order to do that, I create a Uint8Array as a container to store the data from DynamoDB table. Then use a Buffer to grab the data from the Uint8Array. When I construct the Json struct, I convert the Buffer to an utf8 string. Now Json doesn’t complain any more lol.

Looks simple, right?
On the client side, I am using Unity, so it’s somehow easy to read byte array from an utf8 string:

I didn’t mention how to use Flatbuffers, it’s easy to learn and use, I love it a lot.
The prototype works well: I can request a new player profile if there is no record, or return current profile if found the record. I can create a match and request rewards based on the match. The only thing I want to complain is the response speed, sometimes half a sec, sometimes 1 sec, sometimes longer, hopefully paying more money to have bigger memory size and more cpu units can solve the problem.

It’s fun to play with node.js, definitely will use again to program some simple server side functions/services.
I also integrated Facebook SDK, but it’s off topic.

That’s all.