---++!! !JGSL_gateway %TOC{title="Contents:"}% %STARTINCLUDE% ---++ JGSL gateway | *Title* | JGSL gateway | | *Author(s)* | LiXizhi | | *Date* | 2008/12/23 | | *File* | script/kids/3DMapSystemNetwork/JGSL_gateway.lua | ---+++ Description it helps the user to find the best grid server for a given region in a given world. %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemNetwork/JGSL_gateway.lua"); Map3DSystem.JGSL.gateway:Restart(configfile); local gateway = Map3DSystem.JGSL.gateway; local user = gateway:GetUser(jid) </verbatim> ---+++ Member Functions ---++++ !gateway:Reset <verbatim>------------------------------ Grid User ------------------------------ grid user info class local GridUser = { -- server session key associated with the user. SessionKey = nil, -- The main grid node server id (index) gid = nil, -- this is set when client first login. uid = nil, -- this is set when client first login. jid = nil, }</verbatim>; gateway.GridUser = GridUser; create an agent. it will overwrite existing one, if any, with a newly created one. __syntax__ <verbatim>function gateway:Reset()</verbatim> ---++++ !gateway:Restart restart the gateway. Usually the config file specifies which grid node serves which region of the world Since we always return the smallest sized grid server to client, we should use small sized grid node in map positions that have large population. And for large low population world, we can simply use just a single grid node. TODO: Currently, such configuration is manual, in future, we can automatically generate the ideal config file from user analysis it is also possible to work out a dynamic load balancing server, but it is for future release. * _param_ __configfile__ : nil or config file path __syntax__ <verbatim>function gateway:Restart(configfile)</verbatim> __parameters__ | *configfile* | nil or config file path | ---++++ !gateway:GetUser it will create the agent structure if it does not exist __syntax__ <verbatim>function gateway:GetUser(jid)</verbatim> __parameters__ | *jid* | | ---++++ !gateway:CreateUser create an agent. it will overwrite existing one, if any, with a newly created one. __syntax__ <verbatim>function gateway:CreateUser(jid)</verbatim> __parameters__ | *jid* | | ---++++ !gateway:GetBestGridNode get the grid node info that is serving a given worldpath and a location in the world. we always return the smallest sized grid server that exist. * _param_ __worldpath__ :, x,y,z: * _param_ __IsObserver__ : true if we are just getting for an observer node. __syntax__ <verbatim>function gateway:GetBestGridNode(worldpath, x,y,z, IsObserver)</verbatim> __parameters__ | *worldpath* | , x,y,z: | | *x* | | | *y* | | | *z* | | | *IsObserver* | | ---++++ !gateway:HandleMessage handle server messages __syntax__ <verbatim>function gateway:HandleMessage(msg)</verbatim> __parameters__ | *msg* | | %STOPINCLUDE%
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2008-02-29
-
LiXizhi
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback