Resist the Temptation of Crossplatform

Porting game to different platform is boring compared with developing new game, that’s why there are so many technicals to solve this problem. Developed once, deploy everywhere. It’s really awesome for everyone want their software run on different platforms.

iPhone and Android are two big tribes in mobile industry and they are so different, obj-c and java, that make crossplatform developing very difficult. Right now the best way is Unity, but I have to say it really a bit expensive for small budget developer(like me :-) . Recently the cocos2d-x attract my attention a lot, it seems like very promising and there’re already many games released with it. But after careful consideration, I resist the temptation. Below are my reasons.

1.It’s not mature enough, for Android, there some phones they don’t support. Maybe it’s best tool for porting iPhone game developed with cocos2d-iPhone to Android, but I don’t have strong sense of security on Android.

2.Learn new technology cost a lot. cocos2d-x use c++ and the API is like cocos2d family, I know c++ but the API is stranger to me.

3.Debug is difficult on Android.

4.Native technology is the best friend of platform, always.

5.The most important things in making game is making a good game. If the game is not a game on a platform, so it’s not neither on the other. Technical complexity would attract more attention than we should paid, means less attention to the game itself.

So, libgdx is still my best friend on Android :-)

From Lhasa to Mohan

Lesley

First I should thank generous Lesley, with his permission I have this chance to travel. Lesley is a handsome Walsh with dreadlock, this hair style made him very attractive in China, which made him very uncomfortable in crowd. The different attitude to uncommon thing in west and east is one lesson Lesley learned in his journey . Hope him can find his nature and peace in the small village of Laos.

Illusion of Holy Land

Most people, especially non-Chinese have unrealistic imagination of Tibet. I think it may lead by mass media, they described Tibet as a pure holy land, all lost good things out there. I should admit, years before like other undeveloped region, old tradition is strong on this land, people have little idea of commercial society. However right now, things changed a lot on this land. Some blame technology, some blame commercial society, most blame China. My explanation is simple, time changed. Like other place in the world, time also affect this holy land. The youth of Tibetan also want big television, Nike sport gear, beautiful and useless things created by modern world. You got more, you lose more, that’s the balance.

Tibet is not barren land, if you travel along the national road you can find people everywhere. If you want a close look to famous viewpoint, you should pay for it, include Mt. Everest. They built the road and built the gate, then you should pay for the convenience they provided.

I know it’s not easy for non-Chinese go to Tibet, and also not cheap. The easier B-plan is Tibetan area out of Tibet. If you just want enjoy the beautiful nature of Tibet, Tibetan area in Sichuan province is another good choice. You can trek around  snow mountain in mountain area, hired local horse ease your burden. This area is totally same as Tibet and most important things is you can travel in this area without any official restriction.

Tashi 1 Restaurant

The best restaurant I have visited in Lhasa is Tashi 1. It’s price is very reasonable, I mean cheap and tasty food. The recommend dish is Yogurt Cake, Fried Dumplings and Bobi with 4 Fruit. You can find it on Zangyiyuan Road, near Beijing East Road.

Canggu Temple Sweet Tea House

When you walk in old town of Lhasa, you can find many tea house in it, and the best one must be the Canggu Temple Sweet Tea House. As its name said, it located near Canggu Temple. The environment is perfect for drinking tea, and the price is amazing cheap, maybe because its mainly customer is local Tibetan.

I know many non-Chinese tourist in Tibet dare not to try Yak Butter Tea. You can see the funny face when you invite them to drink the tea. Tibetan drink salty yak butter tea in the morning and have sweet butter tea in other time. I prefer the sweet one and it is also easily accepted by non-Chinese. If you want try Tibetan tea, drink sweet tea in Canggu Sweet Tea House is a good choice.

Shambala Palace 

Shambala Palace is a beautiful hostel in old town of Lhasa. Really difficult to find because it’s located in a dead end of alley, you can find the detail on their website. The hostel reconstruction from a old Tibetan building once owned by a Tibetan noble, in my words, you can see Tibetan ghost strolling in it at night. You can see Potala Palace on its roof and all decorations are from local Tibetan.

Because it’s an old building, the sound insulation is not good. Fortunately, everyone in this hotel is keeping quiet, maybe because the ghost is watching us :-)

Stone Pot Chicken

Along G318, Sichuan food is the most common food you can find. If you passed Lulang(鲁朗), you can not miss the Stone Pot Chicken. Actually, this dish is also not Tibetan food, some restaurant invent it recent years. The stone pot is from Medog(墨脱),  put Tibetan chicken, local mushroom and other vegetable in it. Believe me, it’s most delicious dish you can have along G318.

4028 Campsite

G318 start from Shanghai, end at Friendship Bridge in Tibet, full length is 5476km. 4028 Campsite is beside the 4028km milestone and is the only campsite along G318. It’s a lovely place, you can see snow mountain from it, yak and horse are the visitors. The campsite owner have a Tibetan pig named Hemei, if you touch it, it would sleep down to enjoy your touch. Another pet, a dog named Dianzang, it would use its nose to scratch you to beg food.

This site provide food, shower, toilet, wifi, charge and camp equip rent service. And they accept foreigners.

Songstam Meili

Songstam Lodges have five lodges in Yunnan Tibetan Area, Songstam Meili is the new found one located near Mt. Meili. All Songstam Lodges are five star standard hotel, the decoration is Tibetan style and staff are very nice. In every room of Songstam Meili, you can see Mt. Meili. You can’t find a better place around Mt. Meili, so why not award yourself in the tough journey?

The room rate of Songstam Meili is between  RMB900 to RMB1600, dinner is RMB 150 per person. They also provide trekking service.

American Style British Guy

In the night of Songstam Meili, there are three guests there. Me, my girlfriend and a British Guy. Except the accent, you can’t find any relationship from him with British. Maybe the reason is he leave Britain since 1997. He worked in a American chain restaurant company, most time in Hongkong, sometime fly to Shanghai for business.

He amazed to see Chinese buy luxury with bags. We made our explanation and tell him the gloomy future of China we worried. As a foreigner worked in China, and not taken English teacher as his job, he has a bright future, his Chinese colleague and friend never tell him real China, he can’t see the dark side of China. When we told him check the citizenship of his Chinese wealthy friend’s family member, who recently move his family from Australia back to China, we see the non-British face again. Chinese are clever. That’s my explanation.

It seems like almost every foreigner has one Classic Foreigner Question. Before ask the question, they always said you have the right refuse answering it. This guy has his own. After I answered it honestly, I though China is most difficult enigma on this world for foreigners, even you live there you also can’t understand it. Then a strange proud fill my heart.

Tiger Leaping Gorge Trekking

It let me dying. As a computer geek, OK, a nerd, I am very proud I spent one and half an hour from Mr. Zhang Hostel to Tiger Leaping Gorge and back. You should know the normal Chinese take two hours. We started too early, not saw the grandma drug dealer who sold weeds to foreigners. What a pity.

Lijiang and Dali

They both are old town. I prefer Lijiang, it’s small and artful, though a little artificial. Dali is different, many local people live in it, so it’s more practical. Maybe Dali is suitable for long-tern stay. But I just passed by, so Lijiang is more attractive. By the way, Lijiang is famous by its nickname Capital of One Night Stand.

Finally, we arrived Mohan, the Chinese border town to Laos. Farewell to Lesley, we back to Chengdu.

My Home-brew Chili Sauce

Chinese people in Sichuan Provivence made their home-brew chili sauce between July and October every year. Below is my recipe.

1.  I choose the pepper grown in Sichuan Province, actually all types of pepper are fine. Wash and dry them in room temptature.

2. Chop them to sauce. I like using knife than machine, that made the sauce more delicious.

3. Mix the sauce with salt. The proportion of sauce and salt is 5:1.

4.(Optional)  Add Chinese prickly ash in the sauce. I know not everyone like it and it may be hard to find, so it’s optional.

5. Add liquor in the sauce. The proportion of sauce and liquor is 25:1.

6. The most important steps came, the best oil in my mind is rape oil, if you can’t find it, use some vegetable oil instead.

7. Prepare a china or glass jar, clean it with boiling water then dry it.

8. Blend the sauce with oil, put them into the jar.

9. Pour oil into the jar, make sure the sauce all are below the surface. The oil isolate the sauce from air, when you get some sauce out make sure the left sauce still soak in the oil.

10. Well done, finally you got the Chinese chili sauce. Put it in a cool and dark place for one week, then you can use it cook Chinese food especially Sichuan Cuisine.

Amazing Mobile APP Le Assistant 360(乐助手360)

Le Assistant 360 is a schedule management app for iPhone and Android. The producer is Lenova, a big Chinese computer manufacturer. The amazing point of this app is its accurate voice recognition. Believe me, you haven’t see any other app can do what this one do. For example,  you speak to the phone, I have a meeting at 10pm tomorrow and before that I should notice everyone in my office,  then you would see new schedule is added, Notice all colleague to attend the meeting at 10pm tomorrow. It totally understand what you said and the processing is very fast. Is there any special high tech of voice recognition in this app? No.

The fact is that behind the Le Assistant 360, there is a real human assistant for you. He or she get what you say and handle the voice info to schedule then send to your app. So if you speak to it using dialect, you also can get the right result. Bazinga!

It’s not April fool’s joke, it’s a real exist app, from a big company. My question is how to protect user’s privacy? And the labor in China is not cheap as before  and will more expensive in future, this app is free right now, when user group is bigger, can it make enough money for its cost?

My Dear Blog

It’s been a long time, since I left you. I learned a lot of things during my left. I can use Gimp to draw some naive cartoon character and create some realistic metal panel, I learned some ndk  and image processing stuff. Unfortunately they are not enough to made my new game, I made some mistakes and almost need rebuild it from the original idea. That’s OK, making game for me means one prototype after another. I just worried about maybe it’s too late for registering the IGF China, the deadline is 1st Sept. .

Give up or hesitation? No, I’m just a little tired and need talk to you. Everything will be fine in the future, at least will be fine in my mind.

 

Before Evil Come Postmortem

Before Evil Come

Well, I really made it. This is my first Ludum Dare, and actually my second playable game.

Before this competition start, I’m  so exciting and also doubt whether I can finish it. I made a strategy for myself, no collision detection, no physic and no animation. I know they’re important for a game, but I can’t count them in before I really conquer them.

Game Overview

This is an evil game like the title said. You’re a demon, came to our world, because good man protect us you have nothing to do without some buddies. So you go to the wild and hope get some buddies join you. Although it’s wild, still some enemy out there. You can have rest in house and graveyard, but be careful your enemy also rest in some house. After defeat your enemy, you gain exp and may level up. The more buddies and hight level you have, you can kill more people. If you don’t have any buddies, you die.

Developing Tools

I used below great tools.

Libgdx: an open source Java game engine, also supports Android. It’s really good and best game engine on Android in my mind. The texture packer and bitmap font generator tools are very helpful for me in this competition.

Gimp and Inkscape: all graphic assets are made by this two software.  I think Inkscape is a good tool to draw cartoon style graphic.

Bfxr, LMMS and Audacity: The BGM was made by LMMS and other sounds were from Bfxr. Audacity handle the polish work.

Developing Process

Ok, enough background, I want talk about how I made this game. When I knew the theme It’s Dangerous to Go Alone, Take This., the first idea was ant. Tiny ants group a great army to defeat strong army. Based this idea, I split gameplay to two steps, first summon army and second defeat big boss. The bigger army got in step 1, the easier in step 2.

Because I like dead creatures so I replace ants with zombie and skeleton. I’m not expert of complicated control game, so one click control is my choice. Top view, tile map and my cute dead creature, first stage is done.

When I start made second stage, I hesitated. It’s actually a totally different game, did I have enough time to finish it? I give it up at last, instead I made a slot machine mini game, whose digit number is lead by gain points in first stage.  (OK, actually I am just lazy ;-)

After add story board of game background, this game finally done. It’s mini and some kind shabby, but I really love it. So do my girlfriend, though she just like click things and don’t care game content.

Conclution

Cons:

1.Not enough feedback when player made decision.

2.Inside game mechanic is too simple. OK, maybe it’s some kind pro :-) .

3.Not enough introduction, player would be confused :-(

Pros :

1.It’s really very easy.

2.My cartoon characters are cute, isn’t it, especially when player lose. I love the skeleton on the cross.

Hope you like this game and my poor English not disturb you. :-)

 

[Solved]Can’t resume from Sleep on Nexus S with Libgdx

When I test my game on my Nexus S, strange things happened. I pressed power button in my game, the phone fall asleep and my game paused. After touched the power button again, the screen is black and nothing showed up.

After check the forum of Libgdx, I found the method to solve this problem.

by mzechner » Mon Feb 21, 2011 8:05 pm

Ay. Could you do me a favor and add

<activity android:configChanges=”orientation|keyboard|keyboardHidden” … >

to your activity tag?

I’ll try to reproduce this locally with the phones i got.

After add the android:configChanges parameter in my AndroidManifest.xml, everything is OK.

ClassCastException when use TexturePacker of Libgdx

The weekly report of Android Game Untitled is paused, the game is still in  progress.

TexturePacker is useful extension class of Libgdx, it packed all images in one folder to one image with power of 2 width and height and create a pack file record the coordinate info of each sub image. With TextureAtlas you can  load subimage from the assembled one easily. Why we use this not directly use several images. That’s because

1.The width and height of Texture should be pow of 2, that’s not convenient when you want use other width and length.

2.Loading several images is slower than loading one.

When I use the TexturePacker I get an exception

Exception in thread “main” java.lang.ClassCastException: [B cannot be cast to [S
at sun.awt.image.ShortInterleavedRaster.getDataElements(ShortInterleavedRaster.java:245)
at com.matrix.libgdx.util.TexturePacker.squeeze(TexturePacker.java:362)
at com.matrix.libgdx.util.TexturePacker.addImage(TexturePacker.java:98)
at com.matrix.libgdx.util.TexturePacker.<init>(TexturePacker.java:78)
at com.matrix.libgdx.util.TexturePacker.process(TexturePacker.java:748)
at com.matrix.libgdx.util.TexturePacker.process(TexturePacker.java:837)
at com.matrix.libgdx.util.MyPacker.main(TexPacker.java:12)

Because I don’t find any others who confronted the same problem, I think it’s maybe my fault. After digging a while, using debug I found the reason, Every time when squeeze a special file the source.getAlphaRaster() return a ShortInterleavedRaster and that lead to the exception.

I have no idea of this png file, it’s same as others to me. And the only difference between them maybe the special one made by Photoshop and others by GIMP. It seems like the alpha raster of image made by Photoshop is short not byte. It’s just my guess, not sure about that. After removed it, everything is OK. :lol:

Android Game Untitled Week Six

Alpha 1 released, hurrah!

The whole game is nasty right now, I should add real graphic stuff, animation, sound, music, better UI and more funny gameplay. Although there is a lot of things to do and at the same time I learned a lot of things.

The art style in this game is cartoon like, I found a great vector design tool Inkscape. It’s easy to use and have a lot of tutorial, and it’s free and open source, great tool for indie game group with limited budget like us.

In this game, I want some sprites always on the top. However, libgdx can not create multi-layer or set the z-order directly with the Stage class. Update: Different from AndEngine, the multi-layer is implement with groups in libgdx(thx the heroes  behind libgdx, I’ll think twice before post :-) ). All actor in stage drew in the order of adding in stage. Later added actor on the top of before ones. There’s a easier way to implement multi-layer in stage. Create some Groups, each group behalf of one layer, the later added group has bigger z-order, the last group is always on the top. Then just add actors to the  group  instead of adding them to the stage directly. The basic multi-layer function has done.

In this week, I’ll concentrate on the graphic and gameplay.