Documentation ¶
Index ¶
- func AddCallback(d time.Duration, callback func())
- func AddTimer(d time.Duration, callback func())
- func Call(id EntityID, method string, args ...interface{})
- func CallNilSpaces(method string, args ...interface{})
- func CallService(serviceName string, method string, args ...interface{})
- func Entities() entity.EntityMap
- func Exists(typeName string, entityID EntityID, callback storage.ExistsCallbackFunc)
- func GetGameID() uint16
- func GetKVDB(key string, callback kvdb.KVDBGetCallback)
- func GetOrPutKVDB(key string, val string, callback kvdb.KVDBGetOrPutCallback)
- func GetServiceEntityID(serviceName string) common.EntityID
- func ListAttr() *entity.ListAttr
- func ListEntityIDs(typeName string, callback storage.ListCallbackFunc)
- func ListGameIDs() []uint16
- func LoadEntityAnywhere(typeName string, entityID EntityID)
- func LoadEntityLocally(typeName string, entityID EntityID)
- func LoadEntityOnGame(typeName string, entityID EntityID, gameid uint16)
- func MapAttr() *entity.MapAttr
- func Post(callback post.PostCallback)
- func PutKVDB(key string, val string, callback kvdb.KVDBPutCallback)
- func RegisterCrontab(minute, hour, day, month, dayofweek int, cb func())
- func RegisterEntity(typeName string, entityPtr entity.IEntity) *entity.EntityTypeDesc
- func RegisterService(typeName string, entityPtr entity.IEntity)
- func RegisterSpace(spacePtr entity.ISpace)
- func Run()
- type Entity
- type EntityID
- type Space
- type Vector3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCallback ¶ added in v0.1.4
AddTimer adds a timer to be executed after specified duration
func AddTimer ¶ added in v0.1.4
AddTimer adds a repeat timer to be executed every specified duration
func CallNilSpaces ¶ added in v0.1.3
func CallNilSpaces(method string, args ...interface{})
CallNilSpaces calls methods of all nil spaces on all games
func CallService ¶ added in v0.1.3
CallService calls a service entity
func Exists ¶
func Exists(typeName string, entityID EntityID, callback storage.ExistsCallbackFunc)
Exists checks if entityID exists in entity storage
returns result in callback
func GetGameID ¶
func GetGameID() uint16
GetGameID gets the local server ID
server ID is a uint16 number starts from 1, which should be different for each servers server ID is also in the game config section name of goworld.ini
func GetKVDB ¶
func GetKVDB(key string, callback kvdb.KVDBGetCallback)
GetKVDB gets value of key from KVDB
func GetOrPutKVDB ¶
func GetOrPutKVDB(key string, val string, callback kvdb.KVDBGetOrPutCallback)
GetOrPut gets value of key from KVDB, if val not exists or is "", put key-value to KVDB.
func GetServiceEntityID ¶ added in v0.1.4
GetServiceEntityID returns the entityid of the service
func ListEntityIDs ¶
func ListEntityIDs(typeName string, callback storage.ListCallbackFunc)
ListEntityIDs gets all saved entity ids in storage, may take long time and block the main routine
returns result in callback
func LoadEntityAnywhere ¶
LoadEntityAnywhere loads the specified entity from entity storage
func LoadEntityLocally ¶ added in v0.1.6
LoadEntityLocally load entity in the local game If the entity already exists on any server, LoadEntityLocally will do nothing
func LoadEntityOnGame ¶ added in v0.1.6
LoadEntityOnGame loads entity in the specified game If the entity already exists on any server, LoadEntityOnGame will do nothing
func Post ¶
func Post(callback post.PostCallback)
Post posts a callback to be executed It is almost same as AddCallback(0, callback)
func PutKVDB ¶
func PutKVDB(key string, val string, callback kvdb.KVDBPutCallback)
PutKVDB puts key-value to KVDB
func RegisterCrontab ¶ added in v0.1.6
func RegisterCrontab(minute, hour, day, month, dayofweek int, cb func())
RegisterCrontab a callack which will be executed when time condition is satisfied
param minute: time condition satisfied on the specified minute, or every -minute if minute is negative param hour: time condition satisfied on the specified hour, or every -hour when hour is negative param day: time condition satisfied on the specified day, or every -day when day is negative param month: time condition satisfied on the specified month, or every -month when month is negative param dayofweek: time condition satisfied on the specified week day, or every -dayofweek when dayofweek is negative param cb: callback function to be executed when time is satisfied
func RegisterEntity ¶
func RegisterEntity(typeName string, entityPtr entity.IEntity) *entity.EntityTypeDesc
RegisterEntity registers the entity type so that entities can be created or loaded
returns the entity type description object which can be used to define more properties of entity type
func RegisterService ¶ added in v0.1.4
RegisterService registeres an service type After registeration, the service entity will be created automatically on some game
func RegisterSpace ¶
RegisterSpace registers the space entity type.
All spaces will be created as an instance of this type
Types ¶
type Entity ¶ added in v0.1.4
func CreateEntityLocally ¶
CreateEntityLocally creates a entity on the local server
returns EntityID
type EntityID ¶ added in v0.1.4
func CreateEntityAnywhere ¶
CreateEntitySomewhere creates a entity on any server
func CreateEntityOnGame ¶ added in v0.1.6
func CreateSpaceAnywhere ¶
CreateSpaceAnywhere creates a space with specified kind in any game server
func CreateSpaceOnGame ¶ added in v0.1.6
CreateSpaceOnGame creates a space with specified kind on the specified game
returns the space EntityID
func GetNilSpaceID ¶ added in v0.1.4
GetNilSpaceID returns the Entity ID of nil space on the specified game
type Space ¶ added in v0.1.4
func CreateSpaceLocally ¶
CreateSpaceLocally creates a space with specified kind in the local game server
returns the space EntityID
func GetNilSpace ¶ added in v0.1.4
func GetNilSpace() *Space
GetNilSpace returns the nil space on this game Nil space is a special space with Kind = 0. Nil space is the default space for all created entities. Each game has one nil space with fixed EntityID for each game, which can be acquired by calling `GetNilSpaceID`
Since nil game exists on each game with fixed EntityID, an entity can migrate to target game by calling `e.EnterSpace(GetNilSpaceID(gameid), Vector3{})`
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
*goworld*库为开发者提供大部分的GoWorld服务器引擎接口。
|
*goworld*库为开发者提供大部分的GoWorld服务器引擎接口。 |
components
|
|
engine
|
|
lib/gwsnappy
Package snappy implements the snappy block-based compression format.
|
Package snappy implements the snappy block-based compression format. |
examples
|
|
ext
|
|