我要加入

歡樂場外Haxball!

會長:zxc85119 / 小傑開設日:2014-08-02 04:07:25

  • EXP

  • 資金5655  
  • 招募制度:自由加入制
  • 成員:69 人
  • 昨日人氣:0

製作地圖

推上精選編輯

近期編輯:ch15 ...看更多

haxball 球場的檔案的副檔名是  .hbs  (haxball stadium)
可以用
notepad.exe(記事本)
網上的球場編輯器 http://haxpuck.com/      或
其他文字編輯軟件   打開編輯

下面是classic.hbs(預設球場)的內容   裡面其實是一串JSON

{
"name" : "Classic",

"width" : 420,
"height" : 200,

"spawnDistance" : 170,

"bg" : { "type" : "grass", "width" :370, "height" : 170, "kickOffRadius" : 75,"cornerRadius" : 0 },
"vertexes": [
  { "x" : -370, "y" :170,  "trait" : "ballArea" },
  { "x" : -370, "y" :64,   "trait" : "ballArea" },
  { "x" : -370, "y" :-64,  "trait" : "ballArea" },
  { "x" : -370, "y" : -170, "trait" :"ballArea" },
  
  { "x" : 370, "y" : 170,  "trait": "ballArea" },
  { "x" : 370, "y" :64,   "trait" : "ballArea" },
  { "x" : 370, "y" :-64,  "trait" : "ballArea" },
  { "x" : 370, "y" : -170, "trait" :"ballArea" },
  
  { "x" : 0, "y" :  200,"trait" : "kickOffBarrier" },
  { "x" : 0, "y" :   75, "trait": "kickOffBarrier" },
  { "x" : 0, "y" :  -75,"trait" : "kickOffBarrier" },
  { "x" : 0, "y" : -200, "trait" :"kickOffBarrier" },
  
  { "x" : -380, "y" : -64, "trait" :"goalNet" },
  { "x" : -400, "y" : -44, "trait" :"goalNet" },
  { "x" : -400, "y" :  44,"trait" : "goalNet" },
  { "x" : -380, "y" :  64,"trait" : "goalNet" },
  
  { "x" : 380, "y" : -64, "trait" :"goalNet" },
  { "x" : 400, "y" : -44, "trait" :"goalNet" },
  { "x" : 400, "y" :  44,"trait" : "goalNet" },
  { "x" : 380, "y" :  64,"trait" : "goalNet" }
],

"segments" : [
  { "v0" : 0, "v1" : 1, "trait" :"ballArea" },
  { "v0" : 2, "v1" : 3, "trait" :"ballArea" },
  { "v0" : 4, "v1" : 5, "trait" :"ballArea" },
  { "v0" : 6, "v1" : 7, "trait" :"ballArea" },
  
  { "v0" : 12, "v1" : 13, "trait" :"goalNet", "curve" : -90 },
  { "v0" : 13, "v1" : 14, "trait" :"goalNet" },
  { "v0" : 14, "v1" : 15, "trait" :"goalNet", "curve" : -90 },
  
  { "v0" : 16, "v1" : 17, "trait" :"goalNet", "curve" : 90 },
  { "v0" : 17, "v1" : 18, "trait" :"goalNet" },
  { "v0" : 18, "v1" : 19, "trait" :"goalNet", "curve" : 90 },
  
  { "v0" : 8, "v1" : 9, "trait" :"kickOffBarrier" },
  { "v0" : 9, "v1" : 10, "trait" :"kickOffBarrier", "curve" : 180, "cGroup" :["blueKO"] },
  { "v0" : 9, "v1" : 10, "trait" :"kickOffBarrier", "curve" : -180, "cGroup" :["redKO"] },
  { "v0" : 10, "v1" : 11, "trait" :"kickOffBarrier" }
],

"goals" : [
  { "p0" : [-370, 64], "p1" : [-370,-64],"team" : "red" },
  { "p0" : [370, 64], "p1" : [370,-64],"team" : "blue" }
],

"discs" : [
  { "pos" : [-370,  64], "trait" :"goalPost", "color" : "FFCCCC" },
  { "pos" : [-370, -64], "trait" :"goalPost", "color" : "FFCCCC" },
  { "pos" : [ 370,  64], "trait" :"goalPost", "color" : "CCCCFF" },
  { "pos" : [ 370, -64], "trait" :"goalPost", "color" : "CCCCFF" }
],

"planes" : [
  { "normal" : [0, 1], "dist" : -170,"trait" : "ballArea" },
  { "normal" : [0,-1], "dist" : -170,"trait" : "ballArea" },
  { "normal" : [ 0, 1], "dist" : -200,"bCoef" : 0.1 },
  { "normal" : [ 0,-1], "dist" : -200,"bCoef" : 0.1 },
  { "normal" : [ 1, 0], "dist" : -420,"bCoef" : 0.1 },
  { "normal" : [-1, 0], "dist" : -420,"bCoef" : 0.1 }
],

"traits" : {
  "ballArea" : { "vis" : false, "bCoef": 1, "cMask" : ["ball"] },
  "goalPost" : { "radius" : 8,"invMass" : 0, "bCoef" : 0.5 },
  "goalNet" : { "vis" : true, "bCoef" :0.1, "cMask" : ["ball"] },
  "kickOffBarrier" : { "vis" : false,"bCoef" : 0.1, "cGroup" : ["redKO","blueKO"], "cMask" : ["red", "blue"] }
}
}

我們從頭看起

"name" : "Classic",
即是將球場的  名字  設置成  Classic

"width": 420,
"height" : 200,
這兩個是設定  球場可視範圍  的闊和高(由球場中心)
總闊 840,  總 400
剛好是畫面的上限    可視範圍 超出畫面上限 畫面會移動

"spawnDistance" : 170,
設置  球員重生距離    170
這個距離是  球員重生位置   球場中心 的距離

"bg": { "type" : "grass", "width" : 370,"height" : 170, "kickOffRadius" : 75,"cornerRadius" : 0 },
設置 背景(background)
"type":"grass"                       ←種類(type) 可以是 grass / hockey
"width" : 370, "height" : 170   ←
背景 闊和高
"kickOffRadius": 75               ←開球半徑  球場中心圓的大小
"cornerRadius":0                  ←將背景 直角改成圓角  

"vertexes": [...]
設置    的位置 (一直線 是由 兩點 構成)
{"x" : -370, "y" : 170,  "trait" :"ballArea" },
的坐標x, y
"trait"下面會講  暫時理解為  特質/一組屬性

"segments": [...]
兩點 連成 一線
{"v0" : 0, "v1" : 1, "trait" :"ballArea" },    ||     {"v0" : 2, "v1" : 3, "trait" :"ballArea" },
0 1 連成                     ||      2 3 連成
  的特質可以與 不同  所以要標明
  的次序是 按照"vertexes"  中排序  即是

"vertexes": [
  { "x" : -370, "y" :170,  "trait" : "ballArea" },   //←
0
  { "x" : -370, "y" :64,   "trait" : "ballArea" },   //←
1
  { "x" : -370, "y" :-64,  "trait" : "ballArea" },   //←
2
  { "x" : -370, "y" : -170, "trait" :"ballArea" },   //←
3
  ...
],


"goals": [...]
設置  球門線  的位置
{"p0" : [-370, 64], "p1" : [-370,-64], "team" :"red" },
p0 的坐標  p1 的坐標  連成 球門線
"team"記住這是哪一隊 球門線

"discs": [...]
設置 圓盤      這個/些圓盤 並不是 ball 不能踢  亦不能入球得分
{"pos" : [-370,  64], "trait" :"goalPost", "color" : "FFCCCC" },
"pos"會記住  圓盤  的位置
"color"是眾多屬性中的一種         屬性可以放在 "trait" 裡  亦可以抽出來

"planes": [...]
設置  邊界       這是一條無限長的直線 能與邊界碰撞的物件 不能走出邊界外
{"normal" : [0, 1], "dist" : -170, "trait" :"ballArea" },
"normal"會記住 邊界 面向的範圍  數值範圍是  1 -1
"dist"會記住 邊界 球場中心 的距離
   {"normal" : [ 0, 1], "dist" : -200, "bCoef" : 0.1},
   "bCoef"亦是眾多屬性中的一種 可以放在 "trait"


"traits": {...}
設置  特質     
"ballArea": { "vis" : false, "bCoef" : 1, "cMask" :["ball"] },
"ballArea"  ballArea   這個字可以是任何字
{...}中的就是  對應特質中的屬性
通常會用在"traits"的屬性有
"vis"(visual)                             ←看得見  就是 "vis": true  反之 false
"bCoef" (bounce coefficient)    ←物件的反彈係數   兩件會碰撞的物件 係數會相乘
"cGroup"(collision group)        ←碰撞組別  值可以多於一個
                                                 "ball"  "red"  "blue" "wall"  "redKO"  "blueKO" "all" 或是 空的 ""
"cMask" (collision mask)         ←碰撞面具(?)  值同上  
例如:     
物件1 cGroup ball , cMask ball
物件2 cGroup ball ,  cMask ball
物件3 cGroup red , cMask blue
物件4 cGroup blue , cMask red
物件1 物件2 會碰撞
物件3 物件4 會碰撞
物件1 物件3 不會碰撞
物件1 物件4 不會碰撞
物件2 物件3 不會碰撞
物件2 物件4 不會碰撞

意思是若要 兩者碰撞
物件A cGroup 中的值   物件B cMask 中的亦要有相同值  同樣
物件B cGroup 中的值   物件A cMask 中的亦要有相同值  才會碰撞
因為  物件A碰撞物件B = 物件B碰撞物件A

"color"                                       ←值會是16進位值色碼
"radius"                                     ←適用於 "discs" "ballPhysics"(沒有出現在classic.hbs中)  的屬性
"invMass"(inverse mass)        ←可以理解為質量  值越低  就越難被推動
"damping"                                 ←可以理解為摩擦力
                                                      值為1時 不會減速 亦 不會加速
                                                      少於1時會減速 值越低 減速度越高
                                                      加於1時會加速 值越高 加速度越高


**所有數值皆有 正 負


等神人再研究...

公會首頁

主選單
Haxball教學
  操作篇
  指令篇
  地圖篇
關聯資料

目前沒有資料連到「製作地圖」。