12/10/2009

Release before 2010...?

I'm hoping to release this game before the new year.. Thanks to friends' help beta testing, I'm getting all kinds of weird errors. There are some bugs that I have no idea why it's happening. Arrgh..! I actually found a behavior that happens only when I play the game in Japanese. The behavior is that when ever a new Japanese character is display in a UITextView, iPhone mallocs 160 bytes with CoreGraphics add_chunk. The memory lives indefinitely. I don't know how to release these memory. I asked and filed it to Apple, but no reply yet.

年内中にリリースしたい予定。友達のおかげで新しいバグがみつかりました。いらんしーっ。どうやったらこうクラッシュするのかをつきとめないと。。
ちなみに日本語でプレイしてる時でしか起きないバグも発見。バグでもないけど。どうやらUITextViewやらに日本語を表示するときにシステムがmalloc 160 bytesをするけどゲームを終了するまでずっと生きたまま。どうやってメモリーリリースするのかわからんまま。方法はないような気がする。バグでもないけど、バグファイルしても返事こないからもしかしたら答えを探してるのかな。以前バグファイルしたときはすぐに返事きたし。

11/28/2009

Thanksgiving & Such

Still debugging and adjusting game balance. It takes time and bunch of trial and error...
I've been actually catching up with my social life recently, I feel like a human being once more.
BTW, the game is going to be called "Dungeons & Such". If anybody would like to help beta test with me and if you have iPhone or iPod Touch, please shoot me an email.

まだまだデバッグとゲームバランス調整の日々。試行錯誤の繰り返し。でも最近は人間らしい友達とかのソーシャルライフもカムバックしてます。あともうちょっとやー。ちなみにゲーム名が決まりました。「Dungeons & Such」です。ふざけまくりです。
もしもiPhoneかiPod Touch持ってる方でベータテストしたかったらぜひメールください。猫の手も足も借りたいぐらいです。

11/14/2009

Yup. Debugging.

So everything's going well, animation is pretty much done, so I'm onto testing my game and finding more bugs. I mean, MORE bugs. Ay yai yai... por favor hermano. Sayonara geisha. I'm confused.

アニメーションも予定より2週間ほど早く終わったので真剣にゲームバランスとデバッグを始める。がしかしこれがバグが見つかるわ見つかるわでもうむちゃくちゃ。すぐになおせるやつはいいけど、意味不明のバグはかなり困難。ぎゃ〜

11/10/2009

Finished animation

I finished my animation a couple of days ago, finished it a couple of weeks earlier than I had planned. Now for the final tweak and balance check. Hopefully not as many bug encounters as before..

アニメーション完成。予定より2週間ぐらい早く完成。頭で描いてたのがはっきりしてたから早く終わったはず。残るは最終ゲームバランスチェックやらなんやら。バグが前ほど見つからないように。(祈)

11/03/2009

Animation



So I've been working on the opening animation for the past couple of weeks. The draft animation only took two days to make in Flash since I've been thinking about how it wanted to look.

I just love doing frame by frame animation. I like 3D animation too, but it's not the same. It's fun to create the illusion of moving and expressing the lightness and heaviness of the objects with a subtle timing and art. It is hard to get it right.

Now I'm coloring the art.

この2週間ほどオープニングアニメーションを作ってます。ドラフトアニメーションは2日でフラッシュで作りました。頭の中に絵コンテがすでにあったので比較的早くできたほう。
フレームバイフレームアニメーションは3Dやロトスコーピングよりはるかに好きです。日本のアニメはコマを節約して微妙なタイミングで物の重さや速さを表現している。気に入ったアニメーションがあれば保存して研究したりする。アニメーションってすごいなぁ。
今は色塗りをしています。

10/20/2009

Yes, I'm here

I just noticed it's been a long time since my last post!! Yup, I'm still working on it every single day, it was just boring debugging and such although I think I had a few insights about debugging and programming and all that in between, but anyways... wow I really wish I had a talent in writing.. My English is so broken. So I've pretty much finished the programming part of the game so I've been drawing the background art lately again. I just finished drawing 51 of them 5 minutes ago so I needed to celebrate it here. Hurahh! (a celebration roar)
Now I need to draw the background for the square, inn, barracks, cathedral, and the hill. After that is draw some boss characters and draw all the NPCs. Hurraah!! (one more push roar)

気づいたらもう2週間近く留守にしてたこのブログ!誰か読んでるんかな。自己満の開発日記なんやけども。最近の進行具合はデバッグやらバランス調整などでとくに書くこともなかったけどところどころ発見があって楽しかったりもした。発見というのはデバッグの仕方や、プログラミングの醍醐味など。それが終わったので背景の絵をまた描き初めてやっとこさ51枚目完成したのでちょっと祝いにきました。おっしゃ!てな具合で気合いを入れ直してあとは町の絵5枚かいて、NPCの絵かいてボスの絵描いたらおすぃまい。へっへ〜ん♪で、そのあとはゲームバランス調整しながらオープニングアニメーションを作り始める。まだまだ完成には遠いぜよ。

10/07/2009

Progress, progress, and... progress

..moreover, progress.
It was inevitable to learn how to use Instruments due to my buggy-awesomeness-code-of-doom. I found a huge bug where a memory wasn't being freed by Apple's API because I was trying to paste a blank string to a UITextView. This didn't show up in the Leaks Instruments, but it was living forever which could be observed through Object Allocations. It was about 100KB per minute, which adds up over time and crashes the app.
And finally, more progress is yet to come.

進行、 進展、前進するのみ。Instrumentsを使ったデバッグの作業になかなか慣れてきた今日この頃。繊細におおらかに書かれたバグだらけのコードをデバッグするには不可欠。今日はAppleのAPIで生成されたオブジェクトがフリーされてない問題を解決した。いや、一瞬たりとも「アップルのバグか?」とか全然これっぽっちも思ってなかったけど、やっぱり問題は自分でUITextViewに空のNSStringを入れようとしてたみたいでそれがMalloc 160 bytesを蓄積してた。結果、毎分100KBぐらいのリークが発生しててこの数週間悩まされてたんだぜぇ〜。初代iPhoneだと15分ぐらいでクラッシュするという始末。明日はまた違うリークを解決するぞと。
精が出るぜぇ〜。出るんだぜぇ〜。とぜぇぜぇ言いながらやってます。

9/24/2009

The game is actually a game

After all the core game system working, I've been pretty much making data, and making events now. And all of a sudden, the thing is actually a game! It's an interesting shift in the whole development process. I'm having fun making characters and their personality, what they say and how they play in the game. I haven't had any break from this for 15 days. Crazy.

ゲームシステムのコアがほぼ完成した今、武器やモンスターやイベントのデータを作ってる。気がついたら、めっちゃゲームやん!なかなかなゲームやん!と感動してる日々。ここまでくる道のりが長かったなぁ。開発の過程の中ですごい変化がでたような気がする。キャラの性格や台詞を作るのも楽しい。で、かれこれ15日間休まず作ってる。最近の平均時間は10時間かな。おかげでめっちゃ進んだ。楽しい。がしかし、引きこもりすぎ。不可欠でしょうがないんだぜいいぇい。

9/14/2009

Almost ready for testing...

I've been saying this for about 2 weeks now, but for real this time. I've been preparing bunch of data for monsters, items, and tomorrow I'll work on Magic and Skills to test. I organize my data on Google Spreadsheet, I then spit out a CSV file and parse it using a PHP script I wrote. I feel more comfortable doing this than making a XML file and reading it through XML parser in Objective-C. PHP is so much easier... I also wonder how much more difficult it is to hack an xml file than hard coded data.

あとちょっとでテストプレイできるぐらいまで来た。ってもう2週間ほど言ってるような気がする。。この二日間はモンスターデータ、とアイテムデータを前半分ぐらいまでつくってる。明日は技と魔法をつくるかな。このすべてのデータをGoogle Spreadsheetで管理していて、CSVに吐き出して自分で書いたPHPスクリプトでパースしてる。Objective-CでXMLやCSVをパースするよりはるかに簡単のような気がする。XMLとハードコードはどっちがハックするの難しいのかな。

9/11/2009

Debugging spree

Crazy days! Debugging like hell. I've found out about Clang, a free and useful debugging tool for Xcode, but then I found out about the new Build and Analyze menu which pretty much does the same thing as Clang. I'm using both Instruments and that menu to debug my app. It was crashing like crazy 3 days ago, but now my app is running way better. I'm getting memory warning after about 10 minutes of playing. Need to release the objects more properly.

怒濤のデバッグ日和!デバッグツールにはかかせないClangを知り、そしてXcodeについてくるBuild and Analyzeのメニューを知った。どっちもにたようなことをするので今はInstrumentsとそれを使ってる。3日前は死ぬほどクラッシュしてたけど今は10分ほどプレイしてるとメモリー警告メッセージがくるだけ。ちょっとは安心したけど、どこでどうメモリーリークしてるのかを発見しないとまたこれ進まんな。

9/05/2009

Graph of hours spent


This is the graph of hours I've been spending on this game. I keep track of it in Google Docs.

開発時間を記録したグラフ。Google Docsで管理。

9/04/2009

Rampage

Jus getting things done. I think I finally see the end. I'll probably have the game playable for testing within this two weeks. The tweaking of the data for good game balance is going to be just a whole another task. The event system I put in seems to be working, it's just that coming up with story and the balance of it is another task.

またもやめちゃくちゃ進んだ。やっと終わりが見えてきたような気がする。このまま行けば2週間以内でテスト用まで完成するはず。ゲームバランスのためにデータをいじるのがまた難しくなりそうやなぁ。おとといと昨日で導入したイベントシステムは思った以上にうまくいってて快感。絵のないNPCはスペースホルダーとして黒いシルエットにしてるけど、これがまた違う味がでてていいな。なんかで使えるかも。かまいたちの夜的な。

9/02/2009

Events and NPC

I had some kick ass day today. Implementing events and NPC was not an easy task at all but still got stuff done. I think I got the base core working. Now just for the little bits.

今日はざっくり達成感。イベントとNPCを導入するのは思ってた以上に難しかったけどコアな部分はできたはず。「フラグをたてればいいだけ」と思ってたけどそれをどういうふうに作っていくかが思ってもないようなやり方でやることにした。オブジェクト指向の醍醐味というかめんどくさいところというか。。。

8/31/2009

Snow Leopard, more skills and magic

I spent all day installing Snow Leopard and Xcode 3., Snow Leopard iPhone SDK, and everything else. I'm back on track today with more magics and skills. I think I'm going to have to call the skills the Techniques since the Magic and them fall under the category of Skills. Hmm, this might cause some problem later on.

昨日は一日中Snow Leopardインストールと他のソフトのインストールした。ゲームのシステムはできてきたものの、ゲームバランスが絶対難しくなる。

8/27/2009

Heal magic working

What the title says.
Gotta get both the magic and techniques working within two days.
Gonna kick some ass.

ヒールの魔法ができた、ということで他の魔法もさほど難しくないはず。技の導入も似たような感じなのでスムーズにいくはず。積極的にやっていかな一生終わる気配なし。1ヶ月以内にはゲーム自体は完成させたいけど。甘いかな。がんばるぜぇ〜。がんばるんだぜぇ〜。

8/25/2009

Skills and magic

Been busy lately with other things. I started implementing skills and magic for the players. The monster's side is pretty much done. So far so good.

最近他のことで忙しくなった。今日はプレイヤー側の技と魔法を作り始めた。モンスター側はほぼ完成してる。いい調子。
作ってるうちにいいゲームシステムの案なりを思いつく。いいんやけど、ちょっと今更ってとこもある。

8/17/2009

Effect view

The icons of the effect of the spells and skills are working now. I had a problem trying to use the method copy. I still need to dig further into memory management. It's kind of scary what I'm going to run into. Maybe I'll end up with a huge memory leak problem.. it looks ok now.

魔法やスキルのステータス異常などのアイコンが画面上に表示されるようになった。こいつは使える。
今日はcopyメソッドで久々に悪戦苦闘した。コピー自体は簡単にできたけどそのあとにアサインした変数に変化を加えるとクラッシュしたり。なぜに。。

8/14/2009

A lot done

I have no idea how many little things I got done this week. I got the effects of armor, shield, and ring done. Fixed some bugs and found some more, just some solid working days.

今週はやたらと細かい作業をたくさんやっつけた。鎧、盾、指輪の効果はおわったし、バグは直したし新バグは発見したし、充実しまくりの1週間。このままがんばっぞぉ。

8/11/2009

Rings and armors

Rings will increase your stats, and armors will have effects for you to become immune to certain attacks such as poison, sleep, etc. Just going through bunch of states, flags, and if statements. Maybe the shield will reflect certain attacks like fire or something. This is the most enjoyable time in making games is when I'm thinking about the game design. Actually, not all game designs are fun though...

指輪はステータスを上昇、鎧には毒や眠りなどの攻撃を無効化にするというゲームデザインにした。盾はどうするかなぁ。何かを跳ね返すとか炎に強い盾とかつくるべや。こういうの考えてる時が一番楽しいんよなぁ。

8/10/2009

Monster magics

Now some monsters are casting magics using their MPs. This is pretty cool that they have some basic AI.

モンスターが人工知能で魔法を唱え始めた。なかなかエキサイティング。

8/09/2009

Stuff

Finished making the looting system and moving on and fixing some random bugs.
Next up, monster magic skills.

戦利品システムは意外とスムーズに終わってまた小さい虫をやっつけるハメに。
次はモンスターの魔法スキルから作るかな。

8/07/2009

Looting items

Before I dive in to the big decision making that I mentioned about in the last post, I decided to make the looting system after the battle. What's a RPG without looting off the monsters? I almost forgot about the importance of this feature. It makes it fun to encounter certain enemies when you know that they loot something you want.

一つ前の投稿に書いたコアの部分のデザインを考える前に、戦利品いただきシステムを作ることにした。ひとつ:RPGの醍醐味はモンスターからレアアイテムをゲッツすることにあり。もう少しで忘れるところだった。レアアイテムを落とすモンスターとかにあえるとちょっと嬉しくなる感覚は忘れられない。

8/06/2009

Decision before proceeding

I think I fixed the battle system today.. so happy.. Now I need to decide the core game system whether the player will start from level 1 every death, or will they retain their level but get a penalty from death. I need to make this decision now otherwise I can't code for magic spells and what not.

今日戦闘システムのバグを直した。たぶん直せたはず。今のところは問題なく動いてる。めっちゃ嬉しくて今日は気分がよくなった(笑) というところで次に進むためにはゲームのコアな部分の設計をしないといけない。死んでしまうとレベル1からまた始まるのか、ペナルティをうけるだけなのか、これで全然作り勝手がかわってしまう。ゲームデザイン。。このゲームはちょこちょこやってレベル上げていく系のような気がするのでたぶんそうするかなぁ。

8/05/2009

Some thinking


Needing to plan a better system for the battle, I decided to go to the beach and just think.

戦闘システムの改良のため、海辺で作戦を練る。

8/03/2009

Xcode tips #2

I posted before that command + double clicking on a word shows the header files, but you can also do this on your own code also. It is extremely handy if you want to quickly jump to certain method you wrote just by holding down command and double clicking on it.
If you Option click on an Apple's API, it brings up the Documentation and searches it, saving you time to actually bringing up the Documentation and typing what you want to search for.

以前にコマンド+ダブルクリックでヘッダーファイルを開くというティップを紹介したけど、同じ動作を自分のコードにやると元のコードへ飛ぶ。めちゃくちゃ便利。ちなみにオプションクリックはドキュメンテーションを開いてサーチという一石二鳥なショートカット。いつもわざわざドキュメンテーション開いて検索ボックスにタイプしてたのがオプションダブルクリックでできるようになった。

8/02/2009

Target enemy after item use

I've worked on the "choose your target" interface for the items that need it like when I use a smoke bomb, users need to tap an enemy as a target. Since I didn't design with all these features in mind from the beginning, which is a big mistake, is getting more complicated to implement new systems. I wish I new better from the beginning, but you gotta learn it somehow, right? I knew that being scalable and making for expansion in mind is better, but I just didn't know how to go about doing that. Learning it the hard way..! I can take it...! (hurrah...)

今日はいろいろ忙しかった時間の合間に「敵を選択してください」のインターフェースを作った。敵を標的にするアイテムを使用した時とか魔法をかけた時のインターフェース。作り始めた時からこういうの新しい機能をどういうふうに作るかを考慮してなかったので全体のプログラミングデザインの中に無理矢理はめこめていくというややこしい作業になってきた。しゃあないっちゃあしゃあないんやけども。これでも多少考えたつもりではあったんやけどね。(ーー;)ま、これからはこのままやるしかないのだ。。!

8/01/2009

Enemy skills revisited

Back on implementing enemy skills. Skills are easier to do than magics since it's going to be just descriptive attacks and perhaps possibility of doing random hits and damages. I'm going to have to implement MP and attributes of the magic spells.

とりあえず十分な絵はそろったのでまた敵のスキルのプログラミングへスイッチ。消費MPや魔法の属性などのプログラミングはまだやってない。ん〜。なんか若干萎えるなぁ。(笑) やっぱりプレイヤーも敵も魔法使ったほうが楽しいし、なかったらクソゲーすぎるし。しかしこれ、マゾゲートップ10に入りそうやなぁ。

7/30/2009

And more monster..


Completely went to town on drawing monsters. Now I have total of 38 monsters! I need to do at least 5 more. Then I think I'm going to be back on programming for a while again.

今日は集中してモンスターの絵かきまくった。38匹目が完成!あと5匹ぐらい必要なのであと1日あればできるぞぉ。その後はまたプログラミングへ戻るかな。

7/28/2009

More monster art


My goal is to get at least 5 monster art per day. I got 26 done so far. I want at least little more than 30.

目標は一日に5匹はモンスターを描くこと。今のところ26匹。最低30匹は欲しいかな。

7/27/2009

Monster art..


I has awesome wok monzter art done. Herez a goblin.

キョウハ、タクサンもんすたーヲカイタ。コレごぶりん。

7/25/2009

Orc art



I'm switching to drawing the enemy art since I have most of the background art done. I've always wanted to draw the good old orc.

背景を大半描き終えたので敵の絵を描くほうへ切り替える。オークはいつも描きたかったんやでー。

7/20/2009

39/50


I have 11 more background art to go. These last ones should be more time consuming since it's going to have inorganic features.

あと残り11枚の背景まで到達した。50枚なんか絶対多いと思ってたけど毎日こつこつとあればいつかは終わるもの。プログラミングしてる時ほどストレスを感じない。(笑)むしろ毎度ながらポッドキャストを聞きながら描けるので一石二鳥気分。最後の11枚は自然な洞窟というより魔人のダンジョン的な感じにするので難しくなりそう。

7/17/2009

Wacom back!


Back on track with a Wacom tablet! I got the model called Bamboo Fun, the medium sized one. At first, the rough surface felt a little awkward to me, but I got used to it after ten minutes. It was under $150 refurbished, it's doing its job. I wonder why the other ones cost so much.

Wacomタブレット、新しいやつが来た日。Bamboo Funの中サイズのやつをゲット。Graphire3より表面がざらざらで最初は気持ち悪かったけど10分ほどで慣れた。150ドル以下で買えたけど高いやつってどこまで性能違うのか考える。まぁなんでもいいけどこれでまた絵が描けるぜよ。とさっそく好きなポッドキャストを聞きながら絵を描き始めた。

7/15/2009

BOOL in an Array, casting class type


BOOL aBool;
NSMutableArray *aMutableArray = [[NSMutableArray alloc] initWithObjects:[NSNumber numberWithBool:NO], nil];
aBool = [(NSNumber *)[aMutableArray objectAtIndex:0] boolValue];

7/14/2009

Hot day is no good

Continuing on with implementing the enemy skills. I want to make it so that I can assign monsters certain skills such as Bite, Headbutt, Daydream. But these need to be delivered with different sets of probability. It is hot today and I cannot seem to concentrate and didn't get much done. Doh. I ordered a new Wacom tablet though. I got the medium sized Bamboo Fun silver. It had good review so I'm guessing it's not going to betray me.

モンスタースキル開発を続行。噛む、頭突き、ボーッとしている、などのスキルを割り振っていってるけどもちろん全部違う確率で発生させたい。暑いせいかなかなか集中できずじまい。でも新しいワコムタブレットは注文した。ばんぶーなんちゃらってやつ。けっこう大幅に値段が違うけどそこまで性能がかわってくるもんなんかな。ペンの役割さえ果たせればどんなやつでもいいんやけど。

7/13/2009

Enemy skills

My body is all sore from playing ultimate frisbee.
I'm making a list of enemy skills now. Enemies will be casting magics but more importantly, they have to do some weird things that monsters do. How do I put that out better. I suck at writing. I'm using Google Doc's Spreadsheet to organize things like this.
Anyways, my Wacom tablet is still broken, and I'm waiting for the reply from Wacom's support department. I might as well just get the new one maybe. But they are still expensive..


昨日アルティメットフリスビーをやって体中が筋肉痛。
モンスタースキルを作り始めた。魔法も使えるモンスターもいるけどやっぱりモンスターと言えば人間離れした独特な攻撃をしてくるのが醍醐味。文字だけやけど、雰囲気は出るでしょう。Google Docsのスプレッドシートでこういうリストをとりあえず作っていく。
ちなみにワコムタブレットはまだ故障中。サポートにメールしてみたけど、自分でもやっぱり壊れてると思うのでやっぱり買うしかないか。金使いたくねーい。

7/09/2009

34/50 art.. and Wacom broke..!?


Right when I was about to finish drawing the 34th background art, my Wacom tablet completely cut off on me! I was just painting like usual. This could be my first time anything ever broke on me.. I had Graphire3 that's probably about 4 years old, but never really used it often until this project. What could go so wrong? Now I need to buy a new one.. Another unexpected expense..

34枚目の背景を描いている間になんとワコムタブレットが壊れてしもた。たぶん壊れたはず、いきなり無反応になったしLEDライトも消えた。たしかに4年前ぐらいから持ってるけど1年に数回使うだけで今回のプロジェクトで久々に使っただけやのに。なんちゅーこったい。新しいのを買えってかぁ。いらん出費うぉ。

7/07/2009

29/50 art


More painting backgrounds. Is hue, saturation, brightness is all you need to paint..?
On top of that, there's reflection, the surface material, and air density.
I wonder what else there are.

さらに背景を描く。色調、彩度、明度で絵は成立してるのかな。
反射、素材、空気の密度、など。他に何があるか。

7/06/2009

20/50 art


Today I got the 20th background art done. I have 30 more to go.

20枚目の背景を描き終えた。あと30枚かな。

7/02/2009

Art, art, art...





I've been drawing all day today, or rather painting in Photoshop. Without a doubt, I'm getting better at painting these things. It's fun. The good thing about drawing is that I get to listen to Podcast or something verbal instead of just music. When I'm programming, no words come into my head. I wonder what part of the brain is responsible for this. I heard that left brain is responsible for logical, analytical, rational things, and right brain is for intuitive, art, things like that.

今日は一日中絵を描いた。確実に日に日に腕があがってきている、ような気がする。いけそうな気がする〜。絵を描いてる時のいいことは、音楽じゃなくても言葉をしゃべってるPodcastなどが聞けること。プログラミングしてる時に言葉を聞くなんて絶対できない。自分はどっちかというと左脳より右脳派のような気がする。でもロジカルなところはひたすらロジカル。ようするにバランスを重視してます。

6/29/2009

Redoing battle system from scratch...?

I might have to redo the programming for the battle system from ground up. It turns out that my initial approach to doing this wasn't so good, I pretty much knew that it wasn't a great way to begin with, but as the battle gets more complicated, the harder it is to add more features. It feels too clunky as it is now, so it might be a good time to commit this.

もしかしたらそろそろバトルシステムのプログラミングを書き直さないとだめかもしれん。最初からあんまりよくないのはわかってたけどどういうふうになるかとかさっぱりわからなかったので「とりあえず」的なやりかたでやってたらやっぱり壁にぶち当たった。動きもダラダラやし、やっぱり1から書き直したほうがよさげなおさげ。しくしく。。

6/24/2009

Poison attack!

Now I got some poison attacks going on. There will be items and weapon that will do poison damage. Some monsters will have these too. I'm also drawing art as always. It's so much fun to do the art... Only when I can do it right really quick.

毒攻撃を導入。アイテムや武器で毒のダメージを与えることができる。モンスターも同様。
絵も同時進行で描いてます。絵描くのがめっちゃ楽しい。。。早くできればの話やけど。

6/23/2009

Excel data..

I tried to export the Excel spreadsheet of items and monsters to a text format I wanted. I couldn't seem to figure it out. Do I use macros or is there any better way... Does anybody know?

エクセルのアイテムやモンスターのデータを自分の好きなテキストフォーマットに出力する方法をリサーチ。残念ながらいい方法見つからず。マクロを使うか、何か他に方法はあるのか。。誰か知ってたらぜひ教えてください。

6/22/2009

Carried away with painting..



I've spend all day drawing today. It is quite fun. The good thing about drawing and painting is that it is possible to get better at it, to a certain degree, even if you don't paint. By observing the everyday life and how light hits the surface and think about the bouncing of the light rays, you'll understand why it emits certain colors. Maybe it is the same for programming too.

今日は一日中バックグランドを描いた。意外とはまってしまい、3つほどバックグラウンドを描いた。絵を描くということのいいことは、ある程度まで絵を描かなくても上達できるということである。日常生活で見る物の光の反射や形を観察していれば勝手に脳がそれを記憶していく。次絵をかくときはこうすればいい、という情報を得る。プログラミングも同じでデザインパターンなど思い浮かぶのかな。

6/21/2009

#pragma mark



This little tip will help you organize your code. It creates sections with bold fonts in your method pop ups like in the screenshot.

コードを整理するのに役に立つティップです。スクリーンショット参照。


#pragma mark Whatever you want to say

Background art



Painted my first original background in Photoshop. I think I'm go for the quick and easy way for these although they don't look quite as nice.. Maybe I'll touch it up later. Basically I draw a rough sketch using Wacom tablet, then I start painting with opacity set to about 50% for the brushes, this way, it'll give me the watercolor look and feel to it. I haven't done this in years...

このゲーム初のダンジョンのバックグランドをフォトショップで描いた。早く簡単に仕上げたいのとりあえずこのクオリティでやってみる。後で時間があればリタッチしようかなと。フォトショップではまず最初にラフスケッチをブラッシュで描いて、色は50%透明度ぐらいにしてからペイントしていく。これで水彩画のようなタッチになる。あとはペイント、undoの繰り返し。もともと背景画は中学、高校のころに描くのが好きでこの方法で描いていた時期もあったけど、最近は全然描いてなかったなぁ。

6/17/2009

if([myObject isKindOfClass:[UIView class]])

This gets pretty handy, the isKindOfClass: method. It's self explanatory, it gives you a boolean of whether if it is a certain class or not. I usually use it when I have random classes in an array and wants to do something with a specific class.

けっこうよく使うメソッドがこれ、isKindOfClass。配列にいろんなクラスをいれていて例えばUIViewのクラスならば、というふうな命令が下せる。


NSMutableArray *anArray = [[NSMutableArray alloc] init];
UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 100, 100)];
[anArray addObject: [NSNumber numberWithInt:284]];
[anArray addObject: aView];
[anArray addObject: [NSString stringWithFormat:@"a string"]];

for (id aObject in anArray){
if([aObject isKindOfClass:[UIView class]]){
NSLog(@"aObject is a UIView: %@", aObject);
}
}

6/15/2009

More battle stuff

Back on track again. (hopefully) I think the game is playable now even though it is a bit slow still. I had to compromise the blinking animation when the monsters get hit.
So I got the attribute attacks working now. Monsters are put to sleep when they get hit with weapon that have sleeping attribute to it. But for some reason, the other monsters that didn't get hit are put to sleep. Nooo..

また波に乗ってきた、ような気がする、でもないこともない。とりあえずiPhone上でもなんとかプレイできるぐらいのスピードになったので開発を進める。
眠りの属性を持った武器で攻撃するとモンスターが眠るようになった。でもなぜか他の攻撃されてないモンスターまで眠ってしまう。なぜに。。でもたったこれだけでやたら戦闘に楽しみが増えた。

Hit the first wall

Weird bugs and technical difficulty slowed my development process for a couple of days. It works fine on the simulator, but the movement is a bit sluggish on the iPhone. I should have any problem with speed since my game is not based on action. Arghh..

開発スピードがこの二日間ほどちょっと下がった。バグやら技術的なことで悩まされる。シミュレーターではうまく動くけどいざiPhoneに入れて動作を確認すると1匹以上のモンスターを攻撃したときに少し動作が遅くなる。少し90年代のパソコンの動作の動きの鈍さを思い出させる感じ。こらいかんなぁ。

6/13/2009

NSSelectorFromString

I can pass in some strings as a parameter and then have it perform the selector method in the passed in method.

メソッドの名前をNSStringのパラメーターでうけとってそれを後でselectorとして扱う方法を発見。


- (void)performThis:(NSString *)aString {
SEL aSelector = NSSelectorFromString(aString);
[self performSelector:aSelector withObject:nil afterDelay:2];
}

6/12/2009

performSelectorOnMainThread

For some reason, I had the code below when I can just do [self addToBattleTextView:aString].
This was causing the thread to redraw the battle text in an arbitrary order. I don't need multiple threads for my game, bad idea for me to use it! It might have been ok if I had the waitUntilDone:YES, but I'm still novice to use multiple threads. Plus there's no good reason for me to use multiple threads at this point.

下記のコードを使っていたため戦闘メッセージがぐちゃぐちゃになってた。複数のスレッド使わなくていいのになんでこんなことになってたのか。。2時間ぐらい悩んでたyo、うぉにぃちゃん。大体スレッドの使い方把握してないし。

[self performSelectorOnMainThread:@selector(addToBattleTextView:) withObject:aString waitUntilDone:NO];

6/11/2009

Attribute attack and some problem with array

I'm starting to implement the attribute attacks, like attacking with a weapon to put enemies into sleep, which is going well. But I think I got a problem with something different here.. I'm having hard time putting the A, B, C after the enemies names when they are the same kind of monsters. It should be easy! The challenge comes from the fact that the monsters are displayed in a arbitrary order. Pulling my hair out in a graceful way.

属性攻撃を導入しはじめた。「まどろみの剣」で攻撃したらモンスターが寝る、とか。これはうまくいってるけどもう一つ違うとこで苦戦。モンスターの種類が同じ場合、A,B,Cとかで区別をつけるために名前の後に付け足したいのにこれがなかなかうまくいかず。簡単と思ってたのに。。なんで難しいかというと7匹のモンスターがランダムで表示されるためかな。優しく頭をかかえる数時間。

6/10/2009

Fixing things..

Always fixing things... bugs, but not even bugs maybe.
Side slash, diagonal slash, crush, are implemented. They do different damage and stuff.

バグとはいえないほどのバグなど細かいところを修正。
戦闘の横切り、縦切り、斜め切りなど導入。

6/09/2009

Swipe slash

Implemented the first swipe slash attack. These swipe gestures will do different attacking style like slash, hack, pound, etc.

スワイプすることで攻撃のバリエーションを追加。横へスワイプすると横切り、盾は兜割り、など。

6/08/2009

Damage number animation, scroll attack

Implemented damage number animation on top of enemies. For now, the more damage you do, the bigger the number it gets.
Also, the scroll attack to all enemies actually does damage and kills them. Attacking multiple enemies is the best thing!

モンスターの上にダメージ数値を表示。FFスタイルかな。クリティカルヒットの場合はちょっとスタイルを変えた表示も設置する予定。
あと、巻物で複数の敵を攻撃できるようになった。べりぃないす。

Xcode tips

Command + double clicking on it shows the header file.

コマンド+ダブルクリックでヘダーファイルを表示。

6/07/2009

Attack multiple enemies at once



Starting to implement the ways to attack more than one enemy at a time. I already have this set up with the dragging the finger across the screen to "slash" the monsters from different directions. Now I need to actually make it attack. Thinking about displaying the damage number above monsters instead of just having it in the scroll view.

多数のモンスターを同時に攻撃するコードを導入しはじめた。今はとりあえず画面をスワイプすることで剣のさばきを再現してるけど、まだ攻撃自体は作ってない。あと、モンスターの上にダメージ数値を表示しようかと考え中。たぶんやる。よし、やろう。
さてこれから本気モードで作っていくぞ。

6/06/2009

Level up, player death

Player actually gains level, and they now die. I had a hard time adjusting the size of the xp bar as they are collected. Be careful of the UIIView's clipsToBounds, they should be set to YES if you want to resize its bounds and frame. Wasted about 1 hour why my view wasn't changing its size.

レベルアップ設置とプレイヤーのHPが0になったときに死んで店に0階へ飛ばされるようにした。経験値バーの幅を設定するときにUIViewのプロパティであるclipsToBoundsがNOになってたため幅がどうしても100%のままだった。1時間無駄にしてもうた。みなさん気をつけてください。

6/05/2009

Xcode keyboard shortcut tips

Here are three simple Xcode keyboard short cut tips.
Xcodeの便利なショートカットを連載。

1) The Escape key for bringing up suggestion commands for specific class.
ESCキーでクラスのメソッドやプロパティのリストを表示。


2) Command + Shift + D lets you quickly view the header file of highlighted class.
コマンド+シフト+Dで選択したヘダーファイルを表示。


3) Command + Option + Shift + ? opens up the Documentation. This Documentation gets very very handy.
コマンド+オプション+シフト+?でドキュメンテーションを開く。

6/04/2009

Critical hit

Implemented critical hit for both player and monsters. Tweaking little detail as always.

プレイヤーとモンスターのクリティカルヒットを導入。細かいところを直していってる。

6/03/2009

MVC, Singleton, Delegate, NSNotificationCenter

It's hard to come up with a correct design pattern for you program. One of the useful one is NSNotificationCenter where you can access a selector from anywhere in your code.

プログラミングのデザインパターンをうまく構成するのはなかなか難しい。そこで一つ使えるのがNSNotificationCenter。使い過ぎは要注意。

Create a notification:


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMethod) name:@"myNotification" object:nil];


Call it from anywhere in your code:


[[NSNotificationCenter defaultCenter] postNotificationName:@"myNotification" object:nil userInfo:nil];

6/01/2009

Sell items

I finally implemented selling items at the shop. Added in info button for the items so that will will display detailed view of each items. It's an little property called accessoryView in UITableViewCell.

ショップでアイテムが売れるようになった。自分のアイテムのinfoも見れるようなった。UITableViewCellでaccessoryViewというのにボタンを指定するだけ。


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

....

UIButton *anAccessory = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *aImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"icon_info" ofType:@"png"]];
[anAccessory setBackgroundImage:aImage forState:UIControlStateNormal];
anAccessory.frame = CGRectMake(0, 0, 24, 24);
anAccessory.showsTouchWhenHighlighted = YES;
[anAccessory addTarget:self action:@selector(tappedAccessory:withEvent:) forControlEvents:UIControlEventTouchUpInside];
anAccessory.userInteractionEnabled = YES;
cell.accessoryView = anAccessory;



- (void)tappedAccessory:(UIControl *)button withEvent:(UIEvent *)event{
NSIndexPath *indexPath = [self.theTableView indexPathForRowAtPoint: [[[event touchesForView: button] anyObject] locationInView: self.theTableView]];
NSLog(@"%i", indexPath.row);
}

5/29/2009

Shop guy


Some art done for the store guy. His arm kinda looks weird..

店のおやじの絵描いたで。腕変になってんちゃうますのん〜。

5/28/2009

Custom icon in UITableViewCell

Added icons by the items to indicate the item category such as weapons, armors, items, etc.
API made it really easy to do this.

アイテムの左側にアイテムジャンル(武器、防具など)を表示するアイコンを設置。ものすごく簡単にできる。

Inside this method in your UITableViewController:


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


...put this:


UIImage *aIconImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"some_image" ofType:@"png"]];
cell.imageView.image = aIconImage;

5/27/2009

UIImageViewController


Getting images from your photo library is as easy as about... 10 lines of code. I was pretty impressed how the API made it so easy. I'm putting in some player profile picture feature in there.

写真アルバムから写真をゲットすんのにめちゃくちゃ簡単なことにびっくり。
ステータスに自分の写真を入れれるようにした。


@interface StatusViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> {



- (IBAction)showImagePicker:(id)sender
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.delegate = self;
imagePickerController.allowsImageEditing = YES;
[self presentModalViewController:imagePickerController animated:YES];
[imagePickerController release];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[self dismissModalViewControllerAnimated:YES];
}

Getting things done...

Just did a little today, just getting little detailed things done like coming up with standard button size for the entire game, etc. I'm also going to add image picker for player's character, so the player can shoot and choose their own character's picture.

今日はちょっとだけ進んだ。ボタンのサイズを統一など、細かいところを修正。プレイヤーが写真アルバムから自分のキャラクターを選べるようにするリサーチを。めっちゃ簡単にできるみたい。

5/26/2009

Rest, treasure chest, etc.

Tons of little things done. Now resting is possible in an empty room, and there's chances you'll find a treasure chest. Still only know about 90% of the retain, copy, release business.

いっぱいできた。空の部屋で休むことが可能。宝箱も見つかることもあるかも。またメモリー関係の自分のバグで足を止められる。retain, copy, releaseがまだ90%しかわかってないかな。

5/25/2009

Some math for the first time!

I've never had to use more than arithmetic in before, but today I had to use arc cosine for the first time.
I'm drawing a line that from point A to point B, and below is the equation I had to use. Awesome stuff.

今日生まれて初めてプログラミングでコサインを使った。線をかくのに必要。


- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.view];
float deltaX2 = originalPoint.x - currentTouchPosition.x;
float deltaY2 = fabsf(originalPoint.y - currentTouchPosition.y);
float c = sqrt( pow(deltaY2,2) + pow(deltaX2,2));
float radian = acos( (deltaX2 / c ) );
if(originalPoint.y < currentTouchPosition.y) radian = -radian;
CGAffineTransform transformRadian = CGAffineTransformMakeRotation(radian);
theSlash.transform = transformRadian;

...

5/24/2009

Run button working

Now I can run away from the monsters. Also, depending on which floor and room you are on, the encounter situation changes to battle, shop, NPC, empty room, etc. I have yet to implement the NPC part.

モンスターから逃げれるようになった。フロアと部屋によって違うエンカウンターあり。宝の山の部屋とかあれば嬉しいな。

5/23/2009

Next floor...

Now I can go to next floor, but the buttons and the stairs image won't disappear. I need to removeFromSuperview somewhere.

次のフロアへ行けるようになった。階段の絵とボタンが消えないのでどこかでremoveFromSuperviewを呼ばないと。

5/22/2009

Added system button

Now all the buttons on the bottom, Item, Status, System, are placed appropriately. I might add Skill/Magic or something like that later on. I found a bug where a subclassed UITextView does not receive the touchesEnded method. The bug has been filed by other guy at the developer's forum.

アイテム、ステータス、の二つのボタンに一つ追加したのがシステムボタン。戦闘中メッセージスピードの調節をしたりメニューに戻れるようにする。メニューに戻った際にはmemory leakが大変。UITextViewをサブクラスしたときにtouchesEndedが呼ばれないバグを発見。デベロッパーフォーラムで誰かがバグをリポートしてた。バグってまだまだあるんやねぇ。

Object allocations / memory leak


I've been fighting this almost all day today. It seems like it's not deallocating my game object correctly. After every battle, my game allocates extra 1MB as you can see in the picture. My allocation is like a stairway. How do I fix this...

一日中苦戦。戦闘の1ラウンド終わるたんびに1MB分ぐらいのオブジェクトが階段のごとくallocateされてる。もはやこれまでかー!何があかんのかなぁ。

UIImage cache or not to cache

There are different ways to display images. Cached or not cached. Apple employee at the forum said NOT to use the cache way, which is the + (UIImage *)imageNamed:(NSString *)name method in UIImage.
UIImageで絵をロードする時はキャッシュするやり方、 (UIImage *)imageNamed:(NSString *)name 、よりしないやり方のほうがいいらしい。

NSString *aFilePath = [[NSBundle mainBundle] pathForResource:@"mypicture" ofType:@"png"];
UIImage *aImage = [UIImage imageWithContentsOfFile:aFilePath];
UIImageView *aImageView = [[UIImageView alloc] initWithImage:aImage];

5/21/2009

Testing on device

This is my first time testing this app on my iPhone. I've waited because I was afraid I wouldn't be able to use the apps that I had on my iPhone OS 2.2.1, I couldn't downgrade. I had to upgrade my SDK to the latest beta, which caused a little change but fixed it in 15 minutes. It's working nicely on my iPhone now, it looks good.

iPhoneにインストールしてテスト。iPhone 2.2.1にダウングレードできないためちょっとためらいがあったけど、とりあえずはうまくいってるようなので一安心。間違って今まで撮ってた写真を全部消去してしまい、オウマイガ。はっはっは、笑ってすませようやないかぁ。

5/20/2009

Bug found in Cocoa Touch

I can use Potion after battle now. Fixed two bugs.
In UITableView, when you swipe a row, the "Delete" comes up. But then you can't select any of the rows afterwards. The code below fixes the problem. Forums and Google is always my friend. :)
戦闘後でもポーションが使えるようになった。2つのバグ修正。UITableViewで行をスワイプすると「解除」ボタンが表れる。その後にビューがまったく反応しなくなる。解決は下。フォーラムとグーグル様々です。m(_ _ )m


myTableView.alwaysBounceVertical = NO;
myTableView.scrollEnabled = YES;

5/19/2009

Problem solved...

The problem I had last night was solved in like 5 minutes today. I guess you can't think right when you are tired. Eat well, play well, work well, sleep well.
昨日悩んでた問題が5分ぐらいで解けた。なんじゃいー。やっぱり疲れてると集中力や思考能力が下がる。よく食べてよく遊んでよく働いてよく寝よう。

Battle: Item usage

Items can be used during battle, but you cannot change equipment. I'm having problem using up the turn when the player uses the item. It sounds like a simple thing! UIAlertView is so handy. I wish I could customize the design though.
戦闘中のアイテムの使用はできるようになったけど、ターン終了がうまくいかない。UIAlertViewは使えるがデザインをカスタマイズできないのが残念。

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"This is UIAlertView" delegate:nil cancelButtonTitle:@"OKotherButtonTitles:nil];
[alert show];
[alert release];

5/17/2009

This page is so narrow..

I was looking for a simple design like this but with more width template than this one. I don't have time to make my own template.
Update: Ended up fixing it myself. I might have wasted my time.. This area was only 435px, so small!
もっと幅のあるテンプレートないんすかね。こういうシンプルなデザインがいいんやけど。
更新:やっぱり自分で幅を変えた、と。いらん時間ついやしたな。。

5/16/2009

Battle, base done

Now I can attack monsters, defeat them, and move on to next room. No concept of rooms yet though. Players are still gods, can't die. XP and gold obtained after battle. I put some dummy sounds and music. Sure adds flavor to the game.
一通り攻撃だけでバトルができるようになった。敵は倒せるがプレイヤーはまだ無敵。アイテムも使えるように準備。XPとGoldゲット。音量コントロールもできるようにした。ダミーのサウンドと音楽も設置。

5/15/2009

LanguageManager class

So I ended up writing my custom class called LanguageManager, which just holds all the strings that need to be translated and returns the strings.


LanguageManagerというクラスでlocalizationをすることに決定。オプションメニューでスイッチできるようにしたいので、アップルの自動的に認知するやつは使えなかった。


[LanguageManager translate:@"Start"];



+ (NSString *)translate:(NSString *)aString {
Settings *gameSettings = [Settings getInstance];
if (gameSettings.languageSettings == 0) return aString; // if user setting is English
if (gameSettings.languageSettings == 1){ //if user setting is Japanese
if(aString == @"Start") return @"スタート";
if(aString == @"Continue") return @"コンティニュー";
...


I wonder if there's any better way...
これでいいんかいな。

5/14/2009

Localization research

I've figured out how to do localization for the game before, but I wanted it so users (or me) can switch the language on the fly instead of going to the iPhone Settings.
完璧にlocalizationをする方法をサーチ。iPhoneの設定でやるより自分のアプリ内でやりたいしね〜。ほぼ自分のため。iPhone自体は英語で使いたくて、ゲームは日本語でしたいのです。

Some helpful links:

http://www.iphonesdkarticles.com/2008/11/localizing-iphone-apps.html

http://www.bdunagan.com/2009/03/15/ibtool-localization-made-easy/

http://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/Articles/InternatAndLocaliz.html#//apple_ref/doc/uid/20000277


To get what language the user is using:
ユーザーが何語を使ってるか:


NSArray *languages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];
NSLog(@"Current Locale: %@", [[NSLocale currentLocale] localeIdentifier]);
NSLog(@"Current language: %@", currentLanguage);
NSLog(@"Welcome Text: %@", NSLocalizedString(@"TitleKey", @""));

5/13/2009

Battle coding...

I think the battle system is working OK even though the code is very ugly... The more agility you have, the more attack you do.
バトルのコードはきれいじゃないけど、うまくいってる気がする。Agilityを100を超すとアタック。1ラウンドで100を超すと何回も攻撃するorされるシステム。素早さが命になるときもある。

This code would've saved me a million times if I knew this earlier... Often times, I need to execute something after X seconds.
これをもっと早くに知ってればどんだけ助かったことか。。X秒後に何か命令させるのを今までNSTimerでやってました。はっはっは。(T▽T)

[self performSelector:@selector(battle02:) withObject:NO afterDelay:1];

5/12/2009

NSThread, NSTimer

I need a good way to display these battle messages with little delay like 1 second. NSThread and NSTimer were my options. It seems to be working.
NSThreadとか見てみるけど、「◯◯の攻撃!」「◯○のダメージ!」というふうに1秒の間を作ってみる。NSTimerでやってみた。うまくいきそう。


NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSThread sleepForTimeInterval:0.3];
// do stuff here
[self performSelectorOnMainThread:@selector(addToBattleTextView:) withObject:aString waitUntilDone:NO];
[pool release];

5/11/2009

Battle system

Brainstorming for battle system. How should it decide who attacks first. When one reaches 100 agility.
Agilityが100を超すと、攻撃ができるというシステムにしてみる。

5/10/2009

Battle message: UITextView

Using UITextView for displaying battle message that scrolls. "Encountered enemies!" is the first one.
スクロールする戦闘メッセージにUITextViewを設置。「モンスターがあわられた!」が出てくるようになった。

5/09/2009

1 to 7 monsters

Successfully chose and displayed the 1 through 7 monsters, skipping 5.
5匹の時はスキップして、1から7匹うまく出てきた。

5/07/2009

Monster array

I guess I was having trouble displaying them on the screen with arbitrary numbers.
1から7匹出てくるモンスターをうまく画面に表示させるロジックが思いつかない。

More monsters

I forgot what I worked on about monsters haha.
何やったか忘れた。はっはっは。

5/06/2009

Monster encounter!

Now the player encounters monsters! But can't do anything yet...
モンスター出現!でもまだ闘えず。。

5/05/2009

NSKeyedUnarchiver

Using NSKeyedUnarchiver to save player data and item data as an alternative to NSUserDefaults. I've read that NSUserDefaults isn't the best for storing huge amounts of data. Actually, the reason I migrated to NSKeyedUnarchiver is because I couldn't save some object or an array using NSUserDefaults. Now I can save the items I've purchased from the store. Learned how to use enum.
プレイヤーデータ、アイテムデータなどはNSUserDefaultsじゃなくてArchiverでセーブ。買ったアイテムをセーブできるようになった。enumの使い方もおぼえた。



theData = [NSData dataWithContentsOfFile:dataFilePath];
decoder = [[NSKeyedUnarchiver alloc] initForReadingWithData:theData];
Player *tempPlayer = [decoder decodeObjectForKey:@"playerData"];


- (void)savePlayerStateBeforeTerminate {
Player *player = [Player getInstance];
Player *tempPlayer = [[Player alloc] init];
tempPlayer = player;
NSMutableData *theData;
NSKeyedArchiver *encoder;
theData = [NSMutableData data];
encoder = [[NSKeyedArchiver alloc] initForWritingWithMutableData:theData];
[encoder encodeObject:tempPlayer forKey:@"playerData"];
[encoder finishEncoding];
[theData writeToFile:dataFilePath atomically:YES];
[encoder release];
}


Player.m

- (id)initWithCoder:(NSCoder *)decoder
{
playerLevel = [decoder decodeIntegerForKey:@"playerLevel"];
playerFloor = [decoder decodeIntegerForKey:@"playerFloor"];
playerRoom = [decoder decodeIntegerForKey:@"playerRoom"];
...
return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
//[super encodeWithCoder:coder];
[coder encodeInt:playerLevel forKey:@"playerLevel"];
[coder encodeInt:playerFloor forKey:@"playerFloor"];
...
}

5/03/2009

Shop and Item window done

They are located in the bottom screen, it slides up smoothly when you tap it. You can sort and delete the list also with the now familiar user interface Apple came up with. Weapon and armor now equippable.
ショップとアイテム画面が完成。アイテム画面ではsort/deleteもできる。武器と防具の装備も設置。

5/01/2009

UITableViewController and copy, hooray!

Managed to use UITableViewController alright. I understood the concept of the copy method. I needed to copy the object with a new pointer from the items list. Before, I was just copying the pointer. It took me 3 hours of research how to copy object properly.
UITableViewControllerうまくいった。newItem = [aItem copy]しないとだめと気づく&リサーチで3時間ぐらいかかった。


- (id)copyWithZone:(NSZone *)zone {
id aCopy = [[[self class] alloc] init];
[aCopy setItemAbundancyPercent:[self itemAbundancyPercent]];
[aCopy setItemPrice:[self itemPrice]];
[aCopy setItemCategory:[self itemCategory]];
[aCopy setItemName:[self itemName]];
[aCopy setItemWeapon:[self itemWeapon]];
[aCopy setEffectPower:[self effectPower]];
[aCopy setItemAttributeNumber:[self itemAttributeNumber]];
[aCopy setItemDescription:[self itemDescription]];
[aCopy setIsEquipped:[self isEquipped]];
return aCopy;
}

4/30/2009

More buy more Stanford video

I decided to use UITableViewController for listing items and such. I was just using UIButtons and UILabels before.. it was such an mess. I watched 3 more Stanford videos. The weapons won't get chosen randomly, why? Couldn't sleep til 6am.
Buyを押すとUITableViewControllerでリストすることにした。Stanford のクラスのビデオも3つ見る。朝6時まで寝れなかった。武器のアイテムがランダムにならないので苦戦。

4/29/2009

Move on to the dungeon

Once you hit the "Done" button, the "Enter Dungeon" comes up and goes to 1F of the dungeon.
Shopを出ると、1Fへ移動。Sellはまだ完成してない。Buyはなんとかうまくいった。

4/28/2009

Listing random item from a NSArray

I listed random items that are going to be in the store, but this logic doesn't seem like a fast one.. Maybe I'll post some code when I have time... Click on the item, and the item gets added to the itemsArray in Player class.
BuyViewControllerでアイテムをランダムで表示。ランダムロジックがよくない。クリックするとアイテムバッグへそのアイテムを登録。

4/27/2009

Store guy

Store guy comes up, he starts to talk one letter at a time. This animation make it look like he's really talking.
ショップ人間でてきてdialogueが1文字ずつ出るようにした。buyを押すとBuyViewControllerがでてくる。

4/26/2009

ShopViewController

Made ShopViewController for buying items and goods.
ShopViewControllerとかつくった。

4/25/2009

MVC pattern and Singleton

How do I access ItemViewController from GameViewController? Protocol and delegate? I still don't know how to do the MVC pattern right. Using singleton for Player stats and stuff...
GameViewControllerからItemViewControllerなどのアクセス方法を考える。Protocolとdelegateでやるのがいいのかな?プレイヤーデータはsingletonでいいや。と。


+ (Player *) getInstance
{
static Player *myInstance = nil;

@synchronized(self)
{
if( myInstance == nil ){
myInstance = [[Player alloc] init];
}
}
return myInstance;
}

4/23/2009

UI design


Made a game UI in Photoshop. All the images are subject to change.
UIをフォトショップでつくった。開発中画像です。

4/22/2009

Begin, code name "Dungeon(仮)"

Started coding like a maniac. I've brainstormed with my friends over beer while I was still in Japan. That boosted my juice to make this game.
-Watched 6 of the first Stanford class videos on iTunes U. These are great.
-Use NSUserDefaults to save user settings such as music and sound toggle.
-Choose between gender, race, class, and your name.
-Made a SoundManager class with AVAudioPlayer.

本格的に開発スタート!
昨日はstanfordのクラスの映像を6時間ぐらい見た。
- タイトル画面の設置
- Optionsでsoundとmusicのtoggle。NSUserDefaultsで保存。
- 設定はSettingsのsingletonクラス。
- Otherのボタンは他のゲームとかホームページへのリンクなど。
- スタートボタンを押すと、性別、種族、職業、名前を選ぶ。
- musicとsoundのクラスファイル、SoundManagerを作った。AVAudioPlayerを使用。

SoundManager.m

aFilePath = [[NSBundle mainBundle] pathForResource:@"music_title" ofType:@"aif"];
titleBgmAudioPlayer = [[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:aFilePath] error:NULL] retain];
titleBgmAudioPlayer.delegate = self;
titleBgmAudioPlayer.numberOfLoops = -1;
[titleBgmAudioPlayer prepareToPlay];



- (void)playTitleBGM {
if([(NSString *)[[NSUserDefaults standardUserDefaults] stringForKey:@"SettingsMusicSwitch"] isEqualToString:@"YES"]){
titleBgmAudioPlayer.volume = gameSettings.musicVolumeSettings;
[titleBgmAudioPlayer play];
}
}



[soundManager playTitleBGM];


Is this the best way to do this?
これでいいのかな。