Documentation ¶
Index ¶
- Constants
- Variables
- type AIActor
- type AIAdv
- func (a *AIAdv) AimAdjedIntoCube(estpos *go4game.Vector3D, o *SPObj, bulletType GameObjectType) *go4game.Vector3D
- func (a *AIAdv) CheckAct(act ClientActionType) bool
- func (a *AIAdv) CheckActn(act ClientActionType, actcount int) bool
- func (a *AIAdv) MakeAction(packet *RspGamePacket) *ReqGamePacket
- func (a AIAdv) String() string
- func (a *AIAdv) UseAP(act ClientActionType) bool
- func (a *AIAdv) UseAPn(act ClientActionType, actcount int) bool
- type AIAdvAimTarget
- type AIAdvAimTargetList
- type AIAdvFns
- type AIIDListAct
- type AIIntAct
- type AIVector3DAct
- type ActionFnEnvInfo
- type ByTeamScore
- type ClientActionPacket
- type ClientActionType
- type ConnInfo
- type ConnType
- type FactorCalcFn
- type GameConfig
- type GameObject
- func (o *GameObject) ActByTime(world *World, t time.Time) go4game.IDList
- func (o *GameObject) MakeBullet(mo *GameObject, MoveVector go4game.Vector3D) *GameObject
- func (o *GameObject) MakeFoodObj(pos go4game.Vector3D) *GameObject
- func (o *GameObject) MakeHardObj(pos go4game.Vector3D) *GameObject
- func (o *GameObject) MakeHomeMarkObj() *GameObject
- func (o *GameObject) MakeHommingBullet(mo *GameObject, targetteamid int64, targetid int64) *GameObject
- func (o *GameObject) MakeMainObj() *GameObject
- func (o *GameObject) MakeRevolutionDecoObj() *GameObject
- func (o *GameObject) MakeShield(mo *GameObject) *GameObject
- func (o *GameObject) MakeSuperBullet(mo *GameObject, MoveVector go4game.Vector3D) *GameObject
- func (o GameObject) String() string
- func (o *GameObject) ToOctreeObj() go4game.OctreeObjI
- func (o *GameObject) ToSPObj() *SPObj
- type GameObjectActFn
- type GameObjectDisp
- type GameObjectType
- type GameService
- type IDListMakeFn
- type IDecoder
- type IEncoder
- type IntMakeFn
- type NearInfo
- type PacketType
- type ReqGamePacket
- type RspGamePacket
- type SPObj
- type SPObjList
- type Team
- type TeamDisp
- type TeamInfoPacket
- type TeamInfoWeb
- type TeamType
- type VectorMakeFn
- type World
- type WorldDisp
- type WorldInfoWeb
Constants ¶
View Source
const WorldSize = 500
View Source
const WorldSizeY = 500
Variables ¶
View Source
var GameConst = defaultConfig
View Source
var TopHtmlTemplate *htemplate.Template
View Source
var WorldHtmlTemplate *htemplate.Template
View Source
var WorldTextTemplate *ttemplate.Template
Functions ¶
This section is empty.
Types ¶
type AIActor ¶
type AIActor interface { MakeAction(*RspGamePacket) *ReqGamePacket String() string }
func AIstr2AIActor ¶
type AIAdv ¶
type AIAdv struct { AIAdvFns ActionPoint int Score int HomePos go4game.Vector3D // contains filtered or unexported fields }
func (*AIAdv) AimAdjedIntoCube ¶
func (*AIAdv) CheckAct ¶
func (a *AIAdv) CheckAct(act ClientActionType) bool
func (*AIAdv) MakeAction ¶
func (a *AIAdv) MakeAction(packet *RspGamePacket) *ReqGamePacket
func (*AIAdv) UseAP ¶
func (a *AIAdv) UseAP(act ClientActionType) bool
type AIAdvAimTarget ¶
type AIAdvAimTarget struct { *SPObj // contains filtered or unexported fields }
type AIAdvAimTargetList ¶
type AIAdvAimTargetList []*AIAdvAimTarget
func (AIAdvAimTargetList) Len ¶
func (s AIAdvAimTargetList) Len() int
func (AIAdvAimTargetList) Less ¶
func (s AIAdvAimTargetList) Less(i, j int) bool
func (AIAdvAimTargetList) Swap ¶
func (s AIAdvAimTargetList) Swap(i, j int)
type AIAdvFns ¶
type AIAdvFns struct { SuperFns []AIVector3DAct BulletFns []AIVector3DAct AccelFns []AIVector3DAct HommingFns []AIIDListAct BurstFns []AIIntAct }
type AIIDListAct ¶
type AIIDListAct struct { CalcFn FactorCalcFn Fn IDListMakeFn }
type AIVector3DAct ¶
type AIVector3DAct struct { CalcFn FactorCalcFn Fn VectorMakeFn }
type ActionFnEnvInfo ¶
type ActionFnEnvInfo struct {
// contains filtered or unexported fields
}
type ByTeamScore ¶
type ByTeamScore []TeamInfoWeb
func (ByTeamScore) Len ¶
func (s ByTeamScore) Len() int
func (ByTeamScore) Less ¶
func (s ByTeamScore) Less(i, j int) bool
func (ByTeamScore) Swap ¶
func (s ByTeamScore) Swap(i, j int)
type ClientActionPacket ¶
type ClientActionType ¶
type ClientActionType int
const ( ActionAccel ClientActionType = iota ActionBullet ActionSuperBullet ActionHommingBullet ActionBurstBullet ActionEnd )
type ConnInfo ¶
type ConnInfo struct { ReadCh chan *ReqGamePacket WriteCh chan *RspGamePacket // contains filtered or unexported fields }
func NewAIConnInfo ¶
func NewTcpConnInfo ¶
func NewWsConnInfo ¶
type FactorCalcFn ¶
type FactorCalcFn func(a *AIAdv, o *AIAdvAimTarget) float64
type GameConfig ¶
type GameConfig struct { TcpListen string WsListen string FramePerSec float64 AICountPerWorld int AINames []string MaxTcpClientPerWorld int MaxWsClientPerWorld int StartWorldCount int RemoveEmptyWorld bool SetTerrain bool SetFood bool TcpClientEncode string // gob , json WorldCube *go4game.HyperRect WorldDiag float64 WorldCube2 *go4game.HyperRect // for octree WorldDiag2 float64 APIncFrame int KillScore int ShieldCount int MaxObjectRadius float64 MinObjectRadius float64 MoveLimit [GameObjEnd]float64 Radius [GameObjEnd]float64 ObjSqd [GameObjEnd][GameObjEnd]float64 IsInteract [GameObjEnd][GameObjEnd]bool // harmed obj : can harm obj NoInteract [GameObjEnd]bool AP [ActionEnd]int }
func (*GameConfig) Load ¶
func (config *GameConfig) Load(filename string) bool
func (*GameConfig) Save ¶
func (config *GameConfig) Save(filename string) bool
func (*GameConfig) SaveLoad ¶
func (config *GameConfig) SaveLoad(filename string)
func (*GameConfig) Validate ¶
func (config *GameConfig) Validate()
type GameObject ¶
type GameObject struct { *SPObj // contains filtered or unexported fields }
func NewGameObject ¶
func NewGameObject(teamID int64) *GameObject
func (*GameObject) MakeBullet ¶
func (o *GameObject) MakeBullet(mo *GameObject, MoveVector go4game.Vector3D) *GameObject
func (*GameObject) MakeFoodObj ¶
func (o *GameObject) MakeFoodObj(pos go4game.Vector3D) *GameObject
func (*GameObject) MakeHardObj ¶
func (o *GameObject) MakeHardObj(pos go4game.Vector3D) *GameObject
func (*GameObject) MakeHomeMarkObj ¶
func (o *GameObject) MakeHomeMarkObj() *GameObject
func (*GameObject) MakeHommingBullet ¶
func (o *GameObject) MakeHommingBullet(mo *GameObject, targetteamid int64, targetid int64) *GameObject
func (*GameObject) MakeMainObj ¶
func (o *GameObject) MakeMainObj() *GameObject
func (*GameObject) MakeRevolutionDecoObj ¶
func (o *GameObject) MakeRevolutionDecoObj() *GameObject
func (*GameObject) MakeShield ¶
func (o *GameObject) MakeShield(mo *GameObject) *GameObject
func (*GameObject) MakeSuperBullet ¶
func (o *GameObject) MakeSuperBullet(mo *GameObject, MoveVector go4game.Vector3D) *GameObject
func (GameObject) String ¶
func (o GameObject) String() string
func (*GameObject) ToOctreeObj ¶
func (o *GameObject) ToOctreeObj() go4game.OctreeObjI
func (*GameObject) ToSPObj ¶
func (o *GameObject) ToSPObj() *SPObj
type GameObjectActFn ¶
type GameObjectActFn func(m *GameObject, envInfo *ActionFnEnvInfo) bool
type GameObjectDisp ¶
func NewGameObjectDisp ¶
func NewGameObjectDisp(o *GameObject) *GameObjectDisp
type GameObjectType ¶
type GameObjectType int
const ( GameObjNil GameObjectType = iota GameObjMain GameObjShield GameObjBullet GameObjHommingBullet GameObjSuperBullet GameObjDeco GameObjMark GameObjHard GameObjFood GameObjEnd )
type GameService ¶
type GameService struct { ID int64 CmdCh chan go4game.GoCmd Worlds map[int64]*World // contains filtered or unexported fields }
func NewGameService ¶
func NewGameService() *GameService
func (*GameService) Loop ¶
func (g *GameService) Loop()
func (*GameService) Stat ¶
func (g *GameService) Stat(w http.ResponseWriter, r *http.Request)
func (GameService) String ¶
func (m GameService) String() string
type IDListMakeFn ¶
type PacketType ¶
type PacketType int
packet type
const ( // for ai ReqNearInfo PacketType RspNearInfo // for observer ReqWorldInfo RspWorldInfo )
type ReqGamePacket ¶
type ReqGamePacket struct { Cmd PacketType ClientAct *ClientActionPacket }
func (ReqGamePacket) String ¶
func (gp ReqGamePacket) String() string
type RspGamePacket ¶
type RspGamePacket struct { Cmd PacketType TeamInfo *TeamInfoPacket WorldInfo *WorldDisp NearObjs SPObjList }
func (RspGamePacket) String ¶
func (gp RspGamePacket) String() string
type SPObj ¶
type SPObj struct { ID int64 TeamID int64 PosVector go4game.Vector3D MoveVector go4game.Vector3D ObjType GameObjectType }
func (*SPObj) IsCollision ¶
type Team ¶
type Team struct { ID int64 Type TeamType GameObjs map[int64]*GameObject ClientConnInfo *ConnInfo PacketStat go4game.ActionStat Color int ActionPoint int Score int MainObjID int64 HomeObjID int64 CollisionStat go4game.ActionStat NearStat go4game.ActionStat // contains filtered or unexported fields }
func (*Team) NewTeamInfoWeb ¶
func (t *Team) NewTeamInfoWeb() *TeamInfoWeb
type TeamDisp ¶
type TeamDisp struct { ID int64 Color int GOList []GameObjectDisp }
func NewTeamDisp ¶
type TeamInfoPacket ¶
type TeamInfoWeb ¶
type VectorMakeFn ¶
type World ¶
type World struct { ID int64 Teams map[int64]*Team CmdCh chan go4game.GoCmd // contains filtered or unexported fields }
func NewWorld ¶
func NewWorld(g *GameService) *World
func (*World) MakeOctree ¶
func (*World) TeamCountByConn ¶
func (*World) TeamCountByType ¶
type WorldDisp ¶
func NewWorldDisp ¶
type WorldInfoWeb ¶
type WorldInfoWeb struct { ID int64 Disp string Teams []TeamInfoWeb }
func (WorldInfoWeb) String ¶
func (wi WorldInfoWeb) String() string
Click to show internal directories.
Click to hide internal directories.