2011年12月25日 星期日

思考

那就另找士兵?
那是每一round運算時間是2xnxm,現在是<2xnxm
可能能降低至nxm,快了一半。
那就用第二種方法吧。
可能的bug?目標死了,那就另找目標吧。
需要雙方都有這個尋找嗎?還是一方就行?
因為近是雙面的,你離a近代表a離你也近。
那就。。
電腦依靠玩家士兵的距離感來決定該殺誰?
bug可能出於次序問題。
1. a find path
2. if the old distance is same or shorter, just remain. else, find a new one.
3. a walk, random at walk up or left
4. yeah, b gotta find path too, otherwise, there must be bug
then the sequence of units is another problem now.
it cannot say all units attack together.
the sequence base on the sequence of putting units.
if defense, then how?
the athogithm of defense is base on grid.
that need recursive function.
yeah, that will work.
and then the computer's ai?
how to put units?
i guess i will give it limited numbers of units.
actually players vs me.
and then the campign story?
that needs lots of drawing.

思考

那就另找士兵?

那是每一round運算時間是2xnxm,現在是

可能能降低至nxm,快了一半。

那就用第二種方法吧。

可能的bug?目標死了,那就另找目標吧。

需要雙方都有這個尋找嗎?還是一方就行?

因為近是雙面的,你離a近代表a離你也近。

那就。。

電腦依靠玩家士兵的距離感來決定該殺誰?

bug可能出於次序問題。

1. a find path

2. if the old distance is same or shorter, just remain. else, find a new one.

3. a walk, random at walk up or left

4. yeah, b gotta find path too, otherwise, there must be bug

then the sequence of units is another problem now.

it cannot say all units attack together.

the sequence base on the sequence of putting units.

if defense, then how?

the athogithm of defense is base on grid.

that need recursive function.

yeah, that will work.

and then the computer's ai?

how to put units?

i guess i will give it limited numbers of units.

actually players vs me.

and then the campign story?

that needs lots of drawing.

2011年4月19日 星期二

設計

沒有想過FYP 竟要到達這個地步。就是說,直接說吧,畫圖的困難比我想像中大得多,大了十倍以上,大了二十倍以上,基本上是遠超,應該說脫雜我的能力範圍了。我的目的是弄一個可以賣出去的遊戲,所以就找了一位畫2d漫畫的專業導師談,是從大陸來的,透過青年組織認識的。然後,他當然是很有經驗的那一種,也給了我很多寶貴的意見。我想,這裡的一個打擊就是,他告訴我,這不是一個沒有經過基礎繪畫訓練的人能夠勝任的工作。出面的一個遊戲角色設計,一個,就是說一隻狼,也得花上兩天的時間。遠低估了。。

所以,我得請人幫我畫。

你可能問,值得冒這種風險嗎?這game play system也許是不成功的,沒樂趣的。這裡必須透露一個支持我的意念的秘密了。其實這個遊戲,是很多年前一個大富翁環遊世界的小遊戲的複雜版,增加的東西不少,類似的遊戲也很多,(如zombie vs plant),因此不涉及copy right。不過,那時候我最愛玩的就是那個小遊戲,超愛的。對,就是這樣。。

繼續請畫的問題。jesus christ,這麼11個unit的花費總共是一兩千元?其實,也算合理了,1個角色才100元,得畫一兩個小時,再低的話再沒人接這活了。

果然,隔行如隔山。本來,對,本來以為我一個人能夠勝任這些工作,程式,level design,畫圖,結果,果然不行。在認識宋先生之前我是不知道原來angry bird的那個bird是遊戲團隊專雇了外面的設計師設計的= =,據說版權費也是六位數字。

2011年3月15日 星期二



很久沒update blog
沒有人告訴大家一個身兼programer, graphic drawer, level designer的人沒有時間寫這種廢話連篇的東西嗎?
反正在沒有搞文字的東西的時候, 任何東西都走得特別快
相信現代社會, 應該說下一個時代的走向是少說話, 多做事。

東西還沒搞好,沒必要談,以後再說。

2011年2月14日 星期一

繼續前進

上星期五終於決定推掉所有繁忙的兼職工作,把整副心機放在fyp上。話雖如此,這project 還是遭遇到很多困難的,就是說,我一個人做了三個人的工作,分別是寫程式,畫圖,以及level design。J 君說得對,一兼三職,我這是向impossible 挑戰。這沒關係,我就是喜愛挑戰。反正在工作上我也需要畫圖,那現在就是一種高強度的訓練吧。希望評審們能夠體諒這一點吧,製成品的質素可能比不上專業的遊戲(當然,我個人的目標是製成一個在街上賣的遊戲),可是一個人完成三個人的工作無論如何也不是一件容易的事情,那一方面不能兼顧請多見諒吧。。

讓我看看,昨晚finished camping ai. let me see, what next to do? camping ai is so far so good. but level programming needed to be improve. Code is still redundant now.

let me see, level one is 1 wolves. = 1w
level 2 is 2 wolves. = 2w
level 3 is 4 wolves. = 3w
level 4 is 3 wolves in random. (7,2 - 7,5) = 2w
enemy area is in red.

level 5 is 4 wolves in random. (2 area separated) (6,0 - 7,1 , 6,6 - 7,7) = 3w

count is array length.

level 6 is 6 wolves in random (big area: 6,1 - 7,6) = 4w

level 7 is 4 little wolves + 2 big wolves (6,1 - 7,6, big wolf back, little wolf front) = 4w

level 8 is 4 little wolves + 3 big wolves area same = 4w
one little lake

forest

level 9 is 3 big wolves + 4 littles wolves = 4w separate area

top score!

2011年2月9日 星期三

flash!

這幾天,不得不說,又遇到了接近令我灰心的困難。
就是說:flash在iphone上的運行速度到了一個限制。
致命啊!
一個300x300的藍色正方,一直往右邊平移竟然lag的!
adobe,那不是什麼複雜圖案,而只是一塊正方型!
那以後再複雜的圖案怎辦?
地圖的dragging怎辦?
多致命。
這麼lag,我是不會玩的。
也不用旨意能放上istore。
怎辦?
算了。
我也知道算了。
待flash出更新吧。
否則就以後再把東西移植到另一個develop platform 上。

2011年2月1日 星期二

中途站

昨晚搞掂了save data的困難
然後又搞掂了ai的部份
今晚看看怎樣。。
中途stop
就是說,玩家中途restart game都不會有負面的影響
都不會產生bug
怎辦?
那a-star的function花的時間是一至兩毫秒
假如在這段時間之間把game停止,必造成bug

然後,就是level的core function
就是說,在最初的level,player不能做的事多著
怎樣去定義呢?

看看

unit selection
defend state available
map size
zoom degree available
area that player can put unit on

after start, unit selection bar disappear

map is round

grid is lines

when drag selection button, map view move to that area

terrain
rearrange unit buttons

flag

gold

bottom bar is grey, translative

and two round buttons

one is zoom, one is menu

one is start/continue

top is flag button/other functions

walls

second story is pig empire

map is like link

firing houses

firing farm

2011年1月30日 星期日

hu!!!大功告成

今日ai搞掂
(搞到我爆炸!!)
亦搵到save data係iphone既方法
意未著存下level再唔係難事!
gotta sleep..

2011年1月29日 星期六

一個天大白痴的bug

不是說現在的path finding 還有bug嗎?
終於發現問題所在
從來沒有麼白痴過
花了一個小時找到bug
就是

fix前
for (var m:int = openA.length-1; m>0; m--)
{

fix後
for (var m:int = openA.length-1; m>=0; m--)
{

看得出有什麼分別嗎?
就是m>0
讓它永遠讀不到array[0]的數據!!!!!!!!!!!!!!!!!!!!!!!!
fuck me!

2011年1月23日 星期日

一個遊戲的偉大

有感而發寫了這篇文章..

小弟一生裡也玩過很多遊戲了(基本上我是半個宅男吧)
從super mario,逃獄金剛,到aoc,到world of warcraft,之後有了錢,upgrade了配置玩的hitman, crysis, need for speed..etc and etc

現在才明白到一個遊戲入面的可怕
一個很簡單的function, 就是尋路, 也是一種大學問..
可是人家20年前就搞好了這樣的演算法..
發展到了今天,那些gta4,dirt2,那些仿真得跟現實分別不大的物理系統
很難想像裡面幾百萬行的code在電腦裡運行的樣子..
付了多少的心血去畫,去寫..

又辛苦了一晚


今晚終於完成地圖的放大和drag移動
就這樣就花了半晚時間
也fine tone了一下以前的code
使更加有條理

那a star問題還在折磨我
上傳一幅圖就清楚
藍是start, 紅是goal
到了箭咀的位置,應該怎麼走呢???
假使走滿了右邊的空間,那走辦呢?還找不到出口呢
又不能重開走過的點, 到左邊吧?
這就造成一個大爛bug..

2011年1月22日 星期六

a star

既然得寫點東西, 就在這寫吧

3可能的bug
1.全block, unit動彈不得的情況
2.中途block, unit能走到最近target的地方嗎?
3.弓

先有一個seq
var dir_seq:Array

如target.x >= unit.x
先左,後右

先x後y嗎?
不,以distance決定

然後推進了

對!
個人感覺我的寫法可以改變一點
就是說,我找的不是最快的路徑,

這樣會造成unit會走到盡頭才轉彎

like this

if target.x >= unit.x
and target.y >= unit.y

and x distance>y distance

seq is

right
bottom
left
up

result:
1. no-block, 斜者可行曲線
2. 中間有block,
===
想了一個小時
自己的方法有點不行

唉..
明天還是繼續研究一下那些中文網站吧
有點像陷入了pure maths那時候的困境...
對,了解一個新的理論和應用它

A star

想不到我還停留在a star上。。
找了一個source
可是看了很久還不明白
那,還是算了
自己寫一個吧
。。。

2011年1月19日 星期三

天!A-star!!

今天繼續fyp的programming
之前的ai有點不完美, 遇到障礙還是有點笨
所以決定重寫了... (累)
看了一些a star的介紹, 還是決定用了
看來又得腦力操勞.........

2011年1月13日 星期四

上午又fix了一個小bug

這小bug說起來影響真大
亦很難察覺
最初以為是iphone的問題, 跟flash不相容
有點心灰意冷的惑覺..
最後修改了一點code, 終於解決了問題!
所以說, testing這步驟真的很重要...

期中present前進展 (1)




話說這幾天繼續搞核心部份的東西。
花了很多時間解決很多爛問題。
比如說flash 內置的dragging function,真是爛得無話可說
於是我還是自己寫了
還有就是自動移動的各種不名的bug。
花了許多時間去簡化
現在每天在火車上就不斷測試自己的遊戲。。
呵呵,其實樂趣也不少。

2011年1月7日 星期五

01-08

核心的部份快完工了
現在單位可以自由自動地行動
什麼drag and drop的bug都解決了
還差弓兵的attack程序
code變得越來越複雜
快到了除了我誰都不明白的地步了
之前用了pang的方法來dynamically引用number of unit等variable
比方說:
if (unit.x_pos > unit.closest_enenmy.x_pos && unit_pos[unit.camp][unit.x_pos - 1][unit.y_pos] == -1)

呵呵
完全是動態的連結
第一次寫這麼繁複的程序
let's keep going

2011年1月4日 星期二

unit auto moving

今天下午終於搞掂了unit auto moving
auto detect enemy 也ok
現在的問題是其他alternative,比如說當旁邊有盟存怎辦?
那個if 的括括將會挺大的..

讓我想想:

case1: 旁邊是盟友 (或block)
case2: unit是馬
case3: 準備attack
case4: 原來的enemy死了/distance增了

還有很多可能性..
case5: 弓準備attack

這基本搞店後就是defense狀態的處理

想到了
馬的寫法就是, if unit=horse, then loop unit move again
這個行
現在搞原來的enemy死了吧
應該在最開始搞

2011年1月3日 星期一

yup! got it!

今天終於搞掂drag and drop的所有部份
也為即將來臨的enemy detection ai 作好準備了
其實不用tree也可以, 畢竟只是detect distance
每一個loop只是 absolute(x1-x2) + absolute(y1-y2), 不耗太多時間
就這樣

2011年1月2日 星期日

思考

現在很簡單的問題,怎樣令p1的兵自動走到p2的兵。
第一步是找到target.
all unit must contain one variable: target enemy.
this variable determine who to attack.
and then is attack process.
and then is defense states.