|
開始在想 D+E+P 的建構,網絡對戰的部份。
直接的方法:把全個畫面的東東都 transfer 。
不過 broadband demand 太大,不好。
乾脆的方法:大家在事前交換 DLL ,然後只 transfer user input ,兩部電腦一齊計出雙方的 behavior 。
以為這個方法好掂,後來又發現中了招。
第一個係 random 問題。一個 DLL 可能會用到 random ,咁個 behavior 就會好唔同。
折衷的方法是自己建一個 random generator ,在事前交換 random seed 。但如果有 dll 沒有用自建 generator ,就出事。都算了,死有餘辜。
第二個係保安問題。 Send 個 DLL 去對方電腦 run ,和 run 一個 apps 一樣。我不多說了。相信對方才玩吧。
第三個係私密問題。 Send 個 DLL 去對方電腦,對方電腦豈不是有自己的 DLL ?都算了,大家學習一下分享的樂趣吧。(咁都得?)
最後一個,係我認為最大的問題,係浮點數。
搞電腦的人,會不斷地告訴你,浮點數是不準確的。
不準確都算了。但問題係,兩粒不同品牌,或不同型號的 CPU ,浮點數計算是否全然相同,天知曉。這粒 CPU 計 0.1 x 0.1 出 0.0099 ,那粒計出 0.0101 ,就出事了。
大汗中。
以前 interview 過一間遊戲製作公司。那間公司的問卷,談及 CPU 性能的考量,剎有介事一定要用 integer 去做加減乘除。我現在想,在 platform 使用 integer 的同時,該否強制所有 developer 用 integer ?
想到這裡,就大大汗。
開始明白這個世界為何有遊戲機。
--栗子捌貳 11:21 2006年貳月12日 (HKT)
[編輯] 救星
The IEEE standard goes further than just requiring the use of a guard digit. It gives an algorithm for addition, subtraction, multiplication, division and square root, and requires that implementations produce the same result as that algorithm. Thus, when a program is moved from one machine to another, the results of the basic operations will be the same in every bit if both machines support the IEEE standard.
但願如此。
--栗子捌貳 11:29 2006年貳月12日 (HKT)
|