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日 星期二
設計
所以,我得請人幫我畫。
你可能問,值得冒這種風險嗎?這game play system也許是不成功的,沒樂趣的。這裡必須透露一個支持我的意念的秘密了。其實這個遊戲,是很多年前一個大富翁環遊世界的小遊戲的複雜版,增加的東西不少,類似的遊戲也很多,(如zombie vs plant),因此不涉及copy right。不過,那時候我最愛玩的就是那個小遊戲,超愛的。對,就是這樣。。
繼續請畫的問題。jesus christ,這麼11個unit的花費總共是一兩千元?其實,也算合理了,1個角色才100元,得畫一兩個小時,再低的話再沒人接這活了。
果然,隔行如隔山。本來,對,本來以為我一個人能夠勝任這些工作,程式,level design,畫圖,結果,果然不行。在認識宋先生之前我是不知道原來angry bird的那個bird是遊戲團隊專雇了外面的設計師設計的= =,據說版權費也是六位數字。
2011年3月15日 星期二
2011年2月14日 星期一
繼續前進
讓我看看,昨晚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日 星期二
中途站
然後又搞掂了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日 星期日
2011年1月29日 星期六
一個天大白痴的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在電腦裡運行的樣子..
付了多少的心血去畫,去寫..
又辛苦了一晚
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那時候的困境...
對,了解一個新的理論和應用它
2011年1月19日 星期三
天!A-star!!
2011年1月13日 星期四
上午又fix了一個小bug
期中present前進展 (1)
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
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!
也為即將來臨的enemy detection ai 作好準備了
其實不用tree也可以, 畢竟只是detect distance
每一個loop只是 absolute(x1-x2) + absolute(y1-y2), 不耗太多時間
就這樣
2011年1月2日 星期日
思考
第一步是找到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.

