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 MapAttr() *entity.MapAttr
- func Post(callback post.PostCallback)
- func PutKVDB(key string, val string, callback kvdb.KVDBPutCallback)
- 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 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 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 ¶
CreateEntityAnywhere creates a entity on any server
func CreateSpaceAnywhere ¶
CreateSpaceAnywhere creates a space with specified kind in any game server
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
|
|
components
|
|
engine
|
|
lib/gwsnappy
Package snappy implements the snappy block-based compression format.
|
Package snappy implements the snappy block-based compression format. |
examples
|
|
ext
|
|