Sunday, August 25, 2013

Unity3D + C#: Copy all the values from an existing component to another (derived) component, using Reflection

Happens to me all time. I have a prefab with a component such as "Player.cs" which contained over 30 variables of different types, including Transforms and GameObjects too. That it become such a hassle to configure all of them when I wanna make a new class which derived from "Player.cs"... say "Warrior.cs" with a structure like this:

public class Warrior : Player

For sure, the Warrior class will inherits everything from Player class, but that also means you have to reconfigure everything again (without a proper tricks), which is such a tedious work (though it can be done in a short time, if you don't have as many prefabs using the same script as me).

Saturday, August 17, 2013

Notes on Lightweight SWF (LWF) framework for Unity

Lightweight SWF, or LWF, is an open-source framework created by Gree for importing Flash animations into Unity. It's official page:

The infos provided in their wiki are a bit messy, thus this post will try to serve as another organised starting point for using LWF.

For starters, you need to learn how to convert SWF into something readable by the LWF plugins, using a software provided by them called LWFS:

And here's a tutorial (provided by Gree) on how to play the (converted) SWF inside Unity:

Extra infos about the Flash animation production guidelines are also provided by Gree:

The guidelines are a bit confusing for me, so I'm just gonna write my own version below.

Friday, August 2, 2013

AREAS - A Simple Maths Game About Areas - GameDev Notes

// Play the game here: 

I have been doing an on and off HTML-learning for the past few weeks. My main purpose of learning HTML was more for game development than building websites.

It was about last Saturday, when I decided that I've learned enough, and it's time to take what I've learned to use -- I'm gonna build a HTML5 game!

I was just searching around the web for idea when I incidentally stumble upon a simple Maths calculation of Areas and Volumes of a shape (or polygon). So I decided to make a game based on that topic.

For this particular project, I don't intend to touch too much on sprite-animations just yet, as I kinda gave the project a 2 day limit. So I need to finish building the game within 48 hours, as if I'm doing a game jam of my own. But in the end, it took me more than 2 days (5 days to be exact) to finish the project, in which I spent the first 2 days focusing on the core mechanics, and the rest of the 3 days on level design. I also tried to focus a lot on the colour-aesthetic of the game.

As much as I would love to continue working on it (not the game, but more on the outlook of game page, play around with CSS, etc), I was more eager to release the game as I have other ideas I wish to pursue.

Here are some photos of the level design I did for the game (it's like trying to come out with Maths question like a Maths teacher, lol):

Thursday, March 21, 2013

Unity3D + C#: Nested Coroutine (Coroutine within a Coroutine)

To call a coroutine inside a coroutine, like how you would normally call a function within a function:

// function within a function
void Attack()


void Battle()

// coroutine within a coroutine
// the about-to nested coroutine also have to be an IEnumerator method
IEnumerator AttackCoroutine()
yield return new WaitForSeconds(1);

IEnumerator BattleCoroutine()
// call the method using "yield return StartCoroutine(FunctionHere())"
yield return StartCoroutine(AttackCoroutine());
yield return new WaitForSeconds(1);


Thursday, January 31, 2013

#1GAM JAN: InvolveRPG

Finally completed my first #1GAM entry, and it's called "InvolveRPG".

Download links:

It was designed and made in 8 hours (roughly 3 nights of my regular working days).

This entry was made to test an idea where, what if, you're playing an ATB (Active Time Battle) turn-based game, and the charge meter is hidden.

Charge Meter, the one on upper right corner (screenshot from Chrono Trigger)

You'll have to get involve into the game by timing the charge meter yourself, using a... STOPWATCH!

Further instructions can be seen in the game, good luck playing it.
P.S> There's a way to win the game.

Monday, January 14, 2013

Unity3D + C#: Acquiring the length of an Enum

Acquiring the length of an Enum:

int enumLength = System.Enum.GetValues(typeof(nameSpace.type)).Length;

Replace the "nameSpace" to the source (script name) of the Enum type, and "type" to the Enum type.


Saturday, January 12, 2013

My 2013 Resolutions

After seeing all the 2012 resolutions unachieved, I realized I need to be a little more sensible and be clearer about my goal this time. 
Try not to go too big, scope down a little, and have some solid variables in them.

My 2013 Resolutions:
1. Make 12 games

2. Finish Little Green Hood (full version) within the first half of 2013, and publish it for both iOS and Android

3. Finish studying all chapters of Minna no Nihongo 1 (Japanese language text book)

4. Finish reading all my game development books, and learn about designing better games

5. Play as much JRPG, stealth adventure, and survival horror games as I can

6. Complete website design

7. Go to Japan

8. Seriously workout and lose at least 10kg

9. Start a JRPG, stealth-adventure, and survival-horror game mechanics analysis column for my blog

10. Be happier this year

A look back at 2012 resolutions

1. Publish 2 iOS good game on the appstore that will do well (FAIL)
Published 1 iOS game on the AppStore (Little Green Hood Lite), that doesn't so well. It's more of a tech demo to me though.

2. Continue mastering the languages (FAIL)
C# is still my most used language, plus I had a ongoing game project I had to attend to.
I built my website using HTML and Twitter Bootstrap, still not very good at it though.
Barely spend 1% of my time in 2012 to study Japanese.

3. Earn 100,000 USD (FAIL)
I realized making money isn't really my thing, let alone creating the kinds of game that make money.
I've decided to go back to the basics and make games just for the fun of making games. I felt happier that way.

4. Go to Japan (FAIL)
Never did go to Japan, didn't even get a chance to go to TGS while I was having my previous job.
Probably should've master my Japanese speaking first.

5. Learn to drive well (PASS)
I did try learning to drive better around December due to specific reason. Still counts.

6. Take a vacation or two (PASS)
Went to Singapore in November to watch Perfume's concert. 

7. Make a short film (FAIL)
Didn't even have a camcorder. Though I did make a game based on a short film in a 48 hours game jam. But I don't think that counts.

8. Write a blog post a week (FAIL)
Most of the time, I write a new blog post only when I learned something new which I fear I might forgot, or when I developed something interesting that I wanna to share with the world.
I barely do those things anymore now that I've a full time job. Sigh.

9. Start a comic series (FAIL)
Been doing way too many coding works that this resolution had slowly fades away and forgotten.

10. Make the Pokemon (fan-) game I always wanted to make (FAIL)
I don't even remember what the idea was, it was something about "Pokemon" and...

11. Make a gross-able game (FAIL)
Should be the same as 1 and 3, I didn't make any gross-able games as I wasn't so much into the money grinding thing.

12. Lose weight (10Kg) and get a life (FAIL)
Still have the same weight, and no life as always.

13. Survive the apocalypse, and be a hero (PASS)
Survived the apocalypse, hell yeah~!

3 out of 13, that's like 23%. It's bad. 
I've made too many no-so-easy-to-achieve resolutions.

A lot of things had happened to me in 2012, some good, some bad:
- received a grant to develop a mobile game; 
- experienced working with a money-minded investor (although, what kind of investors isn't money minded? lol);
- had a huge amount of stress working on two projects at the same time, even broke down crying in front of my colleagues and boss;
- quit my first job, got broke, and got my second job soon after; 
- had a quarrel with an artist during a game jam which makes me realized how much I need learn about working in a team;
- finished my studies and graduated from MMU;
- experienced rushing a project for a release, and crunching too, as an indie developer (solo);
there's still a lot which I don't quite remember… but I really do learned a lot from these "incidents". 

Hopefully 2013 will be a better year for me, I'll also try my best at the same time.